ql_api_dev.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. /**
  2. @file
  3. ql_api_dev.h
  4. @brief
  5. quectel dev info interface definition.
  6. */
  7. /*================================================================
  8. Copyright (c) 2020 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
  9. Quectel Wireless Solution Proprietary and Confidential.
  10. =================================================================*/
  11. /*=================================================================
  12. EDIT HISTORY FOR MODULE
  13. This section contains comments describing changes made to the module.
  14. Notice that changes are listed in reverse chronological order.
  15. WHEN WHO WHAT, WHERE, WHY
  16. ------------ ------- -------------------------------------------------------------------------------
  17. =================================================================*/
  18. #ifndef QL_API_DEV_H
  19. #define QL_API_DEV_H
  20. #include "ql_api_common.h"
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /*========================================================================
  25. * Macro Definition
  26. *========================================================================*/
  27. #define QL_DEV_ERRCODE_BASE (QL_COMPONENT_STATE_INFO<<16)
  28. #define CONFIG_AT_CFUN_SIM_DETECT_SUPPORT
  29. #define QL_NOT_LIMIT_WRITE 0 //Special meaning, which means that the number of dump writes is not limited
  30. #define QL_LIMIT_WRITE_MAX_CNT 1000 //The maximum cnt of dump writes allowed without clean dump cnt
  31. #ifndef bool
  32. typedef char bool;
  33. #endif
  34. /*===========================================================================
  35. * Struct
  36. ===========================================================================*/
  37. typedef struct
  38. {
  39. uint32_t total_size; ///< memory heap total size
  40. uint32_t avail_size; ///< available size. The actual allocatable size may be less than this
  41. uint32_t max_block_size; ///< maximum allocatable block size
  42. } ql_memory_heap_state_t;
  43. typedef struct
  44. {
  45. bool save_dump_info; //true--save dumo info to file system false--not save
  46. bool del_dump_file; //true--delete dump file, false--not delete
  47. bool clean_dump_cnt; //true--clean dump cnt, false--not clean
  48. uint16_t max_dump_cnt; //the maximum number of times allowed to write dump. clean_dump_cnt can clear the count, range[QL_NOT_LIMIT_WRITE-QL_LIMIT_WRITE_MAX_COUNT]
  49. }ql_dump_config_t;
  50. typedef struct
  51. {
  52. uint16_t current_dump_cnt;
  53. char *dump_buffer;
  54. int length;
  55. }ql_dump_info_t;
  56. /*========================================================================
  57. * Enumeration Definition
  58. *========================================================================*/
  59. //dev component detail errcode, 4 bytes
  60. typedef enum
  61. {
  62. QL_DEV_SUCCESS = QL_SUCCESS,
  63. QL_DEV_EXECUTE_ERR = 1|QL_DEV_ERRCODE_BASE,
  64. QL_DEV_MEM_ADDR_NULL_ERR,
  65. QL_DEV_INVALID_PARAM_ERR,
  66. QL_DEV_BUSY_ERR,
  67. QL_DEV_SEMAPHORE_CREATE_ERR,
  68. QL_DEV_SEMAPHORE_TIMEOUT_ERR,
  69. QL_DEV_HANDLE_INVALID_ERR,
  70. QL_DEV_CFW_CFUN_GET_ERR = 15|QL_DEV_ERRCODE_BASE,
  71. QL_DEV_CFW_CFUN_SET_CURR_COMM_FLAG_ERR = 18|QL_DEV_ERRCODE_BASE,
  72. QL_DEV_CFW_CFUN_SET_COMM_ERR,
  73. QL_DEV_CFW_CFUN_SET_COMM_RSP_ERR,
  74. QL_DEV_CFW_CFUN_RESET_BUSY = 25|QL_DEV_ERRCODE_BASE,
  75. QL_DEV_CFW_CFUN_RESET_CFW_CTRL_ERR,
  76. QL_DEV_CFW_CFUN_RESET_CFW_CTRL_RSP_ERR,
  77. QL_DEV_IMEI_GET_ERR = 33|QL_DEV_ERRCODE_BASE,
  78. QL_DEV_SN_GET_ERR = 36|QL_DEV_ERRCODE_BASE,
  79. QL_DEV_UID_READ_ERR = 39|QL_DEV_ERRCODE_BASE,
  80. QL_DEV_TEMP_GET_ERR = 50|QL_DEV_ERRCODE_BASE,
  81. QL_DEV_WDT_CFG_ERR = 53|QL_DEV_ERRCODE_BASE,
  82. QL_DEV_HEAP_QUERY_ERR = 56|QL_DEV_ERRCODE_BASE,
  83. QL_DEV_AUTHCODE_READ_ERR = 90|QL_DEV_ERRCODE_BASE,
  84. QL_DEV_AUTHCODE_ADDR_NULL_ERR,
  85. QL_DEV_READ_WIFI_MAC_ERR = 100|QL_DEV_ERRCODE_BASE, //read wifi mac address nv error
  86. } ql_errcode_dev_e;
  87. typedef enum
  88. {
  89. QL_DEV_CFUN_MIN = 0,
  90. QL_DEV_CFUN_FULL = 1,
  91. QL_DEV_CFUN_AIR = 4,
  92. } ql_dev_cfun_e;
  93. /*========================================================================
  94. * Variable Definition
  95. *========================================================================*/
  96. /*========================================================================
  97. * function Definition
  98. *========================================================================*/
  99. /*
  100. * to get the IMEI label
  101. */
  102. ql_errcode_dev_e ql_dev_get_imei(char *p_imei, size_t imei_len, uint8_t nSim);
  103. /*
  104. * to get the SN label
  105. */
  106. ql_errcode_dev_e ql_dev_get_sn(char *p_sn, size_t sn_len, uint8_t nSim);
  107. /*
  108. * to get the product ID
  109. */
  110. ql_errcode_dev_e ql_dev_get_product_id(char *p_product_id, size_t product_id_len);
  111. /*
  112. * to get the model type
  113. */
  114. ql_errcode_dev_e ql_dev_get_model(char *p_model, size_t model_len);
  115. /*
  116. * to get the firmware version of model
  117. */
  118. ql_errcode_dev_e ql_dev_get_firmware_version(char *p_version, size_t version_len);
  119. /*
  120. * to get the firmware subversion of model
  121. */
  122. ql_errcode_dev_e ql_dev_get_firmware_subversion(char *p_subversion, size_t subversion_len);
  123. /*
  124. * to get the unique chip id of model
  125. */
  126. ql_errcode_dev_e ql_dev_get_cpu_uid(unsigned long long *p_chip_id);
  127. /*
  128. * to get the current functionality of model
  129. */
  130. ql_errcode_dev_e ql_dev_get_modem_fun(uint8_t *p_function, uint8_t nSim);
  131. /*
  132. * to set the functionality of model or to reset the model
  133. */
  134. ql_errcode_dev_e ql_dev_set_modem_fun(uint8_t at_dst_fun, uint8_t rst, uint8_t nSim);
  135. /*
  136. * to get temperature value of chip
  137. */
  138. ql_errcode_dev_e ql_dev_get_temp_value(int32_t *ql_temp);
  139. /*
  140. * to config watchdog
  141. */
  142. ql_errcode_dev_e ql_dev_cfg_wdt(uint8_t opt);
  143. /*
  144. * to feed wdt
  145. */
  146. ql_errcode_dev_e ql_dev_feed_wdt(void);
  147. /*
  148. * to query memory heap state information
  149. */
  150. ql_errcode_dev_e ql_dev_memory_size_query(ql_memory_heap_state_t *ql_heap_state);
  151. #ifdef CONFIG_QUEC_PROJECT_FEATURE_SECURE_BOOT
  152. /*
  153. * get flag of secure boot enable
  154. */
  155. ql_errcode_dev_e ql_dev_get_secure_boot_enable_state(char *state);
  156. /*
  157. * to enable secure boot
  158. */
  159. ql_errcode_dev_e ql_dev_enable_secure_boot();
  160. /*
  161. * to enable secure boot with flag of whether reset
  162. */
  163. ql_errcode_dev_e ql_dev_enable_secure_boot_ex(bool reset);
  164. #endif
  165. /*
  166. * to read mac address from wifi mac nv
  167. */
  168. ql_errcode_dev_e ql_dev_get_mac_address(char *mac_address, size_t mac_len);
  169. #ifdef CONFIG_QL_OPEN_EXPORT_PKG
  170. /*
  171. * to config dump parameter
  172. */
  173. ql_errcode_dev_e ql_dev_config_dump(ql_dump_config_t *dump_config);
  174. /*
  175. * to get dump info
  176. * if dump_info->dump_buffer is NULL, you can get current_dump_cnt and really data len,
  177. * else you can also get data with specify len.
  178. */
  179. ql_errcode_dev_e ql_dev_get_dump_info(ql_dump_info_t *dump_info);
  180. #endif
  181. /*
  182. * to get systerm random number
  183. */
  184. uint32_t ql_dev_get_sys_srand();
  185. #ifdef __cplusplus
  186. } /*"C" */
  187. #endif
  188. #endif /* QL_API_DEV_H */