Update revision to use TI's mqtt and Freertos.

Dependencies:   mbed client server

Fork of cc3100_Test_mqtt_CM3 by David Fletcher

Committer:
dflet
Date:
Thu Sep 03 14:02:37 2015 +0000
Revision:
3:a8c249046181
SPI Mode change 1 to 0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dflet 3:a8c249046181 1 /*
dflet 3:a8c249046181 2 * simplelink.h - CC31xx/CC32xx Host Driver Implementation
dflet 3:a8c249046181 3 *
dflet 3:a8c249046181 4 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
dflet 3:a8c249046181 5 *
dflet 3:a8c249046181 6 *
dflet 3:a8c249046181 7 * Redistribution and use in source and binary forms, with or without
dflet 3:a8c249046181 8 * modification, are permitted provided that the following conditions
dflet 3:a8c249046181 9 * are met:
dflet 3:a8c249046181 10 *
dflet 3:a8c249046181 11 * Redistributions of source code must retain the above copyright
dflet 3:a8c249046181 12 * notice, this list of conditions and the following disclaimer.
dflet 3:a8c249046181 13 *
dflet 3:a8c249046181 14 * Redistributions in binary form must reproduce the above copyright
dflet 3:a8c249046181 15 * notice, this list of conditions and the following disclaimer in the
dflet 3:a8c249046181 16 * documentation and/or other materials provided with the
dflet 3:a8c249046181 17 * distribution.
dflet 3:a8c249046181 18 *
dflet 3:a8c249046181 19 * Neither the name of Texas Instruments Incorporated nor the names of
dflet 3:a8c249046181 20 * its contributors may be used to endorse or promote products derived
dflet 3:a8c249046181 21 * from this software without specific prior written permission.
dflet 3:a8c249046181 22 *
dflet 3:a8c249046181 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
dflet 3:a8c249046181 24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
dflet 3:a8c249046181 25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
dflet 3:a8c249046181 26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
dflet 3:a8c249046181 27 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
dflet 3:a8c249046181 28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
dflet 3:a8c249046181 29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
dflet 3:a8c249046181 30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
dflet 3:a8c249046181 31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
dflet 3:a8c249046181 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
dflet 3:a8c249046181 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
dflet 3:a8c249046181 34 *
dflet 3:a8c249046181 35 */
dflet 3:a8c249046181 36
dflet 3:a8c249046181 37
dflet 3:a8c249046181 38 /*!
dflet 3:a8c249046181 39 \mainpage SimpleLink Driver
dflet 3:a8c249046181 40
dflet 3:a8c249046181 41 \section intro_sec Introduction
dflet 3:a8c249046181 42
dflet 3:a8c249046181 43 The SimpleLink CC31xx/CC2xx family allows to add Wi-Fi and networking capabilities
dflet 3:a8c249046181 44 to low-cost embedded products without having prior Wi-Fi, RF or networking expertise.
dflet 3:a8c249046181 45 The CC31xx/CC32xx is an ideal solution for microcontroller-based sensor and control
dflet 3:a8c249046181 46 applications such as home appliances, home automation and smart metering.
dflet 3:a8c249046181 47 The CC31xx/CC32xx has integrated a comprehensive TCP/IP network stack, Wi-Fi driver and
dflet 3:a8c249046181 48 security supplicant leading to easier portability to microcontrollers, to an
dflet 3:a8c249046181 49 ultra-low memory footprint, all without compromising the capabilities and robustness
dflet 3:a8c249046181 50 of the final application.
dflet 3:a8c249046181 51
dflet 3:a8c249046181 52
dflet 3:a8c249046181 53
dflet 3:a8c249046181 54 \section modules_sec Module Names
dflet 3:a8c249046181 55 To make it simple, TI's SimpleLink CC31xx/CC32xx platform capabilities were divided into modules by topic (Silo).
dflet 3:a8c249046181 56 These capabilities range from basic device management through wireless
dflet 3:a8c249046181 57 network configuration, standard BSD socket and much more.
dflet 3:a8c249046181 58 Listed below are the various modules in the SimpleLink CC31xx/CC32xx driver:
dflet 3:a8c249046181 59 -# \ref device - controls the behaviour of the CC31xx/CC32xx device (start/stop, events masking and obtaining specific device status)
dflet 3:a8c249046181 60 -# \ref wlan - controls the use of the WiFi WLAN module including:
dflet 3:a8c249046181 61 - Connection features, such as: profiles, policies, SmartConfig™
dflet 3:a8c249046181 62 - Advanced WLAN features, such as: scans, rx filters and rx statistics collection
dflet 3:a8c249046181 63 -# \ref socket - controls standard client/server sockets programming options and capabilities
dflet 3:a8c249046181 64 -# \ref netapp - activates networking applications, such as: HTTP Server, DHCP Server, Ping, DNS and mDNS.
dflet 3:a8c249046181 65 -# \ref netcfg - controls the configuration of the device addresses (i.e. IP and MAC addresses)
dflet 3:a8c249046181 66 -# \ref FileSystem - provides file system capabilities to TI's CC31XX that can be used by both the CC31XX device and the user.
dflet 3:a8c249046181 67
dflet 3:a8c249046181 68
dflet 3:a8c249046181 69 \section proting_sec Porting Guide
dflet 3:a8c249046181 70
dflet 3:a8c249046181 71 The porting of the SimpleLink driver to any new platform is based on few simple steps.
dflet 3:a8c249046181 72 This guide takes you through this process step by step. Please follow the instructions
dflet 3:a8c249046181 73 carefully to avoid any problems during this process and to enable efficient and proper
dflet 3:a8c249046181 74 work with the device.
dflet 3:a8c249046181 75 Please notice that all modifications and porting adjustments of the driver should be
dflet 3:a8c249046181 76 made in the user.h header file only.
dflet 3:a8c249046181 77 Keep making any of the changes only in this file will ensure smoothly transaction to
dflet 3:a8c249046181 78 new versions of the driver at the future!
dflet 3:a8c249046181 79
dflet 3:a8c249046181 80
dflet 3:a8c249046181 81 \subsection porting_step1 Step 1 - Create your own user.h file
dflet 3:a8c249046181 82
dflet 3:a8c249046181 83 The first step is to create a user.h file that will include your configurations and
dflet 3:a8c249046181 84 adjustments. You can use the empty template provided as part of this driver or
dflet 3:a8c249046181 85 you can choose to base your file on file from one of the wide range of examples
dflet 3:a8c249046181 86 applications provided by Texas Instruments
dflet 3:a8c249046181 87
dflet 3:a8c249046181 88
dflet 3:a8c249046181 89 \subsection porting_step2 Step 2 - Select the capabilities set required for your application
dflet 3:a8c249046181 90
dflet 3:a8c249046181 91 Texas Instruments made a lot of efforts to build set of predefined capability sets that would
dflet 3:a8c249046181 92 fit most of the target application.
dflet 3:a8c249046181 93 It is recommended to try and choose one of this predefined capabilities set before going to
dflet 3:a8c249046181 94 build your own customized set. If you find compatible set you can skip the rest of this step.
dflet 3:a8c249046181 95
dflet 3:a8c249046181 96 The available sets are:
dflet 3:a8c249046181 97 -# SL_TINY - Compatible to be used on platforms with very limited resources. Provides
dflet 3:a8c249046181 98 the best in class foot print in terms of Code and Data consumption.
dflet 3:a8c249046181 99 -# SL_SMALL - Compatible to most common networking applications. Provide the most
dflet 3:a8c249046181 100 common APIs with decent balance between code size, data size, functionality
dflet 3:a8c249046181 101 and performances
dflet 3:a8c249046181 102 -# SL_FULL - Provide access to all SimpleLink functionalities
dflet 3:a8c249046181 103
dflet 3:a8c249046181 104
dflet 3:a8c249046181 105 \subsection porting_step3 Step 3 - Bind the device enable/disable output line
dflet 3:a8c249046181 106
dflet 3:a8c249046181 107 The enable/disable line (nHib) provide mechanism to enter the device into the least current
dflet 3:a8c249046181 108 consumption mode. This mode could be used when no traffic is required (tx/rx).
dflet 3:a8c249046181 109 when this line is not connected to any IO of the host this define should be left empty.
dflet 3:a8c249046181 110 Not connecting this line results in ability to start the driver only once.
dflet 3:a8c249046181 111
dflet 3:a8c249046181 112
dflet 3:a8c249046181 113 \subsection porting_step4 Step 4 - Writing your interface communication driver
dflet 3:a8c249046181 114
dflet 3:a8c249046181 115 The SimpleLink device support several standard communication protocol among SPI and
dflet 3:a8c249046181 116 UART. Depending on your needs and your hardware design, you should choose the
dflet 3:a8c249046181 117 communication channel type.
dflet 3:a8c249046181 118 The interface for this communication channel should include 4 simple access functions:
dflet 3:a8c249046181 119 -# open
dflet 3:a8c249046181 120 -# close
dflet 3:a8c249046181 121 -# read
dflet 3:a8c249046181 122 -# write
dflet 3:a8c249046181 123
dflet 3:a8c249046181 124 The way this driver would be implemented is directly effecting the efficiency and
dflet 3:a8c249046181 125 the performances of the SimpleLink device on this platform.
dflet 3:a8c249046181 126 If your system has DMA you should consider to use it in order to increase the utilization
dflet 3:a8c249046181 127 of the communication channel
dflet 3:a8c249046181 128 If you have enough memory resources you should consider using a buffer to increase the
dflet 3:a8c249046181 129 efficiency of the write operations.
dflet 3:a8c249046181 130
dflet 3:a8c249046181 131
dflet 3:a8c249046181 132 \subsection porting_step5 Step 5 - Choose your memory management model
dflet 3:a8c249046181 133
dflet 3:a8c249046181 134 The SimpleLink driver support two memory models:
dflet 3:a8c249046181 135 -# Static (default)
dflet 3:a8c249046181 136 -# Dynamic
dflet 3:a8c249046181 137
dflet 3:a8c249046181 138 If you choose to work in dynamic model you will have to provide alloc and free functions
dflet 3:a8c249046181 139 to be used by the Simple Link driver otherwise nothing need to be done.
dflet 3:a8c249046181 140
dflet 3:a8c249046181 141
dflet 3:a8c249046181 142 \subsection porting_step6 Step 6 - OS adaptation
dflet 3:a8c249046181 143
dflet 3:a8c249046181 144 The SimpleLink driver could run on two kind of platforms:
dflet 3:a8c249046181 145 -# Non-Os / Single Threaded (default)
dflet 3:a8c249046181 146 -# Multi-Threaded
dflet 3:a8c249046181 147
dflet 3:a8c249046181 148 If you choose to work in multi-threaded environment under operating system you will have to
dflet 3:a8c249046181 149 provide some basic adaptation routines to allow the driver to protect access to resources
dflet 3:a8c249046181 150 for different threads (locking object) and to allow synchronization between threads (sync objects).
dflet 3:a8c249046181 151 In additional the driver support running without dedicated thread allocated solely to the simple
dflet 3:a8c249046181 152 link driver. If you choose to work in this mode, you should also supply a spawn method that
dflet 3:a8c249046181 153 will enable to run function on a temporary context.
dflet 3:a8c249046181 154
dflet 3:a8c249046181 155
dflet 3:a8c249046181 156 \subsection porting_step7 Step 7 - Set your asynchronous event handlers routines
dflet 3:a8c249046181 157
dflet 3:a8c249046181 158 The SimpleLink device generate asynchronous events in several situations.
dflet 3:a8c249046181 159 These asynchronous events could be masked.
dflet 3:a8c249046181 160 In order to catch these events you have to provide handler routines.
dflet 3:a8c249046181 161 Please notice that if you not provide a handler routine and the event is received,
dflet 3:a8c249046181 162 the driver will drop this event without any indication of this drop.
dflet 3:a8c249046181 163
dflet 3:a8c249046181 164
dflet 3:a8c249046181 165 \subsection porting_step8 Step 8 - Run diagnostic tools to validate the correctness of your porting
dflet 3:a8c249046181 166
dflet 3:a8c249046181 167 The driver is delivered with some porting diagnostic tools to simplify the porting validation process
dflet 3:a8c249046181 168 and to reduce issues latter. It is very important to follow carefully this process.
dflet 3:a8c249046181 169
dflet 3:a8c249046181 170 The diagnostic process include:
dflet 3:a8c249046181 171 -# Validating Interface Communication Driver
dflet 3:a8c249046181 172 -# Validating OS adaptation layer
dflet 3:a8c249046181 173 -# Validating HW integrity
dflet 3:a8c249046181 174 -# Validating basic work with the device
dflet 3:a8c249046181 175
dflet 3:a8c249046181 176
dflet 3:a8c249046181 177 \section sw_license License
dflet 3:a8c249046181 178
dflet 3:a8c249046181 179 *
dflet 3:a8c249046181 180 *
dflet 3:a8c249046181 181 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
dflet 3:a8c249046181 182 *
dflet 3:a8c249046181 183 *
dflet 3:a8c249046181 184 * Redistribution and use in source and binary forms, with or without
dflet 3:a8c249046181 185 * modification, are permitted provided that the following conditions
dflet 3:a8c249046181 186 * are met:
dflet 3:a8c249046181 187 *
dflet 3:a8c249046181 188 * Redistributions of source code must retain the above copyright
dflet 3:a8c249046181 189 * notice, this list of conditions and the following disclaimer.
dflet 3:a8c249046181 190 *
dflet 3:a8c249046181 191 * Redistributions in binary form must reproduce the above copyright
dflet 3:a8c249046181 192 * notice, this list of conditions and the following disclaimer in the
dflet 3:a8c249046181 193 * documentation and/or other materials provided with the
dflet 3:a8c249046181 194 * distribution.
dflet 3:a8c249046181 195 *
dflet 3:a8c249046181 196 * Neither the name of Texas Instruments Incorporated nor the names of
dflet 3:a8c249046181 197 * its contributors may be used to endorse or promote products derived
dflet 3:a8c249046181 198 * from this software without specific prior written permission.
dflet 3:a8c249046181 199 *
dflet 3:a8c249046181 200 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
dflet 3:a8c249046181 201 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
dflet 3:a8c249046181 202 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
dflet 3:a8c249046181 203 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
dflet 3:a8c249046181 204 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
dflet 3:a8c249046181 205 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
dflet 3:a8c249046181 206 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
dflet 3:a8c249046181 207 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
dflet 3:a8c249046181 208 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
dflet 3:a8c249046181 209 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
dflet 3:a8c249046181 210 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
dflet 3:a8c249046181 211 *
dflet 3:a8c249046181 212 */
dflet 3:a8c249046181 213
dflet 3:a8c249046181 214
dflet 3:a8c249046181 215
dflet 3:a8c249046181 216 #ifndef SIMPLELINK_H_
dflet 3:a8c249046181 217 #define SIMPLELINK_H_
dflet 3:a8c249046181 218
dflet 3:a8c249046181 219 #include "mbed.h"
dflet 3:a8c249046181 220 #include "cc3100_user.h"
dflet 3:a8c249046181 221
dflet 3:a8c249046181 222 namespace mbed_cc3100 {
dflet 3:a8c249046181 223
dflet 3:a8c249046181 224 /*! \attention Async event activation notes
dflet 3:a8c249046181 225 Function prototypes for event callback handlers
dflet 3:a8c249046181 226 Event handler function names should be defined in the user.h file
dflet 3:a8c249046181 227 e.g.
dflet 3:a8c249046181 228 "#define sl_WlanEvtHdlr SLWlanEventHandler"
dflet 3:a8c249046181 229 Indicates all WLAN events are handled by User func "SLWlanEventHandler"
dflet 3:a8c249046181 230 Important notes:
dflet 3:a8c249046181 231 1. Event handlers cannot activate another SimpleLink API from the event's context
dflet 3:a8c249046181 232 2. Event's data is valid during event's context. Any application data
dflet 3:a8c249046181 233 which is required for the user application should be copied or marked
dflet 3:a8c249046181 234 into user's variables
dflet 3:a8c249046181 235 3. It is not recommended to delay the execution of the event callback handler
dflet 3:a8c249046181 236
dflet 3:a8c249046181 237 */
dflet 3:a8c249046181 238
dflet 3:a8c249046181 239 /*!
dflet 3:a8c249046181 240
dflet 3:a8c249046181 241 \addtogroup UserEvents
dflet 3:a8c249046181 242 @{
dflet 3:a8c249046181 243
dflet 3:a8c249046181 244 */
dflet 3:a8c249046181 245
dflet 3:a8c249046181 246
dflet 3:a8c249046181 247 /*****************************************************************************/
dflet 3:a8c249046181 248 /* Macro declarations for Host Driver version */
dflet 3:a8c249046181 249 /*****************************************************************************/
dflet 3:a8c249046181 250 #define SL_DRIVER_VERSION "1.0.0.10"
dflet 3:a8c249046181 251 #define SL_MAJOR_VERSION_NUM 1L
dflet 3:a8c249046181 252 #define SL_MINOR_VERSION_NUM 0L
dflet 3:a8c249046181 253 #define SL_VERSION_NUM 0L
dflet 3:a8c249046181 254 #define SL_SUB_VERSION_NUM 10L
dflet 3:a8c249046181 255
dflet 3:a8c249046181 256
dflet 3:a8c249046181 257 /*****************************************************************************/
dflet 3:a8c249046181 258 /* Macro declarations for predefined configurations */
dflet 3:a8c249046181 259 /*****************************************************************************/
dflet 3:a8c249046181 260
dflet 3:a8c249046181 261 #ifdef SL_TINY
dflet 3:a8c249046181 262
dflet 3:a8c249046181 263 #undef SL_INC_ARG_CHECK
dflet 3:a8c249046181 264 #undef SL_INC_EXT_API
dflet 3:a8c249046181 265 #undef SL_INC_SOCK_SERVER_SIDE_API
dflet 3:a8c249046181 266 #undef SL_INC_WLAN_PKG
dflet 3:a8c249046181 267 #undef SL_INC_NET_CFG_PKG
dflet 3:a8c249046181 268 #undef SL_INC_FS_PKG
dflet 3:a8c249046181 269 #undef SL_INC_SET_UART_MODE
dflet 3:a8c249046181 270 #undef SL_INC_NVMEM_PKG
dflet 3:a8c249046181 271 #define SL_INC_STD_BSD_API_NAMING
dflet 3:a8c249046181 272 #define SL_INC_SOCK_CLIENT_SIDE_API
dflet 3:a8c249046181 273 #define SL_INC_SOCK_RECV_API
dflet 3:a8c249046181 274 #define SL_INC_SOCK_SEND_API
dflet 3:a8c249046181 275 #define SL_INC_SOCKET_PKG
dflet 3:a8c249046181 276 #define SL_INC_NET_APP_PKG
dflet 3:a8c249046181 277 #endif
dflet 3:a8c249046181 278
dflet 3:a8c249046181 279 #ifdef SL_SMALL
dflet 3:a8c249046181 280 #undef SL_INC_EXT_API
dflet 3:a8c249046181 281 #undef SL_INC_NET_APP_PKG
dflet 3:a8c249046181 282 #undef SL_INC_NET_CFG_PKG
dflet 3:a8c249046181 283 #undef SL_INC_FS_PKG
dflet 3:a8c249046181 284 #define SL_INC_ARG_CHECK
dflet 3:a8c249046181 285 #define SL_INC_WLAN_PKG
dflet 3:a8c249046181 286 #define SL_INC_SOCKET_PKG
dflet 3:a8c249046181 287 #define SL_INC_SOCK_CLIENT_SIDE_API
dflet 3:a8c249046181 288 #define SL_INC_SOCK_SERVER_SIDE_API
dflet 3:a8c249046181 289 #define SL_INC_SOCK_RECV_API
dflet 3:a8c249046181 290 #define SL_INC_SOCK_SEND_API
dflet 3:a8c249046181 291 #define SL_INC_SET_UART_MODE
dflet 3:a8c249046181 292 #endif
dflet 3:a8c249046181 293
dflet 3:a8c249046181 294 #ifdef SL_FULL
dflet 3:a8c249046181 295 #define SL_INC_EXT_API
dflet 3:a8c249046181 296 #define SL_INC_NET_APP_PKG
dflet 3:a8c249046181 297 #define SL_INC_NET_CFG_PKG
dflet 3:a8c249046181 298 #define SL_INC_FS_PKG
dflet 3:a8c249046181 299 #define SL_INC_ARG_CHECK
dflet 3:a8c249046181 300 #define SL_INC_WLAN_PKG
dflet 3:a8c249046181 301 #define SL_INC_SOCKET_PKG
dflet 3:a8c249046181 302 #define SL_INC_SOCK_CLIENT_SIDE_API
dflet 3:a8c249046181 303 #define SL_INC_SOCK_SERVER_SIDE_API
dflet 3:a8c249046181 304 #define SL_INC_SOCK_RECV_API
dflet 3:a8c249046181 305 #define SL_INC_SOCK_SEND_API
dflet 3:a8c249046181 306 #define SL_INC_SET_UART_MODE
dflet 3:a8c249046181 307 #endif
dflet 3:a8c249046181 308
dflet 3:a8c249046181 309 #define SL_RET_CODE_OK (0)
dflet 3:a8c249046181 310 #define SL_RET_CODE_INVALID_INPUT (-2)
dflet 3:a8c249046181 311 #define SL_RET_CODE_SELF_ERROR (-3)
dflet 3:a8c249046181 312 #define SL_RET_CODE_NWP_IF_ERROR (-4)
dflet 3:a8c249046181 313 #define SL_RET_CODE_MALLOC_ERROR (-5)
dflet 3:a8c249046181 314
dflet 3:a8c249046181 315 #define sl_SyncObjClear(pObj) sl_SyncObjWait(pObj,NON_OS_SYNC_OBJ_SIGNAL_VALUE,NON_OS_SYNC_OBJ_CLEAR_VALUE,SL_OS_NO_WAIT)
dflet 3:a8c249046181 316
dflet 3:a8c249046181 317 #ifndef SL_TINY_EXT
dflet 3:a8c249046181 318 #define SL_MAX_SOCKETS (8)
dflet 3:a8c249046181 319 #else
dflet 3:a8c249046181 320 #define SL_MAX_SOCKETS (2)
dflet 3:a8c249046181 321 #endif
dflet 3:a8c249046181 322
dflet 3:a8c249046181 323 /*****************************************************************************/
dflet 3:a8c249046181 324 /* Types definitions */
dflet 3:a8c249046181 325 /*****************************************************************************/
dflet 3:a8c249046181 326
dflet 3:a8c249046181 327
dflet 3:a8c249046181 328 #ifndef NULL
dflet 3:a8c249046181 329 #define NULL (0)
dflet 3:a8c249046181 330 #endif
dflet 3:a8c249046181 331
dflet 3:a8c249046181 332 #ifndef FALSE
dflet 3:a8c249046181 333 #define FALSE (0)
dflet 3:a8c249046181 334 #endif
dflet 3:a8c249046181 335
dflet 3:a8c249046181 336 #ifndef TRUE
dflet 3:a8c249046181 337 #define TRUE (!FALSE)
dflet 3:a8c249046181 338 #endif
dflet 3:a8c249046181 339
dflet 3:a8c249046181 340 #ifndef OK
dflet 3:a8c249046181 341 #define OK (0)
dflet 3:a8c249046181 342 #endif
dflet 3:a8c249046181 343
dflet 3:a8c249046181 344 //#ifndef _SL_USER_TYPES
dflet 3:a8c249046181 345 //typedef unsigned char _u8;
dflet 3:a8c249046181 346 //typedef signed char _i8;
dflet 3:a8c249046181 347
dflet 3:a8c249046181 348 //typedef unsigned short _u16;
dflet 3:a8c249046181 349 //typedef signed short _i16;
dflet 3:a8c249046181 350
dflet 3:a8c249046181 351 //typedef unsigned long _u32;
dflet 3:a8c249046181 352 //typedef signed long _i32;
dflet 3:a8c249046181 353 //#define _volatile volatile
dflet 3:a8c249046181 354 //#define _const const
dflet 3:a8c249046181 355 //#endif
dflet 3:a8c249046181 356
dflet 3:a8c249046181 357 typedef uint16_t _SlOpcode_t;
dflet 3:a8c249046181 358 typedef uint8_t _SlArgSize_t;
dflet 3:a8c249046181 359 typedef int16_t _SlDataSize_t;
dflet 3:a8c249046181 360 typedef int16_t _SlReturnVal_t;
dflet 3:a8c249046181 361
dflet 3:a8c249046181 362 /*
dflet 3:a8c249046181 363 * This event status used to block or continue the event propagation
dflet 3:a8c249046181 364 * through all the registered external libs/user application
dflet 3:a8c249046181 365 *
dflet 3:a8c249046181 366 */
dflet 3:a8c249046181 367
dflet 3:a8c249046181 368 typedef enum {
dflet 3:a8c249046181 369 EVENT_PROPAGATION_BLOCK = 0,
dflet 3:a8c249046181 370 EVENT_PROPAGATION_CONTINUE
dflet 3:a8c249046181 371
dflet 3:a8c249046181 372 } _SlEventPropogationStatus_e;
dflet 3:a8c249046181 373
dflet 3:a8c249046181 374 typedef void (*_SlSpawnEntryFunc_t)(void* pValue);
dflet 3:a8c249046181 375
dflet 3:a8c249046181 376 }//namespace mbed_cc3100
dflet 3:a8c249046181 377 /*****************************************************************************/
dflet 3:a8c249046181 378 /* Include files */
dflet 3:a8c249046181 379 /*****************************************************************************/
dflet 3:a8c249046181 380
dflet 3:a8c249046181 381 /*
dflet 3:a8c249046181 382 objInclusion.h and user.h must be included before all api header files
dflet 3:a8c249046181 383 objInclusion.h must be the last arrangement just before including the API header files
dflet 3:a8c249046181 384 since it based on the other configurations to decide which object should be included
dflet 3:a8c249046181 385 */
dflet 3:a8c249046181 386 #include "cc3100_objInclusion.h"
dflet 3:a8c249046181 387 #include "cc3100_trace.h"
dflet 3:a8c249046181 388 #include "cc3100_fs.h"
dflet 3:a8c249046181 389 #include "cc3100_socket.h"
dflet 3:a8c249046181 390 #include "cc3100_netapp.h"
dflet 3:a8c249046181 391 #include "cc3100_wlan.h"
dflet 3:a8c249046181 392 #include "cc3100.h"
dflet 3:a8c249046181 393 #include "cc3100_netcfg.h"
dflet 3:a8c249046181 394 #include "cc3100_wlan_rx_filters.h"
dflet 3:a8c249046181 395
dflet 3:a8c249046181 396 /* The general events dispatcher which is
dflet 3:a8c249046181 397 * initialized to the user handler */
dflet 3:a8c249046181 398 #ifdef sl_GeneralEvtHdlr
dflet 3:a8c249046181 399 #define _SlDrvHandleGeneralEvents sl_GeneralEvtHdlr
dflet 3:a8c249046181 400 #endif
dflet 3:a8c249046181 401
dflet 3:a8c249046181 402 /* The wlan events dispatcher which is
dflet 3:a8c249046181 403 * initialized to the user handler */
dflet 3:a8c249046181 404 #ifdef sl_WlanEvtHdlr
dflet 3:a8c249046181 405 #define _SlDrvHandleWlanEvents sl_WlanEvtHdlr
dflet 3:a8c249046181 406 #endif
dflet 3:a8c249046181 407
dflet 3:a8c249046181 408 /* The NetApp events dispatcher which is
dflet 3:a8c249046181 409 * initialized to the user handler */
dflet 3:a8c249046181 410 #ifdef sl_NetAppEvtHdlr
dflet 3:a8c249046181 411 #define _SlDrvHandleNetAppEvents sl_NetAppEvtHdlr
dflet 3:a8c249046181 412 #endif
dflet 3:a8c249046181 413
dflet 3:a8c249046181 414 /* The http server events dispatcher which is
dflet 3:a8c249046181 415 * initialized to the user handler if exists */
dflet 3:a8c249046181 416 #ifdef sl_HttpServerCallback
dflet 3:a8c249046181 417 #define _SlDrvHandleHttpServerEvents sl_HttpServerCallback
dflet 3:a8c249046181 418 #endif
dflet 3:a8c249046181 419
dflet 3:a8c249046181 420 /* The socket events dispatcher which is
dflet 3:a8c249046181 421 * initialized to the user handler */
dflet 3:a8c249046181 422 #ifdef sl_SockEvtHdlr
dflet 3:a8c249046181 423 #define _SlDrvHandleSockEvents sl_SockEvtHdlr
dflet 3:a8c249046181 424 #endif
dflet 3:a8c249046181 425
dflet 3:a8c249046181 426
dflet 3:a8c249046181 427
dflet 3:a8c249046181 428 #define __CONCAT(x,y) x ## y
dflet 3:a8c249046181 429 #define __CONCAT2(x,y) __CONCAT(x,y)
dflet 3:a8c249046181 430
dflet 3:a8c249046181 431
dflet 3:a8c249046181 432 /*
dflet 3:a8c249046181 433 * The section below handles the external lib event registration
dflet 3:a8c249046181 434 * according to the desired events it specified in its API header file.
dflet 3:a8c249046181 435 * The external lib should be first installed by the user (see user.h)
dflet 3:a8c249046181 436 */
dflet 3:a8c249046181 437 #ifdef SL_EXT_LIB_1
dflet 3:a8c249046181 438
dflet 3:a8c249046181 439 /* General Event Registration */
dflet 3:a8c249046181 440 #if __CONCAT2(SL_EXT_LIB_1, _NOTIFY_GENERAL_EVENT)
dflet 3:a8c249046181 441 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_1, _GeneralEventHdl) (SlDeviceEvent_t *);
dflet 3:a8c249046181 442 #define SlExtLib1GeneralEventHandler __CONCAT2(SL_EXT_LIB_1, _GeneralEventHdl)
dflet 3:a8c249046181 443
dflet 3:a8c249046181 444 #undef EXT_LIB_REGISTERED_GENERAL_EVENTS
dflet 3:a8c249046181 445 #define EXT_LIB_REGISTERED_GENERAL_EVENTS
dflet 3:a8c249046181 446 #endif
dflet 3:a8c249046181 447
dflet 3:a8c249046181 448 /* Wlan Event Registration */
dflet 3:a8c249046181 449 #if __CONCAT2(SL_EXT_LIB_1, _NOTIFY_WLAN_EVENT)
dflet 3:a8c249046181 450 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_1, _WlanEventHdl) (SlWlanEvent_t *);
dflet 3:a8c249046181 451 #define SlExtLib1WlanEventHandler __CONCAT2(SL_EXT_LIB_1, _WlanEventHdl)
dflet 3:a8c249046181 452
dflet 3:a8c249046181 453 #undef EXT_LIB_REGISTERED_WLAN_EVENTS
dflet 3:a8c249046181 454 #define EXT_LIB_REGISTERED_WLAN_EVENTS
dflet 3:a8c249046181 455 #endif
dflet 3:a8c249046181 456
dflet 3:a8c249046181 457 /* NetApp Event Registration */
dflet 3:a8c249046181 458 #if __CONCAT2(SL_EXT_LIB_1, _NOTIFY_NETAPP_EVENT)
dflet 3:a8c249046181 459 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_1, _NetAppEventHdl) (SlNetAppEvent_t *);
dflet 3:a8c249046181 460 #define SlExtLib1NetAppEventHandler __CONCAT2(SL_EXT_LIB_1, _NetAppEventHdl)
dflet 3:a8c249046181 461
dflet 3:a8c249046181 462 #undef EXT_LIB_REGISTERED_NETAPP_EVENTS
dflet 3:a8c249046181 463 #define EXT_LIB_REGISTERED_NETAPP_EVENTS
dflet 3:a8c249046181 464 #endif
dflet 3:a8c249046181 465
dflet 3:a8c249046181 466 /* Http Server Event Registration */
dflet 3:a8c249046181 467 #if __CONCAT2(SL_EXT_LIB_1, _NOTIFY_HTTP_SERVER_EVENT)
dflet 3:a8c249046181 468 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_1, _HttpServerEventHdl) (SlHttpServerEvent_t* , SlHttpServerResponse_t*);
dflet 3:a8c249046181 469 #define SlExtLib1HttpServerEventHandler __CONCAT2(SL_EXT_LIB_1, _HttpServerEventHdl)
dflet 3:a8c249046181 470
dflet 3:a8c249046181 471 #undef EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS
dflet 3:a8c249046181 472 #define EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS
dflet 3:a8c249046181 473 #endif
dflet 3:a8c249046181 474
dflet 3:a8c249046181 475 /* Socket Event Registration */
dflet 3:a8c249046181 476 #if __CONCAT2(SL_EXT_LIB_1, _NOTIFY_SOCK_EVENT)
dflet 3:a8c249046181 477 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_1, _SockEventHdl) (SlSockEvent_t *);
dflet 3:a8c249046181 478 #define SlExtLib1SockEventHandler __CONCAT2(SL_EXT_LIB_1, _SockEventHdl)
dflet 3:a8c249046181 479
dflet 3:a8c249046181 480 #undef EXT_LIB_REGISTERED_SOCK_EVENTS
dflet 3:a8c249046181 481 #define EXT_LIB_REGISTERED_SOCK_EVENTS
dflet 3:a8c249046181 482 #endif
dflet 3:a8c249046181 483
dflet 3:a8c249046181 484 #endif
dflet 3:a8c249046181 485
dflet 3:a8c249046181 486
dflet 3:a8c249046181 487 #ifdef SL_EXT_LIB_2
dflet 3:a8c249046181 488
dflet 3:a8c249046181 489 /* General Event Registration */
dflet 3:a8c249046181 490 #if __CONCAT2(SL_EXT_LIB_2, _NOTIFY_GENERAL_EVENT)
dflet 3:a8c249046181 491 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_2, _GeneralEventHdl) (SlDeviceEvent_t *);
dflet 3:a8c249046181 492 #define SlExtLib2GeneralEventHandler __CONCAT2(SL_EXT_LIB_2, _GeneralEventHdl)
dflet 3:a8c249046181 493
dflet 3:a8c249046181 494 #undef EXT_LIB_REGISTERED_GENERAL_EVENTS
dflet 3:a8c249046181 495 #define EXT_LIB_REGISTERED_GENERAL_EVENTS
dflet 3:a8c249046181 496 #endif
dflet 3:a8c249046181 497
dflet 3:a8c249046181 498 /* Wlan Event Registration */
dflet 3:a8c249046181 499 #if __CONCAT2(SL_EXT_LIB_2, _NOTIFY_WLAN_EVENT)
dflet 3:a8c249046181 500 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_2, _WlanEventHdl) (SlWlanEvent_t *);
dflet 3:a8c249046181 501 #define SlExtLib2WlanEventHandler __CONCAT2(SL_EXT_LIB_2, _WlanEventHdl)
dflet 3:a8c249046181 502
dflet 3:a8c249046181 503 #undef EXT_LIB_REGISTERED_WLAN_EVENTS
dflet 3:a8c249046181 504 #define EXT_LIB_REGISTERED_WLAN_EVENTS
dflet 3:a8c249046181 505 #endif
dflet 3:a8c249046181 506
dflet 3:a8c249046181 507 /* NetApp Event Registration */
dflet 3:a8c249046181 508 #if __CONCAT2(SL_EXT_LIB_2, _NOTIFY_NETAPP_EVENT)
dflet 3:a8c249046181 509 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_2, _NetAppEventHdl) (SlNetAppEvent_t *);
dflet 3:a8c249046181 510 #define SlExtLib2NetAppEventHandler __CONCAT2(SL_EXT_LIB_2, _NetAppEventHdl)
dflet 3:a8c249046181 511
dflet 3:a8c249046181 512 #undef EXT_LIB_REGISTERED_NETAPP_EVENTS
dflet 3:a8c249046181 513 #define EXT_LIB_REGISTERED_NETAPP_EVENTS
dflet 3:a8c249046181 514 #endif
dflet 3:a8c249046181 515
dflet 3:a8c249046181 516 /* Http Server Event Registration */
dflet 3:a8c249046181 517 #if __CONCAT2(SL_EXT_LIB_2, _NOTIFY_HTTP_SERVER_EVENT)
dflet 3:a8c249046181 518 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_2, _HttpServerEventHdl) (SlHttpServerEvent_t* , SlHttpServerResponse_t*);
dflet 3:a8c249046181 519 #define SlExtLib2HttpServerEventHandler __CONCAT2(SL_EXT_LIB_2, _HttpServerEventHdl)
dflet 3:a8c249046181 520
dflet 3:a8c249046181 521 #undef EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS
dflet 3:a8c249046181 522 #define EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS
dflet 3:a8c249046181 523 #endif
dflet 3:a8c249046181 524
dflet 3:a8c249046181 525 /* Socket Event Registration */
dflet 3:a8c249046181 526 #if __CONCAT2(SL_EXT_LIB_2, _NOTIFY_SOCK_EVENT)
dflet 3:a8c249046181 527 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_2, _SockEventHdl) (SlSockEvent_t *);
dflet 3:a8c249046181 528 #define SlExtLib2SockEventHandler __CONCAT2(SL_EXT_LIB_2, _SockEventHdl)
dflet 3:a8c249046181 529
dflet 3:a8c249046181 530 #undef EXT_LIB_REGISTERED_SOCK_EVENTS
dflet 3:a8c249046181 531 #define EXT_LIB_REGISTERED_SOCK_EVENTS
dflet 3:a8c249046181 532 #endif
dflet 3:a8c249046181 533
dflet 3:a8c249046181 534 #endif
dflet 3:a8c249046181 535
dflet 3:a8c249046181 536
dflet 3:a8c249046181 537 #ifdef SL_EXT_LIB_3
dflet 3:a8c249046181 538
dflet 3:a8c249046181 539 /* General Event Registration */
dflet 3:a8c249046181 540 #if __CONCAT2(SL_EXT_LIB_3, _NOTIFY_GENERAL_EVENT)
dflet 3:a8c249046181 541 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_3, _GeneralEventHdl) (SlDeviceEvent_t *);
dflet 3:a8c249046181 542 #define SlExtLib3GeneralEventHandler __CONCAT2(SL_EXT_LIB_3, _GeneralEventHdl)
dflet 3:a8c249046181 543
dflet 3:a8c249046181 544 #undef EXT_LIB_REGISTERED_GENERAL_EVENTS
dflet 3:a8c249046181 545 #define EXT_LIB_REGISTERED_GENERAL_EVENTS
dflet 3:a8c249046181 546 #endif
dflet 3:a8c249046181 547
dflet 3:a8c249046181 548 /* Wlan Event Registration */
dflet 3:a8c249046181 549 #if __CONCAT2(SL_EXT_LIB_3, _NOTIFY_WLAN_EVENT)
dflet 3:a8c249046181 550 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_3, _WlanEventHdl) (SlWlanEvent_t *);
dflet 3:a8c249046181 551 #define SlExtLib3WlanEventHandler __CONCAT2(SL_EXT_LIB_3, _WlanEventHdl)
dflet 3:a8c249046181 552
dflet 3:a8c249046181 553 #undef EXT_LIB_REGISTERED_WLAN_EVENTS
dflet 3:a8c249046181 554 #define EXT_LIB_REGISTERED_WLAN_EVENTS
dflet 3:a8c249046181 555 #endif
dflet 3:a8c249046181 556
dflet 3:a8c249046181 557 /* NetApp Event Registration */
dflet 3:a8c249046181 558 #if __CONCAT2(SL_EXT_LIB_3, _NOTIFY_NETAPP_EVENT)
dflet 3:a8c249046181 559 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_3, _NetAppEventHdl) (SlNetAppEvent_t *);
dflet 3:a8c249046181 560 #define SlExtLib3NetAppEventHandler __CONCAT2(SL_EXT_LIB_3, _NetAppEventHdl)
dflet 3:a8c249046181 561
dflet 3:a8c249046181 562 #undef EXT_LIB_REGISTERED_NETAPP_EVENTS
dflet 3:a8c249046181 563 #define EXT_LIB_REGISTERED_NETAPP_EVENTS
dflet 3:a8c249046181 564 #endif
dflet 3:a8c249046181 565
dflet 3:a8c249046181 566 /* Http Server Event Registration */
dflet 3:a8c249046181 567 #if __CONCAT2(SL_EXT_LIB_3, _NOTIFY_HTTP_SERVER_EVENT)
dflet 3:a8c249046181 568 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_3, _HttpServerEventHdl) (SlHttpServerEvent_t* , SlHttpServerResponse_t*);
dflet 3:a8c249046181 569 #define SlExtLib3HttpServerEventHandler __CONCAT2(SL_EXT_LIB_3, _HttpServerEventHdl)
dflet 3:a8c249046181 570
dflet 3:a8c249046181 571 #undef EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS
dflet 3:a8c249046181 572 #define EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS
dflet 3:a8c249046181 573 #endif
dflet 3:a8c249046181 574
dflet 3:a8c249046181 575 /* Socket Event Registration */
dflet 3:a8c249046181 576 #if __CONCAT2(SL_EXT_LIB_3, _NOTIFY_SOCK_EVENT)
dflet 3:a8c249046181 577 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_3, _SockEventHdl) (SlSockEvent_t *);
dflet 3:a8c249046181 578 #define SlExtLib3SockEventHandler __CONCAT2(SL_EXT_LIB_3, _SockEventHdl)
dflet 3:a8c249046181 579
dflet 3:a8c249046181 580 #undef EXT_LIB_REGISTERED_SOCK_EVENTS
dflet 3:a8c249046181 581 #define EXT_LIB_REGISTERED_SOCK_EVENTS
dflet 3:a8c249046181 582 #endif
dflet 3:a8c249046181 583
dflet 3:a8c249046181 584 #endif
dflet 3:a8c249046181 585
dflet 3:a8c249046181 586
dflet 3:a8c249046181 587 #ifdef SL_EXT_LIB_4
dflet 3:a8c249046181 588
dflet 3:a8c249046181 589 /* General Event Registration */
dflet 3:a8c249046181 590 #if __CONCAT2(SL_EXT_LIB_4, _NOTIFY_GENERAL_EVENT)
dflet 3:a8c249046181 591 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_4, _GeneralEventHdl) (SlDeviceEvent_t *);
dflet 3:a8c249046181 592 #define SlExtLib4GeneralEventHandler __CONCAT2(SL_EXT_LIB_4, _GeneralEventHdl)
dflet 3:a8c249046181 593
dflet 3:a8c249046181 594 #undef EXT_LIB_REGISTERED_GENERAL_EVENTS
dflet 3:a8c249046181 595 #define EXT_LIB_REGISTERED_GENERAL_EVENTS
dflet 3:a8c249046181 596 #endif
dflet 3:a8c249046181 597
dflet 3:a8c249046181 598 /* Wlan Event Registration */
dflet 3:a8c249046181 599 #if __CONCAT2(SL_EXT_LIB_4, _NOTIFY_WLAN_EVENT)
dflet 3:a8c249046181 600 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_4, _WlanEventHdl) (SlWlanEvent_t *);
dflet 3:a8c249046181 601 #define SlExtLib4WlanEventHandler __CONCAT2(SL_EXT_LIB_4, _WlanEventHdl)
dflet 3:a8c249046181 602
dflet 3:a8c249046181 603 #undef EXT_LIB_REGISTERED_WLAN_EVENTS
dflet 3:a8c249046181 604 #define EXT_LIB_REGISTERED_WLAN_EVENTS
dflet 3:a8c249046181 605 #endif
dflet 3:a8c249046181 606
dflet 3:a8c249046181 607 /* NetApp Event Registration */
dflet 3:a8c249046181 608 #if __CONCAT2(SL_EXT_LIB_4, _NOTIFY_NETAPP_EVENT)
dflet 3:a8c249046181 609 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_4, _NetAppEventHdl) (SlNetAppEvent_t *);
dflet 3:a8c249046181 610 #define SlExtLib4NetAppEventHandler __CONCAT2(SL_EXT_LIB_4, _NetAppEventHdl)
dflet 3:a8c249046181 611
dflet 3:a8c249046181 612 #undef EXT_LIB_REGISTERED_NETAPP_EVENTS
dflet 3:a8c249046181 613 #define EXT_LIB_REGISTERED_NETAPP_EVENTS
dflet 3:a8c249046181 614 #endif
dflet 3:a8c249046181 615
dflet 3:a8c249046181 616 /* Http Server Event Registration */
dflet 3:a8c249046181 617 #if __CONCAT2(SL_EXT_LIB_4, _NOTIFY_HTTP_SERVER_EVENT)
dflet 3:a8c249046181 618 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_4, _HttpServerEventHdl) (SlHttpServerEvent_t* , SlHttpServerResponse_t*);
dflet 3:a8c249046181 619 #define SlExtLib4HttpServerEventHandler __CONCAT2(SL_EXT_LIB_4, _HttpServerEventHdl)
dflet 3:a8c249046181 620
dflet 3:a8c249046181 621 #undef EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS
dflet 3:a8c249046181 622 #define EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS
dflet 3:a8c249046181 623 #endif
dflet 3:a8c249046181 624
dflet 3:a8c249046181 625 /* Socket Event Registration */
dflet 3:a8c249046181 626 #if __CONCAT2(SL_EXT_LIB_4, _NOTIFY_SOCK_EVENT)
dflet 3:a8c249046181 627 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_4, _SockEventHdl) (SlSockEvent_t *);
dflet 3:a8c249046181 628 #define SlExtLib4SockEventHandler __CONCAT2(SL_EXT_LIB_4, _SockEventHdl)
dflet 3:a8c249046181 629
dflet 3:a8c249046181 630 #undef EXT_LIB_REGISTERED_SOCK_EVENTS
dflet 3:a8c249046181 631 #define EXT_LIB_REGISTERED_SOCK_EVENTS
dflet 3:a8c249046181 632 #endif
dflet 3:a8c249046181 633
dflet 3:a8c249046181 634 #endif
dflet 3:a8c249046181 635
dflet 3:a8c249046181 636
dflet 3:a8c249046181 637 #ifdef SL_EXT_LIB_5
dflet 3:a8c249046181 638
dflet 3:a8c249046181 639 /* General Event Registration */
dflet 3:a8c249046181 640 #if __CONCAT2(SL_EXT_LIB_5, _NOTIFY_GENERAL_EVENT)
dflet 3:a8c249046181 641 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_5, _GeneralEventHdl) (SlDeviceEvent_t *);
dflet 3:a8c249046181 642 #define SlExtLib5GeneralEventHandler __CONCAT2(SL_EXT_LIB_5, _GeneralEventHdl)
dflet 3:a8c249046181 643
dflet 3:a8c249046181 644 #undef EXT_LIB_REGISTERED_GENERAL_EVENTS
dflet 3:a8c249046181 645 #define EXT_LIB_REGISTERED_GENERAL_EVENTS
dflet 3:a8c249046181 646 #endif
dflet 3:a8c249046181 647
dflet 3:a8c249046181 648 /* Wlan Event Registration */
dflet 3:a8c249046181 649 #if __CONCAT2(SL_EXT_LIB_5, _NOTIFY_WLAN_EVENT)
dflet 3:a8c249046181 650 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_5, _WlanEventHdl) (SlWlanEvent_t *);
dflet 3:a8c249046181 651 #define SlExtLib5WlanEventHandler __CONCAT2(SL_EXT_LIB_5, _WlanEventHdl)
dflet 3:a8c249046181 652
dflet 3:a8c249046181 653 #undef EXT_LIB_REGISTERED_WLAN_EVENTS
dflet 3:a8c249046181 654 #define EXT_LIB_REGISTERED_WLAN_EVENTS
dflet 3:a8c249046181 655 #endif
dflet 3:a8c249046181 656
dflet 3:a8c249046181 657 /* NetApp Event Registration */
dflet 3:a8c249046181 658 #if __CONCAT2(SL_EXT_LIB_5, _NOTIFY_NETAPP_EVENT)
dflet 3:a8c249046181 659 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_5, _NetAppEventHdl) (SlNetAppEvent_t *);
dflet 3:a8c249046181 660 #define SlExtLib5NetAppEventHandler __CONCAT2(SL_EXT_LIB_5, _NetAppEventHdl)
dflet 3:a8c249046181 661
dflet 3:a8c249046181 662 #undef EXT_LIB_REGISTERED_NETAPP_EVENTS
dflet 3:a8c249046181 663 #define EXT_LIB_REGISTERED_NETAPP_EVENTS
dflet 3:a8c249046181 664 #endif
dflet 3:a8c249046181 665
dflet 3:a8c249046181 666 /* Http Server Event Registration */
dflet 3:a8c249046181 667 #if __CONCAT2(SL_EXT_LIB_5, _NOTIFY_HTTP_SERVER_EVENT)
dflet 3:a8c249046181 668 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_5, _HttpServerEventHdl) (SlHttpServerEvent_t* , SlHttpServerResponse_t*);
dflet 3:a8c249046181 669 #define SlExtLib5HttpServerEventHandler __CONCAT2(SL_EXT_LIB_5, _HttpServerEventHdl)
dflet 3:a8c249046181 670
dflet 3:a8c249046181 671 #undef EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS
dflet 3:a8c249046181 672 #define EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS
dflet 3:a8c249046181 673 #endif
dflet 3:a8c249046181 674
dflet 3:a8c249046181 675 /* Socket Event Registration */
dflet 3:a8c249046181 676 #if __CONCAT2(SL_EXT_LIB_5, _NOTIFY_SOCK_EVENT)
dflet 3:a8c249046181 677 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_5, _SockEventHdl) (SlSockEvent_t *);
dflet 3:a8c249046181 678 #define SlExtLib5SockEventHandler __CONCAT2(SL_EXT_LIB_5, _SockEventHdl)
dflet 3:a8c249046181 679
dflet 3:a8c249046181 680 #undef EXT_LIB_REGISTERED_SOCK_EVENTS
dflet 3:a8c249046181 681 #define EXT_LIB_REGISTERED_SOCK_EVENTS
dflet 3:a8c249046181 682 #endif
dflet 3:a8c249046181 683
dflet 3:a8c249046181 684 #endif
dflet 3:a8c249046181 685
dflet 3:a8c249046181 686
dflet 3:a8c249046181 687
dflet 3:a8c249046181 688 #if defined(EXT_LIB_REGISTERED_GENERAL_EVENTS)
dflet 3:a8c249046181 689 void _SlDrvHandleGeneralEvents(SlDeviceEvent_t *slGeneralEvent);
dflet 3:a8c249046181 690 #endif
dflet 3:a8c249046181 691
dflet 3:a8c249046181 692 #if defined(EXT_LIB_REGISTERED_WLAN_EVENTS)
dflet 3:a8c249046181 693 void _SlDrvHandleWlanEvents(SlWlanEvent_t *slWlanEvent);
dflet 3:a8c249046181 694 #endif
dflet 3:a8c249046181 695
dflet 3:a8c249046181 696 #if defined (EXT_LIB_REGISTERED_NETAPP_EVENTS)
dflet 3:a8c249046181 697 void _SlDrvHandleNetAppEvents(SlNetAppEvent_t *slNetAppEvent);
dflet 3:a8c249046181 698 #endif
dflet 3:a8c249046181 699
dflet 3:a8c249046181 700 #if defined(EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS)
dflet 3:a8c249046181 701 void _SlDrvHandleHttpServerEvents(SlHttpServerEvent_t *slHttpServerEvent, SlHttpServerResponse_t *slHttpServerResponse);
dflet 3:a8c249046181 702 #endif
dflet 3:a8c249046181 703
dflet 3:a8c249046181 704
dflet 3:a8c249046181 705 #if defined(EXT_LIB_REGISTERED_SOCK_EVENTS)
dflet 3:a8c249046181 706 void _SlDrvHandleSockEvents(SlSockEvent_t *slSockEvent);
dflet 3:a8c249046181 707 #endif
dflet 3:a8c249046181 708
dflet 3:a8c249046181 709 #ifdef SL_PLATFORM_MULTI_THREADED
dflet 3:a8c249046181 710 #include "cc3100_spawn.h"
dflet 3:a8c249046181 711 #else
dflet 3:a8c249046181 712 #include "cc3100_nonos.h"
dflet 3:a8c249046181 713 #endif
dflet 3:a8c249046181 714
dflet 3:a8c249046181 715 namespace mbed_cc3100 {
dflet 3:a8c249046181 716
dflet 3:a8c249046181 717 /* Async functions description*/
dflet 3:a8c249046181 718
dflet 3:a8c249046181 719 /*!
dflet 3:a8c249046181 720 \brief General async event for inspecting general events
dflet 3:a8c249046181 721
dflet 3:a8c249046181 722 \param[out] pSlDeviceEvent pointer to SlDeviceEvent_t
dflet 3:a8c249046181 723
dflet 3:a8c249046181 724 \par- <b>pSlDeviceEvent->Event = SL_DEVICE_FATAL_ERROR_EVENT </b>
dflet 3:a8c249046181 725 - pSlDeviceEvent->EventData.deviceEvent fields:
dflet 3:a8c249046181 726 - status: An error code indication from the device
dflet 3:a8c249046181 727 - sender: The sender originator which is based on SlErrorSender_e enum
dflet 3:a8c249046181 728
dflet 3:a8c249046181 729 - <b>pSlDeviceEvent->Event = SL_DEVICE_ABORT_ERROR_EVENT </b>
dflet 3:a8c249046181 730 Indicates a severe error occured and the device stopped
dflet 3:a8c249046181 731 - pSlDeviceEvent->EventData.deviceReport fields:
dflet 3:a8c249046181 732 - AbortType: An idication of the event type
dflet 3:a8c249046181 733 - AbortData: Additional info about the data error
dflet 3:a8c249046181 734
dflet 3:a8c249046181 735
dflet 3:a8c249046181 736 \par Example for fatal error:
dflet 3:a8c249046181 737 \code
dflet 3:a8c249046181 738 printf(General Event Handler - ID=%d Sender=%d\n\n",
dflet 3:a8c249046181 739 pSlDeviceEvent->EventData.deviceEvent.status, // status of the general event
dflet 3:a8c249046181 740 pSlDeviceEvent->EventData.deviceEvent.sender); // sender type
dflet 3:a8c249046181 741 \endcode
dflet 3:a8c249046181 742 \par Example for abort request:
dflet 3:a8c249046181 743 \code
dflet 3:a8c249046181 744 printf(Abort type =%d Abort Data=%d\n\n",
dflet 3:a8c249046181 745 pSlDeviceEvent->EventData.deviceReport.AbortType,
dflet 3:a8c249046181 746 pSlDeviceEvent->EventData.deviceReport.AbortData);
dflet 3:a8c249046181 747
dflet 3:a8c249046181 748 \endcode
dflet 3:a8c249046181 749 */
dflet 3:a8c249046181 750 //#if (defined(sl_GeneralEvtHdlr))
dflet 3:a8c249046181 751 //void sl_GeneralEvtHdlr(SlDeviceEvent_t *pSlDeviceEvent);
dflet 3:a8c249046181 752 //#endif
dflet 3:a8c249046181 753
dflet 3:a8c249046181 754
dflet 3:a8c249046181 755 /*!
dflet 3:a8c249046181 756 \brief WLAN Async event handler
dflet 3:a8c249046181 757
dflet 3:a8c249046181 758 \param[out] pSlWlanEvent pointer to SlWlanEvent_t data
dflet 3:a8c249046181 759
dflet 3:a8c249046181 760 \par
dflet 3:a8c249046181 761 Parameters:
dflet 3:a8c249046181 762
dflet 3:a8c249046181 763 - <b>pSlWlanEvent->Event = SL_WLAN_CONNECT_EVENT </b>, STA or P2P client connection indication event
dflet 3:a8c249046181 764 - pSlWlanEvent->EventData.STAandP2PModeWlanConnected main fields:
dflet 3:a8c249046181 765 - ssid_name
dflet 3:a8c249046181 766 - ssid_len
dflet 3:a8c249046181 767 - bssid
dflet 3:a8c249046181 768 - go_peer_device_name
dflet 3:a8c249046181 769 - go_peer_device_name_len
dflet 3:a8c249046181 770
dflet 3:a8c249046181 771 - <b>pSlWlanEvent->Event = SL_WLAN_DISCONNECT_EVENT </b>, STA or P2P client disconnection event
dflet 3:a8c249046181 772 - pSlWlanEvent->EventData.STAandP2PModeDisconnected main fields:
dflet 3:a8c249046181 773 - ssid_name
dflet 3:a8c249046181 774 - ssid_len
dflet 3:a8c249046181 775 - reason_code
dflet 3:a8c249046181 776
dflet 3:a8c249046181 777 - <b>pSlWlanEvent->Event = SL_WLAN_STA_CONNECTED_EVENT </b>, AP/P2P(Go) connected STA/P2P(Client)
dflet 3:a8c249046181 778 - pSlWlanEvent->EventData.APModeStaConnected fields:
dflet 3:a8c249046181 779 - go_peer_device_name
dflet 3:a8c249046181 780 - mac
dflet 3:a8c249046181 781 - go_peer_device_name_len
dflet 3:a8c249046181 782 - wps_dev_password_id
dflet 3:a8c249046181 783 - own_ssid: relevant for event sta-connected only
dflet 3:a8c249046181 784 - own_ssid_len: relevant for event sta-connected only
dflet 3:a8c249046181 785
dflet 3:a8c249046181 786 - <b>pSlWlanEvent->Event = SL_WLAN_STA_DISCONNECTED_EVENT </b>, AP/P2P(Go) disconnected STA/P2P(Client)
dflet 3:a8c249046181 787 - pSlWlanEvent->EventData.APModestaDisconnected fields:
dflet 3:a8c249046181 788 - go_peer_device_name
dflet 3:a8c249046181 789 - mac
dflet 3:a8c249046181 790 - go_peer_device_name_len
dflet 3:a8c249046181 791 - wps_dev_password_id
dflet 3:a8c249046181 792 - own_ssid: relevant for event sta-connected only
dflet 3:a8c249046181 793 - own_ssid_len: relevant for event sta-connected only
dflet 3:a8c249046181 794
dflet 3:a8c249046181 795 - <b>pSlWlanEvent->Event = SL_WLAN_SMART_CONFIG_COMPLETE_EVENT </b>
dflet 3:a8c249046181 796 - pSlWlanEvent->EventData.smartConfigStartResponse fields:
dflet 3:a8c249046181 797 - status
dflet 3:a8c249046181 798 - ssid_len
dflet 3:a8c249046181 799 - ssid
dflet 3:a8c249046181 800 - private_token_len
dflet 3:a8c249046181 801 - private_token
dflet 3:a8c249046181 802
dflet 3:a8c249046181 803 - <b>pSlWlanEvent->Event = SL_WLAN_SMART_CONFIG_STOP_EVENT </b>
dflet 3:a8c249046181 804 - pSlWlanEvent->EventData.smartConfigStopResponse fields:
dflet 3:a8c249046181 805 - status
dflet 3:a8c249046181 806
dflet 3:a8c249046181 807 - <b>pSlWlanEvent->Event = SL_WLAN_P2P_DEV_FOUND_EVENT </b>
dflet 3:a8c249046181 808 - pSlWlanEvent->EventData.P2PModeDevFound fields:
dflet 3:a8c249046181 809 - go_peer_device_name
dflet 3:a8c249046181 810 - mac
dflet 3:a8c249046181 811 - go_peer_device_name_len
dflet 3:a8c249046181 812 - wps_dev_password_id
dflet 3:a8c249046181 813 - own_ssid: relevant for event sta-connected only
dflet 3:a8c249046181 814 - own_ssid_len: relevant for event sta-connected only
dflet 3:a8c249046181 815
dflet 3:a8c249046181 816 - <b>pSlWlanEvent->Event = SL_WLAN_P2P_NEG_REQ_RECEIVED_EVENT </b>
dflet 3:a8c249046181 817 - pSlWlanEvent->EventData.P2PModeNegReqReceived fields
dflet 3:a8c249046181 818 - go_peer_device_name
dflet 3:a8c249046181 819 - mac
dflet 3:a8c249046181 820 - go_peer_device_name_len
dflet 3:a8c249046181 821 - wps_dev_password_id
dflet 3:a8c249046181 822 - own_ssid: relevant for event sta-connected only
dflet 3:a8c249046181 823
dflet 3:a8c249046181 824 - <b>pSlWlanEvent->Event = SL_WLAN_CONNECTION_FAILED_EVENT </b>, P2P only
dflet 3:a8c249046181 825 - pSlWlanEvent->EventData.P2PModewlanConnectionFailure fields:
dflet 3:a8c249046181 826 - status
dflet 3:a8c249046181 827 */
dflet 3:a8c249046181 828 //#if (defined(sl_WlanEvtHdlr))
dflet 3:a8c249046181 829 //void sl_WlanEvtHdlr(SlWlanEvent_t *pSlWlanEvent);
dflet 3:a8c249046181 830 //#endif
dflet 3:a8c249046181 831
dflet 3:a8c249046181 832
dflet 3:a8c249046181 833 /*!
dflet 3:a8c249046181 834 \brief NETAPP Async event handler
dflet 3:a8c249046181 835
dflet 3:a8c249046181 836 \param[out] pSlNetApp pointer to SlNetAppEvent_t data
dflet 3:a8c249046181 837
dflet 3:a8c249046181 838 \par
dflet 3:a8c249046181 839 Parameters:
dflet 3:a8c249046181 840 - <b>pSlNetApp->Event = SL_NETAPP_IPV4_IPACQUIRED_EVENT</b>, IPV4 acquired event
dflet 3:a8c249046181 841 - pSlNetApp->EventData.ipAcquiredV4 fields:
dflet 3:a8c249046181 842 - ip
dflet 3:a8c249046181 843 - gateway
dflet 3:a8c249046181 844 - dns
dflet 3:a8c249046181 845
dflet 3:a8c249046181 846 - <b>pSlNetApp->Event = SL_NETAPP_IP_LEASED_EVENT</b>, AP or P2P go dhcp lease event
dflet 3:a8c249046181 847 - pSlNetApp->EventData.ipLeased fields:
dflet 3:a8c249046181 848 - ip_address
dflet 3:a8c249046181 849 - lease_time
dflet 3:a8c249046181 850 - mac
dflet 3:a8c249046181 851
dflet 3:a8c249046181 852 - <b>pSlNetApp->Event = SL_NETAPP_IP_RELEASED_EVENT</b>, AP or P2P go dhcp ip release event
dflet 3:a8c249046181 853 - pSlNetApp->EventData.ipReleased fields
dflet 3:a8c249046181 854 - ip_address
dflet 3:a8c249046181 855 - mac
dflet 3:a8c249046181 856 - reason
dflet 3:a8c249046181 857
dflet 3:a8c249046181 858 */
dflet 3:a8c249046181 859 //#if (defined(sl_NetAppEvtHdlr))
dflet 3:a8c249046181 860 //void sl_NetAppEvtHdlr(SlNetAppEvent_t *pSlNetApp);
dflet 3:a8c249046181 861 //#endif
dflet 3:a8c249046181 862
dflet 3:a8c249046181 863 /*!
dflet 3:a8c249046181 864 \brief Socket Async event handler
dflet 3:a8c249046181 865
dflet 3:a8c249046181 866 \param[out] pSlSockEvent pointer to SlSockEvent_t data
dflet 3:a8c249046181 867
dflet 3:a8c249046181 868 \par
dflet 3:a8c249046181 869 Parameters:\n
dflet 3:a8c249046181 870 - <b>pSlSockEvent->Event = SL_SOCKET_TX_FAILED_EVENT</b>
dflet 3:a8c249046181 871 - pSlSockEvent->SockTxFailData fields:
dflet 3:a8c249046181 872 - sd
dflet 3:a8c249046181 873 - status
dflet 3:a8c249046181 874 - <b>pSlSockEvent->Event = SL_SOCKET_ASYNC_EVENT</b>
dflet 3:a8c249046181 875 - pSlSockEvent->SockAsyncData fields:
dflet 3:a8c249046181 876 - sd
dflet 3:a8c249046181 877 - type: SSL_ACCEPT or RX_FRAGMENTATION_TOO_BIG or OTHER_SIDE_CLOSE_SSL_DATA_NOT_ENCRYPTED
dflet 3:a8c249046181 878 - val
dflet 3:a8c249046181 879
dflet 3:a8c249046181 880 */
dflet 3:a8c249046181 881 //#if (defined(sl_SockEvtHdlr))
dflet 3:a8c249046181 882 //void sl_SockEvtHdlr(SlSockEvent_t *pSlSockEvent);
dflet 3:a8c249046181 883 //#endif
dflet 3:a8c249046181 884
dflet 3:a8c249046181 885 /*!
dflet 3:a8c249046181 886 \brief HTTP server async event
dflet 3:a8c249046181 887
dflet 3:a8c249046181 888 \param[out] pSlHttpServerEvent pointer to SlHttpServerEvent_t
dflet 3:a8c249046181 889 \param[in] pSlHttpServerResponse pointer to SlHttpServerResponse_t
dflet 3:a8c249046181 890
dflet 3:a8c249046181 891 \par
dflet 3:a8c249046181 892 Parameters: \n
dflet 3:a8c249046181 893
dflet 3:a8c249046181 894 - <b>pSlHttpServerEvent->Event = SL_NETAPP_HTTPGETTOKENVALUE_EVENT</b>
dflet 3:a8c249046181 895 - pSlHttpServerEvent->EventData fields:
dflet 3:a8c249046181 896 - httpTokenName
dflet 3:a8c249046181 897 - data
dflet 3:a8c249046181 898 - len
dflet 3:a8c249046181 899 - pSlHttpServerResponse->ResponseData fields:
dflet 3:a8c249046181 900 - data
dflet 3:a8c249046181 901 - len
dflet 3:a8c249046181 902
dflet 3:a8c249046181 903 - <b>pSlHttpServerEvent->Event = SL_NETAPP_HTTPPOSTTOKENVALUE_EVENT</b>
dflet 3:a8c249046181 904 - pSlHttpServerEvent->EventData.httpPostData fields:
dflet 3:a8c249046181 905 - action
dflet 3:a8c249046181 906 - token_name
dflet 3:a8c249046181 907 - token_value
dflet 3:a8c249046181 908 - pSlHttpServerResponse->ResponseData fields:
dflet 3:a8c249046181 909 - data
dflet 3:a8c249046181 910 - len
dflet 3:a8c249046181 911
dflet 3:a8c249046181 912 */
dflet 3:a8c249046181 913 //#if (defined(sl_HttpServerCallback))
dflet 3:a8c249046181 914 //void sl_HttpServerCallback(SlHttpServerEvent_t *pSlHttpServerEvent, SlHttpServerResponse_t *pSlHttpServerResponse);
dflet 3:a8c249046181 915 //#endif
dflet 3:a8c249046181 916 /*!
dflet 3:a8c249046181 917
dflet 3:a8c249046181 918 Close the Doxygen group.
dflet 3:a8c249046181 919 @}
dflet 3:a8c249046181 920
dflet 3:a8c249046181 921 */
dflet 3:a8c249046181 922
dflet 3:a8c249046181 923 }//namespace mbed_cc3100
dflet 3:a8c249046181 924
dflet 3:a8c249046181 925 #endif /* __SIMPLELINK_H__ */
dflet 3:a8c249046181 926
dflet 3:a8c249046181 927