gps_nmea.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /******************************************************************************
  2. ** File Name: nmea_drv.h *
  3. ** Author: Liangwen.Zhen *
  4. ** DATE: 11/15/2007 *
  5. ** Copyright: 2007 Spreadtrum, Incoporated. All Rights Reserved. *
  6. ** Description: This file defines the basic operation interfaces of NMEA *
  7. ** *
  8. ******************************************************************************
  9. ******************************************************************************
  10. ** Edit History *
  11. ** ------------------------------------------------------------------------- *
  12. ** DATE NAME DESCRIPTION *
  13. ** 11/15/2007 Liangwen.Zhen Create. *
  14. ******************************************************************************/
  15. #ifndef _GPS_NMEA_H_
  16. #define _GPS_NMEA_H_
  17. /**---------------------------------------------------------------------------*
  18. ** Dependencies *
  19. **---------------------------------------------------------------------------*/
  20. /**---------------------------------------------------------------------------*
  21. ** Debugging Flag *
  22. **---------------------------------------------------------------------------*/
  23. #include "sci_types.h"
  24. /**---------------------------------------------------------------------------*
  25. ** Compiler Flag *
  26. **---------------------------------------------------------------------------*/
  27. #ifdef __cplusplus
  28. extern "C" {
  29. #endif
  30. /**---------------------------------------------------------------------------*
  31. ** Macro Definition *
  32. **---------------------------------------------------------------------------*/
  33. #define NMEA_FRAME_PTR uint8 *
  34. #define NMEA_GPS_CHN_CNT_MAX 32
  35. /**---------------------------------------------------------------------------*
  36. ** Enum Definition *
  37. **---------------------------------------------------------------------------*/
  38. /**---------------------------------------------------------------------------*
  39. ** Data Structure Definition *
  40. **---------------------------------------------------------------------------*/
  41. typedef enum
  42. {
  43. NMEA_ERR_NONE = 0x00,
  44. NMEA_ERR_PARAM_INVALID,
  45. NMEA_ERR_NO_FRAME,
  46. NMEA_ERR_NO_FRAME_START,
  47. NMEA_ERR_NO_FRAME_END,
  48. NMEA_ERR_DATA_INVALID,
  49. NMEA_ERR_NO_DATA,
  50. NMEA_ERR_NOT_INIT,
  51. NMEA_ERR_MAX
  52. } NMEA_ERR_E;
  53. typedef struct nmea_gps_channel_info_tag
  54. {
  55. uint16 sat_id;
  56. uint16 snr;
  57. uint16 elevation;
  58. uint16 azimuth;
  59. } NMEA_GPS_CHN_T;
  60. typedef struct nmea_gps_info_tag
  61. {
  62. BOOLEAN is_hw_work;
  63. BOOLEAN is_position_fix;
  64. uint16 cnt_of_sat_in_view;
  65. uint16 cnt_of_sat_fix;
  66. uint16 north_or_south; // 'N': North, 'S': South
  67. uint16 latitude_high; // ddmm
  68. uint16 latitude_low; // .mmmm
  69. uint16 east_or_west; // 'E': East; 'W': West
  70. uint16 longitude_high; // ddmm
  71. uint16 longitude_low; // .mmmm
  72. uint16 cnt_of_chn_valid;
  73. NMEA_GPS_CHN_T gps_chn[NMEA_GPS_CHN_CNT_MAX];
  74. } NMEA_GPS_INFO_T, *NMEA_GPS_INFO_T_PTR;
  75. /**---------------------------------------------------------------------------*
  76. ** PUBLIC Function Prototypes *
  77. **---------------------------------------------------------------------------*/
  78. /*****************************************************************************/
  79. // Description: This function is used to initialize NMEA manager
  80. // Author: Liangwen.Zhen
  81. // Note:
  82. /*****************************************************************************/
  83. PUBLIC void NMEA_Init(void);
  84. /*****************************************************************************/
  85. // Description: This function is used to close NMEA manager
  86. // Author: Liangwen.Zhen
  87. // Note:
  88. /*****************************************************************************/
  89. PUBLIC void NMEA_Close(void);
  90. /*****************************************************************************/
  91. // Description: This function is used to snatch all NMEA frame from data
  92. // stream, and add the frame to the queue
  93. // Author: Liangwen.Zhen
  94. // Note:
  95. /*****************************************************************************/
  96. PUBLIC NMEA_ERR_E NMEA_SnatchFramesFromStream(
  97. uint8 *data_stream_ptr, // point to data stream
  98. uint32 data_stream_len // lenght of data stream
  99. );
  100. /*****************************************************************************/
  101. // Description: This function is used to get NMEA frame from the frame queue
  102. // Author: Liangwen.Zhen
  103. // Note:
  104. /*****************************************************************************/
  105. PUBLIC NMEA_ERR_E NMEA_GetFrame(
  106. NMEA_FRAME_PTR frame_buf_ptr, // point to frame buffer,
  107. uint32 frame_buf_len, // lenght of frame buffer
  108. uint32 *data_len_ptr // point to lenght of return data
  109. );
  110. /*****************************************************************************/
  111. // Description: This function is used to get GPS information from NMEA
  112. // Author: Liangwen.Zhen
  113. // Note:
  114. /*****************************************************************************/
  115. PUBLIC NMEA_GPS_INFO_T_PTR NMEA_GetGpsInfo(void);
  116. /**---------------------------------------------------------------------------*
  117. ** Compiler Flag *
  118. **---------------------------------------------------------------------------*/
  119. #ifdef __cplusplus
  120. }
  121. #endif
  122. #endif // end _GPS_NMEA_H_