device.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. /*
  2. * device.h - CC31xx/CC32xx Host Driver Implementation
  3. *
  4. * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
  5. *
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. *
  11. * Redistributions of source code must retain the above copyright
  12. * notice, this list of conditions and the following disclaimer.
  13. *
  14. * Redistributions in binary form must reproduce the above copyright
  15. * notice, this list of conditions and the following disclaimer in the
  16. * documentation and/or other materials provided with the
  17. * distribution.
  18. *
  19. * Neither the name of Texas Instruments Incorporated nor the names of
  20. * its contributors may be used to endorse or promote products derived
  21. * from this software without specific prior written permission.
  22. *
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  24. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  25. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  26. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  27. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  28. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  29. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  30. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  31. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  32. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  33. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. */
  36. /*****************************************************************************/
  37. /* Include files */
  38. /*****************************************************************************/
  39. #include "simplelink.h"
  40. #ifndef __DEVICE_H__
  41. #define __DEVICE_H__
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45. /*!
  46. \addtogroup device
  47. @{
  48. */
  49. /*****************************************************************************/
  50. /* Macro declarations */
  51. /*****************************************************************************/
  52. /* SL internal Error codes */
  53. /* Receive this error in case there are no resources to issue the command
  54. If possible, increase the number of MAX_CUNCURENT_ACTIONS (result in memory increase)
  55. If not, try again later */
  56. #define SL_POOL_IS_EMPTY (-2000)
  57. /* Receive this error in case a given length for RX buffer was too small.
  58. Receive payload was bigger than the given buffer size. Therefore, payload is cut according to receive size
  59. Recommend to increase buffer size */
  60. #define SL_ESMALLBUF (-2001)
  61. /* Receive this error in case zero length is supplied to a "get" API
  62. Recommend to supply length according to requested information (view options defines for help) */
  63. #define SL_EZEROLEN (-2002)
  64. /* User supplied invalid parameter */
  65. #define SL_INVALPARAM (-2003)
  66. /* Failed to open interface */
  67. #define SL_BAD_INTERFACE (-2004)
  68. /* End of SL internal Error codes */
  69. /*****************************************************************************/
  70. /* Errors returned from the general error async event */
  71. /*****************************************************************************/
  72. /* Send types */
  73. typedef enum
  74. {
  75. SL_ERR_SENDER_HEALTH_MON,
  76. SL_ERR_SENDER_CLI_UART,
  77. SL_ERR_SENDER_SUPPLICANT,
  78. SL_ERR_SENDER_NETWORK_STACK,
  79. SL_ERR_SENDER_WLAN_DRV_IF,
  80. SL_ERR_SENDER_WILINK,
  81. SL_ERR_SENDER_INIT_APP,
  82. SL_ERR_SENDER_NETX,
  83. SL_ERR_SENDER_HOST_APD,
  84. SL_ERR_SENDER_MDNS,
  85. SL_ERR_SENDER_HTTP_SERVER,
  86. SL_ERR_SENDER_DHCP_SERVER,
  87. SL_ERR_SENDER_DHCP_CLIENT,
  88. SL_ERR_DISPATCHER,
  89. SL_ERR_NUM_SENDER_LAST=0xFF
  90. }SlErrorSender_e;
  91. /* Error codes */
  92. #define SL_ERROR_STATIC_ADDR_SUBNET_ERROR (-60) /* network stack error*/
  93. #define SL_ERROR_ILLEGAL_CHANNEL (-61) /* supplicant error */
  94. #define SL_ERROR_SUPPLICANT_ERROR (-72) /* init error code */
  95. #define SL_ERROR_HOSTAPD_INIT_FAIL (-73) /* init error code */
  96. #define SL_ERROR_HOSTAPD_INIT_IF_FAIL (-74) /* init error code */
  97. #define SL_ERROR_WLAN_DRV_INIT_FAIL (-75) /* init error code */
  98. #define SL_ERROR_WLAN_DRV_START_FAIL (-76) /* wlan start error */
  99. #define SL_ERROR_FS_FILE_TABLE_LOAD_FAILED (-77) /* init file system failed */
  100. #define SL_ERROR_PREFERRED_NETWORKS_FILE_LOAD_FAILED (-78) /* init file system failed */
  101. #define SL_ERROR_HOSTAPD_BSSID_VALIDATION_ERROR (-79) /* Ap configurations BSSID error */
  102. #define SL_ERROR_HOSTAPD_FAILED_TO_SETUP_INTERFACE (-80) /* Ap configurations interface error */
  103. #define SL_ERROR_MDNS_ENABLE_FAIL (-81) /* mDNS enable failed */
  104. #define SL_ERROR_HTTP_SERVER_ENABLE_FAILED (-82) /* HTTP server enable failed */
  105. #define SL_ERROR_DHCP_SERVER_ENABLE_FAILED (-83) /* DHCP server enable failed */
  106. #define SL_ERROR_PREFERRED_NETWORK_LIST_FULL (-93) /* supplicant error */
  107. #define SL_ERROR_PREFERRED_NETWORKS_FILE_WRITE_FAILED (-94) /* supplicant error */
  108. #define SL_ERROR_DHCP_CLIENT_RENEW_FAILED (-100) /* DHCP client error */
  109. /* WLAN Connection management status */
  110. #define SL_ERROR_CON_MGMT_STATUS_UNSPECIFIED (-102)
  111. #define SL_ERROR_CON_MGMT_STATUS_AUTH_REJECT (-103)
  112. #define SL_ERROR_CON_MGMT_STATUS_ASSOC_REJECT (-104)
  113. #define SL_ERROR_CON_MGMT_STATUS_SECURITY_FAILURE (-105)
  114. #define SL_ERROR_CON_MGMT_STATUS_AP_DEAUTHENTICATE (-106)
  115. #define SL_ERROR_CON_MGMT_STATUS_AP_DISASSOCIATE (-107)
  116. #define SL_ERROR_CON_MGMT_STATUS_ROAMING_TRIGGER (-108)
  117. #define SL_ERROR_CON_MGMT_STATUS_DISCONNECT_DURING_CONNECT (-109)
  118. #define SL_ERROR_CON_MGMT_STATUS_SG_RESELECT (-110)
  119. #define SL_ERROR_CON_MGMT_STATUS_ROC_FAILURE (-111)
  120. #define SL_ERROR_CON_MGMT_STATUS_MIC_FAILURE (-112)
  121. /* end of WLAN connection management error statuses */
  122. #define SL_ERROR_WAKELOCK_ERROR_PREFIX (-115) /* Wake lock expired */
  123. #define SL_ERROR_LENGTH_ERROR_PREFIX (-116) /* Uart header length error */
  124. #define SL_ERROR_MDNS_CREATE_FAIL (-121) /* mDNS create failed */
  125. #define SL_ERROR_GENERAL_ERROR (-127)
  126. #define SL_DEVICE_GENERAL_CONFIGURATION (1)
  127. #define SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME (11)
  128. #define SL_DEVICE_GENERAL_VERSION (12)
  129. #define SL_DEVICE_STATUS (2)
  130. /*
  131. Declare the different event group classifications
  132. The SimpleLink device send asynchronous events. Each event has a group
  133. classification according to its nature.
  134. */
  135. /* SL_EVENT_CLASS_WLAN connection user events */
  136. #define SL_WLAN_CONNECT_EVENT (1)
  137. #define SL_WLAN_DISCONNECT_EVENT (2)
  138. /* WLAN Smart Config user events */
  139. #define SL_WLAN_SMART_CONFIG_COMPLETE_EVENT (3)
  140. #define SL_WLAN_SMART_CONFIG_STOP_EVENT (4)
  141. /* WLAN AP user events */
  142. #define SL_WLAN_STA_CONNECTED_EVENT (5)
  143. #define SL_WLAN_STA_DISCONNECTED_EVENT (6)
  144. /* WLAN P2P user events */
  145. #define SL_WLAN_P2P_DEV_FOUND_EVENT (7)
  146. #define SL_WLAN_P2P_NEG_REQ_RECEIVED_EVENT (8)
  147. #define SL_WLAN_CONNECTION_FAILED_EVENT (9)
  148. /* SL_EVENT_CLASS_DEVICE user events */
  149. #define SL_DEVICE_FATAL_ERROR_EVENT (1)
  150. #define SL_DEVICE_ABORT_ERROR_EVENT (2)
  151. /* SL_EVENT_CLASS_BSD user events */
  152. #define SL_SOCKET_TX_FAILED_EVENT (1)
  153. #define SL_SOCKET_ASYNC_EVENT (2)
  154. /* SL_EVENT_CLASS_NETAPP user events */
  155. #define SL_NETAPP_IPV4_IPACQUIRED_EVENT (1)
  156. #define SL_NETAPP_IPV6_IPACQUIRED_EVENT (2)
  157. #define SL_NETAPP_IP_LEASED_EVENT (3)
  158. #define SL_NETAPP_IP_RELEASED_EVENT (4)
  159. /* Server Events */
  160. #define SL_NETAPP_HTTPGETTOKENVALUE_EVENT (1)
  161. #define SL_NETAPP_HTTPPOSTTOKENVALUE_EVENT (2)
  162. /*
  163. Declare the different event group classifications for sl_DevGet
  164. for getting status indications
  165. */
  166. /* Events list to mask/unmask*/
  167. #define SL_EVENT_CLASS_GLOBAL (0)
  168. #define SL_EVENT_CLASS_DEVICE (1)
  169. #define SL_EVENT_CLASS_WLAN (2)
  170. #define SL_EVENT_CLASS_BSD (3)
  171. #define SL_EVENT_CLASS_NETAPP (4)
  172. #define SL_EVENT_CLASS_NETCFG (5)
  173. #define SL_EVENT_CLASS_FS (6)
  174. /****************** DEVICE CLASS status ****************/
  175. #define EVENT_DROPPED_DEVICE_ASYNC_GENERAL_ERROR (0x00000001L)
  176. #define STATUS_DEVICE_SMART_CONFIG_ACTIVE (0x80000000L)
  177. /****************** WLAN CLASS status ****************/
  178. #define EVENT_DROPPED_WLAN_WLANASYNCONNECTEDRESPONSE (0x00000001L)
  179. #define EVENT_DROPPED_WLAN_WLANASYNCDISCONNECTEDRESPONSE (0x00000002L)
  180. #define EVENT_DROPPED_WLAN_STA_CONNECTED (0x00000004L)
  181. #define EVENT_DROPPED_WLAN_STA_DISCONNECTED (0x00000008L)
  182. #define STATUS_WLAN_STA_CONNECTED (0x80000000L)
  183. /****************** NETAPP CLASS status ****************/
  184. #define EVENT_DROPPED_NETAPP_IPACQUIRED (0x00000001L)
  185. #define EVENT_DROPPED_NETAPP_IPACQUIRED_V6 (0x00000002L)
  186. #define EVENT_DROPPED_NETAPP_IP_LEASED (0x00000004L)
  187. #define EVENT_DROPPED_NETAPP_IP_RELEASED (0x00000008L)
  188. /****************** BSD CLASS status ****************/
  189. #define EVENT_DROPPED_SOCKET_TXFAILEDASYNCRESPONSE (0x00000001L)
  190. /****************** FS CLASS ****************/
  191. /*****************************************************************************/
  192. /* Structure/Enum declarations */
  193. /*****************************************************************************/
  194. #define ROLE_UNKNOWN_ERR (-1)
  195. #ifdef SL_IF_TYPE_UART
  196. typedef struct
  197. {
  198. _u32 BaudRate;
  199. _u8 FlowControlEnable;
  200. _u8 CommPort;
  201. } SlUartIfParams_t;
  202. #endif
  203. typedef struct
  204. {
  205. _u32 ChipId;
  206. _u32 FwVersion[4];
  207. _u8 PhyVersion[4];
  208. }_SlPartialVersion;
  209. typedef struct
  210. {
  211. _SlPartialVersion ChipFwAndPhyVersion;
  212. _u32 NwpVersion[4];
  213. _u16 RomVersion;
  214. _u16 Padding;
  215. }SlVersionFull;
  216. typedef struct
  217. {
  218. _u32 AbortType;
  219. _u32 AbortData;
  220. }sl_DeviceReportAbort;
  221. typedef struct
  222. {
  223. _i8 status;
  224. SlErrorSender_e sender;
  225. }sl_DeviceReport;
  226. typedef union
  227. {
  228. sl_DeviceReport deviceEvent;
  229. sl_DeviceReportAbort deviceReport;
  230. } _SlDeviceEventData_u;
  231. typedef struct
  232. {
  233. _u32 Event;
  234. _SlDeviceEventData_u EventData;
  235. } SlDeviceEvent_t;
  236. typedef struct
  237. {
  238. /* time */
  239. _u32 sl_tm_sec;
  240. _u32 sl_tm_min;
  241. _u32 sl_tm_hour;
  242. /* date */
  243. _u32 sl_tm_day; /* 1-31 */
  244. _u32 sl_tm_mon; /* 1-12 */
  245. _u32 sl_tm_year; /* YYYY 4 digits */
  246. _u32 sl_tm_week_day; /* not required */
  247. _u32 sl_tm_year_day; /* not required */
  248. _u32 reserved[3];
  249. }SlDateTime_t;
  250. /******************************************************************************/
  251. /* Type declarations */
  252. /******************************************************************************/
  253. typedef void (*P_INIT_CALLBACK)(_u32 Status);
  254. /*****************************************************************************/
  255. /* Function prototypes */
  256. /*****************************************************************************/
  257. /*!
  258. \brief Start the SimpleLink device
  259. This function initialize the communication interface, set the enable pin
  260. of the device, and call to the init complete callback.
  261. \param[in] pIfHdl Opened Interface Object. In case the interface
  262. must be opened outside the SimpleLink Driver, the
  263. user might give the handler to be used in \n
  264. any access of the communication interface with the
  265. device (UART/SPI). \n
  266. The SimpleLink driver will open an interface port
  267. only if this parameter is null! \n
  268. \param[in] pDevName The name of the device to open. Could be used when
  269. the pIfHdl is null, to transfer information to the
  270. open interface function \n
  271. This pointer could be used to pass additional information to
  272. sl_IfOpen in case it is required (e.g. UART com port name)
  273. \param[in] pInitCallBack Pointer to function that would be called
  274. on completion of the initialization process.\n
  275. If this parameter is NULL the function is
  276. blocked until the device initialization
  277. is completed, otherwise the function returns
  278. immediately.
  279. \return Returns the current active role (STA/AP/P2P) or an error code:
  280. - ROLE_STA, ROLE_AP, ROLE_P2P in case of success,
  281. otherwise in failure one of the following is return:
  282. - ROLE_STA_ERR (Failure to load MAC/PHY in STA role)
  283. - ROLE_AP_ERR (Failure to load MAC/PHY in AP role)
  284. - ROLE_P2P_ERR (Failure to load MAC/PHY in P2P role)
  285. \sa sl_Stop
  286. \note belongs to \ref basic_api
  287. \warning This function must be called before any other SimpleLink API is used, or after sl_Stop is called for reinit the device
  288. \par Example:
  289. \code
  290. An example for open interface without callback routine. The interface name and handler are
  291. handled by the sl_IfOpen routine:
  292. if( sl_Start(NULL, NULL, NULL) < 0 )
  293. {
  294. LOG("Error opening interface to device\n");
  295. }
  296. \endcode
  297. */
  298. #if _SL_INCLUDE_FUNC(sl_Start)
  299. _i16 sl_Start(const void* pIfHdl, _i8* pDevName, const P_INIT_CALLBACK pInitCallBack);
  300. #endif
  301. /*!
  302. \brief Stop the SimpleLink device
  303. This function clears the enable pin of the device, closes the communication \n
  304. interface and invokes the stop complete callback
  305. \param[in] timeout Stop timeout in msec. Should be used to give the device time to finish \n
  306. any transmission/reception that is not completed when the function was called. \n
  307. Additional options:
  308. - 0 Enter to hibernate immediately \n
  309. - 0xFFFF Host waits for device's response before \n
  310. hibernating, without timeout protection \n
  311. - 0 < Timeout[msec] < 0xFFFF Host waits for device's response before \n
  312. hibernating, with a defined timeout protection \n
  313. This timeout defines the max time to wait. The NWP \n
  314. response can be sent earlier than this timeout.
  315. \return On success, zero is returned. On error, -1 is returned
  316. \sa sl_Start
  317. \note This API will shutdown the device and invoke the "i/f close" function regardless \n
  318. if it was opened implicitly or explicitly. \n
  319. It is up to the platform interface library to properly handle interface close \n
  320. routine \n
  321. belongs to \ref basic_api \n
  322. \warning
  323. */
  324. #if _SL_INCLUDE_FUNC(sl_Stop)
  325. _i16 sl_Stop(const _u16 timeout);
  326. #endif
  327. /*!
  328. \brief Internal function for setting device configurations
  329. \return On success, zero is returned. On error, -1 is
  330. returned
  331. \param[in] DeviceSetId configuration id
  332. \param[in] Option configurations option
  333. \param[in] ConfigLen configurations len
  334. \param[in] pValues configurations values
  335. \sa
  336. \note
  337. \warning
  338. \par Examples:
  339. \code
  340. Setting device time and date example:
  341. SlDateTime_t dateTime= {0};
  342. dateTime.sl_tm_day = (_u32)23; // Day of month (DD format) range 1-31
  343. dateTime.sl_tm_mon = (_u32)6; // Month (MM format) in the range of 1-12
  344. dateTime.sl_tm_year = (_u32)2014; // Year (YYYY format)
  345. dateTime.sl_tm_hour = (_u32)17; // Hours in the range of 0-23
  346. dateTime.sl_tm_min = (_u32)55; // Minutes in the range of 0-59
  347. dateTime.sl_tm_sec = (_u32)22; // Seconds in the range of 0-59
  348. sl_DevSet(SL_DEVICE_GENERAL_CONFIGURATION,
  349. SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME,
  350. sizeof(SlDateTime_t),
  351. (_u8 *)(&dateTime));
  352. \endcode
  353. */
  354. #if _SL_INCLUDE_FUNC(sl_DevSet)
  355. _i32 sl_DevSet(const _u8 DeviceSetId ,const _u8 Option,const _u8 ConfigLen,const _u8 *pValues);
  356. #endif
  357. /*!
  358. \brief Internal function for getting device configurations
  359. \return On success, zero is returned. On error, -1 is
  360. returned
  361. \param[in] DeviceGetId configuration id - example SL_DEVICE_STATUS
  362. \param[out] pOption Get configurations option, example for get status options
  363. - SL_EVENT_CLASS_GLOBAL
  364. - SL_EVENT_CLASS_DEVICE
  365. - SL_EVENT_CLASS_WLAN
  366. - SL_EVENT_CLASS_BSD
  367. - SL_EVENT_CLASS_NETAPP
  368. - SL_EVENT_CLASS_NETCFG
  369. - SL_EVENT_CLASS_FS
  370. \param[out] pConfigLen The length of the allocated memory as input, when the
  371. function complete, the value of this parameter would be
  372. the len that actually read from the device.\n
  373. If the device return length that is longer from the input
  374. value, the function will cut the end of the returned structure
  375. and will return SL_ESMALLBUF
  376. \param[out] pValues Get configurations values
  377. \sa
  378. \note
  379. \warning
  380. \par Examples:
  381. \code
  382. Example for getting WLAN class status:
  383. _u32 statusWlan;
  384. _u8 pConfigOpt;
  385. _u8 pConfigLen;
  386. pConfigOpt = SL_EVENT_CLASS_WLAN;
  387. pConfigLen = sizeof(_u32);
  388. sl_DevGet(SL_DEVICE_STATUS,&pConfigOpt,&pConfigLen,(_u8 *)(&statusWlan));
  389. Example for getting version:
  390. SlVersionFull ver;
  391. pConfigLen = sizeof(ver);
  392. pConfigOpt = SL_DEVICE_GENERAL_VERSION;
  393. sl_DevGet(SL_DEVICE_GENERAL_CONFIGURATION,&pConfigOpt,&pConfigLen,(_u8 *)(&ver));
  394. printf("CHIP %d\nMAC 31.%d.%d.%d.%d\nPHY %d.%d.%d.%d\nNWP %d.%d.%d.%d\nROM %d\nHOST %d.%d.%d.%d\n",
  395. ver.ChipFwAndPhyVersion.ChipId,
  396. ver.ChipFwAndPhyVersion.FwVersion[0],ver.ChipFwAndPhyVersion.FwVersion[1],
  397. ver.ChipFwAndPhyVersion.FwVersion[2],ver.ChipFwAndPhyVersion.FwVersion[3],
  398. ver.ChipFwAndPhyVersion.PhyVersion[0],ver.ChipFwAndPhyVersion.PhyVersion[1],
  399. ver.ChipFwAndPhyVersion.PhyVersion[2],ver.ChipFwAndPhyVersion.PhyVersion[3],
  400. ver.NwpVersion[0],ver.NwpVersion[1],ver.NwpVersion[2],ver.NwpVersion[3],
  401. ver.RomVersion,
  402. SL_MAJOR_VERSION_NUM,SL_MINOR_VERSION_NUM,SL_VERSION_NUM,SL_SUB_VERSION_NUM);
  403. \endcode
  404. \code
  405. Getting Device time and date example:
  406. SlDateTime_t dateTime = {0};
  407. _i8 configLen = sizeof(SlDateTime_t);
  408. _i8 configOpt = SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME;
  409. sl_DevGet(SL_DEVICE_GENERAL_CONFIGURATION,&configOpt, &configLen,(_u8 *)(&dateTime));
  410. printf("Day %d,Mon %d,Year %d,Hour %,Min %d,Sec %d\n",dateTime.sl_tm_day,dateTime.sl_tm_mon,dateTime.sl_tm_year
  411. dateTime.sl_tm_hour,dateTime.sl_tm_min,dateTime.sl_tm_sec);
  412. \endcode
  413. */
  414. #if _SL_INCLUDE_FUNC(sl_DevGet)
  415. _i32 sl_DevGet(const _u8 DeviceGetId,_u8 *pOption,_u8 *pConfigLen, _u8 *pValues);
  416. #endif
  417. /*!
  418. \brief Set asynchronous event mask
  419. Mask asynchronous events from the device. Masked events do not
  420. generate asynchronous messages from the device.
  421. By default - all events are active
  422. \param[in] EventClass The classification groups that the
  423. mask is referred to. Need to be one of
  424. the following:
  425. - SL_EVENT_CLASS_GLOBAL
  426. - SL_EVENT_CLASS_DEVICE
  427. - SL_EVENT_CLASS_WLAN
  428. - SL_EVENT_CLASS_BSD
  429. - SL_EVENT_CLASS_NETAPP
  430. - SL_EVENT_CLASS_NETCFG
  431. - SL_EVENT_CLASS_FS
  432. \param[in] Mask Event Mask bitmap. Valid mask are (per group):
  433. - SL_EVENT_CLASS_WLAN user events
  434. - SL_WLAN_CONNECT_EVENT
  435. - SL_WLAN_DISCONNECT_EVENT
  436. - SL_EVENT_CLASS_DEVICE user events
  437. - SL_DEVICE_FATAL_ERROR_EVENT
  438. - SL_EVENT_CLASS_BSD user events
  439. - SL_SOCKET_TX_FAILED_EVENT
  440. - SL_SOCKET_ASYNC_EVENT
  441. - SL_EVENT_CLASS_NETAPP user events
  442. - SL_NETAPP_IPV4_IPACQUIRED_EVENT
  443. - SL_NETAPP_IPV6_IPACQUIRED_EVENT
  444. \return On success, zero is returned. On error, -1 is returned
  445. \sa sl_EventMaskGet
  446. \note belongs to \ref ext_api
  447. \warning
  448. \par Example:
  449. \code
  450. An example of masking connection/disconnection async events from WLAN class:
  451. sl_EventMaskSet(SL_EVENT_CLASS_WLAN, (SL_WLAN_CONNECT_EVENT | SL_WLAN_DISCONNECT_EVENT) );
  452. \endcode
  453. */
  454. #if _SL_INCLUDE_FUNC(sl_EventMaskSet)
  455. _i16 sl_EventMaskSet(const _u8 EventClass ,const _u32 Mask);
  456. #endif
  457. /*!
  458. \brief Get current event mask of the device
  459. return the events bit mask from the device. In case that event is
  460. masked, the device is not sending this event.
  461. \param[in] EventClass The classification groups that the
  462. mask is referred to. Need to be one of
  463. the following:
  464. - SL_EVENT_CLASS_GLOBAL
  465. - SL_EVENT_CLASS_DEVICE
  466. - SL_EVENT_CLASS_WLAN
  467. - SL_EVENT_CLASS_BSD
  468. - SL_EVENT_CLASS_NETAPP
  469. - SL_EVENT_CLASS_NETCFG
  470. - SL_EVENT_CLASS_FS
  471. \param[out] pMask Pointer to Mask bitmap where the
  472. value should be stored. Bitmasks are the same as in \ref sl_EventMaskSet
  473. \return On success, zero is returned. On error, -1 is returned
  474. \sa sl_EventMaskSet
  475. \note belongs to \ref ext_api
  476. \warning
  477. \par Example:
  478. \code
  479. An example of getting an event mask for WLAN class
  480. _u32 maskWlan;
  481. sl_StatusGet(SL_EVENT_CLASS_WLAN,&maskWlan);
  482. \endcode
  483. */
  484. #if _SL_INCLUDE_FUNC(sl_EventMaskGet)
  485. _i16 sl_EventMaskGet(const _u8 EventClass,_u32 *pMask);
  486. #endif
  487. /*!
  488. \brief the simple link task entry
  489. \Param
  490. This function must be called from the main loop or from dedicated thread in
  491. the following cases:
  492. - Non-Os Platform - should be called from the mail loop
  493. - Multi Threaded Platform when the user does not implement the external spawn functions -
  494. should be called from dedicated thread allocated to the simplelink driver.
  495. In this mode the function never return.
  496. \return None
  497. \sa sl_Stop
  498. \note belongs to \ref basic_api
  499. \warning This function must be called from a thread that is start running before
  500. any call to other simple link API
  501. */
  502. #if _SL_INCLUDE_FUNC(sl_Task)
  503. void sl_Task(void);
  504. #endif
  505. /*!
  506. \brief Setting the internal uart mode
  507. \param[in] pUartParams Pointer to the uart configuration parameter set:
  508. baudrate - up to 711 Kbps
  509. flow control - enable/disable
  510. comm port - the comm port number
  511. \return On success zero is returned, otherwise - Failed.
  512. \sa sl_Stop
  513. \note belongs to \ref basic_api
  514. \warning This function must consider the host uart capability
  515. */
  516. #ifdef SL_IF_TYPE_UART
  517. #if _SL_INCLUDE_FUNC(sl_UartSetMode)
  518. _i16 sl_UartSetMode(const SlUartIfParams_t* pUartParams);
  519. #endif
  520. #endif
  521. /*!
  522. Close the Doxygen group.
  523. @}
  524. */
  525. #ifdef __cplusplus
  526. }
  527. #endif /* __cplusplus */
  528. #endif /* __DEVICE_H__ */