Port of TI's CC3100 Websock camera demo. Using FreeRTOS, mbedTLS, also parts of Arducam for cams ov5642 and 0v2640. Can also use MT9D111. Work in progress. Be warned some parts maybe a bit flacky. This is for Seeed Arch max only, for an M3, see the demo for CM3 using the 0v5642 aducam mini.
cc3100_simplelink.h
00001 /* 00002 * simplelink.h - CC31xx/CC32xx Host Driver Implementation 00003 * 00004 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ 00005 * 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * 00014 * Redistributions in binary form must reproduce the above copyright 00015 * notice, this list of conditions and the following disclaimer in the 00016 * documentation and/or other materials provided with the 00017 * distribution. 00018 * 00019 * Neither the name of Texas Instruments Incorporated nor the names of 00020 * its contributors may be used to endorse or promote products derived 00021 * from this software without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00026 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00027 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00028 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00029 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00030 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00031 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00032 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00033 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 * 00035 */ 00036 00037 00038 /*! 00039 \mainpage SimpleLink Driver 00040 00041 \section intro_sec Introduction 00042 00043 The SimpleLink CC31xx/CC2xx family allows to add Wi-Fi and networking capabilities 00044 to low-cost embedded products without having prior Wi-Fi, RF or networking expertise. 00045 The CC31xx/CC32xx is an ideal solution for microcontroller-based sensor and control 00046 applications such as home appliances, home automation and smart metering. 00047 The CC31xx/CC32xx has integrated a comprehensive TCP/IP network stack, Wi-Fi driver and 00048 security supplicant leading to easier portability to microcontrollers, to an 00049 ultra-low memory footprint, all without compromising the capabilities and robustness 00050 of the final application. 00051 00052 00053 00054 \section modules_sec Module Names 00055 To make it simple, TI's SimpleLink CC31xx/CC32xx platform capabilities were divided into modules by topic (Silo). 00056 These capabilities range from basic device management through wireless 00057 network configuration, standard BSD socket and much more. 00058 Listed below are the various modules in the SimpleLink CC31xx/CC32xx driver: 00059 -# \ref device - controls the behaviour of the CC31xx/CC32xx device (start/stop, events masking and obtaining specific device status) 00060 -# \ref wlan - controls the use of the WiFi WLAN module including: 00061 - Connection features, such as: profiles, policies, SmartConfig™ 00062 - Advanced WLAN features, such as: scans, rx filters and rx statistics collection 00063 -# \ref socket - controls standard client/server sockets programming options and capabilities 00064 -# \ref netapp - activates networking applications, such as: HTTP Server, DHCP Server, Ping, DNS and mDNS. 00065 -# \ref netcfg - controls the configuration of the device addresses (i.e. IP and MAC addresses) 00066 -# \ref FileSystem - provides file system capabilities to TI's CC31XX that can be used by both the CC31XX device and the user. 00067 00068 00069 \section proting_sec Porting Guide 00070 00071 The porting of the SimpleLink driver to any new platform is based on few simple steps. 00072 This guide takes you through this process step by step. Please follow the instructions 00073 carefully to avoid any problems during this process and to enable efficient and proper 00074 work with the device. 00075 Please notice that all modifications and porting adjustments of the driver should be 00076 made in the user.h header file only. 00077 Keep making any of the changes only in this file will ensure smoothly transaction to 00078 new versions of the driver at the future! 00079 00080 00081 \subsection porting_step1 Step 1 - Create your own user.h file 00082 00083 The first step is to create a user.h file that will include your configurations and 00084 adjustments. You can use the empty template provided as part of this driver or 00085 you can choose to base your file on file from one of the wide range of examples 00086 applications provided by Texas Instruments 00087 00088 00089 \subsection porting_step2 Step 2 - Select the capabilities set required for your application 00090 00091 Texas Instruments made a lot of efforts to build set of predefined capability sets that would 00092 fit most of the target application. 00093 It is recommended to try and choose one of this predefined capabilities set before going to 00094 build your own customized set. If you find compatible set you can skip the rest of this step. 00095 00096 The available sets are: 00097 -# SL_TINY - Compatible to be used on platforms with very limited resources. Provides 00098 the best in class foot print in terms of Code and Data consumption. 00099 -# SL_SMALL - Compatible to most common networking applications. Provide the most 00100 common APIs with decent balance between code size, data size, functionality 00101 and performances 00102 -# SL_FULL - Provide access to all SimpleLink functionalities 00103 00104 00105 \subsection porting_step3 Step 3 - Bind the device enable/disable output line 00106 00107 The enable/disable line (nHib) provide mechanism to enter the device into the least current 00108 consumption mode. This mode could be used when no traffic is required (tx/rx). 00109 when this line is not connected to any IO of the host this define should be left empty. 00110 Not connecting this line results in ability to start the driver only once. 00111 00112 00113 \subsection porting_step4 Step 4 - Writing your interface communication driver 00114 00115 The SimpleLink device support several standard communication protocol among SPI and 00116 UART. Depending on your needs and your hardware design, you should choose the 00117 communication channel type. 00118 The interface for this communication channel should include 4 simple access functions: 00119 -# open 00120 -# close 00121 -# read 00122 -# write 00123 00124 The way this driver would be implemented is directly effecting the efficiency and 00125 the performances of the SimpleLink device on this platform. 00126 If your system has DMA you should consider to use it in order to increase the utilization 00127 of the communication channel 00128 If you have enough memory resources you should consider using a buffer to increase the 00129 efficiency of the write operations. 00130 00131 00132 \subsection porting_step5 Step 5 - Choose your memory management model 00133 00134 The SimpleLink driver support two memory models: 00135 -# Static (default) 00136 -# Dynamic 00137 00138 If you choose to work in dynamic model you will have to provide alloc and free functions 00139 to be used by the Simple Link driver otherwise nothing need to be done. 00140 00141 00142 \subsection porting_step6 Step 6 - OS adaptation 00143 00144 The SimpleLink driver could run on two kind of platforms: 00145 -# Non-Os / Single Threaded (default) 00146 -# Multi-Threaded 00147 00148 If you choose to work in multi-threaded environment under operating system you will have to 00149 provide some basic adaptation routines to allow the driver to protect access to resources 00150 for different threads (locking object) and to allow synchronization between threads (sync objects). 00151 In additional the driver support running without dedicated thread allocated solely to the simple 00152 link driver. If you choose to work in this mode, you should also supply a spawn method that 00153 will enable to run function on a temporary context. 00154 00155 00156 \subsection porting_step7 Step 7 - Set your asynchronous event handlers routines 00157 00158 The SimpleLink device generate asynchronous events in several situations. 00159 These asynchronous events could be masked. 00160 In order to catch these events you have to provide handler routines. 00161 Please notice that if you not provide a handler routine and the event is received, 00162 the driver will drop this event without any indication of this drop. 00163 00164 00165 \subsection porting_step8 Step 8 - Run diagnostic tools to validate the correctness of your porting 00166 00167 The driver is delivered with some porting diagnostic tools to simplify the porting validation process 00168 and to reduce issues latter. It is very important to follow carefully this process. 00169 00170 The diagnostic process include: 00171 -# Validating Interface Communication Driver 00172 -# Validating OS adaptation layer 00173 -# Validating HW integrity 00174 -# Validating basic work with the device 00175 00176 00177 \section sw_license License 00178 00179 * 00180 * 00181 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ 00182 * 00183 * 00184 * Redistribution and use in source and binary forms, with or without 00185 * modification, are permitted provided that the following conditions 00186 * are met: 00187 * 00188 * Redistributions of source code must retain the above copyright 00189 * notice, this list of conditions and the following disclaimer. 00190 * 00191 * Redistributions in binary form must reproduce the above copyright 00192 * notice, this list of conditions and the following disclaimer in the 00193 * documentation and/or other materials provided with the 00194 * distribution. 00195 * 00196 * Neither the name of Texas Instruments Incorporated nor the names of 00197 * its contributors may be used to endorse or promote products derived 00198 * from this software without specific prior written permission. 00199 * 00200 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00201 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00202 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00203 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00204 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00205 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00206 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00207 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00208 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00209 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00210 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00211 * 00212 */ 00213 00214 00215 00216 #ifndef SIMPLELINK_H_ 00217 #define SIMPLELINK_H_ 00218 00219 #include "mbed.h" 00220 #include "cc3100_user.h" 00221 00222 namespace mbed_cc3100 { 00223 00224 /*! \attention Async event activation notes 00225 Function prototypes for event callback handlers 00226 Event handler function names should be defined in the user.h file 00227 e.g. 00228 "#define sl_WlanEvtHdlr SLWlanEventHandler" 00229 Indicates all WLAN events are handled by User func "SLWlanEventHandler" 00230 Important notes: 00231 1. Event handlers cannot activate another SimpleLink API from the event's context 00232 2. Event's data is valid during event's context. Any application data 00233 which is required for the user application should be copied or marked 00234 into user's variables 00235 3. It is not recommended to delay the execution of the event callback handler 00236 00237 */ 00238 00239 /*! 00240 00241 \addtogroup UserEvents 00242 @{ 00243 00244 */ 00245 00246 00247 /*****************************************************************************/ 00248 /* Macro declarations for Host Driver version */ 00249 /*****************************************************************************/ 00250 #define SL_DRIVER_VERSION "1.0.0.10" 00251 #define SL_MAJOR_VERSION_NUM 1L 00252 #define SL_MINOR_VERSION_NUM 0L 00253 #define SL_VERSION_NUM 0L 00254 #define SL_SUB_VERSION_NUM 10L 00255 00256 00257 /*****************************************************************************/ 00258 /* Macro declarations for predefined configurations */ 00259 /*****************************************************************************/ 00260 00261 #ifdef SL_TINY 00262 00263 #undef SL_INC_ARG_CHECK 00264 #undef SL_INC_EXT_API 00265 #undef SL_INC_SOCK_SERVER_SIDE_API 00266 #undef SL_INC_WLAN_PKG 00267 #undef SL_INC_NET_CFG_PKG 00268 #undef SL_INC_FS_PKG 00269 #undef SL_INC_SET_UART_MODE 00270 #undef SL_INC_NVMEM_PKG 00271 #define SL_INC_STD_BSD_API_NAMING 00272 #define SL_INC_SOCK_CLIENT_SIDE_API 00273 #define SL_INC_SOCK_RECV_API 00274 #define SL_INC_SOCK_SEND_API 00275 #define SL_INC_SOCKET_PKG 00276 #define SL_INC_NET_APP_PKG 00277 #endif 00278 00279 #ifdef SL_SMALL 00280 #undef SL_INC_EXT_API 00281 #undef SL_INC_NET_APP_PKG 00282 #undef SL_INC_NET_CFG_PKG 00283 #undef SL_INC_FS_PKG 00284 #define SL_INC_ARG_CHECK 00285 #define SL_INC_WLAN_PKG 00286 #define SL_INC_SOCKET_PKG 00287 #define SL_INC_SOCK_CLIENT_SIDE_API 00288 #define SL_INC_SOCK_SERVER_SIDE_API 00289 #define SL_INC_SOCK_RECV_API 00290 #define SL_INC_SOCK_SEND_API 00291 #define SL_INC_SET_UART_MODE 00292 #endif 00293 00294 #ifdef SL_FULL 00295 #define SL_INC_EXT_API 00296 #define SL_INC_NET_APP_PKG 00297 #define SL_INC_NET_CFG_PKG 00298 #define SL_INC_FS_PKG 00299 #define SL_INC_ARG_CHECK 00300 #define SL_INC_WLAN_PKG 00301 #define SL_INC_SOCKET_PKG 00302 #define SL_INC_SOCK_CLIENT_SIDE_API 00303 #define SL_INC_SOCK_SERVER_SIDE_API 00304 #define SL_INC_SOCK_RECV_API 00305 #define SL_INC_SOCK_SEND_API 00306 #define SL_INC_SET_UART_MODE 00307 #endif 00308 00309 #define SL_RET_CODE_OK (0) 00310 #define SL_RET_CODE_INVALID_INPUT (-2) 00311 #define SL_RET_CODE_SELF_ERROR (-3) 00312 #define SL_RET_CODE_NWP_IF_ERROR (-4) 00313 #define SL_RET_CODE_MALLOC_ERROR (-5) 00314 00315 #define sl_SyncObjClear(pObj) sl_SyncObjWait(pObj,SL_OS_NO_WAIT) 00316 00317 #ifndef SL_TINY_EXT 00318 #define SL_MAX_SOCKETS (8) 00319 #else 00320 #define SL_MAX_SOCKETS (2) 00321 #endif 00322 00323 /*****************************************************************************/ 00324 /* Types definitions */ 00325 /*****************************************************************************/ 00326 00327 00328 #ifndef NULL 00329 #define NULL (0) 00330 #endif 00331 00332 #ifndef FALSE 00333 #define FALSE (0) 00334 #endif 00335 00336 #ifndef TRUE 00337 #define TRUE (!FALSE) 00338 #endif 00339 00340 #ifndef OK 00341 #define OK (0) 00342 #endif 00343 00344 //#ifndef _SL_USER_TYPES 00345 //typedef unsigned char _u8; 00346 //typedef signed char _i8; 00347 00348 //typedef unsigned short _u16; 00349 //typedef signed short _i16; 00350 00351 //typedef unsigned long _u32; 00352 //typedef signed long _i32; 00353 //#define _volatile volatile 00354 //#define _const const 00355 //#endif 00356 00357 typedef uint16_t _SlOpcode_t; 00358 typedef uint8_t _SlArgSize_t; 00359 typedef int16_t _SlDataSize_t; 00360 typedef int16_t _SlReturnVal_t; 00361 00362 /* 00363 * This event status used to block or continue the event propagation 00364 * through all the registered external libs/user application 00365 * 00366 */ 00367 00368 typedef enum { 00369 EVENT_PROPAGATION_BLOCK = 0, 00370 EVENT_PROPAGATION_CONTINUE 00371 00372 } _SlEventPropogationStatus_e; 00373 00374 typedef void (*_SlSpawnEntryFunc_t)(void* pValue); 00375 00376 }//namespace mbed_cc3100 00377 /*****************************************************************************/ 00378 /* Include files */ 00379 /*****************************************************************************/ 00380 00381 /* 00382 objInclusion.h and user.h must be included before all api header files 00383 objInclusion.h must be the last arrangement just before including the API header files 00384 since it based on the other configurations to decide which object should be included 00385 */ 00386 #include "cc3100_objInclusion.h" 00387 #include "cc3100_trace.h" 00388 #include "cc3100_fs.h" 00389 #include "cc3100_socket.h" 00390 #include "cc3100_netapp.h" 00391 #include "cc3100_wlan.h" 00392 #include "cc3100.h" 00393 #include "cc3100_netcfg.h" 00394 #include "cc3100_wlan_rx_filters.h" 00395 00396 /* The general events dispatcher which is 00397 * initialized to the user handler */ 00398 #ifdef sl_GeneralEvtHdlr 00399 #define _SlDrvHandleGeneralEvents sl_GeneralEvtHdlr 00400 #endif 00401 00402 /* The wlan events dispatcher which is 00403 * initialized to the user handler */ 00404 #ifdef sl_WlanEvtHdlr 00405 #define _SlDrvHandleWlanEvents sl_WlanEvtHdlr 00406 #endif 00407 00408 /* The NetApp events dispatcher which is 00409 * initialized to the user handler */ 00410 #ifdef sl_NetAppEvtHdlr 00411 #define _SlDrvHandleNetAppEvents sl_NetAppEvtHdlr 00412 #endif 00413 00414 /* The http server events dispatcher which is 00415 * initialized to the user handler if exists */ 00416 #ifdef sl_HttpServerCallback 00417 #define _SlDrvHandleHttpServerEvents sl_HttpServerCallback 00418 #endif 00419 00420 /* The socket events dispatcher which is 00421 * initialized to the user handler */ 00422 #ifdef sl_SockEvtHdlr 00423 #define _SlDrvHandleSockEvents sl_SockEvtHdlr 00424 #endif 00425 00426 00427 00428 #define __CONCAT(x,y) x ## y 00429 #define __CONCAT2(x,y) __CONCAT(x,y) 00430 00431 00432 /* 00433 * The section below handles the external lib event registration 00434 * according to the desired events it specified in its API header file. 00435 * The external lib should be first installed by the user (see user.h) 00436 */ 00437 #ifdef SL_EXT_LIB_1 00438 00439 /* General Event Registration */ 00440 #if __CONCAT2(SL_EXT_LIB_1, _NOTIFY_GENERAL_EVENT) 00441 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_1, _GeneralEventHdl) (SlDeviceEvent_t *); 00442 #define SlExtLib1GeneralEventHandler __CONCAT2(SL_EXT_LIB_1, _GeneralEventHdl) 00443 00444 #undef EXT_LIB_REGISTERED_GENERAL_EVENTS 00445 #define EXT_LIB_REGISTERED_GENERAL_EVENTS 00446 #endif 00447 00448 /* Wlan Event Registration */ 00449 #if __CONCAT2(SL_EXT_LIB_1, _NOTIFY_WLAN_EVENT) 00450 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_1, _WlanEventHdl) (SlWlanEvent_t *); 00451 #define SlExtLib1WlanEventHandler __CONCAT2(SL_EXT_LIB_1, _WlanEventHdl) 00452 00453 #undef EXT_LIB_REGISTERED_WLAN_EVENTS 00454 #define EXT_LIB_REGISTERED_WLAN_EVENTS 00455 #endif 00456 00457 /* NetApp Event Registration */ 00458 #if __CONCAT2(SL_EXT_LIB_1, _NOTIFY_NETAPP_EVENT) 00459 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_1, _NetAppEventHdl) (SlNetAppEvent_t *); 00460 #define SlExtLib1NetAppEventHandler __CONCAT2(SL_EXT_LIB_1, _NetAppEventHdl) 00461 00462 #undef EXT_LIB_REGISTERED_NETAPP_EVENTS 00463 #define EXT_LIB_REGISTERED_NETAPP_EVENTS 00464 #endif 00465 00466 /* Http Server Event Registration */ 00467 #if __CONCAT2(SL_EXT_LIB_1, _NOTIFY_HTTP_SERVER_EVENT) 00468 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_1, _HttpServerEventHdl) (SlHttpServerEvent_t* , SlHttpServerResponse_t*); 00469 #define SlExtLib1HttpServerEventHandler __CONCAT2(SL_EXT_LIB_1, _HttpServerEventHdl) 00470 00471 #undef EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS 00472 #define EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS 00473 #endif 00474 00475 /* Socket Event Registration */ 00476 #if __CONCAT2(SL_EXT_LIB_1, _NOTIFY_SOCK_EVENT) 00477 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_1, _SockEventHdl) (SlSockEvent_t *); 00478 #define SlExtLib1SockEventHandler __CONCAT2(SL_EXT_LIB_1, _SockEventHdl) 00479 00480 #undef EXT_LIB_REGISTERED_SOCK_EVENTS 00481 #define EXT_LIB_REGISTERED_SOCK_EVENTS 00482 #endif 00483 00484 #endif 00485 00486 00487 #ifdef SL_EXT_LIB_2 00488 00489 /* General Event Registration */ 00490 #if __CONCAT2(SL_EXT_LIB_2, _NOTIFY_GENERAL_EVENT) 00491 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_2, _GeneralEventHdl) (SlDeviceEvent_t *); 00492 #define SlExtLib2GeneralEventHandler __CONCAT2(SL_EXT_LIB_2, _GeneralEventHdl) 00493 00494 #undef EXT_LIB_REGISTERED_GENERAL_EVENTS 00495 #define EXT_LIB_REGISTERED_GENERAL_EVENTS 00496 #endif 00497 00498 /* Wlan Event Registration */ 00499 #if __CONCAT2(SL_EXT_LIB_2, _NOTIFY_WLAN_EVENT) 00500 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_2, _WlanEventHdl) (SlWlanEvent_t *); 00501 #define SlExtLib2WlanEventHandler __CONCAT2(SL_EXT_LIB_2, _WlanEventHdl) 00502 00503 #undef EXT_LIB_REGISTERED_WLAN_EVENTS 00504 #define EXT_LIB_REGISTERED_WLAN_EVENTS 00505 #endif 00506 00507 /* NetApp Event Registration */ 00508 #if __CONCAT2(SL_EXT_LIB_2, _NOTIFY_NETAPP_EVENT) 00509 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_2, _NetAppEventHdl) (SlNetAppEvent_t *); 00510 #define SlExtLib2NetAppEventHandler __CONCAT2(SL_EXT_LIB_2, _NetAppEventHdl) 00511 00512 #undef EXT_LIB_REGISTERED_NETAPP_EVENTS 00513 #define EXT_LIB_REGISTERED_NETAPP_EVENTS 00514 #endif 00515 00516 /* Http Server Event Registration */ 00517 #if __CONCAT2(SL_EXT_LIB_2, _NOTIFY_HTTP_SERVER_EVENT) 00518 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_2, _HttpServerEventHdl) (SlHttpServerEvent_t* , SlHttpServerResponse_t*); 00519 #define SlExtLib2HttpServerEventHandler __CONCAT2(SL_EXT_LIB_2, _HttpServerEventHdl) 00520 00521 #undef EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS 00522 #define EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS 00523 #endif 00524 00525 /* Socket Event Registration */ 00526 #if __CONCAT2(SL_EXT_LIB_2, _NOTIFY_SOCK_EVENT) 00527 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_2, _SockEventHdl) (SlSockEvent_t *); 00528 #define SlExtLib2SockEventHandler __CONCAT2(SL_EXT_LIB_2, _SockEventHdl) 00529 00530 #undef EXT_LIB_REGISTERED_SOCK_EVENTS 00531 #define EXT_LIB_REGISTERED_SOCK_EVENTS 00532 #endif 00533 00534 #endif 00535 00536 00537 #ifdef SL_EXT_LIB_3 00538 00539 /* General Event Registration */ 00540 #if __CONCAT2(SL_EXT_LIB_3, _NOTIFY_GENERAL_EVENT) 00541 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_3, _GeneralEventHdl) (SlDeviceEvent_t *); 00542 #define SlExtLib3GeneralEventHandler __CONCAT2(SL_EXT_LIB_3, _GeneralEventHdl) 00543 00544 #undef EXT_LIB_REGISTERED_GENERAL_EVENTS 00545 #define EXT_LIB_REGISTERED_GENERAL_EVENTS 00546 #endif 00547 00548 /* Wlan Event Registration */ 00549 #if __CONCAT2(SL_EXT_LIB_3, _NOTIFY_WLAN_EVENT) 00550 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_3, _WlanEventHdl) (SlWlanEvent_t *); 00551 #define SlExtLib3WlanEventHandler __CONCAT2(SL_EXT_LIB_3, _WlanEventHdl) 00552 00553 #undef EXT_LIB_REGISTERED_WLAN_EVENTS 00554 #define EXT_LIB_REGISTERED_WLAN_EVENTS 00555 #endif 00556 00557 /* NetApp Event Registration */ 00558 #if __CONCAT2(SL_EXT_LIB_3, _NOTIFY_NETAPP_EVENT) 00559 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_3, _NetAppEventHdl) (SlNetAppEvent_t *); 00560 #define SlExtLib3NetAppEventHandler __CONCAT2(SL_EXT_LIB_3, _NetAppEventHdl) 00561 00562 #undef EXT_LIB_REGISTERED_NETAPP_EVENTS 00563 #define EXT_LIB_REGISTERED_NETAPP_EVENTS 00564 #endif 00565 00566 /* Http Server Event Registration */ 00567 #if __CONCAT2(SL_EXT_LIB_3, _NOTIFY_HTTP_SERVER_EVENT) 00568 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_3, _HttpServerEventHdl) (SlHttpServerEvent_t* , SlHttpServerResponse_t*); 00569 #define SlExtLib3HttpServerEventHandler __CONCAT2(SL_EXT_LIB_3, _HttpServerEventHdl) 00570 00571 #undef EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS 00572 #define EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS 00573 #endif 00574 00575 /* Socket Event Registration */ 00576 #if __CONCAT2(SL_EXT_LIB_3, _NOTIFY_SOCK_EVENT) 00577 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_3, _SockEventHdl) (SlSockEvent_t *); 00578 #define SlExtLib3SockEventHandler __CONCAT2(SL_EXT_LIB_3, _SockEventHdl) 00579 00580 #undef EXT_LIB_REGISTERED_SOCK_EVENTS 00581 #define EXT_LIB_REGISTERED_SOCK_EVENTS 00582 #endif 00583 00584 #endif 00585 00586 00587 #ifdef SL_EXT_LIB_4 00588 00589 /* General Event Registration */ 00590 #if __CONCAT2(SL_EXT_LIB_4, _NOTIFY_GENERAL_EVENT) 00591 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_4, _GeneralEventHdl) (SlDeviceEvent_t *); 00592 #define SlExtLib4GeneralEventHandler __CONCAT2(SL_EXT_LIB_4, _GeneralEventHdl) 00593 00594 #undef EXT_LIB_REGISTERED_GENERAL_EVENTS 00595 #define EXT_LIB_REGISTERED_GENERAL_EVENTS 00596 #endif 00597 00598 /* Wlan Event Registration */ 00599 #if __CONCAT2(SL_EXT_LIB_4, _NOTIFY_WLAN_EVENT) 00600 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_4, _WlanEventHdl) (SlWlanEvent_t *); 00601 #define SlExtLib4WlanEventHandler __CONCAT2(SL_EXT_LIB_4, _WlanEventHdl) 00602 00603 #undef EXT_LIB_REGISTERED_WLAN_EVENTS 00604 #define EXT_LIB_REGISTERED_WLAN_EVENTS 00605 #endif 00606 00607 /* NetApp Event Registration */ 00608 #if __CONCAT2(SL_EXT_LIB_4, _NOTIFY_NETAPP_EVENT) 00609 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_4, _NetAppEventHdl) (SlNetAppEvent_t *); 00610 #define SlExtLib4NetAppEventHandler __CONCAT2(SL_EXT_LIB_4, _NetAppEventHdl) 00611 00612 #undef EXT_LIB_REGISTERED_NETAPP_EVENTS 00613 #define EXT_LIB_REGISTERED_NETAPP_EVENTS 00614 #endif 00615 00616 /* Http Server Event Registration */ 00617 #if __CONCAT2(SL_EXT_LIB_4, _NOTIFY_HTTP_SERVER_EVENT) 00618 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_4, _HttpServerEventHdl) (SlHttpServerEvent_t* , SlHttpServerResponse_t*); 00619 #define SlExtLib4HttpServerEventHandler __CONCAT2(SL_EXT_LIB_4, _HttpServerEventHdl) 00620 00621 #undef EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS 00622 #define EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS 00623 #endif 00624 00625 /* Socket Event Registration */ 00626 #if __CONCAT2(SL_EXT_LIB_4, _NOTIFY_SOCK_EVENT) 00627 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_4, _SockEventHdl) (SlSockEvent_t *); 00628 #define SlExtLib4SockEventHandler __CONCAT2(SL_EXT_LIB_4, _SockEventHdl) 00629 00630 #undef EXT_LIB_REGISTERED_SOCK_EVENTS 00631 #define EXT_LIB_REGISTERED_SOCK_EVENTS 00632 #endif 00633 00634 #endif 00635 00636 00637 #ifdef SL_EXT_LIB_5 00638 00639 /* General Event Registration */ 00640 #if __CONCAT2(SL_EXT_LIB_5, _NOTIFY_GENERAL_EVENT) 00641 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_5, _GeneralEventHdl) (SlDeviceEvent_t *); 00642 #define SlExtLib5GeneralEventHandler __CONCAT2(SL_EXT_LIB_5, _GeneralEventHdl) 00643 00644 #undef EXT_LIB_REGISTERED_GENERAL_EVENTS 00645 #define EXT_LIB_REGISTERED_GENERAL_EVENTS 00646 #endif 00647 00648 /* Wlan Event Registration */ 00649 #if __CONCAT2(SL_EXT_LIB_5, _NOTIFY_WLAN_EVENT) 00650 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_5, _WlanEventHdl) (SlWlanEvent_t *); 00651 #define SlExtLib5WlanEventHandler __CONCAT2(SL_EXT_LIB_5, _WlanEventHdl) 00652 00653 #undef EXT_LIB_REGISTERED_WLAN_EVENTS 00654 #define EXT_LIB_REGISTERED_WLAN_EVENTS 00655 #endif 00656 00657 /* NetApp Event Registration */ 00658 #if __CONCAT2(SL_EXT_LIB_5, _NOTIFY_NETAPP_EVENT) 00659 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_5, _NetAppEventHdl) (SlNetAppEvent_t *); 00660 #define SlExtLib5NetAppEventHandler __CONCAT2(SL_EXT_LIB_5, _NetAppEventHdl) 00661 00662 #undef EXT_LIB_REGISTERED_NETAPP_EVENTS 00663 #define EXT_LIB_REGISTERED_NETAPP_EVENTS 00664 #endif 00665 00666 /* Http Server Event Registration */ 00667 #if __CONCAT2(SL_EXT_LIB_5, _NOTIFY_HTTP_SERVER_EVENT) 00668 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_5, _HttpServerEventHdl) (SlHttpServerEvent_t* , SlHttpServerResponse_t*); 00669 #define SlExtLib5HttpServerEventHandler __CONCAT2(SL_EXT_LIB_5, _HttpServerEventHdl) 00670 00671 #undef EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS 00672 #define EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS 00673 #endif 00674 00675 /* Socket Event Registration */ 00676 #if __CONCAT2(SL_EXT_LIB_5, _NOTIFY_SOCK_EVENT) 00677 extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_5, _SockEventHdl) (SlSockEvent_t *); 00678 #define SlExtLib5SockEventHandler __CONCAT2(SL_EXT_LIB_5, _SockEventHdl) 00679 00680 #undef EXT_LIB_REGISTERED_SOCK_EVENTS 00681 #define EXT_LIB_REGISTERED_SOCK_EVENTS 00682 #endif 00683 00684 #endif 00685 00686 00687 00688 #if defined(EXT_LIB_REGISTERED_GENERAL_EVENTS) 00689 void _SlDrvHandleGeneralEvents(SlDeviceEvent_t *slGeneralEvent); 00690 #endif 00691 00692 #if defined(EXT_LIB_REGISTERED_WLAN_EVENTS) 00693 void _SlDrvHandleWlanEvents(SlWlanEvent_t *slWlanEvent); 00694 #endif 00695 00696 #if defined (EXT_LIB_REGISTERED_NETAPP_EVENTS) 00697 void _SlDrvHandleNetAppEvents(SlNetAppEvent_t *slNetAppEvent); 00698 #endif 00699 00700 #if defined(EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS) 00701 void _SlDrvHandleHttpServerEvents(SlHttpServerEvent_t *slHttpServerEvent, SlHttpServerResponse_t *slHttpServerResponse); 00702 #endif 00703 00704 00705 #if defined(EXT_LIB_REGISTERED_SOCK_EVENTS) 00706 void _SlDrvHandleSockEvents(SlSockEvent_t *slSockEvent); 00707 #endif 00708 00709 #ifdef SL_PLATFORM_MULTI_THREADED 00710 #include "cc3100_spawn.h" 00711 #include "osi.h" 00712 #else 00713 #include "cc3100_nonos.h" 00714 #endif 00715 00716 namespace mbed_cc3100 { 00717 00718 /* Async functions description*/ 00719 00720 /*! 00721 \brief General async event for inspecting general events 00722 00723 \param[out] pSlDeviceEvent pointer to SlDeviceEvent_t 00724 00725 \par- <b>pSlDeviceEvent->Event = SL_DEVICE_FATAL_ERROR_EVENT </b> 00726 - pSlDeviceEvent->EventData.deviceEvent fields: 00727 - status: An error code indication from the device 00728 - sender: The sender originator which is based on SlErrorSender_e enum 00729 00730 - <b>pSlDeviceEvent->Event = SL_DEVICE_ABORT_ERROR_EVENT </b> 00731 Indicates a severe error occured and the device stopped 00732 - pSlDeviceEvent->EventData.deviceReport fields: 00733 - AbortType: An idication of the event type 00734 - AbortData: Additional info about the data error 00735 00736 00737 \par Example for fatal error: 00738 \code 00739 printf(General Event Handler - ID=%d Sender=%d\n\n", 00740 pSlDeviceEvent->EventData.deviceEvent.status, // status of the general event 00741 pSlDeviceEvent->EventData.deviceEvent.sender); // sender type 00742 \endcode 00743 \par Example for abort request: 00744 \code 00745 printf(Abort type =%d Abort Data=%d\n\n", 00746 pSlDeviceEvent->EventData.deviceReport.AbortType, 00747 pSlDeviceEvent->EventData.deviceReport.AbortData); 00748 00749 \endcode 00750 */ 00751 //#if (defined(sl_GeneralEvtHdlr)) 00752 //void sl_GeneralEvtHdlr(SlDeviceEvent_t *pSlDeviceEvent); 00753 //#endif 00754 00755 00756 /*! 00757 \brief WLAN Async event handler 00758 00759 \param[out] pSlWlanEvent pointer to SlWlanEvent_t data 00760 00761 \par 00762 Parameters: 00763 00764 - <b>pSlWlanEvent->Event = SL_WLAN_CONNECT_EVENT </b>, STA or P2P client connection indication event 00765 - pSlWlanEvent->EventData.STAandP2PModeWlanConnected main fields: 00766 - ssid_name 00767 - ssid_len 00768 - bssid 00769 - go_peer_device_name 00770 - go_peer_device_name_len 00771 00772 - <b>pSlWlanEvent->Event = SL_WLAN_DISCONNECT_EVENT </b>, STA or P2P client disconnection event 00773 - pSlWlanEvent->EventData.STAandP2PModeDisconnected main fields: 00774 - ssid_name 00775 - ssid_len 00776 - reason_code 00777 00778 - <b>pSlWlanEvent->Event = SL_WLAN_STA_CONNECTED_EVENT </b>, AP/P2P(Go) connected STA/P2P(Client) 00779 - pSlWlanEvent->EventData.APModeStaConnected fields: 00780 - go_peer_device_name 00781 - mac 00782 - go_peer_device_name_len 00783 - wps_dev_password_id 00784 - own_ssid: relevant for event sta-connected only 00785 - own_ssid_len: relevant for event sta-connected only 00786 00787 - <b>pSlWlanEvent->Event = SL_WLAN_STA_DISCONNECTED_EVENT </b>, AP/P2P(Go) disconnected STA/P2P(Client) 00788 - pSlWlanEvent->EventData.APModestaDisconnected fields: 00789 - go_peer_device_name 00790 - mac 00791 - go_peer_device_name_len 00792 - wps_dev_password_id 00793 - own_ssid: relevant for event sta-connected only 00794 - own_ssid_len: relevant for event sta-connected only 00795 00796 - <b>pSlWlanEvent->Event = SL_WLAN_SMART_CONFIG_COMPLETE_EVENT </b> 00797 - pSlWlanEvent->EventData.smartConfigStartResponse fields: 00798 - status 00799 - ssid_len 00800 - ssid 00801 - private_token_len 00802 - private_token 00803 00804 - <b>pSlWlanEvent->Event = SL_WLAN_SMART_CONFIG_STOP_EVENT </b> 00805 - pSlWlanEvent->EventData.smartConfigStopResponse fields: 00806 - status 00807 00808 - <b>pSlWlanEvent->Event = SL_WLAN_P2P_DEV_FOUND_EVENT </b> 00809 - pSlWlanEvent->EventData.P2PModeDevFound fields: 00810 - go_peer_device_name 00811 - mac 00812 - go_peer_device_name_len 00813 - wps_dev_password_id 00814 - own_ssid: relevant for event sta-connected only 00815 - own_ssid_len: relevant for event sta-connected only 00816 00817 - <b>pSlWlanEvent->Event = SL_WLAN_P2P_NEG_REQ_RECEIVED_EVENT </b> 00818 - pSlWlanEvent->EventData.P2PModeNegReqReceived fields 00819 - go_peer_device_name 00820 - mac 00821 - go_peer_device_name_len 00822 - wps_dev_password_id 00823 - own_ssid: relevant for event sta-connected only 00824 00825 - <b>pSlWlanEvent->Event = SL_WLAN_CONNECTION_FAILED_EVENT </b>, P2P only 00826 - pSlWlanEvent->EventData.P2PModewlanConnectionFailure fields: 00827 - status 00828 */ 00829 //#if (defined(sl_WlanEvtHdlr)) 00830 //void sl_WlanEvtHdlr(SlWlanEvent_t *pSlWlanEvent); 00831 //#endif 00832 00833 00834 /*! 00835 \brief NETAPP Async event handler 00836 00837 \param[out] pSlNetApp pointer to SlNetAppEvent_t data 00838 00839 \par 00840 Parameters: 00841 - <b>pSlNetApp->Event = SL_NETAPP_IPV4_IPACQUIRED_EVENT</b>, IPV4 acquired event 00842 - pSlNetApp->EventData.ipAcquiredV4 fields: 00843 - ip 00844 - gateway 00845 - dns 00846 00847 - <b>pSlNetApp->Event = SL_NETAPP_IP_LEASED_EVENT</b>, AP or P2P go dhcp lease event 00848 - pSlNetApp->EventData.ipLeased fields: 00849 - ip_address 00850 - lease_time 00851 - mac 00852 00853 - <b>pSlNetApp->Event = SL_NETAPP_IP_RELEASED_EVENT</b>, AP or P2P go dhcp ip release event 00854 - pSlNetApp->EventData.ipReleased fields 00855 - ip_address 00856 - mac 00857 - reason 00858 00859 */ 00860 //#if (defined(sl_NetAppEvtHdlr)) 00861 //void sl_NetAppEvtHdlr(SlNetAppEvent_t *pSlNetApp); 00862 //#endif 00863 00864 /*! 00865 \brief Socket Async event handler 00866 00867 \param[out] pSlSockEvent pointer to SlSockEvent_t data 00868 00869 \par 00870 Parameters:\n 00871 - <b>pSlSockEvent->Event = SL_SOCKET_TX_FAILED_EVENT</b> 00872 - pSlSockEvent->SockTxFailData fields: 00873 - sd 00874 - status 00875 - <b>pSlSockEvent->Event = SL_SOCKET_ASYNC_EVENT</b> 00876 - pSlSockEvent->SockAsyncData fields: 00877 - sd 00878 - type: SSL_ACCEPT or RX_FRAGMENTATION_TOO_BIG or OTHER_SIDE_CLOSE_SSL_DATA_NOT_ENCRYPTED 00879 - val 00880 00881 */ 00882 //#if (defined(sl_SockEvtHdlr)) 00883 //void sl_SockEvtHdlr(SlSockEvent_t *pSlSockEvent); 00884 //#endif 00885 00886 /*! 00887 \brief HTTP server async event 00888 00889 \param[out] pSlHttpServerEvent pointer to SlHttpServerEvent_t 00890 \param[in] pSlHttpServerResponse pointer to SlHttpServerResponse_t 00891 00892 \par 00893 Parameters: \n 00894 00895 - <b>pSlHttpServerEvent->Event = SL_NETAPP_HTTPGETTOKENVALUE_EVENT</b> 00896 - pSlHttpServerEvent->EventData fields: 00897 - httpTokenName 00898 - data 00899 - len 00900 - pSlHttpServerResponse->ResponseData fields: 00901 - data 00902 - len 00903 00904 - <b>pSlHttpServerEvent->Event = SL_NETAPP_HTTPPOSTTOKENVALUE_EVENT</b> 00905 - pSlHttpServerEvent->EventData.httpPostData fields: 00906 - action 00907 - token_name 00908 - token_value 00909 - pSlHttpServerResponse->ResponseData fields: 00910 - data 00911 - len 00912 00913 */ 00914 //#if (defined(sl_HttpServerCallback)) 00915 //void sl_HttpServerCallback(SlHttpServerEvent_t *pSlHttpServerEvent, SlHttpServerResponse_t *pSlHttpServerResponse); 00916 //#endif 00917 /*! 00918 00919 Close the Doxygen group. 00920 @} 00921 00922 */ 00923 00924 }//namespace mbed_cc3100 00925 00926 #endif /* __SIMPLELINK_H__ */ 00927 00928
Generated on Tue Jul 12 2022 22:22:38 by 1.7.2