None

Fork of cc3000_hostdriver_mbedsocket by Martin Kojtal

Committer:
Kojto
Date:
Thu Sep 19 07:55:14 2013 +0000
Revision:
0:615c697c33b0
Child:
14:28c8bbbea025
initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 0:615c697c33b0 1 /*****************************************************************************
Kojto 0:615c697c33b0 2 *
Kojto 0:615c697c33b0 3 * C++ interface/implementation created by Martin Kojtal (0xc0170). Thanks to
Kojto 0:615c697c33b0 4 * Jim Carver and Frank Vannieuwkerke for their inital cc3000 mbed port and
Kojto 0:615c697c33b0 5 * provided help.
Kojto 0:615c697c33b0 6 *
Kojto 0:615c697c33b0 7 * This version of "host driver" uses CC3000 Host Driver Implementation. Thus
Kojto 0:615c697c33b0 8 * read the following copyright:
Kojto 0:615c697c33b0 9 *
Kojto 0:615c697c33b0 10 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
Kojto 0:615c697c33b0 11 *
Kojto 0:615c697c33b0 12 * Redistribution and use in source and binary forms, with or without
Kojto 0:615c697c33b0 13 * modification, are permitted provided that the following conditions
Kojto 0:615c697c33b0 14 * are met:
Kojto 0:615c697c33b0 15 *
Kojto 0:615c697c33b0 16 * Redistributions of source code must retain the above copyright
Kojto 0:615c697c33b0 17 * notice, this list of conditions and the following disclaimer.
Kojto 0:615c697c33b0 18 *
Kojto 0:615c697c33b0 19 * Redistributions in binary form must reproduce the above copyright
Kojto 0:615c697c33b0 20 * notice, this list of conditions and the following disclaimer in the
Kojto 0:615c697c33b0 21 * documentation and/or other materials provided with the
Kojto 0:615c697c33b0 22 * distribution.
Kojto 0:615c697c33b0 23 *
Kojto 0:615c697c33b0 24 * Neither the name of Texas Instruments Incorporated nor the names of
Kojto 0:615c697c33b0 25 * its contributors may be used to endorse or promote products derived
Kojto 0:615c697c33b0 26 * from this software without specific prior written permission.
Kojto 0:615c697c33b0 27 *
Kojto 0:615c697c33b0 28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Kojto 0:615c697c33b0 29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Kojto 0:615c697c33b0 30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
Kojto 0:615c697c33b0 31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
Kojto 0:615c697c33b0 32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
Kojto 0:615c697c33b0 33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
Kojto 0:615c697c33b0 34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
Kojto 0:615c697c33b0 35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
Kojto 0:615c697c33b0 36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
Kojto 0:615c697c33b0 37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 0:615c697c33b0 38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 0:615c697c33b0 39 *
Kojto 0:615c697c33b0 40 *****************************************************************************/
Kojto 0:615c697c33b0 41 #include "cc3000.h"
Kojto 0:615c697c33b0 42 #include "cc3000_event.h"
Kojto 0:615c697c33b0 43 #include "cc3000_netapp.h"
Kojto 0:615c697c33b0 44
Kojto 0:615c697c33b0 45 namespace mbed_cc3000 {
Kojto 0:615c697c33b0 46
Kojto 0:615c697c33b0 47 cc3000_event::cc3000_event(cc3000_simple_link &simplelink, cc3000_hci &hci, cc3000_spi &spi, cc3000 &cc3000)
Kojto 0:615c697c33b0 48 : socket_active_status(SOCKET_STATUS_INIT_VAL), _simple_link(simplelink), _hci(hci), _spi(spi), _cc3000(cc3000) {
Kojto 0:615c697c33b0 49
Kojto 0:615c697c33b0 50 }
Kojto 0:615c697c33b0 51
Kojto 0:615c697c33b0 52 cc3000_event::~cc3000_event() {
Kojto 0:615c697c33b0 53
Kojto 0:615c697c33b0 54 }
Kojto 0:615c697c33b0 55
Kojto 0:615c697c33b0 56 /* TODO removed buffer, set it in init */
Kojto 0:615c697c33b0 57 void cc3000_event::received_handler(uint8_t *buffer) {
Kojto 0:615c697c33b0 58 _simple_link.set_data_received_flag(1);
Kojto 0:615c697c33b0 59 _simple_link.set_received_data(buffer);
Kojto 0:615c697c33b0 60
Kojto 0:615c697c33b0 61 hci_unsolicited_event_handler();
Kojto 0:615c697c33b0 62 }
Kojto 0:615c697c33b0 63
Kojto 0:615c697c33b0 64 void cc3000_event::hci_unsol_handle_patch_request(uint8_t *event_hdr) {
Kojto 0:615c697c33b0 65 uint8_t *params = (uint8_t *)(event_hdr) + HCI_EVENT_HEADER_SIZE;
Kojto 0:615c697c33b0 66 uint32_t length = 0;
Kojto 0:615c697c33b0 67 uint8_t *patch;
Kojto 0:615c697c33b0 68
Kojto 0:615c697c33b0 69 switch (*params)
Kojto 0:615c697c33b0 70 {
Kojto 0:615c697c33b0 71 case HCI_EVENT_PATCHES_DRV_REQ:
Kojto 0:615c697c33b0 72 {
Kojto 0:615c697c33b0 73 tDriverPatches func_pointer = (tDriverPatches)_simple_link.get_func_pointer(DRIVER_PATCHES);
Kojto 0:615c697c33b0 74 if (func_pointer)
Kojto 0:615c697c33b0 75 {
Kojto 0:615c697c33b0 76 patch = func_pointer(&length);
Kojto 0:615c697c33b0 77 if (patch)
Kojto 0:615c697c33b0 78 {
Kojto 0:615c697c33b0 79 _hci.patch_send(HCI_EVENT_PATCHES_DRV_REQ, _simple_link.get_transmit_buffer(), patch, length);
Kojto 0:615c697c33b0 80 return;
Kojto 0:615c697c33b0 81 }
Kojto 0:615c697c33b0 82 }
Kojto 0:615c697c33b0 83
Kojto 0:615c697c33b0 84 // Send 0 length Patches response event
Kojto 0:615c697c33b0 85 _hci.patch_send(HCI_EVENT_PATCHES_DRV_REQ, _simple_link.get_transmit_buffer(), 0, 0);
Kojto 0:615c697c33b0 86 break;
Kojto 0:615c697c33b0 87 }
Kojto 0:615c697c33b0 88 case HCI_EVENT_PATCHES_FW_REQ:
Kojto 0:615c697c33b0 89 {
Kojto 0:615c697c33b0 90 tFWPatches func_pointer = (tFWPatches)_simple_link.get_func_pointer(FW_PATCHES);
Kojto 0:615c697c33b0 91 if (func_pointer)
Kojto 0:615c697c33b0 92 {
Kojto 0:615c697c33b0 93 patch = func_pointer(&length);
Kojto 0:615c697c33b0 94 // Build and send a patch
Kojto 0:615c697c33b0 95 if (patch)
Kojto 0:615c697c33b0 96 {
Kojto 0:615c697c33b0 97 _hci.patch_send(HCI_EVENT_PATCHES_FW_REQ, _simple_link.get_transmit_buffer(), patch, length);
Kojto 0:615c697c33b0 98 return;
Kojto 0:615c697c33b0 99 }
Kojto 0:615c697c33b0 100 }
Kojto 0:615c697c33b0 101 // Send 0 length Patches response event
Kojto 0:615c697c33b0 102 _hci.patch_send(HCI_EVENT_PATCHES_FW_REQ, _simple_link.get_transmit_buffer(), 0, 0);
Kojto 0:615c697c33b0 103 break;
Kojto 0:615c697c33b0 104 }
Kojto 0:615c697c33b0 105 case HCI_EVENT_PATCHES_BOOTLOAD_REQ:
Kojto 0:615c697c33b0 106 {
Kojto 0:615c697c33b0 107 tBootLoaderPatches func_pointer = (tBootLoaderPatches)_simple_link.get_func_pointer(BOOTLOADER_PATCHES);
Kojto 0:615c697c33b0 108 if (func_pointer)
Kojto 0:615c697c33b0 109 {
Kojto 0:615c697c33b0 110 patch = func_pointer(&length);
Kojto 0:615c697c33b0 111 if (patch)
Kojto 0:615c697c33b0 112 {
Kojto 0:615c697c33b0 113 _hci.patch_send(HCI_EVENT_PATCHES_BOOTLOAD_REQ, _simple_link.get_transmit_buffer(), patch, length);
Kojto 0:615c697c33b0 114 return;
Kojto 0:615c697c33b0 115 }
Kojto 0:615c697c33b0 116 }
Kojto 0:615c697c33b0 117 // Send 0 length Patches response event
Kojto 0:615c697c33b0 118 _hci.patch_send(HCI_EVENT_PATCHES_BOOTLOAD_REQ, _simple_link.get_transmit_buffer(), 0, 0);
Kojto 0:615c697c33b0 119 break;
Kojto 0:615c697c33b0 120 }
Kojto 0:615c697c33b0 121 }
Kojto 0:615c697c33b0 122 }
Kojto 0:615c697c33b0 123
Kojto 0:615c697c33b0 124 uint8_t *cc3000_event::hci_event_handler(void *ret_param, uint8_t *from, uint8_t *fromlen) {
Kojto 0:615c697c33b0 125 uint8_t *received_data, argument_size;
Kojto 0:615c697c33b0 126 uint16_t length;
Kojto 0:615c697c33b0 127 uint8_t *pucReceivedParams;
Kojto 0:615c697c33b0 128 uint16_t received_op_code = 0;
Kojto 0:615c697c33b0 129 uint32_t return_value;
Kojto 0:615c697c33b0 130 uint8_t * RecvParams;
Kojto 0:615c697c33b0 131 uint8_t *RetParams;
Kojto 0:615c697c33b0 132
Kojto 0:615c697c33b0 133 while (1)
Kojto 0:615c697c33b0 134 {
Kojto 0:615c697c33b0 135 if (_simple_link.get_data_received_flag() != 0)
Kojto 0:615c697c33b0 136 {
Kojto 0:615c697c33b0 137 received_data = _simple_link.get_received_data();
Kojto 0:615c697c33b0 138 if (*received_data == HCI_TYPE_EVNT)
Kojto 0:615c697c33b0 139 {
Kojto 0:615c697c33b0 140 // Event Received
Kojto 0:615c697c33b0 141 STREAM_TO_UINT16((uint8_t *)received_data, HCI_EVENT_OPCODE_OFFSET,received_op_code);
Kojto 0:615c697c33b0 142 pucReceivedParams = received_data + HCI_EVENT_HEADER_SIZE;
Kojto 0:615c697c33b0 143 RecvParams = pucReceivedParams;
Kojto 0:615c697c33b0 144 RetParams = (uint8_t *)ret_param;
Kojto 0:615c697c33b0 145
Kojto 0:615c697c33b0 146 // unsolicited event received - finish handling
Kojto 0:615c697c33b0 147 if (hci_unsol_event_handler((uint8_t *)received_data) == 0)
Kojto 0:615c697c33b0 148 {
Kojto 0:615c697c33b0 149 STREAM_TO_UINT8(received_data, HCI_DATA_LENGTH_OFFSET, length);
Kojto 0:615c697c33b0 150
Kojto 0:615c697c33b0 151 switch(received_op_code)
Kojto 0:615c697c33b0 152 {
Kojto 0:615c697c33b0 153 case HCI_CMND_READ_BUFFER_SIZE:
Kojto 0:615c697c33b0 154 {
Kojto 0:615c697c33b0 155 uint16_t temp = _simple_link.get_number_free_buffers();
Kojto 0:615c697c33b0 156 STREAM_TO_UINT8((uint8_t *)pucReceivedParams, 0, temp);
Kojto 0:615c697c33b0 157 _simple_link.set_number_free_buffers(temp);
Kojto 0:615c697c33b0 158
Kojto 0:615c697c33b0 159 temp = _simple_link.get_buffer_length();
Kojto 0:615c697c33b0 160 STREAM_TO_UINT16((uint8_t *)pucReceivedParams, 1, temp);
Kojto 0:615c697c33b0 161 _simple_link.set_buffer_length(temp);
Kojto 0:615c697c33b0 162 }
Kojto 0:615c697c33b0 163 break;
Kojto 0:615c697c33b0 164
Kojto 0:615c697c33b0 165 case HCI_CMND_WLAN_CONFIGURE_PATCH:
Kojto 0:615c697c33b0 166 case HCI_NETAPP_DHCP:
Kojto 0:615c697c33b0 167 case HCI_NETAPP_PING_SEND:
Kojto 0:615c697c33b0 168 case HCI_NETAPP_PING_STOP:
Kojto 0:615c697c33b0 169 case HCI_NETAPP_ARP_FLUSH:
Kojto 0:615c697c33b0 170 case HCI_NETAPP_SET_DEBUG_LEVEL:
Kojto 0:615c697c33b0 171 case HCI_NETAPP_SET_TIMERS:
Kojto 0:615c697c33b0 172 case HCI_EVNT_NVMEM_READ:
Kojto 0:615c697c33b0 173 case HCI_EVNT_NVMEM_CREATE_ENTRY:
Kojto 0:615c697c33b0 174 case HCI_CMND_NVMEM_WRITE_PATCH:
Kojto 0:615c697c33b0 175 case HCI_NETAPP_PING_REPORT:
Kojto 0:615c697c33b0 176 case HCI_EVNT_MDNS_ADVERTISE:
Kojto 0:615c697c33b0 177
Kojto 0:615c697c33b0 178 STREAM_TO_UINT8(received_data, HCI_EVENT_STATUS_OFFSET, *(uint8_t *)ret_param);
Kojto 0:615c697c33b0 179 break;
Kojto 0:615c697c33b0 180
Kojto 0:615c697c33b0 181 case HCI_CMND_SETSOCKOPT:
Kojto 0:615c697c33b0 182 case HCI_CMND_WLAN_CONNECT:
Kojto 0:615c697c33b0 183 case HCI_CMND_WLAN_IOCTL_STATUSGET:
Kojto 0:615c697c33b0 184 case HCI_EVNT_WLAN_IOCTL_ADD_PROFILE:
Kojto 0:615c697c33b0 185 case HCI_CMND_WLAN_IOCTL_DEL_PROFILE:
Kojto 0:615c697c33b0 186 case HCI_CMND_WLAN_IOCTL_SET_CONNECTION_POLICY:
Kojto 0:615c697c33b0 187 case HCI_CMND_WLAN_IOCTL_SET_SCANPARAM:
Kojto 0:615c697c33b0 188 case HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_START:
Kojto 0:615c697c33b0 189 case HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_STOP:
Kojto 0:615c697c33b0 190 case HCI_CMND_WLAN_IOCTL_SIMPLE_CONFIG_SET_PREFIX:
Kojto 0:615c697c33b0 191 case HCI_CMND_EVENT_MASK:
Kojto 0:615c697c33b0 192 case HCI_EVNT_WLAN_DISCONNECT:
Kojto 0:615c697c33b0 193 case HCI_EVNT_SOCKET:
Kojto 0:615c697c33b0 194 case HCI_EVNT_BIND:
Kojto 0:615c697c33b0 195 case HCI_CMND_LISTEN:
Kojto 0:615c697c33b0 196 case HCI_EVNT_CLOSE_SOCKET:
Kojto 0:615c697c33b0 197 case HCI_EVNT_CONNECT:
Kojto 0:615c697c33b0 198 case HCI_EVNT_NVMEM_WRITE:
Kojto 0:615c697c33b0 199
Kojto 0:615c697c33b0 200 STREAM_TO_UINT32((uint8_t *)pucReceivedParams,0, *(uint32_t *)ret_param);
Kojto 0:615c697c33b0 201 break;
Kojto 0:615c697c33b0 202
Kojto 0:615c697c33b0 203 case HCI_EVNT_READ_SP_VERSION:
Kojto 0:615c697c33b0 204
Kojto 0:615c697c33b0 205 STREAM_TO_UINT8(received_data, HCI_EVENT_STATUS_OFFSET, *(uint8_t *)ret_param);
Kojto 0:615c697c33b0 206 ret_param = ((uint8_t *)ret_param) + 1;
Kojto 0:615c697c33b0 207 STREAM_TO_UINT32((uint8_t *)pucReceivedParams, 0, return_value);
Kojto 0:615c697c33b0 208 UINT32_TO_STREAM((uint8_t *)ret_param, return_value);
Kojto 0:615c697c33b0 209 break;
Kojto 0:615c697c33b0 210
Kojto 0:615c697c33b0 211 case HCI_EVNT_BSD_GETHOSTBYNAME:
Kojto 0:615c697c33b0 212
Kojto 0:615c697c33b0 213 STREAM_TO_UINT32((uint8_t *)pucReceivedParams,GET_HOST_BY_NAME_RETVAL_OFFSET,*(uint32_t *)ret_param);
Kojto 0:615c697c33b0 214 ret_param = ((uint8_t *)ret_param) + 4;
Kojto 0:615c697c33b0 215 STREAM_TO_UINT32((uint8_t *)pucReceivedParams,GET_HOST_BY_NAME_ADDR_OFFSET,*(uint32_t *)ret_param);
Kojto 0:615c697c33b0 216 break;
Kojto 0:615c697c33b0 217
Kojto 0:615c697c33b0 218 case HCI_EVNT_ACCEPT:
Kojto 0:615c697c33b0 219 {
Kojto 0:615c697c33b0 220 STREAM_TO_UINT32((uint8_t *)pucReceivedParams,ACCEPT_SD_OFFSET,*(uint32_t *)ret_param);
Kojto 0:615c697c33b0 221 ret_param = ((uint8_t *)ret_param) + 4;
Kojto 0:615c697c33b0 222 STREAM_TO_UINT32((uint8_t *)pucReceivedParams,ACCEPT_RETURN_STATUS_OFFSET,*(uint32_t *)ret_param);
Kojto 0:615c697c33b0 223 ret_param = ((uint8_t *)ret_param) + 4;
Kojto 0:615c697c33b0 224
Kojto 0:615c697c33b0 225 //This argument returns in network order
Kojto 0:615c697c33b0 226 memcpy((uint8_t *)ret_param, pucReceivedParams + ACCEPT_ADDRESS__OFFSET, sizeof(sockaddr));
Kojto 0:615c697c33b0 227 break;
Kojto 0:615c697c33b0 228 }
Kojto 0:615c697c33b0 229
Kojto 0:615c697c33b0 230 case HCI_EVNT_RECV:
Kojto 0:615c697c33b0 231 case HCI_EVNT_RECVFROM:
Kojto 0:615c697c33b0 232 {
Kojto 0:615c697c33b0 233 STREAM_TO_UINT32((uint8_t *)pucReceivedParams,SL_RECEIVE_SD_OFFSET ,*(uint32_t *)ret_param);
Kojto 0:615c697c33b0 234 ret_param = ((uint8_t *)ret_param) + 4;
Kojto 0:615c697c33b0 235 STREAM_TO_UINT32((uint8_t *)pucReceivedParams,SL_RECEIVE_NUM_BYTES_OFFSET,*(uint32_t *)ret_param);
Kojto 0:615c697c33b0 236 ret_param = ((uint8_t *)ret_param) + 4;
Kojto 0:615c697c33b0 237 STREAM_TO_UINT32((uint8_t *)pucReceivedParams,SL_RECEIVE__FLAGS__OFFSET,*(uint32_t *)ret_param);
Kojto 0:615c697c33b0 238
Kojto 0:615c697c33b0 239 if(((tBsdReadReturnParams *)ret_param)->iNumberOfBytes == ERROR_SOCKET_INACTIVE)
Kojto 0:615c697c33b0 240 {
Kojto 0:615c697c33b0 241 set_socket_active_status(((tBsdReadReturnParams *)ret_param)->iSocketDescriptor,SOCKET_STATUS_INACTIVE);
Kojto 0:615c697c33b0 242 }
Kojto 0:615c697c33b0 243 break;
Kojto 0:615c697c33b0 244 }
Kojto 0:615c697c33b0 245
Kojto 0:615c697c33b0 246 case HCI_EVNT_SEND:
Kojto 0:615c697c33b0 247 case HCI_EVNT_SENDTO:
Kojto 0:615c697c33b0 248 {
Kojto 0:615c697c33b0 249 STREAM_TO_UINT32((uint8_t *)pucReceivedParams,SL_RECEIVE_SD_OFFSET ,*(uint32_t *)ret_param);
Kojto 0:615c697c33b0 250 ret_param = ((uint8_t *)ret_param) + 4;
Kojto 0:615c697c33b0 251 STREAM_TO_UINT32((uint8_t *)pucReceivedParams,SL_RECEIVE_NUM_BYTES_OFFSET,*(uint32_t *)ret_param);
Kojto 0:615c697c33b0 252 ret_param = ((uint8_t *)ret_param) + 4;
Kojto 0:615c697c33b0 253
Kojto 0:615c697c33b0 254 break;
Kojto 0:615c697c33b0 255 }
Kojto 0:615c697c33b0 256
Kojto 0:615c697c33b0 257 case HCI_EVNT_SELECT:
Kojto 0:615c697c33b0 258 {
Kojto 0:615c697c33b0 259 STREAM_TO_UINT32((uint8_t *)pucReceivedParams,SELECT_STATUS_OFFSET,*(uint32_t *)ret_param);
Kojto 0:615c697c33b0 260 ret_param = ((uint8_t *)ret_param) + 4;
Kojto 0:615c697c33b0 261 STREAM_TO_UINT32((uint8_t *)pucReceivedParams,SELECT_READFD_OFFSET,*(uint32_t *)ret_param);
Kojto 0:615c697c33b0 262 ret_param = ((uint8_t *)ret_param) + 4;
Kojto 0:615c697c33b0 263 STREAM_TO_UINT32((uint8_t *)pucReceivedParams,SELECT_WRITEFD_OFFSET,*(uint32_t *)ret_param);
Kojto 0:615c697c33b0 264 ret_param = ((uint8_t *)ret_param) + 4;
Kojto 0:615c697c33b0 265 STREAM_TO_UINT32((uint8_t *)pucReceivedParams,SELECT_EXFD_OFFSET,*(uint32_t *)ret_param);
Kojto 0:615c697c33b0 266 break;
Kojto 0:615c697c33b0 267 }
Kojto 0:615c697c33b0 268
Kojto 0:615c697c33b0 269 case HCI_CMND_GETSOCKOPT:
Kojto 0:615c697c33b0 270
Kojto 0:615c697c33b0 271 STREAM_TO_UINT8(received_data, HCI_EVENT_STATUS_OFFSET,((tBsdGetSockOptReturnParams *)ret_param)->iStatus);
Kojto 0:615c697c33b0 272 //This argument returns in network order
Kojto 0:615c697c33b0 273 memcpy((uint8_t *)ret_param, pucReceivedParams, 4);
Kojto 0:615c697c33b0 274 break;
Kojto 0:615c697c33b0 275
Kojto 0:615c697c33b0 276 case HCI_CMND_WLAN_IOCTL_GET_SCAN_RESULTS:
Kojto 0:615c697c33b0 277
Kojto 0:615c697c33b0 278 STREAM_TO_UINT32((uint8_t *)pucReceivedParams,GET_SCAN_RESULTS_TABlE_COUNT_OFFSET,*(uint32_t *)ret_param);
Kojto 0:615c697c33b0 279 ret_param = ((uint8_t *)ret_param) + 4;
Kojto 0:615c697c33b0 280 STREAM_TO_UINT32((uint8_t *)pucReceivedParams,GET_SCAN_RESULTS_SCANRESULT_STATUS_OFFSET,*(uint32_t *)ret_param);
Kojto 0:615c697c33b0 281 ret_param = ((uint8_t *)ret_param) + 4;
Kojto 0:615c697c33b0 282 STREAM_TO_UINT16((uint8_t *)pucReceivedParams,GET_SCAN_RESULTS_ISVALID_TO_SSIDLEN_OFFSET,*(uint32_t *)ret_param);
Kojto 0:615c697c33b0 283 ret_param = ((uint8_t *)ret_param) + 2;
Kojto 0:615c697c33b0 284 STREAM_TO_UINT16((uint8_t *)pucReceivedParams,GET_SCAN_RESULTS_FRAME_TIME_OFFSET,*(uint32_t *)ret_param);
Kojto 0:615c697c33b0 285 ret_param = ((uint8_t *)ret_param) + 2;
Kojto 0:615c697c33b0 286 memcpy((uint8_t *)ret_param, (uint8_t *)(pucReceivedParams + GET_SCAN_RESULTS_FRAME_TIME_OFFSET + 2), GET_SCAN_RESULTS_SSID_MAC_LENGTH);
Kojto 0:615c697c33b0 287 break;
Kojto 0:615c697c33b0 288
Kojto 0:615c697c33b0 289 case HCI_CMND_SIMPLE_LINK_START:
Kojto 0:615c697c33b0 290 break;
Kojto 0:615c697c33b0 291
Kojto 0:615c697c33b0 292 case HCI_NETAPP_IPCONFIG:
Kojto 0:615c697c33b0 293
Kojto 0:615c697c33b0 294 //Read IP address
Kojto 0:615c697c33b0 295 STREAM_TO_STREAM(RecvParams,RetParams,NETAPP_IPCONFIG_IP_LENGTH);
Kojto 0:615c697c33b0 296 RecvParams += 4;
Kojto 0:615c697c33b0 297
Kojto 0:615c697c33b0 298 //Read subnet
Kojto 0:615c697c33b0 299 STREAM_TO_STREAM(RecvParams,RetParams,NETAPP_IPCONFIG_IP_LENGTH);
Kojto 0:615c697c33b0 300 RecvParams += 4;
Kojto 0:615c697c33b0 301
Kojto 0:615c697c33b0 302 //Read default GW
Kojto 0:615c697c33b0 303 STREAM_TO_STREAM(RecvParams,RetParams,NETAPP_IPCONFIG_IP_LENGTH);
Kojto 0:615c697c33b0 304 RecvParams += 4;
Kojto 0:615c697c33b0 305
Kojto 0:615c697c33b0 306 //Read DHCP server
Kojto 0:615c697c33b0 307 STREAM_TO_STREAM(RecvParams,RetParams,NETAPP_IPCONFIG_IP_LENGTH);
Kojto 0:615c697c33b0 308 RecvParams += 4;
Kojto 0:615c697c33b0 309
Kojto 0:615c697c33b0 310 //Read DNS server
Kojto 0:615c697c33b0 311 STREAM_TO_STREAM(RecvParams,RetParams,NETAPP_IPCONFIG_IP_LENGTH);
Kojto 0:615c697c33b0 312 RecvParams += 4;
Kojto 0:615c697c33b0 313
Kojto 0:615c697c33b0 314 //Read Mac address
Kojto 0:615c697c33b0 315 STREAM_TO_STREAM(RecvParams,RetParams,NETAPP_IPCONFIG_MAC_LENGTH);
Kojto 0:615c697c33b0 316 RecvParams += 6;
Kojto 0:615c697c33b0 317
Kojto 0:615c697c33b0 318 //Read SSID
Kojto 0:615c697c33b0 319 STREAM_TO_STREAM(RecvParams,RetParams,NETAPP_IPCONFIG_SSID_LENGTH);
Kojto 0:615c697c33b0 320
Kojto 0:615c697c33b0 321 }
Kojto 0:615c697c33b0 322 }
Kojto 0:615c697c33b0 323 if (received_op_code == _simple_link.get_op_code())
Kojto 0:615c697c33b0 324 {
Kojto 0:615c697c33b0 325 _simple_link.set_op_code(0);
Kojto 0:615c697c33b0 326 }
Kojto 0:615c697c33b0 327 }
Kojto 0:615c697c33b0 328 else
Kojto 0:615c697c33b0 329 {
Kojto 0:615c697c33b0 330 pucReceivedParams = received_data;
Kojto 0:615c697c33b0 331 STREAM_TO_UINT8((uint8_t *)received_data, HCI_PACKET_ARGSIZE_OFFSET, argument_size);
Kojto 0:615c697c33b0 332
Kojto 0:615c697c33b0 333 STREAM_TO_UINT16((uint8_t *)received_data, HCI_PACKET_LENGTH_OFFSET, length);
Kojto 0:615c697c33b0 334
Kojto 0:615c697c33b0 335 // Data received: note that the only case where from and from length
Kojto 0:615c697c33b0 336 // are not null is in recv from, so fill the args accordingly
Kojto 0:615c697c33b0 337 if (from)
Kojto 0:615c697c33b0 338 {
Kojto 0:615c697c33b0 339 STREAM_TO_UINT32((uint8_t *)(received_data + HCI_DATA_HEADER_SIZE), BSD_RECV_FROM_FROMLEN_OFFSET, *(uint32_t *)fromlen);
Kojto 0:615c697c33b0 340 memcpy(from, (received_data + HCI_DATA_HEADER_SIZE + BSD_RECV_FROM_FROM_OFFSET) ,*fromlen);
Kojto 0:615c697c33b0 341 }
Kojto 0:615c697c33b0 342
Kojto 0:615c697c33b0 343 memcpy(ret_param, pucReceivedParams + HCI_DATA_HEADER_SIZE + argument_size, length - argument_size);
Kojto 0:615c697c33b0 344
Kojto 0:615c697c33b0 345 _simple_link.set_pending_data(0);
Kojto 0:615c697c33b0 346 }
Kojto 0:615c697c33b0 347
Kojto 0:615c697c33b0 348 _simple_link.set_data_received_flag(0);
Kojto 0:615c697c33b0 349
Kojto 0:615c697c33b0 350 //tWlanInterruptEnable func_pointer = (tWlanInterruptEnable)_simple_link.get_func_pointer(WLAN_INTERRUPT_ENABLE);
Kojto 0:615c697c33b0 351 //func_pointer();
Kojto 0:615c697c33b0 352 _spi.wlan_irq_enable();
Kojto 0:615c697c33b0 353
Kojto 0:615c697c33b0 354 // Since we are going to TX - we need to handle this event after the ResumeSPi since we need interrupts
Kojto 0:615c697c33b0 355 if ((*received_data == HCI_TYPE_EVNT) && (received_op_code == HCI_EVNT_PATCHES_REQ))
Kojto 0:615c697c33b0 356 {
Kojto 0:615c697c33b0 357 hci_unsol_handle_patch_request((uint8_t *)received_data);
Kojto 0:615c697c33b0 358 }
Kojto 0:615c697c33b0 359 if ((_simple_link.get_op_code() == 0) && (_simple_link.get_pending_data() == 0))
Kojto 0:615c697c33b0 360 {
Kojto 0:615c697c33b0 361 return NULL;
Kojto 0:615c697c33b0 362 }
Kojto 0:615c697c33b0 363 }
Kojto 0:615c697c33b0 364 }
Kojto 0:615c697c33b0 365 }
Kojto 0:615c697c33b0 366
Kojto 0:615c697c33b0 367 int32_t cc3000_event::hci_unsol_event_handler(uint8_t *event_hdr) {
Kojto 0:615c697c33b0 368 uint8_t *data = NULL;
Kojto 0:615c697c33b0 369 int32_t event_type;
Kojto 0:615c697c33b0 370 uint32_t number_of_released_packets;
Kojto 0:615c697c33b0 371 uint32_t number_of_sent_packets;
Kojto 0:615c697c33b0 372
Kojto 0:615c697c33b0 373 STREAM_TO_UINT16(event_hdr, HCI_EVENT_OPCODE_OFFSET,event_type);
Kojto 0:615c697c33b0 374
Kojto 0:615c697c33b0 375 if (event_type & HCI_EVNT_UNSOL_BASE) {
Kojto 0:615c697c33b0 376 switch(event_type) {
Kojto 0:615c697c33b0 377 case HCI_EVNT_DATA_UNSOL_FREE_BUFF:
Kojto 0:615c697c33b0 378 {
Kojto 0:615c697c33b0 379 hci_event_unsol_flowcontrol_handler(event_hdr);
Kojto 0:615c697c33b0 380
Kojto 0:615c697c33b0 381 number_of_released_packets = _simple_link.get_released_packets();
Kojto 0:615c697c33b0 382 number_of_sent_packets = _simple_link.get_sent_packets();
Kojto 0:615c697c33b0 383
Kojto 0:615c697c33b0 384 if (number_of_released_packets == number_of_sent_packets)
Kojto 0:615c697c33b0 385 {
Kojto 0:615c697c33b0 386 if (_simple_link.get_tx_complete_signal())
Kojto 0:615c697c33b0 387 {
Kojto 0:615c697c33b0 388 //tWlanCB func_pointer = (tWlanCB)_simple_link.get_func_pointer(WLAN_CB);
Kojto 0:615c697c33b0 389 _cc3000.usync_callback(HCI_EVENT_CC3000_CAN_SHUT_DOWN, NULL, 0);
Kojto 0:615c697c33b0 390 }
Kojto 0:615c697c33b0 391 }
Kojto 0:615c697c33b0 392 return 1;
Kojto 0:615c697c33b0 393 }
Kojto 0:615c697c33b0 394 }
Kojto 0:615c697c33b0 395 }
Kojto 0:615c697c33b0 396
Kojto 0:615c697c33b0 397 if (event_type & HCI_EVNT_WLAN_UNSOL_BASE) {
Kojto 0:615c697c33b0 398 switch(event_type) {
Kojto 0:615c697c33b0 399 case HCI_EVNT_WLAN_KEEPALIVE:
Kojto 0:615c697c33b0 400 case HCI_EVNT_WLAN_UNSOL_CONNECT:
Kojto 0:615c697c33b0 401 case HCI_EVNT_WLAN_UNSOL_DISCONNECT:
Kojto 0:615c697c33b0 402 case HCI_EVNT_WLAN_UNSOL_INIT:
Kojto 0:615c697c33b0 403 case HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE:
Kojto 0:615c697c33b0 404 // {
Kojto 0:615c697c33b0 405 // tWlanCB func_pointer = (tWlanCB)_simple_link.get_func_pointer(WLAN_CB);
Kojto 0:615c697c33b0 406 // if( func_pointer )
Kojto 0:615c697c33b0 407 // {
Kojto 0:615c697c33b0 408 // func_pointer(event_type, 0, 0);
Kojto 0:615c697c33b0 409 // }
Kojto 0:615c697c33b0 410 _cc3000.usync_callback(event_type, 0, 0);
Kojto 0:615c697c33b0 411 break;
Kojto 0:615c697c33b0 412 // }
Kojto 0:615c697c33b0 413 case HCI_EVNT_WLAN_UNSOL_DHCP:
Kojto 0:615c697c33b0 414 {
Kojto 0:615c697c33b0 415 uint8_t params[NETAPP_IPCONFIG_MAC_OFFSET + 1]; // extra byte is for the status
Kojto 0:615c697c33b0 416 uint8_t *recParams = params;
Kojto 0:615c697c33b0 417 data = (uint8_t *)(event_hdr) + HCI_EVENT_HEADER_SIZE;
Kojto 0:615c697c33b0 418
Kojto 0:615c697c33b0 419 //Read IP address
Kojto 0:615c697c33b0 420 STREAM_TO_STREAM(data,recParams,NETAPP_IPCONFIG_IP_LENGTH);
Kojto 0:615c697c33b0 421 data += 4;
Kojto 0:615c697c33b0 422 //Read subnet
Kojto 0:615c697c33b0 423 STREAM_TO_STREAM(data,recParams,NETAPP_IPCONFIG_IP_LENGTH);
Kojto 0:615c697c33b0 424 data += 4;
Kojto 0:615c697c33b0 425 //Read default GW
Kojto 0:615c697c33b0 426 STREAM_TO_STREAM(data,recParams,NETAPP_IPCONFIG_IP_LENGTH);
Kojto 0:615c697c33b0 427 data += 4;
Kojto 0:615c697c33b0 428 //Read DHCP server
Kojto 0:615c697c33b0 429 STREAM_TO_STREAM(data,recParams,NETAPP_IPCONFIG_IP_LENGTH);
Kojto 0:615c697c33b0 430 data += 4;
Kojto 0:615c697c33b0 431 //Read DNS server
Kojto 0:615c697c33b0 432 STREAM_TO_STREAM(data,recParams,NETAPP_IPCONFIG_IP_LENGTH);
Kojto 0:615c697c33b0 433 // read the status
Kojto 0:615c697c33b0 434 STREAM_TO_UINT8(event_hdr, HCI_EVENT_STATUS_OFFSET, *recParams);
Kojto 0:615c697c33b0 435
Kojto 0:615c697c33b0 436 // tWlanCB func_pointer = (tWlanCB)_simple_link.get_func_pointer(WLAN_CB);
Kojto 0:615c697c33b0 437 // if( func_pointer )
Kojto 0:615c697c33b0 438 // {
Kojto 0:615c697c33b0 439 _cc3000.usync_callback(event_type, (uint8_t *)params, sizeof(params));
Kojto 0:615c697c33b0 440 // }
Kojto 0:615c697c33b0 441 break;
Kojto 0:615c697c33b0 442 }
Kojto 0:615c697c33b0 443 case HCI_EVNT_WLAN_ASYNC_PING_REPORT:
Kojto 0:615c697c33b0 444 {
Kojto 0:615c697c33b0 445 netapp_pingreport_args_t params;
Kojto 0:615c697c33b0 446 data = (uint8_t *)(event_hdr) + HCI_EVENT_HEADER_SIZE;
Kojto 0:615c697c33b0 447 STREAM_TO_UINT32(data, NETAPP_PING_PACKETS_SENT_OFFSET, params.packets_sent);
Kojto 0:615c697c33b0 448 STREAM_TO_UINT32(data, NETAPP_PING_PACKETS_RCVD_OFFSET, params.packets_received);
Kojto 0:615c697c33b0 449 STREAM_TO_UINT32(data, NETAPP_PING_MIN_RTT_OFFSET, params.min_round_time);
Kojto 0:615c697c33b0 450 STREAM_TO_UINT32(data, NETAPP_PING_MAX_RTT_OFFSET, params.max_round_time);
Kojto 0:615c697c33b0 451 STREAM_TO_UINT32(data, NETAPP_PING_AVG_RTT_OFFSET, params.avg_round_time);
Kojto 0:615c697c33b0 452
Kojto 0:615c697c33b0 453 // tWlanCB func_pointer = (tWlanCB)_simple_link.get_func_pointer(WLAN_CB);
Kojto 0:615c697c33b0 454 // if (func_pointer)
Kojto 0:615c697c33b0 455 // {
Kojto 0:615c697c33b0 456 _cc3000.usync_callback(event_type, (uint8_t *)&params, sizeof(params));
Kojto 0:615c697c33b0 457 // }
Kojto 0:615c697c33b0 458 break;
Kojto 0:615c697c33b0 459 }
Kojto 0:615c697c33b0 460 case HCI_EVNT_BSD_TCP_CLOSE_WAIT:
Kojto 0:615c697c33b0 461 {
Kojto 0:615c697c33b0 462 // tWlanCB func_pointer = (tWlanCB)_simple_link.get_func_pointer(WLAN_CB);
Kojto 0:615c697c33b0 463 // if (func_pointer)
Kojto 0:615c697c33b0 464 // {
Kojto 0:615c697c33b0 465 _cc3000.usync_callback(event_type, NULL, 0);
Kojto 0:615c697c33b0 466 // }
Kojto 0:615c697c33b0 467 break;
Kojto 0:615c697c33b0 468 }
Kojto 0:615c697c33b0 469
Kojto 0:615c697c33b0 470 //'default' case which means "event not supported"
Kojto 0:615c697c33b0 471 default:
Kojto 0:615c697c33b0 472 return (0);
Kojto 0:615c697c33b0 473 }
Kojto 0:615c697c33b0 474 return(1);
Kojto 0:615c697c33b0 475 }
Kojto 0:615c697c33b0 476
Kojto 0:615c697c33b0 477 if ((event_type == HCI_EVNT_SEND) || (event_type == HCI_EVNT_SENDTO) || (event_type == HCI_EVNT_WRITE)) {
Kojto 0:615c697c33b0 478 uint8_t *pArg;
Kojto 0:615c697c33b0 479 int32_t status;
Kojto 0:615c697c33b0 480 pArg = M_BSD_RESP_PARAMS_OFFSET(event_hdr);
Kojto 0:615c697c33b0 481 STREAM_TO_UINT32(pArg, BSD_RSP_PARAMS_STATUS_OFFSET,status);
Kojto 0:615c697c33b0 482 if (ERROR_SOCKET_INACTIVE == status) {
Kojto 0:615c697c33b0 483 // The only synchronous event that can come from SL device in form of
Kojto 0:615c697c33b0 484 // command complete is "Command Complete" on data sent, in case SL device
Kojto 0:615c697c33b0 485 // was unable to transmit
Kojto 0:615c697c33b0 486 int32_t transmit_error = _simple_link.get_transmit_error();
Kojto 0:615c697c33b0 487 STREAM_TO_UINT8(event_hdr, HCI_EVENT_STATUS_OFFSET, transmit_error);
Kojto 0:615c697c33b0 488 _simple_link.set_transmit_error(transmit_error);
Kojto 0:615c697c33b0 489 update_socket_active_status(M_BSD_RESP_PARAMS_OFFSET(event_hdr));
Kojto 0:615c697c33b0 490 return (1);
Kojto 0:615c697c33b0 491 }
Kojto 0:615c697c33b0 492 else {
Kojto 0:615c697c33b0 493 return (0);
Kojto 0:615c697c33b0 494 }
Kojto 0:615c697c33b0 495 }
Kojto 0:615c697c33b0 496 return(0);
Kojto 0:615c697c33b0 497 }
Kojto 0:615c697c33b0 498
Kojto 0:615c697c33b0 499 int32_t cc3000_event::hci_unsolicited_event_handler(void) {
Kojto 0:615c697c33b0 500 uint32_t res = 0;
Kojto 0:615c697c33b0 501 uint8_t *received_data;
Kojto 0:615c697c33b0 502
Kojto 0:615c697c33b0 503 if (_simple_link.get_data_received_flag() != 0) {
Kojto 0:615c697c33b0 504 received_data = (_simple_link.get_received_data());
Kojto 0:615c697c33b0 505
Kojto 0:615c697c33b0 506 if (*received_data == HCI_TYPE_EVNT) {
Kojto 0:615c697c33b0 507 // unsolicited event received - finish handling
Kojto 0:615c697c33b0 508 if (hci_unsol_event_handler((uint8_t *)received_data) == 1) {
Kojto 0:615c697c33b0 509 // An unsolicited event was received:
Kojto 0:615c697c33b0 510 // release the buffer and clean the event received
Kojto 0:615c697c33b0 511 _simple_link.set_data_received_flag(0);
Kojto 0:615c697c33b0 512
Kojto 0:615c697c33b0 513 res = 1;
Kojto 0:615c697c33b0 514 _spi.wlan_irq_enable();
Kojto 0:615c697c33b0 515 }
Kojto 0:615c697c33b0 516 }
Kojto 0:615c697c33b0 517 }
Kojto 0:615c697c33b0 518 return res;
Kojto 0:615c697c33b0 519 }
Kojto 0:615c697c33b0 520
Kojto 0:615c697c33b0 521 void cc3000_event::set_socket_active_status(int32_t sd, int32_t status) {
Kojto 0:615c697c33b0 522 if (M_IS_VALID_SD(sd) && M_IS_VALID_STATUS(status))
Kojto 0:615c697c33b0 523 {
Kojto 0:615c697c33b0 524 socket_active_status &= ~(1 << sd); /* clean socket's mask */
Kojto 0:615c697c33b0 525 socket_active_status |= (status << sd); /* set new socket's mask */
Kojto 0:615c697c33b0 526 }
Kojto 0:615c697c33b0 527 }
Kojto 0:615c697c33b0 528
Kojto 0:615c697c33b0 529 int32_t cc3000_event::hci_event_unsol_flowcontrol_handler(uint8_t *event) {
Kojto 0:615c697c33b0 530 int32_t temp, value;
Kojto 0:615c697c33b0 531 uint16_t i;
Kojto 0:615c697c33b0 532 uint16_t pusNumberOfHandles=0;
Kojto 0:615c697c33b0 533 uint8_t *pReadPayload;
Kojto 0:615c697c33b0 534
Kojto 0:615c697c33b0 535 STREAM_TO_UINT16((uint8_t *)event,HCI_EVENT_HEADER_SIZE,pusNumberOfHandles);
Kojto 0:615c697c33b0 536 pReadPayload = ((uint8_t *)event + HCI_EVENT_HEADER_SIZE + sizeof(pusNumberOfHandles));
Kojto 0:615c697c33b0 537 temp = 0;
Kojto 0:615c697c33b0 538
Kojto 0:615c697c33b0 539 for(i = 0; i < pusNumberOfHandles; i++) {
Kojto 0:615c697c33b0 540 STREAM_TO_UINT16(pReadPayload, FLOW_CONTROL_EVENT_FREE_BUFFS_OFFSET, value);
Kojto 0:615c697c33b0 541 temp += value;
Kojto 0:615c697c33b0 542 pReadPayload += FLOW_CONTROL_EVENT_SIZE;
Kojto 0:615c697c33b0 543 }
Kojto 0:615c697c33b0 544
Kojto 0:615c697c33b0 545 _simple_link.set_number_free_buffers(_simple_link.get_number_free_buffers() + temp);
Kojto 0:615c697c33b0 546 _simple_link.set_number_of_released_packets(_simple_link.get_released_packets() + temp);
Kojto 0:615c697c33b0 547
Kojto 0:615c697c33b0 548 return(ESUCCESS);
Kojto 0:615c697c33b0 549 }
Kojto 0:615c697c33b0 550
Kojto 0:615c697c33b0 551 int32_t cc3000_event::get_socket_active_status(int32_t sd) {
Kojto 0:615c697c33b0 552 if(M_IS_VALID_SD(sd)) {
Kojto 0:615c697c33b0 553 return (socket_active_status & (1 << sd)) ? SOCKET_STATUS_INACTIVE : SOCKET_STATUS_ACTIVE;
Kojto 0:615c697c33b0 554 } else {
Kojto 0:615c697c33b0 555 return SOCKET_STATUS_INACTIVE;
Kojto 0:615c697c33b0 556 }
Kojto 0:615c697c33b0 557 }
Kojto 0:615c697c33b0 558
Kojto 0:615c697c33b0 559 void cc3000_event::update_socket_active_status(uint8_t *resp_params) {
Kojto 0:615c697c33b0 560 int32_t status, sd;
Kojto 0:615c697c33b0 561
Kojto 0:615c697c33b0 562 STREAM_TO_UINT32(resp_params, BSD_RSP_PARAMS_SOCKET_OFFSET,sd);
Kojto 0:615c697c33b0 563 STREAM_TO_UINT32(resp_params, BSD_RSP_PARAMS_STATUS_OFFSET,status);
Kojto 0:615c697c33b0 564
Kojto 0:615c697c33b0 565 if(ERROR_SOCKET_INACTIVE == status) {
Kojto 0:615c697c33b0 566 set_socket_active_status(sd, SOCKET_STATUS_INACTIVE);
Kojto 0:615c697c33b0 567 }
Kojto 0:615c697c33b0 568 }
Kojto 0:615c697c33b0 569
Kojto 0:615c697c33b0 570 void cc3000_event::simplelink_wait_event(uint16_t op_code, void *ret_param) {
Kojto 0:615c697c33b0 571 // In the blocking implementation the control to caller will be returned only
Kojto 0:615c697c33b0 572 // after the end of current transaction
Kojto 0:615c697c33b0 573 _simple_link.set_op_code(op_code);
Kojto 0:615c697c33b0 574 hci_event_handler(ret_param, 0, 0);
Kojto 0:615c697c33b0 575 }
Kojto 0:615c697c33b0 576
Kojto 0:615c697c33b0 577 void cc3000_event::simplelink_wait_data(uint8_t *pBuf, uint8_t *from, uint8_t *fromlen) {
Kojto 0:615c697c33b0 578 // In the blocking implementation the control to caller will be returned only
Kojto 0:615c697c33b0 579 // after the end of current transaction, i.e. only after data will be received
Kojto 0:615c697c33b0 580 _simple_link.set_pending_data(1);
Kojto 0:615c697c33b0 581 hci_event_handler(pBuf, from, fromlen);
Kojto 0:615c697c33b0 582 }
Kojto 0:615c697c33b0 583
Kojto 0:615c697c33b0 584
Kojto 0:615c697c33b0 585 } /* end of cc3000 namespace */