Updated to use external spawn.

Fork of simplelink_V2 by David Fletcher

Committer:
dflet
Date:
Sat Jun 06 13:48:29 2015 +0000
Revision:
1:9b68e650b3f6
Parent:
0:1a07906111ec
Oppps

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dflet 0:1a07906111ec 1 /*
dflet 0:1a07906111ec 2 * - CC31xx/CC32xx Host Driver Implementation
dflet 0:1a07906111ec 3 *
dflet 0:1a07906111ec 4 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
dflet 0:1a07906111ec 5 *
dflet 0:1a07906111ec 6 *
dflet 0:1a07906111ec 7 * Redistribution and use in source and binary forms, with or without
dflet 0:1a07906111ec 8 * modification, are permitted provided that the following conditions
dflet 0:1a07906111ec 9 * are met:
dflet 0:1a07906111ec 10 *
dflet 0:1a07906111ec 11 * Redistributions of source code must retain the above copyright
dflet 0:1a07906111ec 12 * notice, this list of conditions and the following disclaimer.
dflet 0:1a07906111ec 13 *
dflet 0:1a07906111ec 14 * Redistributions in binary form must reproduce the above copyright
dflet 0:1a07906111ec 15 * notice, this list of conditions and the following disclaimer in the
dflet 0:1a07906111ec 16 * documentation and/or other materials provided with the
dflet 0:1a07906111ec 17 * distribution.
dflet 0:1a07906111ec 18 *
dflet 0:1a07906111ec 19 * Neither the name of Texas Instruments Incorporated nor the names of
dflet 0:1a07906111ec 20 * its contributors may be used to endorse or promote products derived
dflet 0:1a07906111ec 21 * from this software without specific prior written permission.
dflet 0:1a07906111ec 22 *
dflet 0:1a07906111ec 23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
dflet 0:1a07906111ec 24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
dflet 0:1a07906111ec 25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
dflet 0:1a07906111ec 26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
dflet 0:1a07906111ec 27 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
dflet 0:1a07906111ec 28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
dflet 0:1a07906111ec 29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
dflet 0:1a07906111ec 30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
dflet 0:1a07906111ec 31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
dflet 0:1a07906111ec 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
dflet 0:1a07906111ec 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
dflet 0:1a07906111ec 34 *
dflet 0:1a07906111ec 35 */
dflet 0:1a07906111ec 36
dflet 0:1a07906111ec 37 #ifndef fPtr_func_h
dflet 0:1a07906111ec 38 #define fPtr_func_h
dflet 0:1a07906111ec 39
dflet 0:1a07906111ec 40 #include "simplelink_V2/cc3100_simplelink.h"
dflet 0:1a07906111ec 41
dflet 0:1a07906111ec 42
dflet 0:1a07906111ec 43 /* Note. C function pointers point to the functions below. */
dflet 0:1a07906111ec 44 /* C++ member function pointers not used ? */
dflet 0:1a07906111ec 45
dflet 0:1a07906111ec 46 namespace mbed_cc3100 {
dflet 0:1a07906111ec 47
dflet 0:1a07906111ec 48
dflet 0:1a07906111ec 49 extern uint32_t g_PingPacketsRecv;
dflet 0:1a07906111ec 50 extern uint32_t g_GatewayIP;
dflet 0:1a07906111ec 51 extern uint32_t g_StationIP;
dflet 0:1a07906111ec 52 extern uint32_t g_DestinationIP;
dflet 0:1a07906111ec 53 extern uint32_t g_BytesReceived; // variable to store the file size
dflet 0:1a07906111ec 54 extern uint32_t g_Status;
dflet 0:1a07906111ec 55 extern uint8_t g_buff[MAX_BUFF_SIZE+1];
dflet 0:1a07906111ec 56 extern int32_t g_SockID;
dflet 0:1a07906111ec 57
dflet 0:1a07906111ec 58 }//namespace mbed_cc3100
dflet 0:1a07906111ec 59
dflet 0:1a07906111ec 60 using namespace mbed_cc3100;
dflet 0:1a07906111ec 61
dflet 0:1a07906111ec 62 #ifdef __cplusplus
dflet 0:1a07906111ec 63 extern "C" {
dflet 0:1a07906111ec 64 #endif
dflet 0:1a07906111ec 65
dflet 0:1a07906111ec 66
dflet 0:1a07906111ec 67 void SimpleLinkPingReport(SlPingReport_t *pPingReport);
dflet 0:1a07906111ec 68
dflet 0:1a07906111ec 69 /*!
dflet 0:1a07906111ec 70 \brief WLAN Async event handler
dflet 0:1a07906111ec 71
dflet 0:1a07906111ec 72 \param[out] pSlWlanEvent pointer to SlWlanEvent_t data
dflet 0:1a07906111ec 73
dflet 0:1a07906111ec 74 \par
dflet 0:1a07906111ec 75 Parameters:
dflet 0:1a07906111ec 76
dflet 0:1a07906111ec 77 - <b>pSlWlanEvent->Event = SL_WLAN_CONNECT_EVENT </b>, STA or P2P client connection indication event
dflet 0:1a07906111ec 78 - pSlWlanEvent->EventData.STAandP2PModeWlanConnected main fields:
dflet 0:1a07906111ec 79 - ssid_name
dflet 0:1a07906111ec 80 - ssid_len
dflet 0:1a07906111ec 81 - bssid
dflet 0:1a07906111ec 82 - go_peer_device_name
dflet 0:1a07906111ec 83 - go_peer_device_name_len
dflet 0:1a07906111ec 84
dflet 0:1a07906111ec 85 - <b>pSlWlanEvent->Event = SL_WLAN_DISCONNECT_EVENT </b>, STA or P2P client disconnection event
dflet 0:1a07906111ec 86 - pSlWlanEvent->EventData.STAandP2PModeDisconnected main fields:
dflet 0:1a07906111ec 87 - ssid_name
dflet 0:1a07906111ec 88 - ssid_len
dflet 0:1a07906111ec 89 - reason_code
dflet 0:1a07906111ec 90
dflet 0:1a07906111ec 91 - <b>pSlWlanEvent->Event = SL_WLAN_STA_CONNECTED_EVENT </b>, AP/P2P(Go) connected STA/P2P(Client)
dflet 0:1a07906111ec 92 - pSlWlanEvent->EventData.APModeStaConnected fields:
dflet 0:1a07906111ec 93 - go_peer_device_name
dflet 0:1a07906111ec 94 - mac
dflet 0:1a07906111ec 95 - go_peer_device_name_len
dflet 0:1a07906111ec 96 - wps_dev_password_id
dflet 0:1a07906111ec 97 - own_ssid: relevant for event sta-connected only
dflet 0:1a07906111ec 98 - own_ssid_len: relevant for event sta-connected only
dflet 0:1a07906111ec 99
dflet 0:1a07906111ec 100 - <b>pSlWlanEvent->Event = SL_WLAN_STA_DISCONNECTED_EVENT </b>, AP/P2P(Go) disconnected STA/P2P(Client)
dflet 0:1a07906111ec 101 - pSlWlanEvent->EventData.APModestaDisconnected fields:
dflet 0:1a07906111ec 102 - go_peer_device_name
dflet 0:1a07906111ec 103 - mac
dflet 0:1a07906111ec 104 - go_peer_device_name_len
dflet 0:1a07906111ec 105 - wps_dev_password_id
dflet 0:1a07906111ec 106 - own_ssid: relevant for event sta-connected only
dflet 0:1a07906111ec 107 - own_ssid_len: relevant for event sta-connected only
dflet 0:1a07906111ec 108
dflet 0:1a07906111ec 109 - <b>pSlWlanEvent->Event = SL_WLAN_SMART_CONFIG_COMPLETE_EVENT </b>
dflet 0:1a07906111ec 110 - pSlWlanEvent->EventData.smartConfigStartResponse fields:
dflet 0:1a07906111ec 111 - status
dflet 0:1a07906111ec 112 - ssid_len
dflet 0:1a07906111ec 113 - ssid
dflet 0:1a07906111ec 114 - private_token_len
dflet 0:1a07906111ec 115 - private_token
dflet 0:1a07906111ec 116
dflet 0:1a07906111ec 117 - <b>pSlWlanEvent->Event = SL_WLAN_SMART_CONFIG_STOP_EVENT </b>
dflet 0:1a07906111ec 118 - pSlWlanEvent->EventData.smartConfigStopResponse fields:
dflet 0:1a07906111ec 119 - status
dflet 0:1a07906111ec 120
dflet 0:1a07906111ec 121 - <b>pSlWlanEvent->Event = SL_WLAN_P2P_DEV_FOUND_EVENT </b>
dflet 0:1a07906111ec 122 - pSlWlanEvent->EventData.P2PModeDevFound fields:
dflet 0:1a07906111ec 123 - go_peer_device_name
dflet 0:1a07906111ec 124 - mac
dflet 0:1a07906111ec 125 - go_peer_device_name_len
dflet 0:1a07906111ec 126 - wps_dev_password_id
dflet 0:1a07906111ec 127 - own_ssid: relevant for event sta-connected only
dflet 0:1a07906111ec 128 - own_ssid_len: relevant for event sta-connected only
dflet 0:1a07906111ec 129
dflet 0:1a07906111ec 130 - <b>pSlWlanEvent->Event = SL_WLAN_P2P_NEG_REQ_RECEIVED_EVENT </b>
dflet 0:1a07906111ec 131 - pSlWlanEvent->EventData.P2PModeNegReqReceived fields
dflet 0:1a07906111ec 132 - go_peer_device_name
dflet 0:1a07906111ec 133 - mac
dflet 0:1a07906111ec 134 - go_peer_device_name_len
dflet 0:1a07906111ec 135 - wps_dev_password_id
dflet 0:1a07906111ec 136 - own_ssid: relevant for event sta-connected only
dflet 0:1a07906111ec 137
dflet 0:1a07906111ec 138 - <b>pSlWlanEvent->Event = SL_WLAN_CONNECTION_FAILED_EVENT </b>, P2P only
dflet 0:1a07906111ec 139 - pSlWlanEvent->EventData.P2PModewlanConnectionFailure fields:
dflet 0:1a07906111ec 140 - status
dflet 0:1a07906111ec 141 */
dflet 0:1a07906111ec 142 #if (defined(sl_WlanEvtHdlr))
dflet 0:1a07906111ec 143 void SimpleLinkWlanEventHandler(SlWlanEvent_t *pWlanEvent);
dflet 0:1a07906111ec 144 #endif
dflet 0:1a07906111ec 145
dflet 0:1a07906111ec 146 /*!
dflet 0:1a07906111ec 147 \brief NETAPP Async event handler
dflet 0:1a07906111ec 148
dflet 0:1a07906111ec 149 \param[out] pSlNetApp pointer to SlNetAppEvent_t data
dflet 0:1a07906111ec 150
dflet 0:1a07906111ec 151 \par
dflet 0:1a07906111ec 152 Parameters:
dflet 0:1a07906111ec 153 - <b>pSlWlanEvent->Event = SL_NETAPP_IPV4_IPACQUIRED_EVENT</b>, IPV4 acquired event
dflet 0:1a07906111ec 154 - pSlWlanEvent->EventData.ipAcquiredV4 fields:
dflet 0:1a07906111ec 155 - ip
dflet 0:1a07906111ec 156 - gateway
dflet 0:1a07906111ec 157 - dns
dflet 0:1a07906111ec 158
dflet 0:1a07906111ec 159 - <b>pSlWlanEvent->Event = SL_NETAPP_IP_LEASED_EVENT</b>, AP or P2P go dhcp lease event
dflet 0:1a07906111ec 160 - pSlWlanEvent->EventData.ipLeased fields:
dflet 0:1a07906111ec 161 - ip_address
dflet 0:1a07906111ec 162 - lease_time
dflet 0:1a07906111ec 163 - mac
dflet 0:1a07906111ec 164
dflet 0:1a07906111ec 165 - <b>pSlWlanEvent->Event = SL_NETAPP_IP_RELEASED_EVENT</b>, AP or P2P go dhcp ip release event
dflet 0:1a07906111ec 166 - pSlWlanEvent->EventData.ipReleased fields
dflet 0:1a07906111ec 167 - ip_address
dflet 0:1a07906111ec 168 - mac
dflet 0:1a07906111ec 169 - reason
dflet 0:1a07906111ec 170
dflet 0:1a07906111ec 171 */
dflet 0:1a07906111ec 172 #if (defined(sl_NetAppEvtHdlr))
dflet 0:1a07906111ec 173 void SimpleLinkNetAppEventHandler(SlNetAppEvent_t *pNetAppEvent);
dflet 0:1a07906111ec 174 #endif
dflet 0:1a07906111ec 175
dflet 0:1a07906111ec 176 /*!
dflet 0:1a07906111ec 177 \brief Socket Async event handler
dflet 0:1a07906111ec 178
dflet 0:1a07906111ec 179 \param[out] pSlSockEvent pointer to SlSockEvent_t data
dflet 0:1a07906111ec 180
dflet 0:1a07906111ec 181 \par
dflet 0:1a07906111ec 182 Parameters:\n
dflet 0:1a07906111ec 183 - <b>pSlSockEvent->Event = SL_SOCKET_TX_FAILED_EVENT</b>
dflet 0:1a07906111ec 184 - pSlSockEvent->EventData fields:
dflet 0:1a07906111ec 185 - sd
dflet 0:1a07906111ec 186 - status
dflet 0:1a07906111ec 187 - <b>pSlSockEvent->Event = SL_SOCKET_ASYNC_EVENT</b>
dflet 0:1a07906111ec 188 - pSlSockEvent->EventData fields:
dflet 0:1a07906111ec 189 - sd
dflet 0:1a07906111ec 190 - type: SSL_ACCEPT or RX_FRAGMENTATION_TOO_BIG or OTHER_SIDE_CLOSE_SSL_DATA_NOT_ENCRYPTED
dflet 0:1a07906111ec 191 - val
dflet 0:1a07906111ec 192
dflet 0:1a07906111ec 193 */
dflet 0:1a07906111ec 194 #if (defined(sl_SockEvtHdlr))
dflet 0:1a07906111ec 195 void SimpleLinkSockEventHandler(SlSockEvent_t *pSock);
dflet 0:1a07906111ec 196 #endif
dflet 0:1a07906111ec 197
dflet 0:1a07906111ec 198 void SimpleLinkGeneralEventHandler(SlDeviceEvent_t *pDevEvent);
dflet 0:1a07906111ec 199
dflet 0:1a07906111ec 200 void SimpleLinkHttpServerCallback(SlHttpServerEvent_t *pHttpEvent, SlHttpServerResponse_t *pHttpResponse);
dflet 0:1a07906111ec 201 #ifndef SL_TINY_EXT
dflet 0:1a07906111ec 202 void _sl_HandleAsync_Accept(void *pVoidBuf);
dflet 0:1a07906111ec 203
dflet 0:1a07906111ec 204 void _sl_HandleAsync_Select(void *pVoidBuf);
dflet 0:1a07906111ec 205
dflet 0:1a07906111ec 206 void _sl_HandleAsync_DnsGetHostByService(void *pVoidBuf);
dflet 0:1a07906111ec 207
dflet 0:1a07906111ec 208 void _sl_HandleAsync_PingResponse(void *pVoidBuf);
dflet 0:1a07906111ec 209 #endif
dflet 0:1a07906111ec 210 void _sl_HandleAsync_Connect(void *pVoidBuf);
dflet 0:1a07906111ec 211
dflet 0:1a07906111ec 212 void _sl_HandleAsync_DnsGetHostByName(void *pVoidBuf);
dflet 0:1a07906111ec 213
dflet 0:1a07906111ec 214 void _sl_HandleAsync_Stop(void *pVoidBuf);
dflet 0:1a07906111ec 215
dflet 0:1a07906111ec 216 _SlReturnVal_t _SlDrvMsgReadSpawnCtx(void *pValue);
dflet 0:1a07906111ec 217
dflet 0:1a07906111ec 218 void _SlDrvDeviceEventHandler(void *pArgs);
dflet 0:1a07906111ec 219
dflet 0:1a07906111ec 220 void _SlDrvNetAppEventHandler(void *pArgs);
dflet 0:1a07906111ec 221
dflet 0:1a07906111ec 222 void _SlDrvHandleHttpServerEvents(SlHttpServerEvent_t *slHttpServerEvent, SlHttpServerResponse_t *slHttpServerResponse);
dflet 0:1a07906111ec 223 void _SlDrvHandleSockEvents(SlSockEvent_t *slSockEvent);
dflet 0:1a07906111ec 224 void _SlDrvHandleNetAppEvents(SlNetAppEvent_t *slNetAppEvent);
dflet 0:1a07906111ec 225 void _SlDrvHandleWlanEvents(SlWlanEvent_t *slWlanEvent);
dflet 0:1a07906111ec 226 void _SlDrvHandleGeneralEvents(SlDeviceEvent_t *slGeneralEvent);
dflet 0:1a07906111ec 227
dflet 0:1a07906111ec 228 #ifdef __cplusplus
dflet 0:1a07906111ec 229 }
dflet 0:1a07906111ec 230 #endif /* __cplusplus */
dflet 0:1a07906111ec 231
dflet 0:1a07906111ec 232 //}//namespace mbed_cc3100
dflet 0:1a07906111ec 233
dflet 0:1a07906111ec 234 #endif//fPtr_func_h
dflet 0:1a07906111ec 235
dflet 0:1a07906111ec 236
dflet 0:1a07906111ec 237
dflet 0:1a07906111ec 238
dflet 0:1a07906111ec 239
dflet 0:1a07906111ec 240
dflet 0:1a07906111ec 241