gps_pc_mode.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. #ifndef GPS_PC_MODE_H
  2. #define GPS_PC_MODE_H
  3. /*
  4. #include "eng_diag.h"
  5. #include "eng_modules.h"
  6. #include "calibration.h"
  7. */
  8. #include "greeneye2.h"
  9. #include "sci_types.h"
  10. #ifndef WIN32
  11. //#include "sprd_fts_type.h"
  12. #endif
  13. /*just a part of gps_pc_mode from gps_pc_mode in gps.c\
  14. this value need sync with it*/
  15. enum gps_pc_mode
  16. {
  17. GPS_WARM_START = 1,
  18. GPS_PS_START = 100,
  19. GPS_COLD_START = 125,
  20. GPS_LOG_ENABLE = 136,
  21. GPS_LOG_DISABLE = 520,
  22. GPS_HOT_START = 1024,
  23. GPS_LTE_DIS = 4128,
  24. GPS_TCXO = 50001, /*TCXO stability test*/
  25. GPS_CW_CN0 = 50002, /*CW CN0 test*/
  26. GPS_RF_GPS_TEST = 50003, /*RF data tool GPS mode*/
  27. GPS_TSX_TEMP = 50004, /*TSX TEMP test*/
  28. GPS_NEW_TCXO = 50005, /*TCXO new stability test*/
  29. GPS_RF_GL = 50006, /*RF data tool GLONASS mode*/
  30. GPS_RF_BD = 50007, /*RF data tool BEIDOU mode*/
  31. GPS_FAC_START = 65535, /*factory start*/
  32. };
  33. enum diag_gnss_subtype
  34. {
  35. DIAG_GNSS_HOT_START = 0,
  36. DIAG_GNSS_COLD_START = 1,
  37. DIAG_GNSS_WARM_START = 2,
  38. DIAG_GNSS_STOP = 3,
  39. DIAG_GNSS_RECEIVE_NMEA = 5,
  40. DIAG_GNSS_MODE_SET = 7,
  41. DIAG_GNSS_PS_START = 8,
  42. DIAG_GNSS_TCXO = 10,
  43. DIAG_GNSS_RF_GPS = 11,
  44. DIAG_GNSS_RF_GLONASS = 12,
  45. DIAG_GNSS_RF_BEIDOU = 13,
  46. DIAG_GNSS_FAC_START = 20,
  47. DIAG_GNSS_NEW_TCXO = 21,
  48. DIAG_GNSS_ORBIT_SWITCH = 23,
  49. GNSS_SUBTYPE_GET_SIGNALMODE = 24,
  50. GNSS_SUBTYPE_SET_SIGNALMODE = 25,
  51. DIAG_GNSS_MAX,
  52. };
  53. enum GNSS_BBAT_CMD_TYPE_E
  54. {
  55. GNSS_BBAT_CMD_START = 1, /* start gps */
  56. GNSS_BBAT_CMD_SEARCH = 2, /* search gps */
  57. GNSS_BBAT_CMD_GET_SVS = 3, /* get number of SVs */
  58. GNSS_BBAT_CMD_CLOSE = 4, /* close gps */
  59. GNSS_BBAT_CMD_GET_SNR = 5, /* get sv snr */
  60. GNSS_BBAT_CMD_MAX
  61. };
  62. #define DEBUG_8850CM_AT_GNSS_DIAG 1
  63. #define EUT_GPS_OK "+SPGPSTEST:OK"
  64. #define EUT_GPS_ERROR "+SPGPSTEST:ERR="
  65. #define EUT_GPS_REQ "+SPGPSTEST:EUT="
  66. #define EUT_GPS_PRN_REQ "+SPGPSTEST:PRN="
  67. #define EUT_GPS_SNR_REQ "+SPGPSTEST:SNR="
  68. #define EUT_GPS_RSSI_REQ "+SPGPSTEST:RSSI="
  69. #define EUT_GPS_TSXTEMP_REQ "+SPGPSTEST:TSXTEMP="
  70. #define EUT_GPS_TCXO_REQ "+SPGPSTEST:TCXO="
  71. #define EUT_GPS_READ_REQ "+SPGPSTEST:READ="
  72. #define EUT_GPS_SEARCH_REQ "+SPGPSTEST:SEARCH="
  73. #define EUT_GPS_SNR_NO_EXIST "NO_EXIST"
  74. #define EUT_GPS_NO_FOUND_STAELITE "NO_FOUND_SATELLITE"
  75. #define EUT_GPS_SV_ID "SV_ID="
  76. #define EUT_GPS_SV_NUMS "SV_NUM="
  77. #define EUT_GPSERR_SEARCH (153)
  78. #define EUT_GPSERR_PRNSTATE (154)
  79. #define EUT_GPSERR_PRNSEARCH (155)
  80. #define EUT_GPSERR_INIT (156)
  81. //for gnss bit mask
  82. #define CPMODE_GPS_MASK 0x1 //00001
  83. #define CPMODE_BD2_MASK 0x2 //00010
  84. #define CPMODE_GLO_MASK 0x4 //00100
  85. #define CPMODE_B1C_MASK 0x8 //01000
  86. #define CPMODE_GAL_MASK 0x10 //10000
  87. #define CPMODE_DEF_MASK 0x0 // Need to be configured again
  88. #define CPMODE_ALL_MASK (CPMODE_GPS_MASK | CPMODE_BD2_MASK | CPMODE_GLO_MASK | CPMODE_B1C_MASK | CPMODE_GAL_MASK)
  89. #define TOURMODE_WORKMODE_DEF 18
  90. #define TWOMODE_WORKMODE_DEF 3
  91. #define TWOMODE_WORKMODE_MAX 3
  92. #define THRMODE_WORKMODE_MAX 25
  93. #define THRMODE_WORKMODE_DEF 16
  94. // GPS PC MODE
  95. #define INIT_MODE 0x7
  96. #define DIAG_TXDATA_FILE "/productinfo/txdata.txt"
  97. #define DIAG_MAX_PAYLOAD_LEN (DIAG_BUFF_SIZE - 10)
  98. #define BBAT_PAYLOAD_LEN 60 //according to Autotest layer
  99. #ifndef WRITE_TO_MAX
  100. #define WRITE_TO_MAX 16
  101. #endif
  102. #ifndef DIAG_BUFF_SIZE
  103. #define DIAG_BUFF_SIZE 4096
  104. #endif
  105. #ifndef DIAG_CMD_GPS_AUTO_TEST
  106. #define DIAG_CMD_GPS_AUTO_TEST 0x3A
  107. #endif
  108. #ifndef WIN32
  109. /* sync with gps_common.h */
  110. /*
  111. typedef enum DevicepowerState
  112. {
  113. DEVICE_DOWNLOADING = 1,
  114. DEVICE_DOWNLOADED,
  115. DEVICE_POWERONING,
  116. DEVICE_POWERONED,
  117. DEVICE_WORKING,
  118. DEVICE_WORKED,
  119. DEVICE_IDLING,
  120. DEVICE_IDLED,
  121. DEVICE_SLEEPING,
  122. DEVICE_SLEEP,
  123. DEVICE_WAKEUPING,
  124. DEVICE_RESET,
  125. DEVICE_POWEROFFING,
  126. DEVICE_POWEROFFED,
  127. DEVICE_ABNORMAL
  128. }TDevicepowerState;
  129. */
  130. /* Begin: cp-mode record */
  131. typedef struct
  132. {
  133. unsigned char length;
  134. unsigned char list[THRMODE_WORKMODE_MAX];
  135. } GNSS_WORKMODE_LIST;
  136. typedef enum
  137. {
  138. GNSS_MODELIST_GET,
  139. GNSS_MODELIST_SET,
  140. GNSS_MODELIST_MAX
  141. } GNSS_ListOp_e;
  142. /* End */
  143. /* begin: mainly for test log print and diag cp-mode config */
  144. typedef enum
  145. {
  146. GNSS_DEF_INIT, /* INIT by APP normal init */
  147. GNSS_DIAGTEST_INIT = 0xFFE0, /* INIT by diag test, gnsstool now */
  148. GNSS_ATTEST_INIT, /* INIT by at test, cali now */
  149. GNSS_MMITEST_INIT, /* INIT by nativemmi test */
  150. } GNSS_INIT_TYPE;
  151. typedef enum
  152. {
  153. GNSS_CHIP_GE2 = 0, /* ID for: GNSS_GE2_PROP_NAME */
  154. GNSS_CHIP_EXTGE2 = 1, /* GNSS_GE2_EXT_PROP_NAME */
  155. GNSS_CHIP_MARLIN3 = 2, /* GNSS_MARLIN3_PROP_NAME */
  156. GNSS_CHIP_MARLIN3_LITE = 3, /* GNSS_MARLIN3_LITE_PROP_NAME */
  157. } GNSSCHIPTYPE_e; /* chip_type in GpsState */
  158. /* end: mainly for test log print and diag cp-mode config */
  159. typedef void (*report_ptr)(const char *nmea, int length);
  160. #ifndef DYMIC_WRITETOPC_FUNC
  161. typedef int (*DYMIC_WRITETOPC_FUNC)(char *rsp, int len);
  162. #endif
  163. #ifndef eng_callback
  164. struct eng_callback
  165. {
  166. unsigned int diag_ap_cmd; //data area: unsigned int for data command
  167. unsigned char type; //command
  168. unsigned char subtype; //data command
  169. char at_cmd[32]; //at comd
  170. int also_need_to_cp;
  171. int (*eng_diag_func)(char *buf, int len, char *rsp, int rsplen);
  172. int (*eng_linuxcmd_func)(char *req, char *rsp);
  173. int (*eng_set_writeinterface_func)(DYMIC_WRITETOPC_FUNC *write_interface_ptr);
  174. int (*eng_cmd_match)(char *buf, int len);
  175. };
  176. #endif
  177. extern int set_report_ptr(DYMIC_WRITETOPC_FUNC *write_interface_ptr);
  178. extern int gps_export_start(void);
  179. extern int gps_export_stop(void);
  180. extern int get_nmea_data(char *nbuff);
  181. extern int set_gps_mode(unsigned int mode);
  182. extern int gnss_hal_init(int type);
  183. extern int get_stop_mode(void);
  184. extern void gps_at_parse(char *buf, char *rsp);
  185. extern int write_register(unsigned int addr, unsigned int value);
  186. extern unsigned int read_register(unsigned int addr);
  187. void cw_data_capture(const char *nmea, int length);
  188. void gps_pc_nmea_parse(const char *nmea, int length);
  189. int gnss_nativeMMI_test(char *buf, char *rsp);
  190. int fft_GetCwCn0(void);
  191. void gps_at_parse_v2(char *buff, char *rsp);
  192. #endif
  193. #endif