syscfg_id.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. #ifndef __JL_CFG_DEC_H__
  2. #define __JL_CFG_DEC_H__
  3. #include "typedef.h"
  4. struct btif_item {
  5. u16 id;
  6. u16 data_len;
  7. };
  8. struct syscfg_operataions {
  9. int (*init)(void);
  10. int (*check_id)(u16 item_id);
  11. int (*read)(u16 item_id, u8 *buf, u16 len);
  12. int (*write)(u16 item_id, u8 *buf, u16 len);
  13. int (*dma_write)(u16 item_id, u8 *buf, u16 len);
  14. int (*read_string)(u16 item_id, u8 *buf, u16 len, u8 ver);
  15. u8 *(*ptr_read)(u16 item_id, u16 *len);
  16. };
  17. #define REGISTER_SYSCFG_OPS(cfg, pri) \
  18. const struct syscfg_operataions cfg SEC_USED(.syscfg.pri.ops)
  19. //=================================================================================//
  20. // 系统配置项(VM, BTIF, cfg_bin)读写接口 //
  21. //接口说明: //
  22. // 1.输入参数 //
  23. // 1)item_id: 配置项ID号, 由本文件统一分配; //
  24. // 2)buf: 用于存储read/write数据内容; //
  25. // 3)len: buf的长度(byte), buf长度必须大于等于read/write数据长度; //
  26. // 2.返回参数: //
  27. // 1)执行正确: 返回值等于实际上所读到的数据长度(大于0); //
  28. // 2)执行错误: 返回值小于等于0, 小于0表示相关错误码; //
  29. // 3.读写接口使用注意事项: //
  30. // 1)不能在中断里调用写(write)接口; //
  31. // 2)调用本读写接口时应该习惯性判断返回值来检查read/write动作是否执行正确; //
  32. //=================================================================================//
  33. /* --------------------------------------------------------------------------*/
  34. /**
  35. * @brief 读取对应配置项的内容
  36. *
  37. * @param [in] item_id 配置项ID号
  38. * @param [out] buf 用于存储read数据内容
  39. * @param [in] len buf的长度(byte), buf长度必须大于等于read数据长度
  40. *
  41. * @return 1)执行正确: 返回值等于实际上所读到的数据长度(大于0);
  42. * 2)执行错误: 返回值小于等于0, 小于0表示相关错误码;
  43. */
  44. /* --------------------------------------------------------------------------*/
  45. int syscfg_read(u16 item_id, void *buf, u16 len);
  46. /* --------------------------------------------------------------------------*/
  47. /**
  48. * @brief 写入对应配置项的内容
  49. *
  50. * @param [in] item_id 配置项ID号
  51. * @param [in] buf 用于存储write数据内容
  52. * @param [in] len buf的长度(byte), buf长度必须大于等于write数据长度
  53. *
  54. * @return 1)执行正确: 返回值等于实际上所读到的数据长度(大于0);
  55. * 2)执行错误: 返回值小于等于0, 小于0表示相关错误码;
  56. */
  57. /* --------------------------------------------------------------------------*/
  58. int syscfg_write(u16 item_id, void *buf, u16 len);
  59. /* --------------------------------------------------------------------------*/
  60. /**
  61. * @brief 以dma的方式写入对应配置项的内容, 请注意buf地址需要按照4byte对齐
  62. *
  63. * @param [in] item_id 配置项ID号
  64. * @param [in] buf 用于存储write数据内容
  65. * @param [in] len buf的长度(byte), buf长度必须大于等于write数据长度
  66. *
  67. * @return 1)执行正确: 返回值等于实际上所读到的数据长度(大于0);
  68. * 2)执行错误: 返回值小于等于0, 小于0表示相关错误码;
  69. */
  70. /* --------------------------------------------------------------------------*/
  71. int syscfg_dma_write(u16 item_id, void *buf, u16 len);
  72. /* --------------------------------------------------------------------------*/
  73. /**
  74. * @brief 读取同一个配置项存在多份数据中的某一份数据, ver读取表示第几份数据, ver从 0 开始;
  75. * @brief 典型应用: 读取配置项CFG_BT_NAME中多个蓝牙名中的某一个蓝牙名;
  76. *
  77. * @param [in] item_id 配置项ID号
  78. * @param [in] buf 用于存储read数据内容
  79. * @param [in] len buf的长度(byte), buf长度必须大于等于read数据长度
  80. * @param [in] ver 读取表示第几份数据
  81. *
  82. * @return 1)执行正确: 返回值等于实际上所读到的数据长度(大于0);
  83. * 2)执行错误: 返回值小于等于0, 小于0表示相关错误码;
  84. */
  85. /* --------------------------------------------------------------------------*/
  86. int syscfg_read_string(u16 item_id, void *buf, u16 len, u8 ver);
  87. /* --------------------------------------------------------------------------*/
  88. /**
  89. * @brief 获取配置项的地址
  90. * @brief 注: 只支持cfg_tools.bin文件中的配置项读取
  91. * @param [in] item_id 配置项ID号
  92. * @param [out] len 配置项长度
  93. *
  94. * @return 配置项地址指针(可以用cpu直接访问);
  95. */
  96. /* --------------------------------------------------------------------------*/
  97. u8 *syscfg_ptr_read(u16 item_id, u16 *len);
  98. //==================================================================================================//
  99. // 配置项ID分配说明 //
  100. // 1.配置项ID号根据存储区域进行分配; //
  101. // 2.存储区域有3个: 1)VM区域; 2)sys_cfg.bin; 3)BTIF区域 //
  102. // 3.配置项ID号分配如下: //
  103. // 0)[0]: 配置项ID号0为配置项工具保留ID号; //
  104. // 1)[ 1 ~ 49]: 共49项, 预留给用户自定义, 只存于VM区域; //
  105. // 2)[ 50 ~ 99]: 共50项, sdk相关配置项, 只存于VM区域; //
  106. // 3)[100 ~ 127]: 共28项, sdk相关配置项, 可以存于VM区域, sys_cfg.bin(作为默认值) 和 BTIF区域; //
  107. // 4)[512 ~ 700]: 共188项, sdk相关配置项, 只存于sys_cfg.bin; //
  108. //==================================================================================================//
  109. //=================================================================================//
  110. // 用户自定义配置项[1 ~ 49] //
  111. //=================================================================================//
  112. #define CFG_USER_DEFINE_BEGIN 1
  113. #define CFG_USER_DEFINE_END 49
  114. //=================================================================================//
  115. // 只存VM配置项[50 ~ 99] //
  116. //=================================================================================//
  117. #define CFG_STORE_VM_ONLY_BEGIN 50
  118. #define AT_CHAR_DEV_NAME 51
  119. #define CFG_STORE_VM_ONLY_END 99
  120. //=================================================================================//
  121. // 可以存于VM, sys_cfg.bin(默认值)和BTIF区域的配置项[100 ~ 127] //
  122. // (VM支持扩展到511) //
  123. //=================================================================================//
  124. #define CFG_STORE_VM_BIN_BTIF_BEGIN 100
  125. #define CFG_STORE_VM_BIN_BTIF_END (VM_ITEM_MAX_NUM - 1) //在app_cfg文件中配置128/256
  126. //==================================================================================================//
  127. //ID号分配方案:
  128. // 1) 与APP CASE 相关的ID (0 ~ 50);
  129. // 3) lib库保留ID(蓝牙, trim 值) (范围: 61 ~ 127); //67项
  130. // 4) 与app_case 扩展ID号,需要更大的ram资源(128 ~ 511);
  131. //==================================================================================================//
  132. //=================================================================================//
  133. // SDK库保留配置项[61 ~ 127] //
  134. //=================================================================================//
  135. #define CFG_REMOTE_DB_INFO 61
  136. #define CFG_REMOTE_DB_00 62
  137. #define CFG_REMOTE_DB_01 63
  138. #define CFG_REMOTE_DB_02 64
  139. #define CFG_REMOTE_DB_03 65
  140. #define CFG_REMOTE_DB_04 66
  141. #define CFG_REMOTE_DB_05 67
  142. #define CFG_REMOTE_DB_06 68
  143. #define CFG_REMOTE_DB_07 69
  144. #define CFG_REMOTE_DB_08 70
  145. #define CFG_REMOTE_DB_09 71
  146. #define CFG_REMOTE_DB_10 72
  147. #define CFG_REMOTE_DB_11 73
  148. #define CFG_REMOTE_DB_12 74
  149. #define CFG_REMOTE_DB_13 75
  150. #define CFG_REMOTE_DB_14 76
  151. #define CFG_REMOTE_DB_15 77
  152. #define CFG_REMOTE_DB_16 78
  153. #define CFG_REMOTE_DB_17 79
  154. #define CFG_REMOTE_DB_18 80
  155. #define CFG_REMOTE_DB_19 81
  156. #define CFG_DAC_TEST_VOLT 82
  157. #define CFG_BLE_MODE_INFO 83
  158. #define CFG_TWS_PAIR_AA 84
  159. #define CFG_TWS_CONNECT_AA 85
  160. #define CFG_MUSIC_VOL 86
  161. #define CFG_CHARGESTORE_TWS_CHANNEL 87
  162. #define CFG_DAC_DTB 88
  163. #define CFG_MC_BIAS 89
  164. #define CFG_POR_FLAG 90
  165. #define CFG_MIC_LDO_VSEL 91
  166. #define CFG_DAC_TRIM_INFO 92
  167. #define CFG_BT_TRIM_INFO 93
  168. #define CFG_ANC_INFO 94
  169. #define CFG_TWS_LOCAL_ADDR 95
  170. #define CFG_TWS_REMOTE_ADDR 96
  171. #define CFG_TWS_COMMON_ADDR 97
  172. #define CFG_TWS_CHANNEL 98
  173. #define VM_PMU_VOLTAGE 99
  174. #define CFG_SYS_VOL 100
  175. //=========== btif & cfg_tool.bin & vm ============//
  176. #define CFG_BT_NAME 101
  177. #define CFG_BT_MAC_ADDR 102
  178. #define VM_BLE_LOCAL_INFO 109
  179. #define CFG_BT_FRE_OFFSET 110
  180. #define VM_GMA_ALI_PARA 111
  181. #define VM_DMA_RAND 112
  182. #define VM_GMA_MAC 113
  183. #define VM_TME_AUTH_COOKIE 114
  184. #define VM_UPDATE_FLAG 115
  185. #define VM_RTC_TRIM 116
  186. #define VM_BLE_REMOTE_DB_INFO 117
  187. #define VM_BLE_REMOTE_DB_00 118
  188. #define VM_BLE_REMOTE_DB_01 119
  189. #define VM_BLE_REMOTE_DB_02 120
  190. #define VM_BLE_REMOTE_DB_03 121
  191. #define VM_BLE_REMOTE_DB_04 122
  192. #define VM_BLE_REMOTE_DB_05 123
  193. #define VM_BLE_REMOTE_DB_06 124
  194. #define VM_BLE_REMOTE_DB_07 125
  195. #define VM_BLE_REMOTE_DB_08 126
  196. #define VM_BLE_REMOTE_DB_09 127
  197. #define VM_MESH_NODE_INFO_START 176 //(+72)
  198. #define CFG_ONLINE_EQ_DRC_DATA_ID 254//在线调试保存参数的id
  199. #define CFG_ONLINE_SAVE_ID 255//在线保存文件大小的id
  200. //=================================================================================//
  201. // 只存于sys_cfg.bin的配置项[512 ~ 700] //
  202. //=================================================================================//
  203. #define CFG_STORE_BIN_ONLY_BEGIN 512
  204. //硬件类配置项[513 ~ 600]
  205. #define CFG_UART_ID 513
  206. #define CFG_HWI2C_ID 514
  207. #define CFG_SWI2C_ID 515
  208. #define CFG_HWSPI_ID 516
  209. #define CFG_SWSPI_ID 517
  210. #define CFG_SD_ID 518
  211. #define CFG_USB_ID 519
  212. #define CFG_LCD_ID 520
  213. #define CFG_TOUCH_ID 521
  214. #define CFG_IOKEY_ID 522
  215. #define CFG_ADKEY_ID 523
  216. #define CFG_AUDIO_ID 524
  217. #define CFG_VIDEO_ID 525
  218. #define CFG_WIFI_ID 526
  219. #define CFG_NIC_ID 527
  220. #define CFG_LED_ID 528
  221. #define CFG_POWER_MANG_ID 529
  222. #define CFG_IRFLT_ID 530
  223. #define CFG_PLCNT_ID 531
  224. #define CFG_PWMLED_ID 532
  225. #define CFG_RDEC_ID 533
  226. #define CFG_CHARGE_STORE_ID 534
  227. #define CFG_CHARGE_ID 535
  228. #define CFG_LOWPOWER_V_ID 536
  229. #define CFG_MIC_TYPE_ID 537
  230. #define CFG_COMBINE_SYS_VOL_ID 538
  231. #define CFG_COMBINE_CALL_VOL_ID 539
  232. #define CFG_LP_TOUCH_KEY_ID 540
  233. //蓝牙类配置项[601 ~ 650]
  234. #define CFG_BT_RF_POWER_ID 601
  235. #define CFG_TWS_PAIR_CODE_ID 602
  236. #define CFG_AUTO_OFF_TIME_ID 603
  237. #define CFG_AEC_ID 604
  238. #define CFG_UI_TONE_STATUS_ID 605
  239. #define CFG_KEY_MSG_ID 606
  240. #define CFG_LRC_ID 607
  241. #define CFG_DMS_ID 609
  242. #define CFG_ANC_ID 610
  243. #define CFG_SMS_DNS_ID 612 //单mic神经网络降噪
  244. #define CFG_DMS_DNS_ID 613 //双mic神经网络降噪
  245. #define CFG_DMS_FLEXIBLE_ID 614 //灵活可变双mic降噪
  246. //其它类配置项[651 ~ 700]
  247. #define CFG_STORE_BIN_ONLY_END 700
  248. #endif