greeneye2_gnss_libgps_api.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707
  1. /******************************************************************************
  2. ** File Name: greeneye2_gnss_libgps_api.h *
  3. ** Author: *
  4. ** DATE: *
  5. ** Copyright: 2005 Spreadtrum, Incoporated. All Rights Reserved. *
  6. ** Description: *
  7. ******************************************************************************
  8. ******************************************************************************
  9. ** Edit History *
  10. ** --------------------------------------------------------------------------*
  11. ** DATE NAME DESCRIPTION *
  12. ******************************************************************************/
  13. /**---------------------------------------------------------------------------*
  14. ** Dependencies *
  15. **---------------------------------------------------------------------------*/
  16. #ifndef GREENEYE2_GNSS_LIBGPS_API_H
  17. #define GREENEYE2_GNSS_LIBGPS_API_H
  18. /**---------------------------------------------------------------------------*
  19. ** Compiler Flag *
  20. **---------------------------------------------------------------------------*/
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /**---------------------------------------------------------------------------*
  25. ** Data Structures *
  26. **---------------------------------------------------------------------------*/
  27. #ifndef NULL
  28. #define NULL 0 //((void *)0)
  29. #endif
  30. /******************************************************
  31. The Data format between the GPS Lib and GNSS device
  32. -------------------------------------------------------------|
  33. |Magic Number| Type |Subtype|Lenth | CRC | DATA...... |
  34. |~~~~ | 1 Byte |1 Byte | 2 Byte | 2 Byte| n bytes |
  35. -------------------------------------------------------------
  36. *******************************************************/
  37. //define the type data communication
  38. #define GNSS_LIBGPS_SET_PARA_TYPE (0x01)
  39. #define GNSS_LIBGPS_REQUEST_TYPE (0x02) //aiding data
  40. #define GNSS_LIBGPS_FWPROC_ADD_TYPE (0x66)
  41. #define GNSS_LIBGPS_RESPONSE_TYPE (0x03) //aiding data
  42. #define GNSS_LIBGPS_NOTIFIED_TYPE (0x04) //active report
  43. #define GNSS_LIBGPS_DATA_TYPE (0x05) //nmea,log,dump
  44. #define GNSS_LIBGPS_AIDING_DATA_TYPE (0x06) //aiding data
  45. //add the power and work mode for special deal with begin
  46. #define GNSS_LIBGPS_POWER_REQUEST_TYPE (0x07)
  47. #define GNSS_LIBGPS_POWER_RESPONSE_TYPE (0x08)
  48. //add the power and work mode for special deal with end
  49. #define GNSS_LIBGPS_FLASH_TYPE (0x09)
  50. #define GNSS_LIBGPS_FLASH_ADD_TYPE (0x6d) //0x09+100 GAL/B1C FLASH
  51. #define GNSS_LIBGPS_EUT_TYPE (0x0a)
  52. #define GNSS_LIBGPS_REG_WR_TYPE (0x0b) // GNSS_REG_WR
  53. #define GNSS_LIBGPS_NMEA_TYPE (0x0c)
  54. #define GNSS_LIBGPS_MAX_TYPE (0x0d) // GNSS_REG_WR
  55. #define GNSS_LIBGPS_QUERY_STARTMODE_AGNSS_TYPE (0x66)
  56. #define GNSS_LIBGPS_RESPONSE_STARTMODE_AGNSS_NMEA_TYPE (0x6c)
  57. // GNSS_LIBGPS_SET_PARA_TYPE begin
  58. #define GNSS_LIBGPS_SET_GNSS_SUBTYPE (0x01)
  59. #define GNSS_LIBGPS_SET_DGPS_SUBTYPE (0x02)
  60. #define GNSS_LIBGPS_SET_LTE_SUBTYPE (0x03)
  61. #define GNSS_LIBGPS_SET_REPORT_PARA_SUBTYPE (0x04) //set report data type and period
  62. #define GNSS_LIBGPS_SET_GPSTIME_SUBTYPE (0x05)
  63. #define GNSS_LIBGPS_SET_LOGLEVEL_SUBTYPE (0x06)
  64. #define GNSS_LIBGPS_SET_WORKMODE_SUBTYPE (0X07)
  65. #define GNSS_LIBGPS_RESETCHIP_SUBTYPE (0x08)
  66. #define GNSS_LIBGPS_RESETEVB_SUBTYPE (0x09)
  67. #define GNSS_LIBGPS_SETMODE_SUBTYPE (0x0a)
  68. #define GNSS_LIBGPS_CLEAR_FLASH_CONFIG_SUBTYPE (0x0b)
  69. #define GNSS_LIBGPS_SET_OUTPUT_PROTOCOL_SUBTYPE (0x0c)
  70. #define GNSS_LIBGPS_SET_REPORT_INTERVAL (0x0d) // CTS_TEST
  71. #define GNSS_LIBGPS_SET_LTE_SWITCH (0x20)
  72. #define GNSS_LIBGPS_SET_CMCC_SWITCH (0x21)
  73. #define GNSS_LIBGPS_SET_NETWORK_STATUS (0x22)
  74. #define GNSS_LIBGPS_SET_REALEPH_STATUS (0x23)
  75. #define GNSS_LIBGPS_SET_WIFI_STATUS (0x24)
  76. #define GNSS_LIBGPS_SET_ASSERT_STATUS (0x25)
  77. #define GNSS_LIBGPS_SET_DELETE_AIDING_DATA_BIT (0x26)
  78. #define GNSS_LIBGPS_SETPLATFORM_SUBTYPE (0x27)
  79. #define GNSS_LIBGPS_SET_GLOLTE_SUBTYPE (0x29)
  80. #define GNSS_LIBGPS_SET_BDSLTE_SUBTYPE (0x30)
  81. #define GNSS_LIBGPS_SET_SMD_FLAG_SUBTYPE (0x31)
  82. #define GNSS_LIBGPS_SMD_RESPONSE_SUBTYPE (0x32)
  83. #define GNSS_LIBGPS_GLOOBS_SUBTYPE (0x33)
  84. #define GNSS_LIBGPS_GLOLTE_SUBTYPE (0x34)
  85. #define GNSS_LIBGPS_BDSOBS_SUBTYPE (0x35)
  86. #define GNSS_LIBGPS_BDSLTE_SUBTYPE (0x36)
  87. //GNSS_LIBGPS_SET_PARA_TYPE end
  88. // GNSS_LIBGPS_REQUEST_TYPE begin
  89. #define GNSS_LIBGPS_REQUEST_VERSION_SUBTYPE (0x01)
  90. #define GNSS_LIBGPS_REQUEST_CHIP_SUBTYPE (0x02)
  91. #define GNSS_LIBGPS_REQUEST_GPSTIME_SUBTYPE (0x03)
  92. #define GNSS_LIBGPS_REQUEST_CONSTELLATION_SUBTYPE (0x04)
  93. #define GNSS_LIBGPS_REQUEST_MEASUREMENT_SUBTYPE (0x05)
  94. #define GNSS_LIBGPS_REQUEST_TSXTEMP_SUBTYPE (0x06)
  95. //#define GNSS_LIBGPS_REQUEST_POWER_MANAGER_SUBTYPE (0x04)// Power manager
  96. // GNSS_LIBGPS_REQUEST_TYPE end
  97. // GNSS_LIBGPS_FWPROC_ADD_TYPE begin
  98. #define GNSS_LIBGPS_TO_FW_FLASH_GAL_EPH_SUBTYPE (0x2b)
  99. #define GNSS_LIBGPS_TO_FW_FLASH_GAL_ALM1_SUBTYPE (0x2c)
  100. #define GNSS_LIBGPS_TO_FW_FLASH_GAL_ALM2_SUBTYPE (0x2d)
  101. #define GNSS_LIBGPS_TO_FW_FLASH_B1C_EPH_SUBTYPE (0x2f)
  102. #define GNSS_LIBGPS_TO_FW_FLASH_GPS_ALM_CPY_OTHER_SUBTYPE (0x36)
  103. #define GNSS_LIBGPS_TO_FW_FLASH_B1C_ALM_SUBTYPE (0x30) // pending
  104. #define GNSS_LIBGPS_TO_FW_FLASH_ADD_PvtMisc_SUBTYPE (0x38)
  105. #define GNSS_LIBGPS_TO_FW_FLASH_ADD_IONO_UTC_SUBTYPE (0x39)
  106. #define GNSS_LIBGPS_TO_FW_FLASH_ADD_PVT_SEQLSQ_SUBTYPE (0x3a)
  107. #define GNSS_LIBGPS_FL_WORK_MODULES_SUBTYPE (0x3b)
  108. #define GNSS_LIBGPS_VDR_MODULES_SUBTYPE (0x3c)
  109. // GNSS_LIBGPS_FWPROC_ADD_TYPE end
  110. //TODO ADD
  111. //GNSS_LIBGPS_RESPONSE_TYPE begin
  112. #define GNSS_LIBGPS_RESPONSE_VERSION_SUBTYPE (0x01)
  113. #define GNSS_LIBGPS_RESPONSE_CHIP_SUBTYPE (0x02)
  114. #define GNSS_LIBGPS_RESPONSE_GPSTIME_SUBTYPE (0x03)
  115. #define GNSS_LIBGPS_RESPONSE_CONSTELLATION_SUBTYPE (0x04)
  116. #define GNSS_LIBGPS_RESPONSE_CP_CRASH_SUBTYPE (0x0f)
  117. //#define GNSS_LIBGPS_RESPONSE_POWER_RESPONSE_SUBTYPE (0x04)
  118. // GNSS_LIBGPS_RESPONSE_TYPE end
  119. //define GNSS_LIBGPS_DATA_TYPE begin
  120. #define GNSS_LIBGPS_NMEA_SUBTYPE (0x01)
  121. #define GNSS_LIBGPS_ASSERT_SUBTYPE (0x02)
  122. #define GNSS_LIBGPS_LOG_SUBTYPE (0x03)
  123. #define GNSS_LIBGPS_DGPS_SUBTYPE (0x04)
  124. #define GNSS_LIBGPS_LTE_SUBTYPE (0x05)
  125. #define GNSS_LIBGPS_TEST_SUBTYPE (0x06)
  126. #define GNSS_LIBGPS_MEASUREMENT_SUBTYPE (0x07) // TODO
  127. #define GNSS_LIBGPS_MSA_MEASUREMENT_SUBTYPE (0x08)
  128. #define GNSS_LIBGPS_LOG_DDDD_SUBTYPE (0x09) // 4 double datas
  129. #define GNSS_LIBGPS_LOG_LLLL_SUBTYPE (0x0A) // 4 long datas
  130. #define GNSS_LIBGPS_LOG_SSSS_SUBTYPE (0x0B) // 4 short datas
  131. #define GNSS_LIBGPS_LOG_FFFF_SUBTYPE (0x0C) // 4 float datas
  132. #define GNSS_LIBGPS_MEMDUMP_DATA_SUBTYPE (0x0D)
  133. #define GNSS_LIBGPS_MEMDUMP_CODE_SUBTYPE (0x0E)
  134. #define GNSS_LIBGPS_LOG_BB_SUBTYPE (0x0F) //baseband log
  135. #define GNSS_LIBGPS_SET_AP_TSX_TEMP (0x10)
  136. #define GNSS_LIBGPS_SET_CP_TSX_TEMP (0x11)
  137. #define GNSS_LIBGPS_SAVE_TSX_TEMP (0x12)
  138. #define GNSS_LIBGPS_CALI_TSX_TEMP (0x13) // TSXTEMP
  139. #define GNSS_LIBGPS_TTFF_SUBTYPE (0x14)
  140. #define GNSS_LIBGPS_MINILOG_SUBTYPE (0x15)
  141. #define GNSS_LIBGPS_MEMDUMP_PCHANNEL_SUBTYPE (0x16)
  142. #define GNSS_LIBGPS_ELLIPES_SUBTYPE (0x17)
  143. #define GNSS_LIBGPS_OBS_SUBTYPE (0x25)
  144. #define GNSS_LIBGPS_NAVIGATION_SUBTYPE (0x26)
  145. #define GNSS_LIBGPS_GPSCLOCK_SUBTYPE (0x27)
  146. #define GNSS_LIBGPS_SMD_REQUEST_SUBTYPE (0x37)
  147. #define GNSS_LIBGPS_SOFTBIT_CLEAR_SUBTYPE (0x50)
  148. #define GNSS_LIBGPS_SOFTBIT_SEND_SUBTYPE (0x51)
  149. //define GNSS_LIBGPS_DATA_TYPE end
  150. //define GNSS_LIBGPS_FLASH_TYPE begin
  151. /*Addr bias for writing to flash*/
  152. #define GNSS_LIBGPS_FLASH_PvtMisc_SUBTYPE (0x0)
  153. #define GNSS_LIBGPS_FLASH_GPS_EPH1_SUBTYPE (0x01)
  154. #define GNSS_LIBGPS_FLASH_GPS_EPH2_SUBTYPE (0x02)
  155. #define GNSS_LIBGPS_FLASH_GPS_EPH3_SUBTYPE (0x03)
  156. #define GNSS_LIBGPS_FLASH_GPS_EPH4_SUBTYPE (0x04)
  157. #define GNSS_LIBGPS_FLASH_GPS_ALM_SUBTYPE (0x05)
  158. #define GNSS_LIBGPS_FLASH_GPS_ALM_CPY1_SUBTYPE (0x06)
  159. #define GNSS_LIBGPS_FLASH_GPS_ALM_CPY2_SUBTYPE (0x07)
  160. #define GNSS_LIBGPS_FLASH_GPS_ALM_CPY3_SUBTYPE (0x08)
  161. #define GNSS_LIBGPS_FLASH_GPS_ALM_CPY4_SUBTYPE (0x09)
  162. #define GNSS_LIBGPS_FLASH_GPS_ALM_CPY5_SUBTYPE (0x0A)
  163. #define GNSS_LIBGPS_FLASH_GPS_ALM_CPY6_SUBTYPE (0x0B)
  164. #define GNSS_LIBGPS_FLASH_QZS_EPH_SUBTYPE (0x0C)
  165. #define GNSS_LIBGPS_FLASH_QZS_ALM_SUBTYPE (0x0D)
  166. #define GNSS_LIBGPS_FLASH_BD2_EPH1_SUBTYPE (0x0E)
  167. #define GNSS_LIBGPS_FLASH_BD2_EPH2_SUBTYPE (0x0F)
  168. #define GNSS_LIBGPS_FLASH_BD2_ALM_SUBTYPE (0x10)
  169. #define GNSS_LIBGPS_FLASH_BD2_ALM_CPY1_SUBTYPE (0x11)
  170. #define GNSS_LIBGPS_FLASH_BD2_ALM_CPY2_SUBTYPE (0x12)
  171. #define GNSS_LIBGPS_FLASH_BD2_ALM_CPY3_SUBTYPE (0x13)
  172. #define GNSS_LIBGPS_FLASH_BD2_ALM_CPY4_SUBTYPE (0x14)
  173. #define GNSS_LIBGPS_FLASH_GLO_EPH1_SUBTYPE (0x15)
  174. #define GNSS_LIBGPS_FLASH_GLO_EPH2_SUBTYPE (0x16)
  175. #define GNSS_LIBGPS_FLASH_GLO_EPH3_SUBTYPE (0x17)
  176. #define GNSS_LIBGPS_FLASH_GLO_EPH4_SUBTYPE (0x18)
  177. #define GNSS_LIBGPS_FLASH_GLO_ALM1_SUBTYPE (0x19)
  178. #define GNSS_LIBGPS_FLASH_GLO_ALM2_SUBTYPE (0x1A)
  179. #define GNSS_LIBGPS_FLASH_IONO_UTC_SUBTYPE (0x1B)
  180. #define GNSS_LIBGPS_FLASH_SYS_CFG_SUBTYPE (0x1C)
  181. #define GNSS_LIBGPS_FLASH_ALMCPY_COMM_SUBTYPE (0x1D)
  182. #define GNSS_LIBGPS_FLASH_PVT_SEQLSQ_SUBTYPE (0x1E)
  183. #define GNSS_LIBGPS_FLASH_PVT_BLUNDER_SUBTYPE (0x1F)
  184. #define GNSS_LIBGPS_FLASH_STIME_SUBTYPE (0x20)
  185. //define GNSS_LIBGPS_FLASH_TYPE end
  186. //following LIBGPS_FLASH_TYPE define LIBGPS_FLASH_ADD_TYPE for GAL/B1C //Cfg_New
  187. //define GNSS_LIBGPS_FLASH_ADD_TYPE begin
  188. #define GNSS_LIBGPS_FLASH_ADD_GAL_EPH1_SUBTYPE (0x21)
  189. #define GNSS_LIBGPS_FLASH_ADD_GAL_EPH2_SUBTYPE (0x22)
  190. #define GNSS_LIBGPS_FLASH_ADD_GAL_EPH3_SUBTYPE (0x23)
  191. #define GNSS_LIBGPS_FLASH_ADD_GAL_EPH4_SUBTYPE (0x24)
  192. #define GNSS_LIBGPS_FLASH_ADD_GAL_ALM1_SUBTYPE (0x25)
  193. #define GNSS_LIBGPS_FLASH_ADD_GAL_ALM2_SUBTYPE (0x26)
  194. #define GNSS_LIBGPS_FLASH_ADD_B1C_EPH1_SUBTYPE (0x27)
  195. #define GNSS_LIBGPS_FLASH_ADD_B1C_EPH2_SUBTYPE (0x28)
  196. #define GNSS_LIBGPS_FLASH_ADD_B1C_EPH3_SUBTYPE (0x29)
  197. #define GNSS_LIBGPS_FLASH_ADD_B1C_EPH4_SUBTYPE (0x2a)
  198. #define GNSS_LIBGPS_FLASH_ADD_B1C_EPH5_SUBTYPE (0x2b)
  199. #define GNSS_LIBGPS_FLASH_GPS_ALM_CPY_OTHER_SUBTYPE (0x2c)
  200. #define GNSS_LIBGPS_FLASH_ADD_B1C_ALM_SUBTYPE (0x2d) // pending
  201. #define GNSS_LIBGPS_FLASH_ADD_PvtMisc_SUBTYPE (0x2e)
  202. #define GNSS_LIBGPS_FLASH_ADD_IONO_UTC_SUBTYPE (0x2f)
  203. #define GNSS_LIBGPS_FLASH_ADD_PVT_SEQLSQ_SUBTYPE (0x30)
  204. #define GNSS_LIBGPS_FLASH_BD2_EPH3_SUBTYPE (0x31)
  205. #define GNSS_LIBGPS_FLASH_BD2_EPH4_SUBTYPE (0x32)
  206. #define GNSS_LIBGPS_FLASH_BD2_EPH5_SUBTYPE (0x33)
  207. #define GNSS_LIBGPS_FLASH_BD2_ALM_EXT_SUBTYPE (0x34)
  208. #define GNSS_LIBGPS_FLASH_BD2_EPH6_SUBTYPE (0x35)
  209. #define GNSS_LIBGPS_FLASH_BD2_EPH7_SUBTYPE (0x36)
  210. #define GNSS_LIBGPS_FLASH_BD2_EPH8_SUBTYPE (0x37)
  211. //define GNSS_LIBGPS_FLASH_ADD_TYPE end
  212. #define GNSS_LIBGPS_FLASH_MAX_LEN_SUBTYPE (56)
  213. //define GNSS_LIBGPS_AIDING_DATA_TYPE begin
  214. #define GNSS_LIBGPS_AIDING_REFTIME_SUBTYPE (0x01) //mino:it will use POSVELTIME
  215. #define GNSS_LIBGPS_AIDING_REFPOSITION_SUBTYPE (0x02) //mino:it will use POSVELTIME
  216. #define GNSS_LIBGPS_AIDING_REFEPHEMERIS_SUBTYPE (0x03) //mino:it will use GPSSEPHEMERIS
  217. #define GNSS_LIBGPS_AIDING_ASSISTANCE_SUBTYPE (0x04) //
  218. #define GNSS_LIBGPS_AIDING_ALMANAC_SUBTYPE (0x05) //mino:it will use GPSALMANAC
  219. #define GNSS_LIBGPS_AIDING_DGPS_SUBTYPE (0x06)
  220. #define GNSS_LIBGPS_AIDING_IONOSPHERE_SUBTYPE (0x07)
  221. #define GNSS_LIBGPS_AIDING_UTC_SUBTYPE (0x08)
  222. #define GNSS_LIBGPS_AIDING_REALTIME_INTEGRITY_SUBTYPE (0x09)
  223. #define GNSS_LIBGPS_AIDING_IONOUTC_SUBTYPE (0x0A)
  224. #define GNSS_LIBGPS_AIDING_POSVELTIME_SUBTYPE (0x0B)
  225. #define GNSS_LIBGPS_AIDING_BDSALMANAC_SUBTYPE (0x0C)
  226. #define GNSS_LIBGPS_AIDING_GPSALMANAC_SUBTYPE (0x0D)
  227. #define GNSS_LIBGPS_AIDING_GPSEPHEMERIS_SUBTYPE (0x0E)
  228. #define GNSS_LIBGPS_AIDING_BDSEPHEMERIS_SUBTYPE (0x0F)
  229. #define GNSS_LIBGPS_AIDING_RCVSTATUS_SUBTYPE (0x10)
  230. #define GNSS_LIBGPS_AIDING_BDSALMPACKEDCOPY_SUBTYPE (0x11)
  231. #define GNSS_LIBGPS_AIDING_SET_SENSOR_SUBTYPE (0x12)
  232. #define GNSS_LIBGPS_AIDING_SENSOR_SUBTYPE (0x13)
  233. //define GNSS_LIBGPS_AIDING_DATA_TYPE end
  234. //GNSS_LIBGPS_POWER_REQUEST_TYPE begin
  235. #define GNSS_LIBGPS_POWER_ON_REQ_SUBTYPE (0x01)
  236. #define GNSS_LIBGPS_POWER_SHUTDOWN_REQ_SUBTYPE (0x02)
  237. #define GNSS_LIBGPS_POWER_IDLEON_REQ_SUBTYPE (0x03)
  238. #define GNSS_LIBGPS_POWER_IDLEOFF_REQ_SUBTYPE (0x04)
  239. #define GNSS_LIBGPS_POWER_RESET_REQ_SUBTYPE (0x05)
  240. //define GNSS_LIBGPS_POWER_REQUEST_TYPE end
  241. //define GNSS_LIBGPS_POWER_RESPONSE_TYPE begin
  242. #define GNSS_LIBGPS_POWERON_STATUS_SUCCESS (0x01)
  243. #define GNSS_LIBGPS_POWERON_STATUS_FAILED (0x02)
  244. #define GNSS_LIBGPS_IDLON_STATUS_SUCCESS (0x03)
  245. #define GNSS_LIBGPS_IDLON_STATUS_FAILED (0x04)
  246. #define GNSS_LIBGPS_IDLOFF_STATUS_SUCCESS (0x05)
  247. #define GNSS_LIBGPS_IDLOFF_STATUS_FAILED (0x06)
  248. #define GNSS_LIBGPS_SHUTDOWN_STATUS_SUCCESS (0x07)
  249. #define GNSS_LIBGPS_SHUTDOWN_STATUS_FAILED (0x09)
  250. #define GNSS_LIBGPS_RESET_STATUS_SUCCESS (0x0A)
  251. #define GNSS_LIBGPS_RESET_STATUS_FAILED (0x0B)
  252. //define GNSS_LIBGPS_POWER_RESPONSE_TYPE end
  253. //define GNSS_LIBGPS_SET_LOGLEVEL_SUBTYPE begin
  254. #define GNSS_LIBGPS_DEBUG_OFF (0x01)
  255. #define GNSS_LIBGPS_DEBUG_LEVEL0 (0x02)
  256. #define GNSS_LIBGPS_DEBUG_LEVEL1 (0x03)
  257. #define GNSS_LIBGPS_DEBUG_LEVEL2 (0x04)
  258. //define GNSS_LIBGPS_SET_LOGLEVEL_SUBTYPE end
  259. //define GNSS_LIBGPS_NOTIFIED_TYPE begin
  260. #define GNSS_NOTIFIED_DEVICE_STATE_SUBTYPE (0x01)
  261. //define GNSS_LIBGPS_NOTIFIED_TYPE end
  262. #define GNSS_DEVICE_READY_STATE (0x01)
  263. #define GNSS_DEVICE_SLEEP_STATE (0x02)
  264. #define GNSS_DEVICE_ABOUT_STATE (0x03)
  265. // GNSS_LIBGPS_EUT_TYPE begin
  266. #define GNSS_LIBGPS_EUT_CW_SUBTYPE (0x01)
  267. #define GNSS_LIBGPS_EUT_MIDBAND_SUBTYPE (0x02)
  268. #define GNSS_LIBGPS_EUT_TCXO_SUBTYPE (0x03)
  269. #define GNSS_LIBGPS_EUT_TSXTEMP_SUBTYPE (0x04)
  270. #define GNSS_LIBGPS_EUT_RFDATA_CAP_SUBTYPE (0x05)
  271. // GNSS_LIBGPS_EUT_TYPE end
  272. // GNSS_LIBGPS_REG_WR_TYPE begin
  273. #define GNSS_LIBGPS_REG_WRITE_SUBTYPE (0x01) // GNSS_REG_WR
  274. #define GNSS_LIBGPS_REG_READ_SUBTYPE (0x02) // GNSS_REG_WR
  275. #define GNSS_LIBGPS_REG_VALUE_SUBTYPE (0x03) // GNSS_REG_WR
  276. // GNSS_LIBGPS_REG_WR_TYPE end
  277. //GNSS_LIBGPS_QUERY_STARTMODE_AGNSS_TYPE begin
  278. #define GNSS_LIBGPS_QUERY_STARTMODE_AGNSS_SUBTYPE (0x3d)
  279. //GNSS_LIBGPS_QUERY_STARTMODE_AGNSS_TYPE end
  280. //GNSS_LIBGPS_RESPONSE_STARTMODE_AGNSS_NMEA_TYPE begin
  281. #define GNSS_LIBGPS_RESPONSE_STARTMODE_AGNSS_SUBTYPE (0x37)
  282. #define GNSS_LIBGPS_GST_SUBTYPE (0x25)
  283. #define GNSS_LIBGPS_SET_BD2LTE_EXT_SUBTYPE (0x36)
  284. /* GNSS_LIBGPS_RESPONSE_STARTMODE_AGNSS_NMEA_TYPE end*/
  285. //Assistant DATA
  286. #define DATA_POSVELTIME (0x0001)
  287. #define DATA_IONOUTC (0x0002)
  288. #define DATA_GPSSEPHEMERIS (0x0004)
  289. #define DATA_GPSALMANAC (0x0008)
  290. #define DATA_BDSEPHEMERIS (0x0010)
  291. #define DATA_GPSALMPACKEDCOPY (0x0020)
  292. #define DATA_BDSALMPACKEDCOPY (0x0040)
  293. #define DATA_ACQUISITION_ASSISTANCE (0x0080)
  294. //it define encode and decode begin
  295. #define GNSS_MAGIC_NUMBER_LEN (4)
  296. #define GNSS_MAX_DATA_CRC (2)
  297. #define GNSS_MAGIC_NUMBER (0x7E)
  298. #define GNSS_MAX_HEAD_LEN (10)
  299. #define GNSS_LOG_BB_LEN (32)
  300. #define GNSS_LOG_DDDD_LEN (57)
  301. #define GNSS_LOG_LLLL_LEN (41)
  302. #define GNSS_LOG_SSSS_LEN (33)
  303. #define GNSS_LOG_FFFF_LEN (41)
  304. #define GNSS_LOG_DDDD_CRC (0xFDC0)
  305. #define GNSS_LOG_LLLL_CRC (0xFDCF)
  306. #define GNSS_LOG_SSSS_CRC (0xFDD6)
  307. #define GNSS_LOG_FFFF_CRC (0xFDCD)
  308. #define GNSS_GET_HIGH_BYTE(D) (unsigned char)((D) >> 8)
  309. #define GNSS_GET_LOW_BYTE(D) (unsigned char)(D)
  310. #define TRUE 1
  311. #define FALSE 0
  312. #define GNSS_FLASH_BLOCK_SIZE 4096
  313. //it define encode and decode end
  314. //it define gnsstool type and subtype begin
  315. #define GNSS_LIBGPS_TO_GNSSTOOL_MSG_HEAD_TYPE (0x3A)
  316. #define GNSS_LIBGPS_TO_GNSSTOOL_ACCURACY_MSG_HEAD_SUBTYPE (0x07)
  317. //it define gnsstool type and subtype end
  318. /********************************************************
  319. * Structrues
  320. *********************************************************/
  321. #define MAX_SATS_NUMBERS (32)
  322. #define MAX_GLO_SATS_NUMBERS (28)
  323. #define MAX_BDS_SATS_NUMBERS (14)
  324. #define MAX_SATS_IN_VIEW (16)
  325. #define MAX_MSG_BUFF_SIZE (2038) //from 1024 to 3904
  326. #define STRING_MAX_LENGTH (15)
  327. typedef enum _EWorkMode
  328. {
  329. COLD_START_MODE = 1,
  330. WARM_START_MODE,
  331. HOT_START_MODE,
  332. FAC_START_MODE
  333. } EWorkMode_e;
  334. typedef struct _TPosLLH
  335. {
  336. double lat; /** geographical latitude */
  337. double lon; /** geographical longitude */
  338. double hae; /** geographical altitude */
  339. } TPosLLH_t;
  340. typedef struct _TVelocity
  341. {
  342. float horizontalSpeed; // kmh
  343. float bearing;
  344. float verticalSpeed; // kmh
  345. char verticalDirect; // 0: upward, 1:downward
  346. } TVelocity_t;
  347. typedef struct _TGpsTime
  348. {
  349. unsigned short weekNo; /*< week number (from beginning of current week cycle) */
  350. unsigned long second; /*< seconds (from beginning of current week no) */
  351. unsigned long secondFrac; /*< seconds fraction (from beginning of current second) units: 1ns */
  352. } TGpsTime_t;
  353. typedef struct _TEphemerisPacked
  354. {
  355. unsigned char flag; // bit0 means ephemeris valid
  356. unsigned char svid;
  357. unsigned int word[30];
  358. } TEphemerisPacked_t; //sizeof= 122Bytes
  359. typedef struct _TGpsAlmanacPacked
  360. {
  361. unsigned int flag; //bit 0-31 indicates alm validility flag of sv1-32
  362. unsigned int FramePageWord[2][25][8];
  363. } TGpsAlmanacPacked_t; //sizeof= 1604Bytes
  364. typedef struct _TBd2sAlmanacPacked
  365. {
  366. unsigned int flag; //bit 0-29 indicates alm validility flag of sv1-30
  367. unsigned int healthFlag; //bit 0-29 indicates alm health info of sv1-30,defaulted value is 0(0 indicates healthy),changed when decoded from pages
  368. unsigned int FramePageWord[2][24][8]; //WORD2-9 for decode,pay attention that 2LSB of word2 has been put into 2MSB of word3 both D1&D2
  369. } TBd2sAlmanacPacked_t; //sizeof= 1544Bytes
  370. typedef struct _TGpsAlmanacPackedCopy
  371. {
  372. unsigned int svMask[2][25]; //bit 0-31 indicates svMask one page of one subframe in one copy
  373. unsigned int FramePageValid[2]; // valid flag for page1~25 in subframe 4/5
  374. unsigned int FramePageWord[2][25][8];
  375. } TGpsAlmanacPackedCopy_t; //sizeof= 1808Bytes
  376. typedef struct _TBd2AlmanacPackedCopy
  377. {
  378. unsigned int svMask[2][24]; //bit 0-31 indicates svMask one page of one subframe in one copy
  379. unsigned int FramePageValid[2]; // valid flag for page1~25 in subframe 4/5
  380. unsigned int FramePageWord[2][24][8]; //WORD3-10 for data aiding,only for D1
  381. } TBd2AlmanacPackedCopy_t; //sizeof= 1736Bytes
  382. typedef struct _TAlmanac
  383. {
  384. unsigned char flag;
  385. unsigned char svid;
  386. unsigned short health; //type changed from unsigned char to unsigned short, for health of BD2 occupy 9 bits
  387. int toa;
  388. int week;
  389. // variables decoded from stream data
  390. double M0; // Mean Anomaly at Reference Time
  391. double ecc; // Eccentricity
  392. double sqrtA; // Square Root of the Semi-Major Axis
  393. double omega0; // Longitude of Ascending Node of Orbit Plane at Weekly Epoch
  394. double i0; // Inclination Angle at Reference Time
  395. double w; // Argument of Perigee
  396. double omega_dot; // Rate of Right Ascension
  397. double af0; // Satellite Clock Correction
  398. double af1; // Satellite Clock Correction
  399. // variables derived from basic data, avoid calculate every time
  400. double axis; // Semi-major Axis of Orbit
  401. double n; // Mean Angular Rate
  402. double root_ecc; // Square Root of One Minus Ecc Square
  403. double omega_t; // Longitude of Ascending Node of Orbit Plane at toe
  404. double omega_delta; // Delta Between omega_dot and WGS_OMEGDOTE
  405. } TAlmanac_t;
  406. typedef struct _TAddionalDopplerFields
  407. {
  408. float doppler1; // range: [-1.0, 0.5]hz/sec
  409. float dopplerUncertainty; // range: [12.5, 200]hz
  410. } TAddionalDopplerFields_t;
  411. typedef struct _TAddionalAngleFields
  412. {
  413. float azimuth; // range:0--384.75 deg
  414. float elevation; // range:0--78.75 deg
  415. } TAddionalAngleFields_t;
  416. typedef struct _TAcquisElement
  417. {
  418. unsigned char svid; // range:1--64
  419. unsigned char intCodePhase; // range:0--19 C/A period
  420. unsigned char gpsBitNumber; // range:0--3
  421. unsigned char codePhaseSearchWindow; // range:0--192 chips
  422. unsigned char addionalAngleFlag; // 1: addionalAngle is valid
  423. unsigned char addionalDopplerFlag; // 1: addionalDoppler is valid
  424. unsigned short codePhase; // range:0--1022 chips
  425. TAddionalDopplerFields_t addionalDoppler;
  426. TAddionalAngleFields_t addionalAngle;
  427. float doppler0; // range:-5120...5117.5
  428. } TAcquisElement_t;
  429. typedef struct _TAcquisAssist
  430. {
  431. unsigned char count; // acquisElement[0]...acquisElement[count-1] is valid value
  432. unsigned long gpsTime; // unit: ms
  433. TAcquisElement_t acquisElement[MAX_SATS_IN_VIEW];
  434. } TAcquisAssist_t;
  435. typedef struct _TMeasureElement
  436. {
  437. unsigned char satelliteID; // range: 0-63
  438. unsigned char cNo; // carrier noise ratio, range:(0..63)
  439. unsigned char pseuRangeRMSErr; // index, range:(0..63)
  440. //MpathIndic mpathInd; // multipath indicator
  441. unsigned short wholeChips; // whole value of the code phase measurement, range:(0..1022)
  442. unsigned short fracChips; // fractional value of the code phase measurement, range:(0..1023),
  443. float doppler; // doppler, mulltiply by 0.2, range:(-32768..32767)
  444. } TMeasureElement_t;
  445. typedef struct _TMeasuresList
  446. {
  447. unsigned long gpsTOW;
  448. unsigned short listNums;
  449. TMeasureElement_t msrElement[MAX_SATS_IN_VIEW];
  450. } TMeasuresList_t;
  451. typedef struct _TGpsEphemerisList
  452. {
  453. TEphemerisPacked_t Ephemeris[MAX_SATS_IN_VIEW];
  454. } TGpsEphemerisList_t;
  455. typedef struct _TBdsEphemerisList
  456. {
  457. TEphemerisPacked_t Ephemeris[MAX_SATS_IN_VIEW];
  458. } TBdsEphemerisList_t;
  459. typedef struct _TGpsAlmanac
  460. {
  461. int index;
  462. TGpsAlmanacPackedCopy_t Almanac;
  463. } TGpsAlmanacCopyList_t;
  464. typedef struct _TBdsAlmanac
  465. {
  466. int index;
  467. TBd2AlmanacPackedCopy_t Almanac;
  468. } TBdsAlmanacCopyList_t;
  469. typedef struct _TIonoParam
  470. {
  471. float a0; // 2**-30
  472. float a1; // 2**-27
  473. float a2; // 2**-24
  474. float a3; // 2**-24
  475. float b0; // 2**11
  476. float b1; // 2**14
  477. float b2; // 2**16
  478. float b3; // 2**16
  479. unsigned long flag; // 1, availble
  480. } TIonoParam_t;
  481. // UTC parameters
  482. typedef struct _TUtcParam
  483. {
  484. double A0; // second, 2**-30
  485. double A1; // second/second, 2**-50
  486. short WN;
  487. short WNLSF;
  488. unsigned char tot; // 2**12
  489. unsigned char TLS; // leap second
  490. unsigned char TLSF;
  491. unsigned char DN;
  492. unsigned int flag; // 1, availble
  493. } TUtcParam_t;
  494. typedef struct _TRtcTime
  495. {
  496. int flag;
  497. int Reserved;
  498. int week;
  499. int msCount;
  500. unsigned int timeUnc; //heidi add
  501. } TRtcTime_t;
  502. typedef struct _TPosVelParam
  503. {
  504. int PosQuality;
  505. int Reserved;
  506. double freqBias;
  507. TPosLLH_t ReceiverPos;
  508. unsigned int posUnc; //heidi add
  509. } TPosVelParam_t;
  510. typedef struct _TTimeDiff
  511. {
  512. int flag;
  513. int Reserved;
  514. double ToGPSTimeDiff;
  515. } TTimeDiff_t;
  516. typedef struct _TPosVelTimeParam
  517. {
  518. TPosVelParam_t PosVelParam;
  519. TRtcTime_t RTCTime;
  520. TTimeDiff_t TimeDiff;
  521. unsigned int CheckSum;
  522. } TPosVelTimeParam_t;
  523. typedef struct _TIonoUtcParam
  524. {
  525. TIonoParam_t IonoParam[2];
  526. TUtcParam_t UTCParam[2];
  527. unsigned int CheckSum;
  528. } TIonoUtcParam_t;
  529. typedef struct _TCmdData
  530. {
  531. unsigned char type;
  532. unsigned char subType;
  533. unsigned short length;
  534. unsigned char buff[MAX_MSG_BUFF_SIZE];
  535. } TCmdData_t;
  536. typedef struct _TLogDDDDFormat4
  537. {
  538. char str[STRING_MAX_LENGTH];
  539. double value1;
  540. double value2;
  541. double value3;
  542. double value4;
  543. } TLogDDDDFormat4_t;
  544. typedef struct _TLogLLLLFormat4
  545. {
  546. char str[STRING_MAX_LENGTH];
  547. long value1;
  548. long value2;
  549. long value3;
  550. long value4;
  551. } TLogLLLLFormat4_t;
  552. typedef struct _TLogSSSSFormat4
  553. {
  554. char str[STRING_MAX_LENGTH];
  555. short value1;
  556. short value2;
  557. short value3;
  558. short value4;
  559. } TLogSSSSFormat4_t;
  560. typedef struct _TLogFFFFFormat4
  561. {
  562. char str[STRING_MAX_LENGTH];
  563. float value1;
  564. float value2;
  565. float value3;
  566. float value4;
  567. } TLogFFFFFormat4_t;
  568. typedef struct _TLogSDSDSDFormat6
  569. {
  570. char FunctionName[STRING_MAX_LENGTH];
  571. char str1[STRING_MAX_LENGTH];
  572. double value1;
  573. char str2[STRING_MAX_LENGTH];
  574. double value2;
  575. char str3[STRING_MAX_LENGTH];
  576. double value3;
  577. } TLogSDSDSDFormat6_t;
  578. //it define encode and decode struct union begin
  579. typedef enum
  580. {
  581. GNSS_RECV_SEARCH_FLAG,
  582. GNSS_RECV_COLLECT_HEAD,
  583. GNSS_RECV_DATA,
  584. GNSS_RECV_Complete,
  585. GNSS_RECV_ERROR,
  586. } GNSS_RecvState_e;
  587. // GNSS frame (User Data part only)
  588. typedef struct
  589. {
  590. char type;
  591. char subtype;
  592. unsigned short dataLen;
  593. unsigned char *pBuf;
  594. } GNSS_packet_t;
  595. typedef struct __GNSS_DataProcessor
  596. {
  597. GNSS_RecvState_e state;
  598. unsigned short headSize; //receive head len
  599. unsigned short receivedDataLen; ////receive data len
  600. unsigned short dataLen; //total data len
  601. //add debug information
  602. unsigned short errorNum;
  603. unsigned char curHeader[GNSS_MAX_HEAD_LEN];
  604. //GNSS_packet_t *pCurData;
  605. TCmdData_t cmdData;
  606. } TGNSS_DataProcessor_t;
  607. typedef struct __TGNSS_Baseband_Log
  608. {
  609. unsigned char type;
  610. unsigned char svid;
  611. unsigned short data1;
  612. unsigned short data2;
  613. unsigned short data3;
  614. unsigned int bbtime;
  615. unsigned int data4;
  616. unsigned int data5;
  617. unsigned int data6;
  618. unsigned int data7;
  619. unsigned int pad;
  620. } TGNSS_Baseband_Log_t;
  621. //it define encode and decode struct union end
  622. /**---------------------------------------------------------------------------*
  623. ** Function Prototypes *
  624. **---------------------------------------------------------------------------*/
  625. void GNSS_InitParsePacket(TGNSS_DataProcessor_t *pStream);
  626. void GNSS_FillHead(TCmdData_t *pIndata, unsigned char *pOutData);
  627. int GNSS_EncodeOnePacket(TCmdData_t *pInData, unsigned char *pOutData, unsigned short outLen);
  628. int GNSS_ParseOnePacket(TGNSS_DataProcessor_t *pStream, unsigned char *pData, unsigned short Len);
  629. /**--------------------------------------------------------------------------*
  630. ** Compiler Flag *
  631. **---------------------------------------------------------------------------*/
  632. #ifdef __cplusplus
  633. }
  634. #endif
  635. #endif //GNSS_LIBGPS_API_H