DeepCover Embedded Security in IoT: Public-key Secured Data Paths

Dependencies:   MaximInterface

The MAXREFDES155# is an internet-of-things (IoT) embedded-security reference design, built to authenticate and control a sensing node using elliptic-curve-based public-key cryptography with control and notification from a web server.

The hardware includes an ARM® mbed™ shield and attached sensor endpoint. The shield contains a DS2476 DeepCover® ECDSA/SHA-2 coprocessor, Wifi communication, LCD push-button controls, and status LEDs. The sensor endpoint is attached to the shield using a 300mm cable and contains a DS28C36 DeepCover ECDSA/SHA-2 authenticator, IR-thermal sensor, and aiming laser for the IR sensor. The MAXREFDES155# is equipped with a standard Arduino® form-factor shield connector for immediate testing using an mbed board such as the MAX32600MBED#. The combination of these two devices represent an IoT device. Communication to the web server is accomplished with the shield Wifi circuitry. Communication from the shield to the attached sensor module is accomplished over I2C . The sensor module represents an IoT endpoint that generates small data with a requirement for message authenticity/integrity and secure on/off operational control.

The design is hierarchical with each mbed platform and shield communicating data from the sensor node to a web server that maintains a centralized log and dispatches notifications as necessary. The simplicity of this design enables rapid integration into any star-topology IoT network to provide security with the low overhead and cost provided by the ECDSA-P256 asymmetric-key and SHA-256 symmetric-key algorithms.

More information about the MAXREFDES155# is available on the Maxim Integrated website.

Committer:
IanBenzMaxim
Date:
Fri Feb 24 11:23:12 2017 -0600
Revision:
0:33d4e66780c0
Initial commit.

Who changed what in which revision?

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