wm_params.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  1. /**
  2. * @file wm_params.h
  3. *
  4. * @brief param manager Module
  5. *
  6. * @author winnermicro
  7. *
  8. * Copyright (c) 2015 Winner Microelectronics Co., Ltd.
  9. */
  10. #ifndef TLS_PARAMS_H
  11. #define TLS_PARAMS_H
  12. #include "wm_type_def.h"
  13. /***************************************************************************************
  14. ID | Data Type
  15. ***************************************************************************************
  16. TLS_PARAM_ID_SSID | struct tls_param_ssid ssid
  17. TLS_PARAM_ID_ENCRY | u8 encry
  18. TLS_PARAM_ID_KEY | struct tls_param_key key
  19. TLS_PARAM_ID_IP | struct tls_param_ip ipcfg
  20. TLS_PARAM_ID_AUTOMODE | u8 auto_mode
  21. TLS_PARAM_ID_DEFSOCKET | N/A
  22. TLS_PARAM_ID_BSSID | struct tls_param_bssid bssid
  23. TLS_PARAM_ID_CHANNEL | u8 channel
  24. TLS_PARAM_ID_CHANNEL_EN | u8 channel_enable
  25. TLS_PARAM_ID_COUNTRY_REGION | u8 wireless_region
  26. TLS_PARAM_ID_WPROTOCOL | u8 wireless_protocol
  27. TLS_PARAM_ID_ADHOC_AUTOCREATE | N/A
  28. TLS_PARAM_ID_ROAMING | u8 auto_roam
  29. TLS_PARAM_ID_AUTO_RETRY_CNT | N/A
  30. TLS_PARAM_ID_WBGR | struct tls_param_bgr wbgr
  31. TLS_PARAM_ID_USRINTF | N/A
  32. TLS_PARAM_ID_AUTO_TRIGGER_LENGTH | N/A
  33. TLS_PARAM_ID_DEBUG_MODE | N/A
  34. TLS_PARAM_ID_HARDVERSION | struct tls_param_hardware_version hardware_v
  35. TLS_PARAM_ID_BRDSSID | u8 ssid_broadcast_enable
  36. TLS_PARAM_ID_DNSNAME | u8 local_dnsname[32]
  37. TLS_PARAM_ID_DEVNAME | u8 local_device_name[32]
  38. TLS_PARAM_ID_PSM | u8 auto_powersave
  39. TLS_PARAM_ID_ORAY_CLIENT | N/A
  40. TLS_PARAM_ID_UPNP | N/A
  41. TLS_PARAM_ID_UART | struct tls_param_uart uart_cfg
  42. TLS_PARAM_ID_WPS | struct tls_param_wps wps
  43. TLS_PARAM_ID_AUTO_TRIGGER_PERIOD | N/A
  44. TLS_PARAM_ID_ESCAPE_CHAR | N/A
  45. TLS_PARAM_ID_ESCAPE_PERIOD | N/A
  46. TLS_PARAM_ID_IO_MODE | N/A
  47. TLS_PARAM_ID_CMD_MODE | N/A
  48. TLS_PARAM_ID_PASSWORD | u8 PassWord[6]
  49. TLS_PARAM_ID_CHANNEL_LIST | u16 channellist
  50. TLS_PARAM_ID_WEBS_CONFIG | struct tls_webs_cfg WebsCfg
  51. TLS_PARAM_ID_ONESHOT_CFG | u8 oneshotflag
  52. TLS_PARAM_ID_SHA1 | N/A
  53. TLS_PARAM_ID_ORIGIN_KEY | N/A
  54. TLS_PARAM_ID_ORIGIN_SSID | N/A
  55. TLS_PARAM_ID_AUTO_RECONNECT | u8 auto_reconnect
  56. ***************************************************************************************/
  57. #define TLS_PARAM_STATUS_OK (0)
  58. #define TLS_PARAM_STATUS_EINVALID (1)
  59. #define TLS_PARAM_STATUS_EMEM (2)
  60. #define TLS_PARAM_STATUS_EIO (3)
  61. #define TLS_PARAM_STATUS_EPERM (4)
  62. #define TLS_PARAM_STATUS_EINVALIDID (5)
  63. /** MACRO of Magic number initial value */
  64. #define TLS_PARAM_INIT_MAGIC (0xffffffff)
  65. /** MACRO of Magic number valid value */
  66. #define TLS_PARAM_MAGIC (0x4947414d)
  67. /** MACRO of parameter partition number */
  68. #define TLS_PARAM_PARTITION_NUM (2)
  69. /** MACRO of parameter identity */
  70. #define TLS_PARAM_ID_ALL (-1)
  71. #define TLS_PARAM_ID_SSID (0)
  72. #define TLS_PARAM_ID_ENCRY (1)
  73. #define TLS_PARAM_ID_KEY (2)
  74. #define TLS_PARAM_ID_IP (3)
  75. #define TLS_PARAM_ID_AUTOMODE (4)
  76. #define TLS_PARAM_ID_DEFSOCKET (5)
  77. #define TLS_PARAM_ID_BSSID (6)
  78. #define TLS_PARAM_ID_CHANNEL (7)
  79. #define TLS_PARAM_ID_CHANNEL_EN (8)
  80. #define TLS_PARAM_ID_COUNTRY_REGION (9)
  81. #define TLS_PARAM_ID_WPROTOCOL (10)
  82. #define TLS_PARAM_ID_ADHOC_AUTOCREATE (11)
  83. #define TLS_PARAM_ID_ROAMING (12)
  84. #define TLS_PARAM_ID_AUTO_RETRY_CNT (13)
  85. #define TLS_PARAM_ID_WBGR (14)
  86. #define TLS_PARAM_ID_USRINTF (15)
  87. #define TLS_PARAM_ID_AUTO_TRIGGER_LENGTH (16)
  88. #define TLS_PARAM_ID_DEBUG_MODE (17)
  89. #define TLS_PARAM_ID_HARDVERSION (18)
  90. #define TLS_PARAM_ID_BRDSSID (19)
  91. #define TLS_PARAM_ID_DNSNAME (20)
  92. #define TLS_PARAM_ID_DEVNAME (21)
  93. #define TLS_PARAM_ID_PSM (22)
  94. #define TLS_PARAM_ID_ORAY_CLIENT (23)
  95. #define TLS_PARAM_ID_UPNP (24)
  96. #define TLS_PARAM_ID_UART (26)
  97. #define TLS_PARAM_ID_WPS (27)
  98. #define TLS_PARAM_ID_AUTO_TRIGGER_PERIOD (28)
  99. #define TLS_PARAM_ID_ESCAPE_CHAR (29)
  100. #define TLS_PARAM_ID_ESCAPE_PERIOD (30)
  101. #define TLS_PARAM_ID_IO_MODE (31)
  102. #define TLS_PARAM_ID_CMD_MODE (32)
  103. #define TLS_PARAM_ID_PASSWORD (33)
  104. #define TLS_PARAM_ID_CHANNEL_LIST (34)
  105. #define TLS_PARAM_ID_WEBS_CONFIG (35)
  106. #define TLS_PARAM_ID_ONESHOT_CFG (36)
  107. #define TLS_PARAM_ID_SHA1 (37)
  108. #define TLS_PARAM_ID_ORIGIN_KEY (38)
  109. #define TLS_PARAM_ID_ORIGIN_SSID (39)
  110. #define TLS_PARAM_ID_AUTO_RECONNECT (40)
  111. #define TLS_PARAM_ID_QUICK_CONNECT (41)
  112. #define TLS_PARAM_ID_KEY_CHANGE (42)
  113. #define TLS_PARAM_ID_SSID_CHANGE (43)
  114. #define TLS_PARAM_ID_SOFTAP_SSID (44)
  115. #define TLS_PARAM_ID_SOFTAP_PSK (45)
  116. #define TLS_PARAM_ID_SOFTAP_ENCRY (46)
  117. #define TLS_PARAM_ID_SOFTAP_KEY (47)
  118. #define TLS_PARAM_ID_SOFTAP_IP (48)
  119. #define TLS_PARAM_ID_SOFTAP_CHANNEL (49)
  120. #define TLS_PARAM_ID_SOFTAP_WBGR (50)
  121. #define TLS_PARAM_ID_SNTP_SERVER1 (51)
  122. #define TLS_PARAM_ID_SNTP_SERVER2 (52)
  123. #define TLS_PARAM_ID_SNTP_SERVER3 (53)
  124. #define TLS_PARAM_ID_TEM_OFFSET (54)
  125. /** BT&BLE param */
  126. #define TLS_PARAM_ID_BT_ADAPTER (55)
  127. #define TLS_PARAM_ID_BT_REMOTE_DEVICE_1 (56)
  128. #define TLS_PARAM_ID_BT_REMOTE_DEVICE_2 (57)
  129. #define TLS_PARAM_ID_BT_REMOTE_DEVICE_3 (58)
  130. #define TLS_PARAM_ID_BT_REMOTE_DEVICE_4 (59)
  131. #define TLS_PARAM_ID_BT_REMOTE_DEVICE_5 (60)
  132. #define TLS_PARAM_ID_BT_REMOTE_DEVICE_6 (61)
  133. #define TLS_PARAM_ID_BT_REMOTE_DEVICE_7 (62)
  134. #define TLS_PARAM_ID_BT_REMOTE_DEVICE_8 (63)
  135. #define TLS_PARAM_ID_BT_REMOTE_DEVICE_9 (64)
  136. #define TLS_PARAM_ID_BT_REMOTE_DEVICE_10 (65)
  137. #define TLS_PARAM_ID_MAX (66)
  138. /** MACRO of Physical moe of Ieee802.11 */
  139. #define TLS_PARAM_PHY_11BG_MIXED (0)
  140. #define TLS_PARAM_PHY_11B (1)
  141. #define TLS_PARAM_PHY_11BGN_MIXED (2)
  142. /** MACRO of Ieee802.11 Tx Rate for parameter set */
  143. #define TLS_PARAM_TX_RATEIDX_1M (0)
  144. #define TLS_PARAM_TX_RATEIDX_2M (1)
  145. #define TLS_PARAM_TX_RATEIDX_5_5M (2)
  146. #define TLS_PARAM_TX_RATEIDX_11M (3)
  147. #define TLS_PARAM_TX_RATEIDX_6M (4)
  148. #define TLS_PARAM_TX_RATEIDX_9M (5)
  149. #define TLS_PARAM_TX_RATEIDX_12M (6)
  150. #define TLS_PARAM_TX_RATEIDX_18M (7)
  151. #define TLS_PARAM_TX_RATEIDX_24M (8)
  152. #define TLS_PARAM_TX_RATEIDX_36M (9)
  153. #define TLS_PARAM_TX_RATEIDX_48M (10)
  154. #define TLS_PARAM_TX_RATEIDX_54M (11)
  155. #define TLS_PARAM_TX_RATEIDX_MCS0 (12)
  156. #define TLS_PARAM_TX_RATEIDX_MCS1 (13)
  157. #define TLS_PARAM_TX_RATEIDX_MCS2 (14)
  158. #define TLS_PARAM_TX_RATEIDX_MCS3 (15)
  159. #define TLS_PARAM_TX_RATEIDX_MCS4 (16)
  160. #define TLS_PARAM_TX_RATEIDX_MCS5 (17)
  161. #define TLS_PARAM_TX_RATEIDX_MCS6 (18)
  162. #define TLS_PARAM_TX_RATEIDX_MCS7 (19)
  163. #define TLS_PARAM_TX_RATEIDX_MCS8 (20)
  164. #define TLS_PARAM_TX_RATEIDX_MCS9 (21)
  165. #define TLS_PARAM_TX_RATEIDX_MCS10 (22)
  166. #define TLS_PARAM_TX_RATEIDX_MCS11 (23)
  167. #define TLS_PARAM_TX_RATEIDX_MCS12 (24)
  168. #define TLS_PARAM_TX_RATEIDX_MCS13 (25)
  169. #define TLS_PARAM_TX_RATEIDX_MCS14 (26)
  170. #define TLS_PARAM_TX_RATEIDX_MCS15 (27)
  171. #define TLS_PARAM_TX_RATEIDX_MCS32 (28)
  172. /** MACRO of SSID Broadcast */
  173. #define TLS_PARAM_SSIDBRD_DISABLE (0)
  174. #define TLS_PARAM_SSIDBRD_ENABLE (1)
  175. #define TLS_PARAM_ROAM_DISABLE (0)
  176. #define TLS_PARAM_ROAM_ENABLE (1)
  177. /** MACRO of Power Saving Mode */
  178. #define TLS_PARAM_PSM_DISABLE (0)
  179. #define TLS_PARAM_PSM_ENABLE (1)
  180. #define TLS_PARAM_DDNS_DISABLE (0)
  181. #define TLS_PARAM_DDNS_ENABLE (1)
  182. #define TLS_PARAM_AUTO_CREATE_ADHOC_DISABLE (0)
  183. #define TLS_PARAM_AUTO_CREATE_ADHOC_ENABLE (1)
  184. #define TLS_PARAM_WPS_DISABLE (0)
  185. #define TLS_PARAM_WPS_ENABLE (1)
  186. #define TLS_PARAM_WPS_MODE_PIN (0)
  187. #define TLS_PARAM_WPS_MODE_PBC (1)
  188. #define TLS_PARAM_WPS_FLAG_NEGOTIATED (1 << 0)
  189. #define TLS_PARAM_UPNP_DISABLE (0)
  190. #define TLS_PARAM_UPNP_ENABLE (1)
  191. /** MACRO of IEEE802.11 Work MODE */
  192. #define TLS_PARAM_IEEE80211_INFRA (1)
  193. #define TLS_PARAM_IEEE80211_ADHOC (2)
  194. #define TLS_PARAM_IEEE80211_SOFTAP (4)
  195. /** MACRO of Command or Transparent Mode */
  196. #define TLS_PARAM_MANUAL_MODE (0)
  197. #define TLS_PARAM_AUTO_MODE (1)
  198. #define TLS_PARAM_ALWAYS_ONLINE_ENABLE (1)
  199. #define TLS_PARAM_ALWAYS_ONLINE_DISABLE (0)
  200. /** MACRO of DHCP ENABLE or DISABLE */
  201. #define TLS_PARAM_DHCP_ENABLE (1)
  202. #define TLS_PARAM_DHCP_DISABLE (0)
  203. /** MACRO of COUNTRY CODE for channel number */
  204. #define TLS_PARAM_REGION_0_BG_BAND (0) /* 1-11 */
  205. #define TLS_PARAM_REGION_1_BG_BAND (1) /* 1-13 */
  206. #define TLS_PARAM_REGION_2_BG_BAND (2) /* 10-11 */
  207. #define TLS_PARAM_REGION_3_BG_BAND (3) /* 10-13 */
  208. #define TLS_PARAM_REGION_4_BG_BAND (4) /* 14 */
  209. #define TLS_PARAM_REGION_5_BG_BAND (5) /* 1-14 */
  210. #define TLS_PARAM_REGION_6_BG_BAND (6) /* 3-9 */
  211. #define TLS_PARAM_REGION_7_BG_BAND (7) /* 5-13 */
  212. #define TLS_PARAM_REGION_MAXIMUM_BG_BAND TLS_PARAM_REGION_7_BG_BAND
  213. /** MACRO of ENCRYPT TYPE */
  214. #define TLS_PARAM_ENCRY_OPEN (0)
  215. #define TLS_PARAM_ENCRY_WEP64 (1)
  216. #define TLS_PARAM_ENCRY_WEP128 (2)
  217. #define TLS_PARAM_ENCRY_WPA_PSK_TKIP (3)
  218. #define TLS_PARAM_ENCRY_WPA_PSK_AES (4)
  219. #define TLS_PARAM_ENCRY_WPA2_PSK_TKIP (5)
  220. #define TLS_PARAM_ENCRY_WPA2_PSK_AES (6)
  221. /** MACRO of USER INTERFACE TYPE */
  222. #define TLS_PARAM_USR_INTF_LUART (0)
  223. #define TLS_PARAM_USR_INTF_HUART (1)
  224. #define TLS_PARAM_USR_INTF_HSPI (2)
  225. #define TLS_PARAM_USR_INTF_HSDIO (3)
  226. /** MACRO of UART BAUDRATE */
  227. #define TLS_PARAM_UART_BAUDRATE_B600 (600)
  228. #define TLS_PARAM_UART_BAUDRATE_B1200 (1200)
  229. #define TLS_PARAM_UART_BAUDRATE_B1800 (1800)
  230. #define TLS_PARAM_UART_BAUDRATE_B2400 (2400)
  231. #define TLS_PARAM_UART_BAUDRATE_B4800 (4800)
  232. #define TLS_PARAM_UART_BAUDRATE_B9600 (9600)
  233. #define TLS_PARAM_UART_BAUDRATE_B19200 (19200)
  234. #define TLS_PARAM_UART_BAUDRATE_B38400 (38400)
  235. #define TLS_PARAM_UART_BAUDRATE_B57600 (57600)
  236. #define TLS_PARAM_UART_BAUDRATE_B115200 (115200)
  237. #define TLS_PARAM_HUART_BAUDRATE_B230400 (230400)
  238. #define TLS_PARAM_HUART_BAUDRATE_B460800 (460800)
  239. #define TLS_PARAM_HUART_BAUDRATE_B921600 (921600)
  240. #define TLS_PARAM_HUART_BAUDRATE_B1000000 (1000000)
  241. #define TLS_PARAM_HUART_BAUDRATE_B1250000 (1250000)
  242. #define TLS_PARAM_HUART_BAUDRATE_B1500000 (1500000)
  243. #define TLS_PARAM_HUART_BAUDRATE_B2000000 (2000000)
  244. /** MACRO of UART PARITY */
  245. #define TLS_PARAM_UART_PARITY_NONE (0)
  246. #define TLS_PARAM_UART_PARITY_EVEN (1)
  247. #define TLS_PARAM_UART_PARITY_ODD (2)
  248. #define TLS_PARAM_UART_PARITY_MARK (3)
  249. #define TLS_PARAM_UART_PARITY_SPACE (4)
  250. /** MACRO of UART STOP BITS */
  251. #define TLS_PARAM_UART_STOPBITS_1BITS (0)
  252. #define TLS_PARAM_UART_STOPBITS_2BITS (1)
  253. /** MACRO of UART FLOW CONTROL */
  254. #define TLS_PARAM_UART_FLOW_DISABLE (0)
  255. #define TLS_PARAM_UART_FLOW_ENABLE (1)
  256. #define TLS_PARAM_HSPI_MAX_SCLK (33000000)
  257. /** MACRO of SOCKET PARAMETER */
  258. #define TLS_PARAM_SOCKET_TCP (0)
  259. #define TLS_PARAM_SOCKET_UDP (1)
  260. #define TLS_PARAM_SOCKET_CLIENT (0)
  261. #define TLS_PARAM_SOCKET_SERVER (1)
  262. #define TLS_PARAM_SOCKET_DEFAULT_PORT (60000)
  263. /** Structure of hardware parameter */
  264. struct tls_param_hardware_version {
  265. u8 mark;
  266. u8 main;
  267. u8 sub;
  268. u8 material;
  269. u8 year;
  270. u8 week;
  271. u8 res[2];
  272. };
  273. /** Structure of specified BSSID parameter */
  274. struct tls_param_bssid {
  275. u8 bssid_enable;
  276. u8 res;
  277. u8 bssid[6];
  278. };
  279. /** Structure of SSID parameter */
  280. struct tls_param_ssid {
  281. u8 ssid[32];
  282. u32 ssid_len;
  283. };
  284. /** Structure of TEM parameter */
  285. struct tls_param_tem_offset {
  286. u8 offset_len;
  287. s32 offset;
  288. };
  289. /** Structure of KEY parameter */
  290. struct tls_param_key {
  291. u8 psk[64];
  292. u8 key_length;
  293. u8 key_index;
  294. u8 key_format;
  295. u8 res;
  296. };
  297. /** Structure of original KEY parameter */
  298. struct tls_param_original_key {
  299. u8 psk[64];
  300. u32 key_length;
  301. };
  302. /** Structure of SHA1 KEY parameter */
  303. struct tls_param_sha1{
  304. u8 psk_set;
  305. u8 psk[32];
  306. };
  307. /** Structure of 802.11 bgn rate parameter */
  308. struct tls_param_bgr {
  309. u8 bg;
  310. u8 max_rate;
  311. u8 res[2];
  312. };
  313. /** Structure of IP parameter */
  314. struct tls_param_ip {
  315. u8 dhcp_enable;
  316. u8 res[3];
  317. u8 ip[4];
  318. u8 netmask[4];
  319. u8 gateway[4];
  320. u8 dns1[4];
  321. u8 dns2[4];
  322. };
  323. /** Structure of uart parameter */
  324. struct tls_param_uart {
  325. u32 baudrate;
  326. u8 stop_bits;
  327. u8 parity;
  328. u8 flow;
  329. u8 charsize;
  330. };
  331. /** Structure of socket parameter */
  332. struct tls_param_socket {
  333. u8 protocol;
  334. u8 client_or_server;
  335. u16 port_num;
  336. u8 host[32];
  337. };
  338. struct tls_param_wps {
  339. u8 wps_enable;
  340. u8 mode;
  341. u8 flag;
  342. u8 res;
  343. u8 pin[8];
  344. };
  345. /** Structure of oray client */
  346. struct tls_param_oray_client {
  347. u32 oray_client_enable;
  348. u8 oray_client_user[32];
  349. u8 oray_client_pass[32];
  350. };
  351. /** Structure of web server parameter */
  352. struct tls_webs_cfg {
  353. u8 AutoRun;
  354. u8 Reserved;
  355. u16 PortNum;
  356. };
  357. /** Structure of user default parameter */
  358. typedef struct tls_user_param{
  359. u8 wireless_protocol;
  360. u8 auto_mode;
  361. u8 dhcp_enable;
  362. u8 user_port_mode;
  363. u8 ip[4];
  364. u8 netmask[4];
  365. u8 gateway[4];
  366. u8 dns[4];
  367. u32 baudrate;
  368. u8 socket_protocol;
  369. u8 socket_client_or_server;
  370. u16 socket_port_num;
  371. u8 socket_host[32];
  372. u8 auto_powersave;
  373. u8 PassWord[6];
  374. }ST_Wm_User_Param;
  375. typedef struct {
  376. u32 valid_tag; /*0xdeadbeaf means valid*/
  377. u32 valid_bit;
  378. u8 bd_addr[6]; /*Local Address*/
  379. uint8_t name_len;
  380. u8 name[16]; /*Local Name*/
  381. u32 class_of_device; /*Class of Device*/
  382. u8 io_cap;
  383. u8 discoverable;
  384. u8 connectable;
  385. u8 bt_auth_req;
  386. u8 mode; /*Adv, Initiator, ......*/
  387. u8 ble_auth_req;
  388. u8 ir[16];
  389. u8 irk[16];
  390. u8 dhk[16];
  391. u8 er[16];
  392. } bt_adapter_t;
  393. typedef struct {
  394. u32 valid_tag; /*0xdeadbeaf means valid*/
  395. u8 in_use;
  396. u32 valid_bit;
  397. u8 bd_addr[6];
  398. u8 name[16];
  399. u8 name_len;
  400. u32 class_of_device;
  401. u32 available_service;
  402. u8 link_key[16];
  403. u8 key_type;
  404. u8 io_cap;
  405. u8 pin_length;
  406. u8 device_type;
  407. u8 reconnect_needed;
  408. u8 ble_addr_type;
  409. /* KEY_PENC */
  410. u8 key_penc[28];
  411. /* KEY_PID */
  412. u8 key_pid[23];
  413. /* KEY_PID */
  414. u8 key_lid[23];
  415. /* KEY_PCSRK */
  416. u8 key_pcsrk[24];
  417. /* KEY_LCSRK */
  418. u8 key_lcsrk[24];
  419. /* KEY_LENC */
  420. u8 key_lenc[20];
  421. u32 manufacturer;
  422. u32 lmpver;
  423. u32 lmpsubver;
  424. } bt_remote_device_t;
  425. /**
  426. * @defgroup System_APIs System APIs
  427. * @brief System APIs
  428. */
  429. /**
  430. * @addtogroup System_APIs
  431. * @{
  432. */
  433. /**
  434. * @defgroup Param_APIs Param APIs
  435. * @brief Param manager APIs
  436. */
  437. /**
  438. * @addtogroup Param_APIs
  439. * @{
  440. */
  441. /**
  442. * @brief This function is used to initialize parameter's manage module
  443. *
  444. * @param[in] None
  445. *
  446. * @retval TLS_PARAM_STATUS_OK init success
  447. * @retval TLS_PARAM_STATUS_EMEM memory error
  448. * @retval TLS_PARAM_STATUS_EIO io error
  449. * @retval TLS_PARAM_STATUS_EPERM magic number error
  450. *
  451. * @note None
  452. */
  453. int tls_param_init(void);
  454. /**
  455. * @brief This function is used to load the system's default
  456. parameters
  457. *
  458. * @param[in] None
  459. *
  460. * @return None
  461. *
  462. * @note This function read user defined parameters first,
  463. if wrong, all the parameters restore factory settings
  464. */
  465. void tls_param_load_factory_default(void);
  466. /**
  467. * @brief This function is used to set one system parameter by its id
  468. *
  469. * @param[in] id param id,from TLS_PARAM_ID_SSID
  470. to (TLS_PARAM_ID_MAX - 1)
  471. * @param[in] *argv store parameters
  472. * @param[in] to_flash whether the parameter is written to flash,
  473. 1:write to flash,0:only write memory
  474. *
  475. * @retval TLS_PARAM_STATUS_OK set success
  476. * @retval TLS_PARAM_STATUS_EINVALID invalid param
  477. *
  478. * @note None
  479. */
  480. int tls_param_set(int id, void *argv, bool to_flash);
  481. /**
  482. * @brief This function is used to get one system parameter by its id.
  483. *
  484. * @param[in] id param id,from TLS_PARAM_ID_SSID
  485. to (TLS_PARAM_ID_MAX - 1)
  486. * @param[in] *argv store parameters
  487. * @param[in] from_flash whether the parameter is readed from flash,
  488. 1 read from flash,0 read from memory
  489. *
  490. * @retval TLS_PARAM_STATUS_OK success
  491. * @retval TLS_PARAM_STATUS_EINVALID invalid param
  492. *
  493. * @note None
  494. */
  495. int tls_param_get(int id, void *argv, bool from_flash);
  496. /**
  497. * @brief This function is used to write parameter into flash
  498. *
  499. * @param[in] id param id,from TLS_PARAM_ID_ALL
  500. to (TLS_PARAM_ID_MAX - 1)
  501. *
  502. * @retval TLS_PARAM_STATUS_OK success
  503. * @retval TLS_PARAM_STATUS_EINVALID invalid param
  504. * @retval TLS_PARAM_STATUS_EIO read or write flash error
  505. *
  506. * @note None
  507. */
  508. int tls_param_to_flash(int id);
  509. /**
  510. * @brief This function is used to recovery the parameters from
  511. the backup area to the parameter area,and load them into ram
  512. *
  513. * @param[in] None
  514. *
  515. * @return None
  516. *
  517. * @note None
  518. */
  519. void tls_restore_param_from_backup(void);
  520. /**
  521. * @brief This function is used to load default parametes into ram
  522. *
  523. * @param[in] None
  524. *
  525. * @retval TLS_PARAM_STATUS_OK set success
  526. * @retval TLS_PARAM_STATUS_EINVALID parameter wrong
  527. * @retval TLS_PARAM_STATUS_EIO read or write falsh error
  528. *
  529. * @note This function read user defined parameters first,
  530. if wrong, all the parameters restore factory settings
  531. */
  532. int tls_param_to_default(void);
  533. /**
  534. * @brief This function is used to write user's parameters into the
  535. flash
  536. *
  537. * @param[in] None
  538. *
  539. * @retval TLS_PARAM_STATUS_OK success
  540. * @retval other failed
  541. *
  542. * @note None
  543. */
  544. int tls_param_save_user_default(void);
  545. /**
  546. * @brief This function is used to modify user's default parameters,
  547. then write them into flash
  548. *
  549. * @param[in] *user_param
  550. *
  551. * @retval TLS_PARAM_STATUS_OK success
  552. * @retval other failed
  553. *
  554. * @note None
  555. */
  556. int tls_param_save_user(struct tls_user_param *user_param);
  557. /**
  558. * @brief This function is used to get updp mode.(updp:update user
  559. default parameters)
  560. *
  561. * @param[in] None
  562. *
  563. * @retval update mode
  564. *
  565. * @note None
  566. */
  567. u8 tls_param_get_updp_mode(void);
  568. /**
  569. * @brief This function is used to set updp mode
  570. *
  571. * @param[in] mode
  572. *
  573. * @return None
  574. *
  575. * @note None
  576. */
  577. void tls_param_set_updp_mode(u8 mode);
  578. /**
  579. * @brief This function is used to get program param
  580. *
  581. * @param[in] *pBase pointer to save base address
  582. *
  583. * @retval 0 success
  584. * @retval other failed
  585. *
  586. * @note None
  587. */
  588. int tls_param_get_program_param(u32 *pBase);
  589. /**
  590. * @brief This function is used to set program base,image len,and
  591. checksum
  592. *
  593. * @param[in] base base address
  594. * @param[in] totallen total length of the image
  595. * @param[in] checksum checksum value of the image
  596. *
  597. * @retval 0 success
  598. * @retval other failed
  599. *
  600. * @note None
  601. */
  602. int tls_param_set_program_param(u32 base, u32 totallen, u32 checksum);
  603. /**
  604. * @brief This function is used to get bt param offset located in system param area
  605. *
  606. * @param[in] id from TLS_PARAM_ID_BT_REMOTE_DEVICE_1 to TLS_PARAM_ID_BT_REMOTE_DEVICE_5
  607. * @param[in] from_flash whether the parameter is readed from flash,
  608. 1 read from flash(invalid for now),0 read from memory
  609. *
  610. * @retval >0 success
  611. * @retval other failed
  612. *
  613. * @note None
  614. */
  615. int tls_param_get_bt_param_address(int id, int from_flash);
  616. /**
  617. * @}
  618. */
  619. /**
  620. * @}
  621. */
  622. #endif /* WM_PARAM_H */