quec_internal_cfg.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. /*================================================================
  2. Copyright (c) 2021, Quectel Wireless Solutions Co., Ltd. All rights reserved.
  3. Quectel Wireless Solutions Proprietary and Confidential.
  4. =================================================================*/
  5. /*=================================================================
  6. EDIT HISTORY FOR MODULE
  7. This section contains comments describing changes made to the module.
  8. Notice that changes are listed in reverse chronological order.
  9. WHEN WHO WHAT, WHERE, WHY
  10. ------------ ------- -------------------------------------------------------------------------------
  11. =================================================================*/
  12. #ifndef QUEC_INTERNAL_CFG_H
  13. #define QUEC_INTERNAL_CFG_H
  14. #include "quec_common.h"
  15. #include "quec_pin_index.h"
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. /*===========================================================================
  20. * Macro
  21. ===========================================================================*/
  22. #define ADC_CHANNEL_NONE (-1)
  23. #ifdef CONFIG_QL_PROJECT_DEF_EG915U
  24. #define QUEC_AT_SIM_APREADYCTRL
  25. #ifndef CONFIG_QL_OPEN_EXPORT_PKG
  26. #define QUEC_AT_GPIO_FAST_POWEROFF
  27. #endif
  28. #endif
  29. #if (defined CONFIG_QUEC_PROJECT_FEATURE_BOOT_SDMMC)\
  30. || (defined CONFIG_QUEC_PROJECT_FEATURE_BOOT_EMMC)\
  31. || (defined CONFIG_QUEC_PROJECT_FEATURE_BOOT_SDMMC2)\
  32. || (defined CONFIG_QUEC_PROJECT_FEATURE_BOOT_EMMC2)
  33. #define QUEC_PROJECT_FEATURE_BOOT_SD_EMMC
  34. #endif
  35. #if (defined CONFIG_QUEC_PROJECT_FEATURE_SDMMC)\
  36. || (defined CONFIG_QUEC_PROJECT_FEATURE_EMMC)\
  37. || (defined CONFIG_QUEC_PROJECT_FEATURE_SDMMC2)\
  38. || (defined CONFIG_QUEC_PROJECT_FEATURE_EMMC2)
  39. #define QUEC_PROJECT_FEATURE_SD_EMMC
  40. #endif
  41. /***** for QPINEXT *****/
  42. #ifndef CONFIG_QL_OPEN_EXPORT_PKG
  43. #define PINEXT_NONE 0xff
  44. /***** EG700U/EG500U sd_det *****/
  45. #define SD_DET_PIN QUEC_PIN_SD_DET
  46. //#define SD_DET_GPIO QUEC_GPIO_SD_DET
  47. /***** EC600U cam_lamp *****/
  48. #define LOCATE_LAMP_PIN QUEC_PIN_DNAME_SPI_LCD_CS
  49. #define LOCATE_LAMP_GPIO QUEC_GPIO_DNAME_SPI_LCD_CS
  50. #define LOCATE_LAMP_GPIO_FUNC 1
  51. #define LOCATE_LAMP_LCD_FUNC 0
  52. #define FILL_LIGHT_PIN QUEC_PIN_DNAME_SPI_LCD_SIO
  53. #define FILL_LIGHT_GPIO QUEC_GPIO_DNAME_SPI_LCD_SIO
  54. #define FILL_LIGHT_GPIO_FUNC 1
  55. #define FILL_LIGHT_LCD_FUNC 0
  56. #endif
  57. /*===========================================================================
  58. * Enum
  59. ===========================================================================*/
  60. typedef enum
  61. {
  62. QUEC_AUTO = 0, /* AUTO */
  63. QUEC_GSM, /* GSM */
  64. QUEC_WCDMA, /* WCDMA */
  65. QUEC_LTE, /* LTE */
  66. QUEC_LTE_GSM = 7,
  67. }quec_nw_scanmode_type_e;
  68. typedef enum
  69. {
  70. QUEC_BAND_GSM_900 = 0x01,
  71. QUEC_BAND_GSM_1800 = 0x02,
  72. QUEC_BAND_GSM_850 = 0x04,
  73. QUEC_BAND_GSM_1900 = 0x08,
  74. QUEC_BAND_LTE_BAND1 = 0x01,
  75. QUEC_BAND_LTE_BAND2 = 0x02,
  76. QUEC_BAND_LTE_BAND3 = 0x04,
  77. QUEC_BAND_LTE_BAND4 = 0x08,
  78. QUEC_BAND_LTE_BAND5 = 0x10,
  79. QUEC_BAND_LTE_BAND7 = 0x40,
  80. QUEC_BAND_LTE_BAND8 = 0x80,
  81. QUEC_BAND_LTE_BAND20 = 0x80000,
  82. QUEC_BAND_LTE_BAND28 = 0x8000000,
  83. QUEC_BAND_LTE_BAND34 = 0x200000000,
  84. QUEC_BAND_LTE_BAND38 = 0x2000000000,
  85. QUEC_BAND_LTE_BAND39 = 0x4000000000,
  86. QUEC_BAND_LTE_BAND40 = 0x8000000000,
  87. QUEC_BAND_LTE_BAND41 = 0x10000000000,
  88. QUEC_BAND_LTE_BAND66 = 0x2
  89. }quec_band_type_e;
  90. typedef enum {
  91. RDA_BAND_GSM_450 = 0x01, //#define CSW_GSM_450 (1 << 0)
  92. RDA_BAND_GSM_480 = 0x02, //#define CSW_GSM_480 (1 << 1)
  93. RDA_BAND_GSM_850 = 0x20, //#define CSW_GSM_850 (1 << 5)
  94. RDA_BAND_PGSM_900 = 0x04, //#define CSW_GSM_900P (1 << 2)
  95. RDA_BAND_EGSM_900 = 0x08, //#define CSW_GSM_900E (1 << 3)
  96. RDA_BAND_GSM_1800 = 0x40, //#define CSW_DCS_1800 (1 << 6)
  97. RDA_BAND_GSM_1900 = 0x80, //#define CSW_PCS_1900 (1 << 7)
  98. RDA_BAND_LTE_BAND1 = 1,
  99. RDA_BAND_LTE_BAND2 = 2,
  100. RDA_BAND_LTE_BAND3 = 3,
  101. RDA_BAND_LTE_BAND4 = 4,
  102. RDA_BAND_LTE_BAND5 = 5,
  103. RDA_BAND_LTE_BAND7 = 7,
  104. RDA_BAND_LTE_BAND8 = 8,
  105. RDA_BAND_LTE_BAND20 = 20,
  106. RDA_BAND_LTE_BAND28 = 28,
  107. RDA_BAND_LTE_BAND34 = 34,
  108. RDA_BAND_LTE_BAND38 = 38,
  109. RDA_BAND_LTE_BAND39 = 39,
  110. RDA_BAND_LTE_BAND40 = 40,
  111. RDA_BAND_LTE_BAND41 = 41,
  112. RDA_BAND_LTE_BAND66 = 66,
  113. RDA_BAND_LTE_BANDMAX
  114. }rda_band_type_e;
  115. typedef enum
  116. {
  117. PIN_EXT_FUNC_NONE = 0,
  118. PIN_EXT_FUNC_MIN,
  119. PIN_EXT_FUNC_SD = PIN_EXT_FUNC_MIN, //1
  120. PIN_EXT_FUNC_AP_READY,
  121. PIN_EXT_FUNC_MAIN_DSR,
  122. PIN_EXT_FUNC_LOCATE_LAMP = 4,
  123. PIN_EXT_FUNC_SPI_LCD_CS,
  124. PIN_EXT_FUNC_FILL_LIGHT = 6,
  125. PIN_EXT_FUNC_SPI_LCD_SIO,
  126. PIN_EXT_FUNC_MAX,
  127. }QPINEXT_FUNC;
  128. typedef enum
  129. {
  130. QUEC_PIN_CUST_FUNC_NONE = 0, /* no func */
  131. QUEC_PIN_CUST_FUNC_DEFAULT, /* default func */
  132. QUEC_PIN_CUST_FUNC_SIM1 /* sim1 func */
  133. }ql_pin_sel_func_e;
  134. typedef enum
  135. {
  136. QUEC_EMBED_FLASH_TO_UFS = 0, /* mapping embed flash to UFS */
  137. QUEC_EXT_FLASH_TO_UFS, /* mapping ext flash to UFS */
  138. }quec_ufs_mapping_select_e;
  139. /*===========================================================================
  140. * Struct
  141. ===========================================================================*/
  142. typedef struct
  143. {
  144. uint8_t mount_sffs_flag; /* Whether to mount file system to Ext Flash*/
  145. uint8_t ufs_mapping_select; /* Which Flash maps to UFS */
  146. uint8_t xip_flag; /* Whether to run code on Ext Flash */
  147. } quec_ext_flash_cfg_s;
  148. typedef struct
  149. {
  150. uint8_t channel_adc0;
  151. uint8_t channel_adc1;
  152. uint8_t channel_adc2;
  153. uint8_t channel_adc3;
  154. } ql_adc_channel_s;
  155. typedef struct
  156. {
  157. uint8_t gsm_size;
  158. uint8_t lte_size;
  159. } ql_band_size_s;
  160. typedef struct
  161. {
  162. int64_t quec_band;
  163. uint8_t rda_band;
  164. }quectel_band_info_s;
  165. typedef struct
  166. {
  167. #ifdef CONFIG_QUEC_PROJECT_FEATURE_RFTEST_AT
  168. uint8_t mode;
  169. char *name;
  170. uint16_t band;
  171. uint16_t num;
  172. uint32_t tx_chanel_min;
  173. uint32_t tx_chanel_max;
  174. uint32_t rx_chanel_min;
  175. uint32_t rx_chanel_max;
  176. #endif /* CONFIG_QUEC_PROJECT_FEATURE_RFTEST_AT */
  177. }qrftest_label_type;
  178. typedef struct
  179. {
  180. uint8_t sleep_ind_pin; //example 0:have no func 1:default func 2:sim1 func
  181. uint8_t wakeup_in_pin;
  182. uint8_t main_dtr_pin;
  183. uint8_t ap_ready_pin;
  184. uint8_t net_mode_pin;
  185. uint8_t w_disable_pin;
  186. } ql_pin_set_s;
  187. #ifndef CONFIG_QL_OPEN_EXPORT_PKG
  188. typedef struct
  189. {
  190. uint8_t pin_num;
  191. uint8_t pin_func1; // default func
  192. uint8_t pin_func2;
  193. } QPINEXT_S;
  194. #endif
  195. #ifndef CONFIG_QL_OPEN_EXPORT_PKG
  196. #define QUEC_FUNC_SIM_DISABLE 0
  197. #define QUEC_FUNC_SIM_ENABLE 1
  198. #define QUEC_FUNC_SIM_ENABLE_DET 2
  199. #ifdef CONFIG_QL_PROJECT_DEF_EC200G
  200. #define QUEC_DUAL_SIM_SINGLE_STANDBY_PIN_MAX 5
  201. #else
  202. #define QUEC_DUAL_SIM_SINGLE_STANDBY_PIN_MAX 1
  203. #endif
  204. /* Indicates whether the pins of SIM1 are multiplexed for other functions */
  205. #define QUEC_SIM1_REUSED() ((PINEXT_NONE == quec_sim1_pin_set_fun[0].pin_num ? false : true))
  206. typedef enum
  207. {
  208. SIM_PIN_SLEEP_IND = 0,
  209. SIM_PIN_WAKEUP_IN,
  210. SIM_PIN_AP_READY,
  211. SIM_PIN_NET_MODE,
  212. SIM_PIN_W_DIASABLE,
  213. } quec_sim_pin_index_e;
  214. typedef struct
  215. {
  216. uint8_t pin_num;
  217. uint8_t pin_enable; //Whether the PIN is used for SIM card function, 0:disable 1:enable sim 2:enable sim det
  218. }quec_sim_pin_set_s;
  219. #endif /* CONFIG_QL_OPEN_EXPORT_PKG */
  220. /*===========================================================================
  221. * Extern
  222. ===========================================================================*/
  223. extern int8_t ql_wifi_rssi_offset[];
  224. extern const ql_adc_channel_s ql_adc_channel_num;
  225. extern const quec_ext_flash_cfg_s ql_ext_flash_cfg;//Variables are defined in ql_hal_spi_flash_prop.c
  226. extern const uint8_t ql_gsm_select;
  227. extern const uint8_t ql_lte_ext_size;
  228. extern const ql_band_size_s ql_band_size;
  229. extern const quectel_band_info_s quectel_band_tbl_gsm[];
  230. extern const quectel_band_info_s quectel_band_tbl_lte[];
  231. extern const quectel_band_info_s quectel_band_tbl_lte_ext[];
  232. #ifdef CONFIG_QUEC_PROJECT_FEATURE_RFTEST_AT
  233. extern qrftest_label_type qrftest_labels[];
  234. #endif
  235. extern const uint16_t ql_band41_bw_sel;
  236. extern volatile ql_pin_set_s ql_pin_set;
  237. #ifndef CONFIG_QL_OPEN_EXPORT_PKG
  238. extern QPINEXT_S _qpinext[5];
  239. extern const quec_sim_pin_set_s quec_sim1_pin_set_fun[];
  240. #endif
  241. #ifdef __cplusplus
  242. } /*"C" */
  243. #endif
  244. #endif /* QUEC_INTERNAL_CFG_H */