TI's CC3100. A test demo with very little testing done!

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
dflet
Date:
Tue Feb 10 12:09:29 2015 +0000
Child:
1:c73566c6788a
Commit message:
For test only! Not much has been tested, but the 2 demo apps run ok. Alot more work needs to be done!

Changed in this revision

G_functions/fPtr_func.cpp Show annotated file Show diff for this revision Revisions of this file
G_functions/fPtr_func.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
myBoardInit.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100.cpp Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_driver.cpp Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_driver.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_fs.cpp Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_fs.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_netapp.cpp Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_netapp.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_netcfg.cpp Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_netcfg.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_nonos.cpp Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_nonos.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_objInclusion.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_protocol.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_simplelink.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_sl_common.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_socket.cpp Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_socket.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_spawn.cpp Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_spawn.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_spi.cpp Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_spi.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_trace.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_user.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_wlan.cpp Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_wlan.h Show annotated file Show diff for this revision Revisions of this file
simplelink/cc3100_wlan_rx_filters.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/G_functions/fPtr_func.cpp	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,746 @@
+/*
+ *  - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+//#include "mbed.h"
+#include "cc3100_simplelink.h"
+//#include "cc3100_sl_common.h"
+//#include "cc3100_protocol.h"
+
+//#include "cc3100_driver.h"
+//#include "cc3100_nonos.h"
+//#include "cc3100_netapp.h"
+#include "cc3100.h"
+#include "fPtr_func.h"
+
+    
+using namespace mbed_cc3100;    
+    
+cc3100_driver *_driver;
+cc3100_nonos  *_nonos;
+cc3100_netapp *_netapp;
+cc3100        *_cc3100_;
+
+#ifdef __cplusplus
+extern "C" {
+#endif    
+
+/*!
+    \brief This function handles ping report events
+
+    \param[in]      pPingReport holds the ping report statistics
+
+    \return         None
+
+    \note
+
+    \warning
+*/
+void SimpleLinkPingReport(SlPingReport_t *pPingReport)
+{
+    _cc3100_->SET_STATUS_BIT(g_Status, STATUS_BIT_PING_DONE);
+
+    if(pPingReport == NULL)
+        printf(" [PING REPORT] NULL Pointer Error\r\n");
+
+    g_PingPacketsRecv = pPingReport->PacketsReceived;
+}
+
+
+/*******************************************************************************/
+/*   _sl_HandleAsync_Accept */
+/*******************************************************************************/
+void _sl_HandleAsync_Accept(void *pVoidBuf)
+{
+    //printf("_sl_HandleAsync_Accept\r\n");
+    _SocketAddrResponse_u *pMsgArgs = (_SocketAddrResponse_u *)_SL_RESP_ARGS_START(pVoidBuf);
+
+    OSI_RET_OK_CHECK(_nonos->sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+
+    VERIFY_PROTOCOL(( pMsgArgs->IpV4.sd & BSD_SOCKET_ID_MASK) <= SL_MAX_SOCKETS);
+    VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs);
+
+    memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs,sizeof(_SocketAddrResponse_u));
+    OSI_RET_OK_CHECK(_nonos->sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE));
+
+    OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+    return;
+}
+
+/*******************************************************************************/
+/*   _sl_HandleAsync_Connect */
+/*******************************************************************************/
+void _sl_HandleAsync_Connect(void *pVoidBuf)
+{
+    //printf("_sl_HandleAsync_Connect\r\n");
+    _SocketResponse_t *pMsgArgs = (_SocketResponse_t *)_SL_RESP_ARGS_START(pVoidBuf);
+
+    OSI_RET_OK_CHECK(_nonos->sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+
+    VERIFY_PROTOCOL((pMsgArgs->sd & BSD_SOCKET_ID_MASK) <= SL_MAX_SOCKETS);
+    VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs);
+
+    ((_SocketResponse_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs))->sd = pMsgArgs->sd;
+    ((_SocketResponse_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs))->statusOrLen = pMsgArgs->statusOrLen;
+
+    OSI_RET_OK_CHECK(_nonos->sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE));
+    OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+    return;
+}
+
+/*******************************************************************************/
+/*   _sl_HandleAsync_Select */
+/*******************************************************************************/
+void _sl_HandleAsync_Select(void *pVoidBuf)
+{
+    //printf("_sl_HandleAsync_Select\r\n");
+    _SelectAsyncResponse_t *pMsgArgs = (_SelectAsyncResponse_t *)_SL_RESP_ARGS_START(pVoidBuf);
+
+    OSI_RET_OK_CHECK(_nonos->sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+
+    VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs);
+
+    memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_SelectAsyncResponse_t));
+    OSI_RET_OK_CHECK(_nonos->sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE));
+
+    OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+    return;
+}
+
+/******************************************************************************/
+/*  _sl_HandleAsync_DnsGetHostByName */
+/******************************************************************************/
+void _sl_HandleAsync_DnsGetHostByName(void *pVoidBuf)
+{
+    //printf("_sl_HandleAsync_DnsGetHostByName\r\n");
+    _GetHostByNameIPv4AsyncResponse_t *pMsgArgs = (_GetHostByNameIPv4AsyncResponse_t *)_SL_RESP_ARGS_START(pVoidBuf);
+
+    OSI_RET_OK_CHECK(_nonos->sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+
+    VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs);
+
+    /*IPv6 */
+    if(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].AdditionalData & SL_NETAPP_FAMILY_MASK) {
+        memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_GetHostByNameIPv6AsyncResponse_t));
+    }
+    /*IPv4 */
+    else {
+        memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_GetHostByNameIPv4AsyncResponse_t));
+    }
+    OSI_RET_OK_CHECK(_nonos->sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE));
+
+    OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+    return;
+}
+
+/******************************************************************************/
+
+/******************************************************************************
+    _sl_HandleAsync_DnsGetHostByService
+
+    CALLER          NWP - Async event on sl_DnsGetHostByService with IPv4 Family
+
+
+    DESCRIPTION:
+
+                    Async event on sl_DnsGetHostByService command with IPv4 Family.
+                    Return service attributes like IP address, port and text according to service name.
+                    The user sets a service name Full/Part (see example below), and should get the:
+                    1. IP of the service
+                    2. The port of service.
+                    3. The text of service.
+
+                    Hence it can make a connection to the specific service and use it.
+                    It is similar to get host by name method.
+
+                    It is done by a single shot query with PTR type on the service name.
+
+
+
+                    Note:
+                    1. The return's attributes are belonged to first service that is found.
+                    It can be other services with the same service name will response to
+                    the query. The results of these responses are saved in the peer cache of the NWP, and
+                    should be read by another API.
+
+
+        PARAMETERS:
+
+                  pVoidBuf - is point to opcode of the event.
+                  it contains the outputs that are given to the user
+
+                  outputs description:
+
+                   1.out_pAddr[]                    - output: Contain the IP address of the service.
+                   2.out_pPort                      - output: Contain the port of the service.
+                   3.inout_TextLen                  - Input:  Contain the max length of the text that the user wants to get.
+                                                              it means that if the test of service is bigger that its value than
+                                                              the text is cut to inout_TextLen value.
+                                                      Output: Contain the length of the text that is returned. Can be full text or part
+                                                              of the text (see above).
+
+                   4.out_pText                      - Contain the text of the service (full or part see above- inout_TextLen description).
+
+  *
+
+
+    RETURNS:        success or fail.
+
+******************************************************************************/
+void _sl_HandleAsync_DnsGetHostByService(void *pVoidBuf)
+{
+    //printf("_sl_HandleAsync_DnsGetHostByService\r\n");
+    _GetHostByServiceAsyncResponse_t* Res;
+    uint16_t TextLen;
+    uint16_t UserTextLen;
+
+    /*pVoidBuf - is point to opcode of the event.*/
+
+    /*set pMsgArgs to point to the attribute of the event.*/
+    _GetHostByServiceIPv4AsyncResponse_t *pMsgArgs = (_GetHostByServiceIPv4AsyncResponse_t *)_SL_RESP_ARGS_START(pVoidBuf);
+
+    VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs);
+
+    /*IPv6*/
+    if(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].AdditionalData & SL_NETAPP_FAMILY_MASK) {
+        return;
+    }
+    /*IPv4*/
+    else {
+        /*************************************************************************************************
+
+        1. Copy the attribute part of the evnt to the attribute part of the response
+        memcpy(g_pCB->GetHostByServiceCB.pAsyncRsp, pMsgArgs, sizeof(_GetHostByServiceIPv4AsyncResponse_t));
+
+        set to TextLen the text length of the service.*/
+        TextLen = pMsgArgs->TextLen;
+
+        /*Res pointed to mDNS global object struct */
+        Res = (_GetHostByServiceAsyncResponse_t*)g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs;
+
+
+
+        /*It is 4 bytes so we avoid from memcpy*/
+        Res->out_pAddr[0]   = pMsgArgs->Address;
+        Res->out_pPort[0]   = pMsgArgs->Port;
+        Res->Status         = pMsgArgs->Status;
+
+        /*set to TextLen the text length of the user (input fromthe user).*/
+        UserTextLen = Res->inout_TextLen[0];
+
+        /*Cut the service text if the user requested for smaller text.*/
+        UserTextLen = (TextLen <= UserTextLen) ? TextLen : UserTextLen;
+        Res->inout_TextLen[0] = UserTextLen ;
+
+        /**************************************************************************************************
+
+        2. Copy the payload part of the evnt (the text) to the payload part of the response
+        the lenght of the copy is according to the text length in the attribute part. */
+
+
+        memcpy(Res->out_pText          ,
+                  (int8_t *)(& pMsgArgs[1]),   /* & pMsgArgs[1] -> 1st byte after the fixed header = 1st byte of variable text.*/
+                  UserTextLen);
+
+
+        /**************************************************************************************************/
+
+        OSI_RET_OK_CHECK(_nonos->sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE));
+        return;
+    }
+}
+
+/*****************************************************************************/
+/*  _sl_HandleAsync_PingResponse */
+/*****************************************************************************/
+void _sl_HandleAsync_PingResponse(void *pVoidBuf)
+{
+    //printf("_sl_HandleAsync_PingResponse\r\n");
+    _PingReportResponse_t *pMsgArgs  = (_PingReportResponse_t *)_SL_RESP_ARGS_START(pVoidBuf);
+    SlPingReport_t pingReport;
+
+    if(pPingCallBackFunc) {
+        _netapp->CopyPingResultsToReport(pMsgArgs,&pingReport);
+        pPingCallBackFunc(&pingReport);
+    } else {
+
+        OSI_RET_OK_CHECK(_nonos->sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE,NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+        VERIFY_SOCKET_CB(NULL != g_pCB->PingCB.PingAsync.pAsyncRsp);
+
+        if (NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs) {
+            memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_PingReportResponse_t));
+            OSI_RET_OK_CHECK(_nonos->sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE));
+        }
+        OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+    }
+    return;
+}
+
+/* ******************************************************************************/
+/*  _SlDrvMsgReadSpawnCtx                                                       */
+/* ******************************************************************************/
+_SlReturnVal_t _SlDrvMsgReadSpawnCtx(void *pValue)
+{
+    //printf("_SlDrvMsgReadSpawnCtx\r\n");
+
+#ifdef SL_POLLING_MODE_USED
+    int16_t retCode = OSI_OK;
+    /*  for polling based systems */
+    do {
+        retCode = sl_LockObjLock(&g_pCB->GlobalLockObj, 0);
+        if ( OSI_OK != retCode ) {
+            if (TRUE == g_pCB->IsCmdRespWaited) {
+                OSI_RET_OK_CHECK( sl_SyncObjSignal(&g_pCB->CmdSyncObj) );
+                return SL_RET_CODE_OK;
+                //return;
+            }
+        }
+
+    } while (OSI_OK != retCode);
+
+#else
+    
+    OSI_RET_OK_CHECK(_nonos->sl_LockObjLock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER) );
+    
+#endif
+    
+    g_pCB->FunctionParams.AsyncExt.pAsyncBuf = NULL;/*  buffer must be allocated by _SlDrvMsgRead */
+    g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler= NULL;
+    g_pCB->FunctionParams.AsyncExt.RxMsgClass = CMD_RESP_CLASS;/* init to illegal value and verify it's overwritten with the valid one */
+
+    /*  Messages might have been read by CmdResp context. Therefore after */
+    /*  getting LockObj, check again where the Pending Rx Msg is still present. */
+    if(FALSE == (_driver->_SL_PENDING_RX_MSG(g_pCB))) {
+        OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+        return SL_RET_CODE_OK;
+        //return;
+    }
+   
+    VERIFY_RET_OK(_driver->_SlDrvMsgRead());
+
+    g_pCB->RxDoneCnt++;
+
+    switch(g_pCB->FunctionParams.AsyncExt.RxMsgClass) {
+        case ASYNC_EVT_CLASS:
+            /*  If got here and protected by LockObj a message is waiting  */
+            /*  to be read */
+            VERIFY_PROTOCOL(NULL != g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+
+            _driver->_SlAsyncEventGenericHandler();
+
+#if (SL_MEMORY_MGMT == SL_MEMORY_MGMT_STATIC)
+            g_pCB->FunctionParams.AsyncExt.pAsyncBuf = NULL;
+#else
+            free(g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+#endif
+            break;
+        case DUMMY_MSG_CLASS:
+        case RECV_RESP_CLASS:
+            /* These types are legal in this context. Do nothing */
+            break;
+        case CMD_RESP_CLASS:
+            /* Command response is illegal in this context. */
+            /* No 'break' here: Assert! */
+        default:
+            VERIFY_PROTOCOL(0);
+    }
+
+    OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+
+    return(SL_RET_CODE_OK);   
+    //return;
+}
+
+/***************************************************************************
+_sl_HandleAsync_Stop - handles stop signalling to
+a waiting object
+****************************************************************************/
+void _sl_HandleAsync_Stop(void *pVoidBuf)
+{
+    //printf("_SlDrvNetAppEventHandler\r\n");
+    _BasicResponse_t *pMsgArgs = (_BasicResponse_t *)_SL_RESP_ARGS_START(pVoidBuf);
+
+    VERIFY_SOCKET_CB(NULL != g_pCB->StopCB.pAsyncRsp);
+
+    OSI_RET_OK_CHECK(_nonos->sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE,NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+
+    memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_BasicResponse_t));
+    OSI_RET_OK_CHECK(_nonos->sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE));
+    OSI_RET_OK_CHECK(_nonos->sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+    return;
+}
+
+/******************************************************************************
+_SlDrvDeviceEventHandler - handles internally device async events
+******************************************************************************/
+void _SlDrvDeviceEventHandler(void *pArgs)
+{
+    //printf("_SlDrvDeviceEventHandler\r\n");
+    _SlResponseHeader_t *pHdr = (_SlResponseHeader_t *)pArgs;
+    //printf("Debug pHdr->GenHeader.Opcode 0x%X\r\n",pHdr->GenHeader.Opcode);
+    switch(pHdr->GenHeader.Opcode) {
+        case SL_OPCODE_DEVICE_INITCOMPLETE:
+            _cc3100_->_sl_HandleAsync_InitComplete(pHdr);
+            //printf("_SlDrvDeviceEventHandler 2\r\n");
+            break;
+        case SL_OPCODE_DEVICE_STOP_ASYNC_RESPONSE:
+            _sl_HandleAsync_Stop(pHdr);
+            //printf("_SlDrvDeviceEventHandler 3\r\n");
+            break;
+        case  SL_OPCODE_DEVICE_DEVICEASYNCFATALERROR:
+#ifdef sl_GeneralEvtHdlr
+        {
+            _BasicResponse_t *pMsgArgs = (_BasicResponse_t *)_SL_RESP_ARGS_START(pHdr);
+            SlDeviceEvent_t devHandler;
+            devHandler.Event = SL_DEVICE_FATAL_ERROR_EVENT;
+            devHandler.EventData.deviceEvent.status = pMsgArgs->status & 0xFF;
+            devHandler.EventData.deviceEvent.sender = (SlErrorSender_e)((pMsgArgs->status >> 8) & 0xFF);
+            SimpleLinkGeneralEventHandler(&devHandler);
+            //printf("_SlDrvDeviceEventHandler 4\r\n");
+        }
+#endif
+        break;
+        default:
+            //SL_ERROR_TRACE2(MSG_306, "ASSERT: _SlDrvDeviceEventHandler : invalid opcode = 0x%x = %i", pHdr->GenHeader.Opcode, pHdr->GenHeader.Opcode);
+            printf("ASSERT: _SlDrvDeviceEventHandler : invalid opcode = 0x%x = %i", pHdr->GenHeader.Opcode, pHdr->GenHeader.Opcode);
+            VERIFY_PROTOCOL(0);
+    }
+}
+
+/*****************************************************************************/
+/* _SlDrvNetAppEventHandler */
+/*****************************************************************************/
+void _SlDrvNetAppEventHandler(void *pArgs)
+{
+    //printf("_SlDrvNetAppEventHandler\r\n");
+    _SlResponseHeader_t *pHdr = (_SlResponseHeader_t *)pArgs;
+#ifdef sl_HttpServerCallback
+    SlHttpServerEvent_t     httpServerEvent;
+    SlHttpServerResponse_t  httpServerResponse;
+#endif
+    switch(pHdr->GenHeader.Opcode) {
+        case SL_OPCODE_NETAPP_DNSGETHOSTBYNAMEASYNCRESPONSE:
+        case SL_OPCODE_NETAPP_DNSGETHOSTBYNAMEASYNCRESPONSE_V6:
+            _sl_HandleAsync_DnsGetHostByName(pArgs);
+            break;
+        case SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICEASYNCRESPONSE:
+        case SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICEASYNCRESPONSE_V6:
+            _sl_HandleAsync_DnsGetHostByService(pArgs);
+            break;
+        case SL_OPCODE_NETAPP_PINGREPORTREQUESTRESPONSE:
+            _sl_HandleAsync_PingResponse(pArgs);
+            break;
+        case SL_OPCODE_NETAPP_HTTPGETTOKENVALUE: {
+#ifdef sl_HttpServerCallback
+            uint8_t *pTokenName;
+            slHttpServerData_t Token_value;
+            sl_NetAppHttpServerGetToken_t *httpGetToken = (sl_NetAppHttpServerGetToken_t *)_SL_RESP_ARGS_START(pHdr);
+            pTokenName = (uint8_t *)((sl_NetAppHttpServerGetToken_t *)httpGetToken + 1);
+
+            httpServerResponse.Response = SL_NETAPP_HTTPSETTOKENVALUE;
+            httpServerResponse.ResponseData.token_value.len = MAX_TOKEN_VALUE_LEN;
+            httpServerResponse.ResponseData.token_value.data = (uint8_t *)_SL_RESP_ARGS_START(pHdr) + MAX_TOKEN_NAME_LEN; //Reuse the async buffer for getting the token value response from the user
+
+            httpServerEvent.Event = SL_NETAPP_HTTPGETTOKENVALUE_EVENT;
+            httpServerEvent.EventData.httpTokenName.len = httpGetToken->token_name_len;
+            httpServerEvent.EventData.httpTokenName.data = pTokenName;
+
+            Token_value.token_name =  pTokenName;
+
+            SimpleLinkHttpServerCallback(&httpServerEvent, &httpServerResponse);
+
+            Token_value.value_len = httpServerResponse.ResponseData.token_value.len;
+            Token_value.name_len = httpServerEvent.EventData.httpTokenName.len;
+
+            Token_value.token_value = httpServerResponse.ResponseData.token_value.data;
+
+
+            _netapp->sl_NetAppSendTokenValue(&Token_value);
+#endif
+        }
+        break;
+
+        case SL_OPCODE_NETAPP_HTTPPOSTTOKENVALUE: {
+#ifdef sl_HttpServerCallback
+            uint8_t *pPostParams;
+
+            sl_NetAppHttpServerPostToken_t *httpPostTokenArgs = (sl_NetAppHttpServerPostToken_t *)_SL_RESP_ARGS_START(pHdr);
+            pPostParams = (uint8_t *)((sl_NetAppHttpServerPostToken_t *)httpPostTokenArgs + 1);
+
+            httpServerEvent.Event = SL_NETAPP_HTTPPOSTTOKENVALUE_EVENT;
+
+            httpServerEvent.EventData.httpPostData.action.len = httpPostTokenArgs->post_action_len;
+            httpServerEvent.EventData.httpPostData.action.data = pPostParams;
+            pPostParams+=httpPostTokenArgs->post_action_len;
+
+            httpServerEvent.EventData.httpPostData.token_name.len = httpPostTokenArgs->token_name_len;
+            httpServerEvent.EventData.httpPostData.token_name.data = pPostParams;
+            pPostParams+=httpPostTokenArgs->token_name_len;
+
+            httpServerEvent.EventData.httpPostData.token_value.len = httpPostTokenArgs->token_value_len;
+            httpServerEvent.EventData.httpPostData.token_value.data = pPostParams;
+
+            httpServerResponse.Response = SL_NETAPP_RESPONSE_NONE;
+
+
+            SimpleLinkHttpServerCallback(&httpServerEvent, &httpServerResponse);
+#endif
+        }
+        break;
+        default:
+            SL_ERROR_TRACE2(MSG_305, "ASSERT: _SlDrvNetAppEventHandler : invalid opcode = 0x%x = %i", pHdr->GenHeader.Opcode, pHdr->GenHeader.Opcode);
+            VERIFY_PROTOCOL(0);
+    }
+}
+
+/*
+ * ASYNCHRONOUS EVENT HANDLERS -- Start
+ */
+
+/*!
+    \brief This function handles WLAN events
+
+    \param[in]      pWlanEvent is the event passed to the handler
+
+    \return         None
+
+    \note
+
+    \warning
+*/
+#if (defined(sl_WlanEvtHdlr))
+void SimpleLinkWlanEventHandler(SlWlanEvent_t *pWlanEvent)
+{
+    
+    //printf("Debug SimpleLinkWlanEventHandler\r\n");
+    if(pWlanEvent == NULL)
+        printf(" [WLAN EVENT] NULL Pointer Error \n\r");
+
+    switch(pWlanEvent->Event) {
+        case SL_WLAN_CONNECT_EVENT: {
+            _cc3100_->SET_STATUS_BIT(g_Status, STATUS_BIT_CONNECTION);
+
+            /*
+             * Information about the connected AP (like name, MAC etc) will be
+             * available in 'slWlanConnectAsyncResponse_t' - Applications
+             * can use it if required
+             *
+             * slWlanConnectAsyncResponse_t *pEventData = NULL;
+             * pEventData = &pWlanEvent->EventData.STAandP2PModeWlanConnected;
+             *
+             */
+        }
+        break;
+
+        case SL_WLAN_DISCONNECT_EVENT: {
+            slWlanConnectAsyncResponse_t*  pEventData = NULL;
+
+            _cc3100_->CLR_STATUS_BIT(g_Status, STATUS_BIT_CONNECTION);
+            _cc3100_->CLR_STATUS_BIT(g_Status, STATUS_BIT_IP_ACQUIRED);
+
+            pEventData = &pWlanEvent->EventData.STAandP2PModeDisconnected;
+
+            /* If the user has initiated 'Disconnect' request, 'reason_code' is SL_USER_INITIATED_DISCONNECTION */
+            if(SL_USER_INITIATED_DISCONNECTION == pEventData->reason_code) {
+                printf(" Device disconnected from the AP on application's request \n\r");
+            } else {
+                printf(" Device disconnected from the AP on an ERROR..!! \n\r");
+            }
+        }
+        break;
+
+        case SL_WLAN_STA_CONNECTED_EVENT: {
+            _cc3100_->SET_STATUS_BIT(g_Status, STATUS_BIT_STA_CONNECTED);
+        }
+        break;
+
+        case SL_WLAN_STA_DISCONNECTED_EVENT: {
+            _cc3100_->CLR_STATUS_BIT(g_Status, STATUS_BIT_STA_CONNECTED);
+            _cc3100_->CLR_STATUS_BIT(g_Status, STATUS_BIT_IP_LEASED);
+        }
+        break;
+
+        default: {
+            printf(" [WLAN EVENT] Unexpected event \n\r");
+        }
+        break;
+    }
+}
+#endif
+
+/*!
+    \brief This function handles events for IP address acquisition via DHCP
+           indication
+
+    \param[in]      pNetAppEvent is the event passed to the handler
+
+    \return         None
+
+    \note
+
+    \warning
+*/
+#if (defined(sl_NetAppEvtHdlr))
+void SimpleLinkNetAppEventHandler(SlNetAppEvent_t *pNetAppEvent)
+{
+    
+    if(pNetAppEvent == NULL){
+        printf(" [NETAPP EVENT] NULL Pointer Error \n\r");
+    }
+    
+    switch(pNetAppEvent->Event) {
+        case SL_NETAPP_IPV4_IPACQUIRED_EVENT: {
+            
+            //printf("SL_NETAPP_IPV4_IPACQUIRED_EVENT \n\r");
+            SlIpV4AcquiredAsync_t *pEventData = NULL;
+            //printf("g_Status 2 = 0x%X\r\n",_cc3100_->g_Status);
+            _cc3100_->SET_STATUS_BIT(g_Status, STATUS_BIT_IP_ACQUIRED);
+            //printf("g_Status 2 = 0x%X\r\n",_cc3100_->g_Status);
+            
+            pEventData = &pNetAppEvent->EventData.ipAcquiredV4;
+            
+            g_GatewayIP = pEventData->gateway;
+            //printf("g_GatewayIP =  = 0x%X\r\n",pEventData->gateway);
+            //printf("Debug 4 SL_NETAPP_IPV4_IPACQUIRED_EVENT \n\r");
+        }
+        break;
+
+        case SL_NETAPP_IP_LEASED_EVENT: {
+            //printf("SL_NETAPP_IP_LEASED_EVENT \n\r");
+            g_StationIP = pNetAppEvent->EventData.ipLeased.ip_address;
+            //_cc3100_->g_Status = 0;
+            _cc3100_->SET_STATUS_BIT(g_Status, STATUS_BIT_IP_LEASED);
+            //printf("g_Status 3 = 0x%X\r\n",_cc3100_->g_Status);
+            
+        }
+        break;
+
+        default: {
+            printf(" [NETAPP EVENT] Unexpected event \n\r");
+        }
+        break;
+    }
+}
+#endif 
+
+/*!
+    \brief This function handles socket events indication
+
+    \param[in]      pSock is the event passed to the handler
+
+    \return         None
+*/
+#if (defined(sl_SockEvtHdlr))
+void SimpleLinkSockEventHandler(SlSockEvent_t *pSock)
+{
+    if(pSock == NULL)
+        printf(" [SOCK EVENT] NULL Pointer Error \n\r");
+    
+    switch( pSock->Event )
+    {
+        case SL_SOCKET_TX_FAILED_EVENT:
+            /*
+             * TX Failed
+             *
+             * Information about the socket descriptor and status will be
+             * available in 'SlSockEventData_t' - Applications can use it if
+             * required
+             *
+             * SlSockEventData_t *pEventData = NULL;
+             * pEventData = & pSock->EventData;
+             */
+            switch( pSock->EventData.status )
+            {
+                case SL_ECLOSE:
+                    printf(" [SOCK EVENT] Close socket operation, failed to transmit all queued packets\n\r");
+                    break;
+                default:
+                    printf(" [SOCK EVENT] Unexpected event \n\r");
+                    break;
+            }
+            break;
+
+        default:
+            printf(" [SOCK EVENT] Unexpected event \n\r");
+            break;
+    }
+}
+#endif
+
+/*!
+    \brief This function handles callback for the HTTP server events
+
+    \param[in]      pHttpEvent - Contains the relevant event information
+    \param[in]      pHttpResponse - Should be filled by the user with the
+                    relevant response information
+
+    \return         None
+
+    \note
+
+    \warning
+*/
+#if (defined(sl_HttpServerCallback))
+void SimpleLinkHttpServerCallback(SlHttpServerEvent_t *pHttpEvent, SlHttpServerResponse_t *pHttpResponse)
+{
+    /*
+     * This application doesn't work with HTTP server - Hence these
+     * events are not handled here
+     */
+    printf(" [HTTP EVENT] Unexpected event \n\r");
+}
+#endif
+/*!
+    \brief This function handles general error events indication
+
+    \param[in]      pDevEvent is the event passed to the handler
+
+    \return         None
+*/
+#if (defined(sl_GeneralEvtHdlr))
+void SimpleLinkGeneralEventHandler(SlDeviceEvent_t *pDevEvent)
+{
+    /*
+     * Most of the general errors are not FATAL are are to be handled
+     * appropriately by the application
+     */
+    printf(" [GENERAL EVENT] \n\r");
+}
+#endif
+
+#ifdef  __cplusplus
+}
+#endif /*  __cplusplus */
+
+//}//namespace
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/G_functions/fPtr_func.h	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,240 @@
+/*
+ *  - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+#ifndef fPtr_func_h
+#define fPtr_func_h
+
+#include "cc3100_simplelink.h"
+//#include "cc3100_driver.h"
+//#include "cc3100_nonos.h"
+//#include "cc3100_netapp.h"
+//#include "cc3100.h"
+
+/* Note. C function pointers point to the functions below. */
+/* C++ member function pointers not used ?           */
+
+namespace mbed_cc3100 { 
+
+
+    extern uint32_t  g_PingPacketsRecv;
+    extern uint32_t  g_GatewayIP;
+    extern uint32_t  g_StationIP;
+    extern uint32_t  g_DestinationIP;
+    extern uint32_t  g_BytesReceived; // variable to store the file size 
+    extern uint32_t  g_Status;
+    extern uint8_t   g_buff[MAX_BUFF_SIZE+1];
+    extern int32_t   g_SockID;
+    
+}//namespace mbed_cc3100    
+    
+using namespace mbed_cc3100;
+    
+#ifdef __cplusplus
+extern "C" {
+#endif     
+    
+
+void SimpleLinkPingReport(SlPingReport_t *pPingReport);
+   
+/*!
+    \brief WLAN Async event handler
+
+    \param[out]      pSlWlanEvent   pointer to SlWlanEvent_t data
+
+    \par
+             Parameters:
+
+             - <b>pSlWlanEvent->Event = SL_WLAN_CONNECT_EVENT </b>, STA or P2P client connection indication event
+                 - pSlWlanEvent->EventData.STAandP2PModeWlanConnected main fields:
+                      - ssid_name
+                      - ssid_len
+                      - bssid
+                      - go_peer_device_name
+                      - go_peer_device_name_len
+
+             - <b>pSlWlanEvent->Event = SL_WLAN_DISCONNECT_EVENT </b>, STA or P2P client disconnection event
+                 - pSlWlanEvent->EventData.STAandP2PModeDisconnected main fields:
+                      - ssid_name
+                      - ssid_len
+                      - reason_code
+
+             - <b>pSlWlanEvent->Event = SL_WLAN_STA_CONNECTED_EVENT </b>, AP/P2P(Go) connected STA/P2P(Client)
+                  - pSlWlanEvent->EventData.APModeStaConnected fields:
+                      - go_peer_device_name
+                      - mac
+                      - go_peer_device_name_len
+                      - wps_dev_password_id
+                      - own_ssid:  relevant for event sta-connected only
+                      - own_ssid_len:  relevant for event sta-connected only
+
+             - <b>pSlWlanEvent->Event = SL_WLAN_STA_DISCONNECTED_EVENT </b>, AP/P2P(Go) disconnected STA/P2P(Client)
+                  - pSlWlanEvent->EventData.APModestaDisconnected fields:
+                      - go_peer_device_name
+                      - mac
+                      - go_peer_device_name_len
+                      - wps_dev_password_id
+                      - own_ssid:  relevant for event sta-connected only
+                      - own_ssid_len:  relevant for event sta-connected only
+
+             - <b>pSlWlanEvent->Event = SL_WLAN_SMART_CONFIG_COMPLETE_EVENT </b>
+                  - pSlWlanEvent->EventData.smartConfigStartResponse fields:
+                     - status
+                     - ssid_len
+                     - ssid
+                     - private_token_len
+                     - private_token
+
+             - <b>pSlWlanEvent->Event = SL_WLAN_SMART_CONFIG_STOP_EVENT </b>
+                     - pSlWlanEvent->EventData.smartConfigStopResponse fields:
+                         - status
+
+             - <b>pSlWlanEvent->Event = SL_WLAN_P2P_DEV_FOUND_EVENT </b>
+                     - pSlWlanEvent->EventData.P2PModeDevFound fields:
+                         - go_peer_device_name
+                         - mac
+                         - go_peer_device_name_len
+                         - wps_dev_password_id
+                         - own_ssid:  relevant for event sta-connected only
+                         - own_ssid_len:  relevant for event sta-connected only
+
+             - <b>pSlWlanEvent->Event = SL_WLAN_P2P_NEG_REQ_RECEIVED_EVENT </b>
+                      - pSlWlanEvent->EventData.P2PModeNegReqReceived fields
+                          - go_peer_device_name
+                          - mac
+                          - go_peer_device_name_len
+                          - wps_dev_password_id
+                          - own_ssid:  relevant for event sta-connected only
+
+             - <b>pSlWlanEvent->Event = SL_WLAN_CONNECTION_FAILED_EVENT </b>, P2P only
+                       - pSlWlanEvent->EventData.P2PModewlanConnectionFailure fields:
+                           - status
+*/
+#if (defined(sl_WlanEvtHdlr))
+void SimpleLinkWlanEventHandler(SlWlanEvent_t *pWlanEvent);
+#endif
+
+/*!
+    \brief NETAPP Async event handler
+
+    \param[out]      pSlNetApp   pointer to SlNetAppEvent_t data
+
+    \par
+             Parameters:
+              - <b>pSlWlanEvent->Event = SL_NETAPP_IPV4_IPACQUIRED_EVENT</b>, IPV4 acquired event
+                  - pSlWlanEvent->EventData.ipAcquiredV4 fields:
+                       - ip
+                       - gateway
+                       - dns
+
+              - <b>pSlWlanEvent->Event = SL_NETAPP_IP_LEASED_EVENT</b>, AP or P2P go dhcp lease event
+                  - pSlWlanEvent->EventData.ipLeased  fields:
+                       - ip_address
+                       - lease_time
+                       - mac
+
+              - <b>pSlWlanEvent->Event = SL_NETAPP_IP_RELEASED_EVENT</b>, AP or P2P go dhcp ip release event
+                   - pSlWlanEvent->EventData.ipReleased fields
+                       - ip_address
+                       - mac
+                       - reason
+
+*/
+#if (defined(sl_NetAppEvtHdlr))
+void SimpleLinkNetAppEventHandler(SlNetAppEvent_t *pNetAppEvent);
+#endif
+
+/*!
+    \brief Socket Async event handler
+
+    \param[out]      pSlSockEvent   pointer to SlSockEvent_t data
+
+    \par
+             Parameters:\n
+             - <b>pSlSockEvent->Event = SL_SOCKET_TX_FAILED_EVENT</b>
+                 - pSlSockEvent->EventData fields:
+                     - sd
+                     - status
+             - <b>pSlSockEvent->Event = SL_SOCKET_ASYNC_EVENT</b>
+                - pSlSockEvent->EventData fields:
+                     - sd
+                     - type: SSL_ACCEPT  or RX_FRAGMENTATION_TOO_BIG or OTHER_SIDE_CLOSE_SSL_DATA_NOT_ENCRYPTED
+                     - val
+
+*/
+#if (defined(sl_SockEvtHdlr))
+void SimpleLinkSockEventHandler(SlSockEvent_t *pSock);
+#endif
+
+void SimpleLinkGeneralEventHandler(SlDeviceEvent_t *pDevEvent);
+
+void SimpleLinkHttpServerCallback(SlHttpServerEvent_t *pHttpEvent, SlHttpServerResponse_t *pHttpResponse);
+
+void _sl_HandleAsync_Accept(void *pVoidBuf);
+
+void _sl_HandleAsync_Connect(void *pVoidBuf);
+
+void _sl_HandleAsync_Select(void *pVoidBuf);
+
+void _sl_HandleAsync_DnsGetHostByName(void *pVoidBuf);
+
+void _sl_HandleAsync_DnsGetHostByService(void *pVoidBuf);
+
+void _sl_HandleAsync_PingResponse(void *pVoidBuf);
+
+void _sl_HandleAsync_Stop(void *pVoidBuf);
+
+_SlReturnVal_t _SlDrvMsgReadSpawnCtx(void *pValue);
+
+//void _SlDrvMsgReadSpawnCtx(void *pValue);
+
+void _SlDrvDeviceEventHandler(void *pArgs);
+
+void _SlDrvNetAppEventHandler(void *pArgs);
+
+#ifdef  __cplusplus
+}
+#endif /*  __cplusplus */
+
+//}//namespace mbed_cc3100
+
+#endif//fPtr_func_h
+
+
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,361 @@
+/*
+ * main.c - sample application to switch to AP mode and ping client
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+/*
+ * Application Name     -   Getting started with Wi-Fi Access-Point mode
+ * Application Overview -   This sample application demonstrates how
+ *                          to configure CC3100 in Access-Point mode. Any
+ *                          WLAN station in its range can connect/communicate
+ *                          to/with it as per the standard networking protocols.
+ *                          On a successful connection, the device ping's the
+ *                          connected station.
+ * Application Details  -   http://processors.wiki.ti.com/index.php/CC31xx_Getting_Started_with_WLAN_AP
+ *                          doc\examples\getting_started_with_wlan_ap.pdf
+ */
+
+#include "cc3100_simplelink.h"
+#include "cc3100_sl_common.h"
+
+#include "fPtr_func.h"
+#include "cc3100_spi.h"
+#include "myBoardInit.h"
+
+using namespace mbed_cc3100;
+
+class cc3100_netcfg *_netcfg;
+
+#if (THIS_BOARD == MBED_BOARD_LPC1768)
+//cc3100 _cc3100(p9, p10, p8, SPI(p5, p6, p7));//LPC1768  irq, nHib, cs, mosi, miso, sck
+cc3100 _cc3100(p9, p10, p8, SPI(p11, p12, p13));//LPC1768  irq, nHib, cs, mosi, miso, sck
+Serial pc(USBTX, USBRX);//lpc1768
+#elif (THIS_BOARD == ST_MBED_NUCLEOF411)
+cc3100 _cc3100(PA_9, PC_7, PB_6, SPI(PA_7, PA_6, PA_5));//nucleoF411  irq, nHib, cs, mosi, miso, sck
+Serial pc(SERIAL_TX, SERIAL_RX);//nucleoF411
+#elif (THIS_BOARD == ST_MBED_NUCLEOF401)
+cc3100 _cc3100(PA_9, PC_7, PB_6, SPI(PA_7, PA_6, PA_5));//nucleoF401  irq, nHib, cs, mosi, miso, sck
+Serial pc(SERIAL_TX, SERIAL_RX);//nucleoF401
+#elif (THIS_BOARD == EA_MBED_LPC4088)
+cc3100 _cc3100(p9, p10, p8, SPI(p5, p6, p7));//LPC4088  irq, nHib, cs, mosi, miso, sck
+Serial pc(USBTX, USBRX);//EA_lpc4088
+#elif (THIS_BOARD == ST_MBED_NUCLEOF103)
+cc3100 _cc3100(PA_9, PC_7, PB_6, SPI(PA_7, PA_6, PA_5));//nucleoF103  irq, nHib, cs, mosi, miso, sck
+Serial pc(SERIAL_TX, SERIAL_RX);
+#else
+
+#endif
+
+#define APPLICATION_VERSION "1.1.0"
+
+/*
+ * GLOBAL VARIABLES -- Start
+ */
+int32_t demo = 1;
+
+/*
+ * GLOBAL VARIABLES -- End
+ */
+
+
+/*
+ * STATIC FUNCTION DEFINITIONS -- Start
+ */
+
+static void displayBanner();
+/*
+ * STATIC FUNCTION DEFINITIONS -- End
+ */
+ 
+void station_app(void);
+void AP_app(void);
+
+/*
+ * Application's entry point
+ */
+  
+ 
+int main(void) {
+
+    pc.baud(115200);
+
+    int32_t retVal = -1;
+
+    retVal = _cc3100.initializeAppVariables();
+    ASSERT_ON_ERROR(retVal);
+
+    displayBanner();
+
+    _cc3100.CLR_STATUS_BIT(g_Status, STATUS_BIT_PING_DONE);
+    g_PingPacketsRecv = 0;
+
+    /*
+     * Following function configures the device to default state by cleaning
+     * the persistent settings stored in NVMEM (viz. connection profiles &
+     * policies, power policy etc)
+     *
+     * Applications may choose to skip this step if the developer is sure
+     * that the device is in its default state at start of application
+     *
+     * Note that all profiles and persistent settings that were done on the
+     * device will be lost
+     */
+    retVal = _cc3100.configureSimpleLinkToDefaultState();
+    
+    if(retVal < 0) {
+        if (DEVICE_NOT_IN_STATION_MODE == retVal)
+            printf(" Failed to configure the device to its default state \n\r");
+
+        LOOP_FOREVER();
+    }
+
+    printf(" Device is configured in it's default state \n\r");
+    
+    /*
+     * Assumption is that the device is configured in station mode already
+     * and it is in its default state
+     */
+    /* Initializing the CC3100 device */
+    
+    if(!(demo ==1)){
+        retVal = _cc3100.sl_Start(0, 0, 0);
+    
+        if ((retVal < 0) || (ROLE_STA != retVal) ){
+        printf(" Failed to start the device \n\r");
+        LOOP_FOREVER();
+        }
+
+        printf(" Device started as STATION \n\r");
+    }
+    
+    if(demo == 0 ){
+       station_app();
+    }else{
+       AP_app(); 
+    }    
+    return 0;
+}    
+
+/*!
+    \brief This function displays the application's banner
+
+    \param      None
+
+    \return     None
+*/
+static void displayBanner()
+{
+    if(!demo){
+        printf("\n\r\n\r");
+        printf(" Getting started with WLAN access-point application - Version ");
+        printf("%s",APPLICATION_VERSION);
+        printf("\n\r*******************************************************************************\n\r");
+    
+    }else{
+         printf("\n\r\n\r");
+         printf(" Getting started with station application - Version ");
+         printf(" %s", APPLICATION_VERSION);
+         printf("\n\r*******************************************************************************\n\r");
+    }
+}
+
+void AP_app(void){
+    
+    SlPingStartCommand_t PingParams = {0};
+    SlPingReport_t Report = {0};
+    SlNetCfgIpV4Args_t ipV4 = {0};
+    SlNetAppDhcpServerBasicOpt_t dhcpParams = {0};
+
+    uint8_t SecType = 0;
+    int32_t role = ROLE_STA;
+    int32_t retVal = -1;
+    
+    /*
+     * Assumption is that the device is configured in station mode already
+     * and it is in its default state
+     */
+    role = _cc3100.sl_Start(0, 0, 0);
+    if (ROLE_AP == role) {
+        /* If the device is in AP mode, we need to wait for this event before doing anything */
+        while(!_cc3100.IS_IP_ACQUIRED(g_Status,STATUS_BIT_IP_ACQUIRED)) {
+            _cc3100.SlNonOsMainLoopTask();
+        }
+    } else {
+        /* Configure CC3100 to start in AP mode */
+        retVal = _cc3100.WlanSetMode(ROLE_AP);
+        if(retVal < 0)
+            LOOP_FOREVER();
+
+        retVal = _cc3100.sl_Stop(SL_STOP_TIMEOUT);
+        if(retVal < 0)
+            LOOP_FOREVER();
+
+        _cc3100.CLR_STATUS_BIT(g_Status, STATUS_BIT_IP_ACQUIRED);
+
+        role = _cc3100.sl_Start(0, 0, 0);
+        if (ROLE_AP == role) {
+            /* If the device is in AP mode, we need to wait for this event before doing anything */
+            while(!_cc3100.IS_IP_ACQUIRED(g_Status,STATUS_BIT_IP_ACQUIRED)) {
+                _cc3100.SlNonOsMainLoopTask();
+            }
+        } else {
+            printf(" Device couldn't be configured in AP mode \n\r");
+            LOOP_FOREVER();
+        }
+    }
+    
+    printf(" Ready to configue SSID\r\n");
+
+    /* Configure the SSID of the CC3100 */
+    retVal = _cc3100.WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SSID, strlen(SSID_AP_MODE), (uint8_t *)SSID_AP_MODE);
+    if(retVal < 0)
+        LOOP_FOREVER();
+
+    SecType = SEC_TYPE_AP_MODE;
+    /* Configure the Security parameter the AP mode */
+    retVal = _cc3100.WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SECURITY_TYPE, 1, (uint8_t *)&SecType);
+    if(retVal < 0)
+        LOOP_FOREVER();
+
+    retVal = _cc3100.WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_PASSWORD, strlen(PASSWORD_AP_MODE), (uint8_t *)PASSWORD_AP_MODE);
+    if(retVal < 0){
+        LOOP_FOREVER();
+    }
+    
+    ipV4.ipV4 = _netcfg->SL_IPV4_VAL(192,168,0,1);//CONFIG_IP;
+    ipV4.ipV4Mask = _netcfg->SL_IPV4_VAL(255,255,255,0);//CONFIG_MASK;
+    ipV4.ipV4Gateway = _netcfg->SL_IPV4_VAL(192,168,0,1);//CONFIG_GATEWAY;
+    ipV4.ipV4DnsServer = _netcfg->SL_IPV4_VAL(192,168,0,1);//CONFIG_DNS;
+
+    /* Configure the Static IP */
+    retVal = _cc3100.NetCfgSet(SL_IPV4_AP_P2P_GO_STATIC_ENABLE,1,sizeof(SlNetCfgIpV4Args_t), (uint8_t *)&ipV4);
+    if(retVal < 0)
+        LOOP_FOREVER();
+
+    dhcpParams.lease_time      =  IP_LEASE_TIME;
+    dhcpParams.ipv4_addr_start =  _netcfg->SL_IPV4_VAL(192,168,0,100);//DHCP_START_IP;
+    dhcpParams.ipv4_addr_last  =  _netcfg->SL_IPV4_VAL(192,168,0,200);//DHCP_END_IP;
+
+    retVal = _cc3100.NetAppSet(SL_NET_APP_DHCP_SERVER_ID, NETAPP_SET_DHCP_SRV_BASIC_OPT, sizeof(SlNetAppDhcpServerBasicOpt_t), (uint8_t*)&dhcpParams);
+    if(retVal < 0)
+        LOOP_FOREVER();
+
+    /* Restart the CC3100 */
+    retVal = _cc3100.sl_Stop(SL_STOP_TIMEOUT);
+    if(retVal < 0)
+        LOOP_FOREVER();
+
+    g_Status = 0;
+    
+    role = _cc3100.sl_Start(0, 0, 0);
+    
+    if (ROLE_AP == role) {
+        /* If the device is in AP mode, we need to wait for this event before doing anything */
+        while(!_cc3100.IS_IP_ACQUIRED(g_Status,STATUS_BIT_IP_ACQUIRED)) {
+            _cc3100.SlNonOsMainLoopTask();
+        }
+    } else {
+        printf(" Device couldn't enter AP mode \n\r");
+        LOOP_FOREVER();
+    }
+    printf(" Device started as Access Point\n\r");
+
+    /* Wait */
+    printf(" Waiting for clients to connect...!\n\r");
+    while((!_cc3100.IS_IP_LEASED(g_Status,STATUS_BIT_IP_LEASED)) || (!_cc3100.IS_STA_CONNECTED(g_Status,STATUS_BIT_STA_CONNECTED))) {
+        _cc3100.SlNonOsMainLoopTask();
+    }
+    printf(" Client connected to the device \n\r");
+    printf(" Pinging...! \n\r");
+
+    /* Set the ping parameters */
+    PingParams.PingIntervalTime = PING_INTERVAL;
+    PingParams.PingSize = PING_SIZE;
+    PingParams.PingRequestTimeout = PING_TIMEOUT;
+    PingParams.TotalNumberOfAttempts = PING_ATTEMPTS;
+    PingParams.Flags = 0;
+    PingParams.Ip = g_StationIP; /* Fill the station IP address connected to CC3100 */
+
+    /* Ping client connected to CC3100 */
+    retVal = _cc3100.NetAppPingStart((SlPingStartCommand_t*)&PingParams, SL_AF_INET, (SlPingReport_t*)&Report, &SimpleLinkPingReport);
+    if(retVal < 0)
+        LOOP_FOREVER();
+
+    /* Wait */
+    while(!_cc3100.IS_PING_DONE(g_Status,STATUS_BIT_PING_DONE)) {
+        _cc3100.SlNonOsMainLoopTask();
+    }
+
+    if (0 == g_PingPacketsRecv) {
+        printf(" A STATION couldn't connect to the device \n\r");
+        //ASSERT_ON_ERROR(LAN_CONNECTION_FAILED);
+        printf(" ERROR code %d\n\r", LAN_CONNECTION_FAILED);
+    }
+
+    printf(" Device and the station are successfully connected \n\r");
+    //return SUCCESS;
+}
+
+void station_app(void){
+    
+    int32_t retVal = -1;
+
+    /* Connecting to WLAN AP */
+    retVal = _cc3100.establishConnectionWithAP();
+    if(retVal < 0)
+    {
+        printf(" Failed to establish connection w/ an AP \n\r");
+        LOOP_FOREVER();
+    }
+
+    printf(" Connection established w/ AP and IP is acquired \n\r");
+    printf(" Pinging...! \n\r");
+    retVal = _cc3100.checkLanConnection();
+    if(retVal < 0)
+    {
+        printf(" Device couldn't connect to LAN \n\r");
+        LOOP_FOREVER();
+    }
+
+    retVal = _cc3100.checkInternetConnection();
+    if(retVal < 0)
+    {
+        printf(" Device couldn't connect to the internet \n\r");
+        LOOP_FOREVER();
+    }
+
+    printf(" Device successfully connected to the LAN and internet \n\r");
+}              
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/myBoardInit.h	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,32 @@
+/* mbed Microcontroller Library
+ * Copyright (c) 2006-2013 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef myBoardInit_H
+#define myBoardInit_H
+
+
+#define MBED_BOARD_LPC1768 10
+#define ST_MBED_NUCLEOF411 20
+#define EA_MBED_LPC4088    30
+#define ST_MBED_NUCLEOF103 40
+#define ST_MBED_NUCLEOF401 50
+#define UNDEFINED          60//add new board here
+
+#define THIS_BOARD         MBED_BOARD_LPC1768
+//#define THIS_BOARD         ST_MBED_NUCLEOF411
+//#define THIS_BOARD         EA_MBED_LPC4088
+//#define THIS_BOARD         ST_MBED_NUCLEOF103
+//#define THIS_BOARD         ST_MBED_NUCLEOF401
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100.cpp	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,1378 @@
+/*
+* device.c - CC31xx/CC32xx Host Driver Implementation
+*
+* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+*
+*
+*  Redistribution and use in source and binary forms, with or without
+*  modification, are permitted provided that the following conditions
+*  are met:
+*
+*    Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+*
+*    Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the
+*    distribution.
+*
+*    Neither the name of Texas Instruments Incorporated nor the names of
+*    its contributors may be used to endorse or promote products derived
+*    from this software without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+*  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+*  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+*  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+*  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+*  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+
+
+/*****************************************************************************/
+/* Include files                                                             */
+/*****************************************************************************/
+#include "cc3100_simplelink.h"
+#include "cc3100_protocol.h"
+#include "cc3100_sl_common.h"
+#include "cc3100.h"
+
+#include "fPtr_func.h"
+//#include "GetSNTPTime.h"
+
+namespace mbed_cc3100 {	
+
+    uint32_t  g_PingPacketsRecv;
+    uint32_t  g_GatewayIP;
+    uint32_t  g_StationIP;
+    uint32_t  g_DestinationIP;
+    uint32_t  g_BytesReceived; // variable to store the file size 
+    uint32_t  g_Status;
+    uint8_t   g_buff[MAX_BUFF_SIZE+1];
+    int32_t   g_SockID;		
+
+
+cc3100::cc3100(PinName cc3100_irq, PinName cc3100_nHIB, PinName cc3100_cs, SPI cc3100_spi)
+    : _spi(cc3100_irq, cc3100_nHIB, cc3100_cs, cc3100_spi, _driver),
+      _driver(_nonos, _netapp, _flowcont, _spi), _nonos(_driver), _wlan(_driver, _wlan_filters),
+      _wlan_filters(_driver), _netapp(_driver, _nonos), _fs(_driver), _netcfg(_driver),
+      _socket(_driver, _nonos), _flowcont(_driver, _nonos)
+
+       
+{
+
+}
+
+cc3100::~cc3100()
+{
+
+}
+
+/*!
+    \brief This function initializes the application variables
+
+    \param[in]  None
+
+    \return     0 on success, negative error-code on error
+*/
+int32_t cc3100::initializeAppVariables()
+{
+    
+    g_Status = 0;
+    g_PingPacketsRecv = 0;
+    g_StationIP = 0;
+    g_GatewayIP = 0;
+    g_DestinationIP = 0;
+    g_BytesReceived = 0; /* variable to store the file size */
+    g_SockID = 0;
+    memset(g_buff, 0, sizeof(g_buff));
+
+    return SUCCESS;
+}
+
+int32_t cc3100::NetAppPingStart(SlPingStartCommand_t* pPingParams, uint8_t family, SlPingReport_t *pReport, const P_SL_DEV_PING_CALLBACK pPingCallback){
+
+    return (_netapp.sl_NetAppPingStart(pPingParams, family, pReport, pPingCallback));
+
+}
+
+int32_t cc3100::NetAppSet(uint8_t AppId ,uint8_t Option,uint8_t OptionLen, uint8_t *pOptionValue){
+	
+	return (_netapp.sl_NetAppSet(AppId ,Option, OptionLen, (uint8_t *)pOptionValue));
+	
+}	
+
+int16_t cc3100::NetCfgSet(uint8_t ConfigId ,uint8_t ConfigOpt, uint8_t ConfigLen, uint8_t *pValues){
+	
+	return (_netcfg.sl_NetCfgSet(ConfigId ,ConfigOpt, ConfigLen, (uint8_t *)pValues));
+	
+}	
+
+int16_t cc3100::WlanSet(uint16_t ConfigId ,uint16_t ConfigOpt,uint16_t ConfigLen, uint8_t *pValues){
+	
+	return (_wlan.sl_WlanSet(ConfigId, ConfigOpt, ConfigLen, (uint8_t*)pValues));
+	
+}	
+
+void cc3100::SlNonOsMainLoopTask(){
+	
+	_nonos._SlNonOsMainLoopTask();
+	
+}	
+
+int16_t cc3100::WlanSetMode(const uint8_t mode){
+	
+	return ( _wlan.sl_WlanSetMode(mode));
+}
+    
+/*!
+    \brief Disconnecting from a WLAN Access point
+
+    This function disconnects from the connected AP
+
+    \param[in]      None
+
+    \return         none
+
+    \note
+
+    \warning        If the WLAN disconnection fails, we will be stuck in this function forever.
+*/
+int32_t cc3100::disconnectFromAP()
+{
+    int32_t retVal = -1;
+
+    /*
+     * The function returns 0 if 'Disconnected done', negative number if already disconnected
+     * Wait for 'disconnection' event if 0 is returned, Ignore other return-codes
+     */
+    retVal = _wlan.sl_WlanDisconnect();
+    if(0 == retVal)
+    {
+        /* Wait */
+        while(IS_CONNECTED(g_Status,STATUS_BIT_CONNECTION)) { SlNonOsMainLoopTask(); }
+    }
+
+    return SUCCESS;
+}     
+
+/*!
+    \brief This function configure the SimpleLink device in its default state. It:
+           - Sets the mode to STATION
+           - Configures connection policy to Auto and AutoSmartConfig
+           - Deletes all the stored profiles
+           - Enables DHCP
+           - Disables Scan policy
+           - Sets Tx power to maximum
+           - Sets power policy to normal
+           - Unregisters mDNS services
+           - Remove all filters
+
+    \param[in]      none
+
+    \return         On success, zero is returned. On error, negative is returned
+*/
+int32_t cc3100::configureSimpleLinkToDefaultState()
+{
+    SlVersionFull   ver = {0};
+    _WlanRxFilterOperationCommandBuff_t  RxFilterIdMask = {0};
+
+    uint8_t           val = 1;
+    uint8_t           configOpt = 0;
+    uint8_t           configLen = 0;
+    uint8_t           power = 0;
+
+    int32_t          retVal = -1;
+    int32_t          role = -1;
+
+    role = sl_Start(0, 0, 0);
+    ASSERT_ON_ERROR(role);
+
+    /* If the device is not in station-mode, try configuring it in station-mode */
+    if (ROLE_STA != role) {
+        if (ROLE_AP == role) {
+            /* If the device is in AP mode, we need to wait for this event before doing anything */
+            while(!IS_IP_ACQUIRED(g_Status,STATUS_BIT_IP_ACQUIRED)) {
+                _nonos._SlNonOsMainLoopTask();
+            }
+        }
+        
+        /* Switch to STA role and restart */
+        retVal = _wlan.sl_WlanSetMode(ROLE_STA);
+        ASSERT_ON_ERROR(retVal);
+        
+        retVal = sl_Stop(SL_STOP_TIMEOUT);
+        ASSERT_ON_ERROR(retVal);
+
+        retVal = sl_Start(0, 0, 0);
+        ASSERT_ON_ERROR(retVal);
+
+        /* Check if the device is in station again */
+        if (ROLE_STA != retVal) {
+            /* We don't want to proceed if the device is not coming up in station-mode */
+            ASSERT_ON_ERROR(DEVICE_NOT_IN_STATION_MODE);
+        }
+    }
+    
+    /* Get the device's version-information */
+    configOpt = SL_DEVICE_GENERAL_VERSION;
+    configLen = sizeof(ver);
+    retVal = sl_DevGet(SL_DEVICE_GENERAL_CONFIGURATION, &configOpt, &configLen, (uint8_t *)(&ver));
+    ASSERT_ON_ERROR(retVal);
+    
+    /* Set connection policy to Auto + SmartConfig (Device's default connection policy) */
+    retVal = _wlan.sl_WlanPolicySet(SL_POLICY_CONNECTION, SL_CONNECTION_POLICY(1, 0, 0, 0, 1), NULL, 0);
+    ASSERT_ON_ERROR(retVal);
+    
+    /* Remove all profiles */
+    retVal = _wlan.sl_WlanProfileDel(0xFF);
+    ASSERT_ON_ERROR(retVal);
+    
+    /*
+     * Device in station-mode. Disconnect previous connection if any
+     * The function returns 0 if 'Disconnected done', negative number if already disconnected
+     * Wait for 'disconnection' event if 0 is returned, Ignore other return-codes
+     */
+    retVal = _wlan.sl_WlanDisconnect();
+    if(0 == retVal) {
+        /* Wait */
+        while(IS_CONNECTED(g_Status,STATUS_BIT_CONNECTION)) {
+            SlNonOsMainLoopTask();
+        }
+    }
+    
+    /* Enable DHCP client*/
+    retVal = _netcfg.sl_NetCfgSet(SL_IPV4_STA_P2P_CL_DHCP_ENABLE,1,1,&val);
+    ASSERT_ON_ERROR(retVal);
+    
+    /* Disable scan */
+    configOpt = SL_SCAN_POLICY(0);
+    retVal = _wlan.sl_WlanPolicySet(SL_POLICY_SCAN , configOpt, NULL, 0);
+    ASSERT_ON_ERROR(retVal);
+    
+    /* Set Tx power level for station mode
+       Number between 0-15, as dB offset from maximum power - 0 will set maximum power */
+    power = 0;
+    retVal = _wlan.sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_STA_TX_POWER, 1, (uint8_t *)&power);
+    ASSERT_ON_ERROR(retVal);
+    
+    /* Set PM policy to normal */
+    retVal = _wlan.sl_WlanPolicySet(SL_POLICY_PM , SL_NORMAL_POLICY, NULL, 0);
+    ASSERT_ON_ERROR(retVal);
+
+    /* Unregister mDNS services */
+    retVal = _netapp.sl_NetAppMDNSUnRegisterService(0, 0);
+    ASSERT_ON_ERROR(retVal);
+
+    /* Remove  all 64 filters (8*8) */
+    memset(RxFilterIdMask.FilterIdMask, 0xFF, 8);
+    retVal = _wlan_filters.sl_WlanRxFilterSet(SL_REMOVE_RX_FILTER, (uint8_t *)&RxFilterIdMask,
+             sizeof(_WlanRxFilterOperationCommandBuff_t));
+    ASSERT_ON_ERROR(retVal);
+
+    retVal = sl_Stop(SL_STOP_TIMEOUT);
+    ASSERT_ON_ERROR(retVal);
+
+    retVal = initializeAppVariables();
+    ASSERT_ON_ERROR(retVal);
+
+    return retVal; /* Success */
+}
+
+/*!
+    \brief Create UDP socket to communicate with server.
+
+    \param[in]      none
+
+    \return         Socket descriptor for success otherwise negative
+
+    \warning
+*/
+int32_t cc3100::createUDPConnection()
+{
+    int32_t sd = 0;
+
+    sd = _socket.sl_Socket(SL_AF_INET, SL_SOCK_DGRAM, IPPROTO_UDP);
+    if( sd < 0 )
+    {
+        printf("Error creating socket\n\r\n\r");
+    }
+
+    return sd;
+}
+
+int32_t cc3100::sock_Close(int16_t sd){
+	
+	return _socket.sl_Close(sd);
+}	
+
+/*!
+    \brief Create connection with server.
+
+    This function opens a socket and create the endpoint communication with server
+
+    \param[in]      DestinationIP - IP address of the server
+
+    \return         socket id for success and negative for error
+*/
+int32_t cc3100::createConnection(uint32_t DestinationIP)
+{
+    SlSockAddrIn_t  Addr = {0};
+    int32_t           Status = 0;
+    int32_t           AddrSize = 0;
+    int32_t           SockID = 0;
+
+    Addr.sin_family = SL_AF_INET;
+    Addr.sin_port = _socket.sl_Htons(80);
+    Addr.sin_addr.s_addr = _socket.sl_Htonl(DestinationIP);
+
+    AddrSize = sizeof(SlSockAddrIn_t);
+
+    SockID = _socket.sl_Socket(SL_AF_INET,SL_SOCK_STREAM, 0);
+    ASSERT_ON_ERROR(SockID);
+
+    Status = _socket.sl_Connect(SockID, ( SlSockAddr_t *)&Addr, AddrSize);
+    if (Status < 0)
+    {
+        _socket.sl_Close(SockID);
+        ASSERT_ON_ERROR(Status);
+    }
+
+    return SockID;
+}
+
+/*!
+    \brief Convert hex to decimal base
+
+    \param[in]      ptr - pointer to string containing number in hex
+
+    \return         number in decimal base
+
+*/
+int32_t cc3100::hexToi(unsigned char *ptr)
+{
+    uint32_t result = 0;
+    uint32_t len = 0;
+
+    int32_t  idx = -1;
+
+    len = strlen((const char*) ptr);
+
+    /* convert characters to upper case */
+    for(idx = 0; ptr[idx] != '\0'; ++idx)
+    {
+        if( (ptr[idx] >= 'a') &&
+            (ptr[idx] <= 'f') )
+        {
+            ptr[idx] -= 32;         /* Change case - ASCII 'a' = 97, 'A' = 65 => 97-65 = 32 */
+        }
+    }
+
+    for(idx = 0; ptr[idx] != '\0'; ++idx)
+    {
+        if(ptr[idx] >= '0' && ptr[idx] <= '9')
+        {
+            /* Converting '0' to '9' to their decimal value */
+            result += (ptr[idx] - '0') * (1 << (4 * (len - 1 - idx)));
+        }
+        else if(ptr[idx] >= 'A' && ptr[idx] <= 'F')
+        {
+            /* Converting hex 'A' to 'F' to their decimal value */
+            result += (ptr[idx] - 55) * (1 << (4 * (len -1 - idx))); /* .i.e. 'A' - 55 = 10, 'F' - 55 = 15 */
+        }
+        else
+        {
+            ASSERT_ON_ERROR(INVALID_HEX_STRING);
+        }
+    }
+
+    return result;
+}
+
+/*!
+    \brief Calculate the file chunk size
+
+    \param[in]      len - pointer to length of the data in the buffer
+    \param[in]      p_Buff - pointer to pointer of buffer containing data
+    \param[out]     chunk_size - pointer to variable containing chunk size
+
+    \return         0 for success, -ve for error
+
+*/
+int32_t cc3100::getChunkSize(int32_t *len, uint8_t **p_Buff, uint32_t *chunk_size)
+{
+    int32_t   idx = -1;
+    unsigned char   lenBuff[10];
+
+    idx = 0;
+    memset(lenBuff, 0, sizeof(lenBuff));
+    while(*len >= 0 && **p_Buff != 13) /* check for <CR> */
+    {
+        if(0 == *len)
+        {
+            memset(g_buff, 0, sizeof(g_buff));
+            *len = _socket.sl_Recv(g_SockID, &g_buff[0], MAX_BUFF_SIZE, 0);
+            if(*len <= 0)
+                ASSERT_ON_ERROR(TCP_RECV_ERROR);
+
+            *p_Buff = g_buff;
+        }
+
+        lenBuff[idx] = **p_Buff;
+        idx++;
+        (*p_Buff)++;
+        (*len)--;
+    }
+
+    (*p_Buff) += 2; /* skip <CR><LF> */
+    (*len) -= 2;
+    *chunk_size = hexToi(lenBuff);
+
+    return SUCCESS;
+}
+
+/*!
+    \brief Obtain the file from the server
+
+    This function requests the file from the server and save it on serial flash.
+    To request a different file for different user needs to modify the
+    PREFIX_BUFFER and POST_BUFFER macros.
+
+    \param[in]      None
+
+    \return         0 for success and negative for error
+
+*/
+/*
+int32_t cc3100::getFile()
+{
+    uint32_t Token = 0;
+    uint32_t recv_size = 0;
+    uint8_t *pBuff = 0;
+    uint8_t eof_detected = 0;
+    uint8_t isChunked = 0;
+
+    int32_t transfer_len = -1;
+    int32_t retVal = -1;
+    int32_t fileHandle = -1;
+
+    memset(g_buff, 0, sizeof(g_buff));
+
+    //Puts together the HTTP GET string.
+    strcpy((char*)g_buff, PREFIX_BUFFER);
+    strcat((char*)g_buff, POST_BUFFER);
+
+    //Send the HTTP GET string to the opened TCP/IP socket.
+    transfer_len = _socket.sl_Send(g_SockID, g_buff, strlen((const char*)g_buff), 0);
+
+    if (transfer_len < 0)
+    {
+        // error 
+        printf(" Socket Send Error\r\n");
+        ASSERT_ON_ERROR(TCP_SEND_ERROR);
+    }
+
+    memset(g_buff, 0, sizeof(g_buff));
+
+    //get the reply from the server in buffer.
+    transfer_len = _socket.sl_Recv(g_SockID, &g_buff[0], MAX_BUFF_SIZE, 0);
+
+    if(transfer_len <= 0)
+        ASSERT_ON_ERROR(TCP_RECV_ERROR);
+
+    // Check for 404 return code 
+    if(strstr((const char*)g_buff, HTTP_FILE_NOT_FOUND) != 0)
+    {
+        printf(" File not found, check the file and try again\r\n");
+        ASSERT_ON_ERROR(FILE_NOT_FOUND_ERROR);
+    }
+
+    // if not "200 OK" return error 
+    if(strstr((const char*)g_buff, HTTP_STATUS_OK) == 0)
+    {
+        printf(" Error during downloading the file\r\n");
+        ASSERT_ON_ERROR(INVALID_SERVER_RESPONSE);
+    }
+
+    // check if content length is transferred with headers 
+    pBuff = (uint8_t *)strstr((const char*)g_buff, HTTP_CONTENT_LENGTH);
+    if(pBuff != 0)
+    {
+        // not supported 
+        printf(" Server response format is not supported\r\n");
+        ASSERT_ON_ERROR(FORMAT_NOT_SUPPORTED);
+    }
+
+    // Check if data is chunked 
+    pBuff = (uint8_t *)strstr((const char*)g_buff, HTTP_TRANSFER_ENCODING);
+    if(pBuff != 0)
+    {
+        pBuff += strlen(HTTP_TRANSFER_ENCODING);
+        while(*pBuff == SPACE)
+            pBuff++;
+
+        if(memcmp(pBuff, HTTP_ENCODING_CHUNKED, strlen(HTTP_ENCODING_CHUNKED)) == 0)
+        {
+            recv_size = 0;
+            isChunked = 1;
+        }
+    }
+    else
+    {
+        // Check if connection will be closed by after sending data
+         // In this method the content length is not received and end of
+         // connection marks the end of data 
+        pBuff = (uint8_t *)strstr((const char*)g_buff, HTTP_CONNECTION);
+        if(pBuff != 0)
+        {
+            pBuff += strlen(HTTP_CONNECTION);
+            while(*pBuff == SPACE)
+                pBuff++;
+
+            if(memcmp(pBuff, HTTP_ENCODING_CHUNKED, strlen(HTTP_CONNECTION_CLOSE)) == 0)
+            {
+                // not supported 
+                printf(" Server response format is not supported\r\n");
+                ASSERT_ON_ERROR(FORMAT_NOT_SUPPORTED);
+            }
+        }
+    }
+
+    // "\r\n\r\n" marks the end of headers 
+    pBuff = (uint8_t *)strstr((const char*)g_buff, HTTP_END_OF_HEADER);
+    if(pBuff == 0)
+    {
+        printf(" Invalid response\r\n");
+        ASSERT_ON_ERROR(INVALID_SERVER_RESPONSE);
+    }
+    // Increment by 4 to skip "\r\n\r\n" 
+    pBuff += 4;
+
+    // Adjust buffer data length for header size 
+    transfer_len -= (pBuff - g_buff);
+
+    // If data in chunked format, calculate the chunk size 
+    if(isChunked == 1)
+    {
+        retVal = getChunkSize(&transfer_len, &pBuff, &recv_size);
+        if(retVal < 0)
+        {
+            // Error 
+            printf(" Problem with connection to server\r\n");
+            return retVal;
+        }
+    }
+
+    // Open file to save the downloaded file 
+    retVal = _fs.sl_FsOpen((uint8_t *)FILE_NAME,
+                       FS_MODE_OPEN_WRITE, &Token, &fileHandle);
+    if(retVal < 0)
+    {
+        // File Doesn't exit create a new of 45 KB file 
+        retVal = _fs.sl_FsOpen((uint8_t *)FILE_NAME,
+                           _fs.FS_MODE_OPEN_CREATE(SIZE_45K,_FS_FILE_OPEN_FLAG_COMMIT|_FS_FILE_PUBLIC_WRITE),
+                           &Token, &fileHandle);
+        if(retVal < 0)
+        {
+            printf(" Error during opening the file\r\n");
+            return retVal;
+        }
+    }
+
+    while (0 < transfer_len)
+    {
+        // For chunked data recv_size contains the chunk size to be received
+         // while the transfer_len contains the data in the buffer 
+        if(recv_size <= transfer_len)
+        {
+            // write the recv_size 
+            retVal = _fs.sl_FsWrite(fileHandle, g_BytesReceived,
+                    (uint8_t *)pBuff, recv_size);
+            if(retVal < recv_size)
+            {
+                // Close file without saving 
+                retVal = _fs.sl_FsClose(fileHandle, 0, (unsigned char*)"A", 1);
+                printf(" Error during writing the file\r\n");
+                return FILE_WRITE_ERROR;
+            }
+            transfer_len -= recv_size;
+            g_BytesReceived +=recv_size;
+            pBuff += recv_size;
+            recv_size = 0;
+
+            if(isChunked == 1)
+            {
+                // if data in chunked format calculate next chunk size 
+                pBuff += 2; // 2 bytes for <CR> <LF> 
+                transfer_len -= 2;
+
+                if(getChunkSize(&transfer_len, &pBuff, &recv_size) < 0)
+                {
+                    // Error 
+                    break;
+                }
+
+                // if next chunk size is zero we have received the complete file 
+                if(recv_size == 0)
+                {
+                    eof_detected = 1;
+                    break;
+                }
+
+                if(recv_size < transfer_len)
+                {
+                    // Code will enter this section if the new chunk size is less then
+                     // then the transfer size. This will the last chunk of file received
+                     
+                    retVal = _fs.sl_FsWrite(fileHandle, g_BytesReceived,
+                            (uint8_t *)pBuff, recv_size);
+                    if(retVal < recv_size)
+                    {
+                        // Close file without saving 
+                        retVal = _fs.sl_FsClose(fileHandle, 0, (unsigned char*)"A", 1);
+                        printf(" Error during writing the file\r\n");
+                        return FILE_WRITE_ERROR;
+                    }
+                    transfer_len -= recv_size;
+                    g_BytesReceived +=recv_size;
+                    pBuff += recv_size;
+                    recv_size = 0;
+
+                    pBuff += 2; // 2bytes for <CR> <LF> 
+                    transfer_len -= 2;
+
+                    // Calculate the next chunk size, should be zero 
+                    if(getChunkSize(&transfer_len, &pBuff, &recv_size) < 0)
+                    {
+                        // Error 
+                        break;
+                    }
+
+                    // if next chunk size is non zero error 
+                    if(recv_size != 0)
+                    {
+                        // Error 
+                        break;
+                    }
+                    eof_detected = 1;
+                    break;
+                }
+                else
+                {
+                    // write data on the file 
+                    retVal = _fs.sl_FsWrite(fileHandle, g_BytesReceived,
+                            (uint8_t *)pBuff, transfer_len);
+                    if(retVal < transfer_len)
+                    {
+                        // Close file without saving 
+                        retVal = _fs.sl_FsClose(fileHandle, 0, (unsigned char*)"A", 1);
+                        printf(" Error during writing the file\r\n");
+                        ASSERT_ON_ERROR(FILE_WRITE_ERROR);
+                    }
+                    recv_size -= transfer_len;
+                    g_BytesReceived +=transfer_len;
+                }
+            }
+            // complete file received exit 
+            if(recv_size == 0)
+            {
+                eof_detected = 1;
+                break;
+            }
+        }
+        else
+        {
+            // write data on the file 
+            retVal = _fs.sl_FsWrite(fileHandle, g_BytesReceived,
+                                 (uint8_t *)pBuff, transfer_len);
+            if (retVal < 0)
+            {
+                // Close file without saving 
+                retVal = _fs.sl_FsClose(fileHandle, 0, (unsigned char*)"A", 1);
+                printf(" Error during writing the file\r\n");
+                ASSERT_ON_ERROR(FILE_WRITE_ERROR);
+            }
+            g_BytesReceived +=transfer_len;
+            recv_size -= transfer_len;
+        }
+
+        memset(g_buff, 0, sizeof(g_buff));
+
+        transfer_len = _socket.sl_Recv(g_SockID, &g_buff[0], MAX_BUFF_SIZE, 0);
+        if(transfer_len <= 0)
+            ASSERT_ON_ERROR(TCP_RECV_ERROR);
+
+        pBuff = g_buff;
+    }
+
+    // If user file has checksum which can be used to verify the temporary
+     // file then file should be verified
+     // In case of invalid file (FILE_NAME) should be closed without saving to
+     // recover the previous version of file 
+    if(0 > transfer_len || eof_detected == 0)
+    {
+        // Close file without saving 
+        retVal = _fs.sl_FsClose(fileHandle, 0, (unsigned char*)"A", 1);
+        printf(" Error While File Download\r\n");
+        ASSERT_ON_ERROR(INVALID_FILE);
+    }
+    else
+    {
+        // Save and close file 
+        retVal = _fs.sl_FsClose(fileHandle, 0, 0, 0);
+        ASSERT_ON_ERROR(retVal);
+    }
+
+    return SUCCESS;;
+}
+*/
+
+/*!
+    \brief Connecting to a WLAN Access point
+
+    This function connects to the required AP (SSID_NAME).
+    The function will return once we are connected and have acquired IP address
+
+    \param[in]  None
+
+    \return     0 on success, negative error-code on error
+
+    \note
+
+    \warning    If the WLAN connection fails or we don't acquire an IP address,
+                We will be stuck in this function forever.
+*/
+int32_t cc3100::establishConnectionWithAP()
+{
+    //printf(" cc3100::establishConnectionWithAP \n\r");
+    SlSecParams_t secParams = {0};
+    int32_t retVal = 0;
+
+    secParams.Key = (signed char *)PASSKEY;
+    secParams.KeyLen = strlen(PASSKEY);
+    secParams.Type = SEC_TYPE;
+
+    retVal = _wlan.sl_WlanConnect((signed char *)SSID_NAME, strlen(SSID_NAME), 0, &secParams, 0);
+    ASSERT_ON_ERROR(retVal);
+
+    /* Wait */
+    while((!IS_CONNECTED(g_Status,STATUS_BIT_CONNECTION)) || (!IS_IP_ACQUIRED(g_Status,STATUS_BIT_IP_ACQUIRED))) { _nonos._SlNonOsMainLoopTask(); }
+    return SUCCESS;
+}
+
+/*!
+    \brief This function checks the LAN connection by pinging the AP's gateway
+
+    \param[in]  None
+
+    \return     0 on success, negative error-code on error
+*/
+int32_t cc3100::checkLanConnection()
+{
+    SlPingStartCommand_t pingParams = {0};
+    SlPingReport_t pingReport = {0};
+
+    int32_t retVal = -1;
+
+    CLR_STATUS_BIT(g_Status, STATUS_BIT_PING_DONE);
+    g_PingPacketsRecv = 0;
+
+    /* Set the ping parameters */
+    pingParams.PingIntervalTime = PING_INTERVAL;
+    pingParams.PingSize = PING_PKT_SIZE;
+    pingParams.PingRequestTimeout = PING_TIMEOUT;
+    pingParams.TotalNumberOfAttempts = PING_ATTEMPTS;
+    pingParams.Flags = 0;
+    pingParams.Ip = g_GatewayIP;
+
+    /* Check for LAN connection */
+    retVal = _netapp.sl_NetAppPingStart( (SlPingStartCommand_t*)&pingParams, SL_AF_INET,
+                                 (SlPingReport_t*)&pingReport, SimpleLinkPingReport);
+    ASSERT_ON_ERROR(retVal);
+
+    /* Wait */
+    while(!IS_PING_DONE(g_Status,STATUS_BIT_PING_DONE)) { SlNonOsMainLoopTask(); }
+
+    if(0 == g_PingPacketsRecv)
+    {
+        /* Problem with LAN connection */
+        ASSERT_ON_ERROR(LAN_CONNECTION_FAILED);
+    }
+
+    /* LAN connection is successful */
+    return SUCCESS;
+}
+
+/*!
+    \brief This function checks the internet connection by pinging
+           the external-host (HOST_NAME)
+
+    \param[in]  None
+
+    \return     0 on success, negative error-code on error
+*/
+int32_t cc3100::checkInternetConnection()
+{
+    SlPingStartCommand_t pingParams = {0};
+    SlPingReport_t pingReport = {0};
+
+    uint32_t ipAddr = 0;
+
+    int32_t retVal = -1;
+
+    CLR_STATUS_BIT(g_Status, STATUS_BIT_PING_DONE);
+    g_PingPacketsRecv = 0;
+
+    /* Set the ping parameters */
+    pingParams.PingIntervalTime = PING_INTERVAL;
+    pingParams.PingSize = PING_PKT_SIZE;
+    pingParams.PingRequestTimeout = PING_TIMEOUT;
+    pingParams.TotalNumberOfAttempts = PING_ATTEMPTS;
+    pingParams.Flags = 0;
+    pingParams.Ip = g_GatewayIP;
+
+    /* Check for Internet connection */
+    retVal = _netapp.sl_NetAppDnsGetHostByName((unsigned char *)HOST_NAME, strlen(HOST_NAME), &ipAddr, SL_AF_INET);
+    ASSERT_ON_ERROR(retVal);
+
+    /* Replace the ping address to match HOST_NAME's IP address */
+    pingParams.Ip = ipAddr;
+
+    /* Try to ping HOST_NAME */
+    retVal = _netapp.sl_NetAppPingStart( (SlPingStartCommand_t*)&pingParams, SL_AF_INET,
+                                 (SlPingReport_t*)&pingReport, SimpleLinkPingReport);
+    ASSERT_ON_ERROR(retVal);
+
+    /* Wait */
+    while(!IS_PING_DONE(g_Status,STATUS_BIT_PING_DONE)) { SlNonOsMainLoopTask(); }
+
+    if (0 == g_PingPacketsRecv)
+    {
+        /* Problem with internet connection*/
+        ASSERT_ON_ERROR(INTERNET_CONNECTION_FAILED);
+    }
+
+    /* Internet connection is successful */
+    return SUCCESS;
+}
+    
+/*****************************************************************************/
+/* Internal functions                                                        */
+/*****************************************************************************/
+
+int16_t cc3100::_sl_GetStartResponseConvert(uint32_t Status)
+{
+
+    switch(Status) {
+        case INIT_STA_OK:
+            return ROLE_STA;
+        case INIT_STA_ERR:
+            return ROLE_STA_ERR;
+        case INIT_AP_OK:
+            return ROLE_AP;
+        case INIT_AP_ERR:
+            return ROLE_AP_ERR;
+        case INIT_P2P_OK:
+            return ROLE_P2P;
+        case INIT_P2P_ERR:
+            return ROLE_P2P_ERR;
+        default:
+            return (int16_t)Status;
+    }
+}
+
+/*****************************************************************************/
+/* API Functions                                                             */
+/*****************************************************************************/
+
+bool cc3100::IS_PING_DONE(uint32_t status_variable,const uint32_t bit){
+	
+	    g_Status = status_variable;
+	    
+	    if(0 != (g_Status & ((uint32_t)1L<<(bit)))){
+	    	return TRUE;
+        }else{
+        	return FALSE;
+        }
+}
+        
+bool cc3100::IS_CONNECTED(uint32_t status_variable,const uint32_t bit){
+	
+	    g_Status = status_variable;
+	    
+	    if(0 != (g_Status & ((uint32_t)1L<<(bit)))){
+	    	return TRUE;
+        }else{
+        	return FALSE;
+        }
+}
+        
+bool cc3100::IS_STA_CONNECTED(uint32_t status_variable,const uint32_t bit){
+	
+	    g_Status = status_variable;
+	    
+	    if(0 != (g_Status & ((uint32_t)1L<<(bit)))){
+	    	return TRUE;
+        }else{
+        	return FALSE;
+        }
+} 
+       
+bool cc3100::IS_IP_ACQUIRED(uint32_t status_variable,const uint32_t bit){
+	
+	    g_Status = status_variable;
+	    
+	    if(0 != (g_Status & ((uint32_t)1L<<(bit)))){
+	    	return TRUE;
+        }else{
+        	return FALSE;
+        }
+}
+        
+bool cc3100::IS_IP_LEASED(uint32_t status_variable,const uint32_t bit){
+	
+	    g_Status = status_variable;
+	    
+	    if(0 != (g_Status & ((uint32_t)1L<<(bit)))){
+	    	return TRUE;
+        }else{
+        	return FALSE;
+        }
+}
+        
+bool cc3100::IS_CONNECTION_FAILED(uint32_t status_variable,const uint32_t bit){
+	    
+	    g_Status = status_variable;
+	    
+	    if(0 != (g_Status & ((uint32_t)1L<<(bit)))){
+	    	return TRUE;
+        }else{
+        	return FALSE;
+        }
+}
+        
+bool cc3100::IS_P2P_NEG_REQ_RECEIVED(uint32_t status_variable,const uint32_t bit){
+	
+	    g_Status = status_variable;
+	    
+	    if(0 != (g_Status & ((uint32_t)1L<<(bit)))){
+	    	return TRUE;
+        }else{
+        	return FALSE;
+        }
+}
+        
+bool cc3100::IS_SMARTCONFIG_DONE(uint32_t status_variable,const uint32_t bit){
+	
+	    g_Status = status_variable;
+	    
+	    if(0 != (g_Status & ((uint32_t)1L<<(bit)))){
+	    	return TRUE;
+        }else{
+        	return FALSE;
+        }
+}
+        
+bool cc3100::IS_SMARTCONFIG_STOPPED(uint32_t status_variable,const uint32_t bit){
+	
+	    g_Status = status_variable;
+	    
+	    if(0 != (g_Status & ((uint32_t)1L<<(bit)))){	    	
+	    	return TRUE;
+        }else{
+        	return FALSE;       	
+        }        
+}
+
+void cc3100::CLR_STATUS_BIT(uint32_t status_variable, const uint32_t bit){
+	    
+	    g_Status = status_variable;
+	    status_variable &= ~((uint32_t)1L<<(bit));
+	    g_Status = status_variable;
+}
+
+void cc3100::SET_STATUS_BIT(uint32_t status_variable, const uint32_t bit){
+
+	    g_Status = status_variable;
+	    status_variable |= ((uint32_t)1L<<(bit));
+	    g_Status = status_variable;
+}
+	    
+/*****************************************************************************/
+/* sl_Task                                                                   */
+/*****************************************************************************/
+#if _SL_INCLUDE_FUNC(sl_Task)
+void cc3100::sl_Task(void)
+{
+#ifdef _SlTaskEntry
+    _nonos._SlNonOsMainLoopTask;
+    
+#endif
+}
+#endif
+
+/*****************************************************************************/
+/* sl_Start                                                                  */
+/*****************************************************************************/
+#if _SL_INCLUDE_FUNC(sl_Start)
+int16_t cc3100::sl_Start(const void* pIfHdl, int8_t*  pDevName, const P_INIT_CALLBACK pInitCallBack)
+{
+    int16_t ObjIdx = MAX_CONCURRENT_ACTIONS;
+    InitComplete_t  AsyncRsp;
+
+    /* Perform any preprocessing before enable networking services */
+    sl_DeviceEnablePreamble();
+    
+    /* ControlBlock init */
+    _driver._SlDrvDriverCBInit();
+    
+    /* open the interface: usually SPI or UART */
+    if (NULL == pIfHdl) 
+    {
+        g_pCB->FD = _spi.spi_Open((int8_t *)pDevName, 0);
+    } 
+    else 
+    {
+        g_pCB->FD = (_SlFd_t)pIfHdl;
+    }   
+    /* Use Obj to issue the command, if not available try later */
+    ObjIdx = _driver._SlDrvWaitForPoolObj(START_STOP_ID,SL_MAX_SOCKETS);
+    if (MAX_CONCURRENT_ACTIONS == ObjIdx) 
+    {
+        printf("SL_POOL_IS_EMPTY\r\n");
+        return SL_POOL_IS_EMPTY;
+    }
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(&g_pCB->ProtectionLockObj,  NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+    g_pCB->ObjPool[ObjIdx].pRespArgs = (uint8_t *)&AsyncRsp;
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+
+    if( g_pCB->FD >= 0) {
+        _spi.CC3100_disable();
+       
+        if(NULL != pInitCallBack) {
+            g_pCB->pInitCallback = pInitCallBack;
+        }
+        _spi.CC3100_enable();
+
+        if (NULL == pInitCallBack) {
+            
+            OSI_RET_OK_CHECK(_nonos.sl_SyncObjWait(&g_pCB->ObjPool[ObjIdx].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE, NON_OS_SYNC_OBJ_CLEAR_VALUE, SL_OS_WAIT_FOREVER));
+            /*release Pool Object*/           
+            _driver._SlDrvReleasePoolObj(g_pCB->FunctionParams.AsyncExt.ActionIndex);            
+            return _sl_GetStartResponseConvert(AsyncRsp.Status);
+        }
+    }
+    
+    return (int16_t)g_pCB->FD;
+
+}
+#endif
+
+/***************************************************************************
+_sl_HandleAsync_InitComplete - handles init complete signalling to
+a waiting object
+****************************************************************************/
+void cc3100::_sl_HandleAsync_InitComplete(void *pVoidBuf)
+{
+
+    InitComplete_t *pMsgArgs = (InitComplete_t *)_SL_RESP_ARGS_START(pVoidBuf);
+
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+
+    if(g_pCB->pInitCallback) {
+        g_pCB->pInitCallback(_sl_GetStartResponseConvert(pMsgArgs->Status));
+    } else {
+        memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(InitComplete_t));        
+        OSI_RET_OK_CHECK(_nonos.sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE));
+    }
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+
+    if(g_pCB->pInitCallback) {
+        _driver._SlDrvReleasePoolObj(g_pCB->FunctionParams.AsyncExt.ActionIndex);
+    }
+
+}
+
+/*****************************************************************************
+sl_stop
+******************************************************************************/
+typedef union {
+    _DevStopCommand_t  Cmd;
+    _BasicResponse_t   Rsp;
+} _SlStopMsg_u;
+
+const _SlCmdCtrl_t _SlStopCmdCtrl = {
+    SL_OPCODE_DEVICE_STOP_COMMAND,
+    sizeof(_DevStopCommand_t),
+    sizeof(_BasicResponse_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_Stop)
+int16_t cc3100::sl_Stop(uint16_t timeout)
+{
+    int16_t RetVal=0;
+    _SlStopMsg_u      Msg;
+    _BasicResponse_t  AsyncRsp;
+    int16_t ObjIdx = MAX_CONCURRENT_ACTIONS;
+    /* if timeout is 0 the shutdown is forced immediately */
+    if( 0 == timeout ) {
+        _spi.registerInterruptHandler(NULL, NULL);
+        _spi.CC3100_disable();
+        RetVal = _spi.spi_Close(g_pCB->FD);
+
+    } else {
+        /* let the device make the shutdown using the defined timeout */
+        Msg.Cmd.Timeout = timeout;
+        /* Use Obj to issue the command, if not available try later */
+        ObjIdx = _driver._SlDrvWaitForPoolObj(START_STOP_ID,SL_MAX_SOCKETS);
+        if (MAX_CONCURRENT_ACTIONS == ObjIdx) {
+            return SL_POOL_IS_EMPTY;
+        }
+        OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+
+        g_pCB->ObjPool[ObjIdx].pRespArgs = (uint8_t *)&AsyncRsp;
+
+        OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+
+        VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlStopCmdCtrl, &Msg, NULL));
+
+        if(SL_OS_RET_CODE_OK == (int16_t)Msg.Rsp.status) {
+            OSI_RET_OK_CHECK(_nonos.sl_SyncObjWait(&g_pCB->ObjPool[ObjIdx].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE, NON_OS_SYNC_OBJ_CLEAR_VALUE, SL_OS_WAIT_FOREVER));
+            Msg.Rsp.status = AsyncRsp.status;
+            RetVal = Msg.Rsp.status;
+        }
+
+        _driver._SlDrvReleasePoolObj((uint8_t)ObjIdx);
+
+        _spi.registerInterruptHandler(NULL, NULL);
+        _spi.CC3100_disable();
+        _spi.spi_Close(g_pCB->FD);
+    }
+    _driver._SlDrvDriverCBDeinit();
+
+    return RetVal;
+}
+#endif
+
+
+/*****************************************************************************
+sl_EventMaskSet
+*****************************************************************************/
+typedef union {
+    _DevMaskEventSetCommand_t	    Cmd;
+    _BasicResponse_t	            Rsp;
+} _SlEventMaskSetMsg_u;
+
+const _SlCmdCtrl_t _SlEventMaskSetCmdCtrl = {
+    SL_OPCODE_DEVICE_EVENTMASKSET,
+    sizeof(_DevMaskEventSetCommand_t),
+    sizeof(_BasicResponse_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_EventMaskSet)
+int16_t cc3100::sl_EventMaskSet(uint8_t EventClass , uint32_t Mask)
+{
+    _SlEventMaskSetMsg_u Msg;
+    Msg.Cmd.group = EventClass;
+    Msg.Cmd.mask = Mask;
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlEventMaskSetCmdCtrl, &Msg, NULL));
+
+    return (int16_t)Msg.Rsp.status;
+}
+#endif
+
+/******************************************************************************
+sl_EventMaskGet
+******************************************************************************/
+typedef union {
+    _DevMaskEventGetCommand_t	    Cmd;
+    _DevMaskEventGetResponse_t      Rsp;
+} _SlEventMaskGetMsg_u;
+
+const _SlCmdCtrl_t _SlEventMaskGetCmdCtrl = {
+    SL_OPCODE_DEVICE_EVENTMASKGET,
+    sizeof(_DevMaskEventGetCommand_t),
+    sizeof(_DevMaskEventGetResponse_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_EventMaskGet)
+int16_t cc3100::sl_EventMaskGet(uint8_t EventClass, uint32_t *pMask)
+{
+    _SlEventMaskGetMsg_u Msg;
+
+    Msg.Cmd.group = EventClass;
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlEventMaskGetCmdCtrl, &Msg, NULL));
+
+    *pMask = Msg.Rsp.mask;
+    return SL_RET_CODE_OK;
+}
+#endif
+
+
+
+/******************************************************************************
+sl_DevGet
+******************************************************************************/
+
+typedef union {
+    _DeviceSetGet_t	    Cmd;
+    _DeviceSetGet_t	    Rsp;
+} _SlDeviceMsgGet_u;
+
+const _SlCmdCtrl_t _SlDeviceGetCmdCtrl = {
+    SL_OPCODE_DEVICE_DEVICEGET,
+    sizeof(_DeviceSetGet_t),
+    sizeof(_DeviceSetGet_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_DevGet)
+int32_t cc3100::sl_DevGet(uint8_t DeviceGetId, uint8_t *pOption,uint8_t *pConfigLen, uint8_t *pValues)
+{
+    _SlDeviceMsgGet_u         Msg;
+    _SlCmdExt_t               CmdExt;
+    
+    if (*pConfigLen == 0) {
+        return SL_EZEROLEN;
+    }
+   
+    if( pOption ) {
+        CmdExt.TxPayloadLen = 0;
+        CmdExt.RxPayloadLen = *pConfigLen;
+        CmdExt.pTxPayload = NULL;
+        CmdExt.pRxPayload = (uint8_t *)pValues;
+        CmdExt.ActualRxPayloadLen = 0;
+
+        Msg.Cmd.DeviceSetId = DeviceGetId;
+
+        Msg.Cmd.Option   = (uint16_t)*pOption;
+
+        VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlDeviceGetCmdCtrl, &Msg, &CmdExt));
+        
+        if( pOption ) {
+            *pOption = (uint8_t)Msg.Rsp.Option;
+        }
+        
+        if (CmdExt.RxPayloadLen < CmdExt.ActualRxPayloadLen) {
+            *pConfigLen = (uint8_t)CmdExt.RxPayloadLen;
+            return SL_ESMALLBUF;
+        } else {
+            *pConfigLen = (uint8_t)CmdExt.ActualRxPayloadLen;
+        }
+        
+        return (int16_t)Msg.Rsp.Status;
+    } else {
+        return -1;
+    }
+}
+#endif
+
+/******************************************************************************
+sl_DevSet
+******************************************************************************/
+typedef union {
+    _DeviceSetGet_t    Cmd;
+    _BasicResponse_t   Rsp;
+} _SlDeviceMsgSet_u;
+
+const _SlCmdCtrl_t _SlDeviceSetCmdCtrl = {
+    SL_OPCODE_DEVICE_DEVICESET,
+    sizeof(_DeviceSetGet_t),
+    sizeof(_BasicResponse_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_DevSet)
+int32_t cc3100::sl_DevSet(uint8_t DeviceSetId ,uint8_t Option,uint8_t ConfigLen, uint8_t *pValues)
+{
+    _SlDeviceMsgSet_u         Msg;
+    _SlCmdExt_t               CmdExt;
+
+    CmdExt.TxPayloadLen = (ConfigLen+3) & (~3);
+    CmdExt.RxPayloadLen = 0;
+    CmdExt.pTxPayload = (uint8_t *)pValues;
+    CmdExt.pRxPayload = NULL;
+
+
+    Msg.Cmd.DeviceSetId    = DeviceSetId;
+    Msg.Cmd.ConfigLen   = ConfigLen;
+    Msg.Cmd.Option   = Option;
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlDeviceSetCmdCtrl, &Msg, &CmdExt));
+
+    return (int16_t)Msg.Rsp.status;
+}
+#endif
+
+/******************************************************************************
+sl_UartSetMode
+******************************************************************************/
+#ifdef SL_IF_TYPE_UART
+typedef union {
+    _DevUartSetModeCommand_t	  Cmd;
+    _DevUartSetModeResponse_t     Rsp;
+} _SlUartSetModeMsg_u;
+
+const _SlCmdCtrl_t _SlUartSetModeCmdCtrl = {
+    SL_OPCODE_DEVICE_SETUARTMODECOMMAND,
+    sizeof(_DevUartSetModeCommand_t),
+    sizeof(_DevUartSetModeResponse_t)
+};
+
+
+#if _SL_INCLUDE_FUNC(sl_UartSetMode)
+int16_t cc3100::sl_UartSetMode(const SlUartIfParams_t* pUartParams)
+{
+    _SlUartSetModeMsg_u Msg;
+    uint32_t magicCode = 0xFFFFFFFF;
+
+    Msg.Cmd.BaudRate = pUartParams->BaudRate;
+    Msg.Cmd.FlowControlEnable = pUartParams->FlowControlEnable;
+
+
+    VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlUartSetModeCmdCtrl, &Msg, NULL));
+
+    /* cmd response OK, we can continue with the handshake */
+    if (SL_RET_CODE_OK == Msg.Rsp.status) {
+        sl_IfMaskIntHdlr();
+
+        /* Close the comm port */
+        sl_IfClose(g_pCB->FD);
+
+        /* Re-open the comm port */
+        sl_IfOpen((void * )pUartParams, UART_IF_OPEN_FLAG_RE_OPEN);
+        sl_IfUnMaskIntHdlr();
+
+        /* send the magic code and wait for the response */
+        sl_IfWrite(g_pCB->FD, (uint8_t* )&magicCode, 4);
+
+        magicCode = UART_SET_MODE_MAGIC_CODE;
+        sl_IfWrite(g_pCB->FD, (uint8_t* )&magicCode, 4);
+
+        /* clear magic code */
+        magicCode = 0;
+
+        /* wait (blocking) till the magic code to be returned from device */
+        sl_IfRead(g_pCB->FD, (uint8_t* )&magicCode, 4);
+
+        /* check for the received magic code matching */
+        if (UART_SET_MODE_MAGIC_CODE != magicCode) {
+            _SL_ASSERT(0);
+        }
+    }
+
+    return (int16_t)Msg.Rsp.status;
+}
+#endif
+#endif
+
+}//namespace
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100.h	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,824 @@
+/*
+ * device.h - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+#ifndef DEVICE_H_
+#define DEVICE_H_
+
+/*****************************************************************************/
+/* Include files                                                             */
+/*****************************************************************************/
+#include "mbed.h"
+#include "cc3100_simplelink.h"
+#include "cc3100_driver.h"
+#include "cc3100_wlan_rx_filters.h"
+
+#include "cc3100_spi.h"
+#include "cc3100_netcfg.h"
+
+namespace mbed_cc3100 {
+
+/*!
+
+    \addtogroup device
+    @{
+
+*/
+    const uint16_t   MAX_BUFF_SIZE =  1460;
+    extern uint32_t  g_PingPacketsRecv;
+    extern uint32_t  g_GatewayIP;
+    extern uint32_t  g_StationIP;
+    extern uint32_t  g_DestinationIP;
+    extern uint32_t  g_BytesReceived; // variable to store the file size 
+    extern uint32_t  g_Status;
+    extern uint8_t   g_buff[MAX_BUFF_SIZE+1];
+    extern int32_t   g_SockID;
+
+
+/* File on the serial flash */
+#define FILE_NAME "cc3000_module.pdf"
+#define HOST_NAME       "www.ti.com"
+
+#define HTTP_FILE_NOT_FOUND    "404 Not Found" /* HTTP file not found response */
+#define HTTP_STATUS_OK         "200 OK"  /* HTTP status ok response */
+#define HTTP_CONTENT_LENGTH    "Content-Length:"  /* HTTP content length header */
+#define HTTP_TRANSFER_ENCODING "Transfer-Encoding:" /* HTTP transfer encoding header */
+#define HTTP_ENCODING_CHUNKED  "chunked" /* HTTP transfer encoding header value */
+#define HTTP_CONNECTION        "Connection:" /* HTTP Connection header */
+#define HTTP_CONNECTION_CLOSE  "close"  /* HTTP Connection header value */
+#define HTTP_END_OF_HEADER  "\r\n\r\n"  /* string marking the end of headers in response */
+
+/*****************************************************************************/
+/* Macro declarations                                                        */
+/*****************************************************************************/
+
+const uint16_t IP_LEASE_TIME    =    3600;
+
+const uint16_t SIZE_45K      =  46080;  /* Serial flash file size 45 KB */
+const uint16_t READ_SIZE     =  1450;
+const uint8_t SPACE          =  32;
+
+const uint16_t PING_INTERVAL   =   1000;
+const uint8_t  PING_SIZE       =   20;
+const uint16_t PING_TIMEOUT    =   3000;
+const uint8_t  PING_ATTEMPTS   =   3;
+const uint8_t  PING_PKT_SIZE   =   20; 
+
+const uint8_t SL_STOP_TIMEOUT    =    0xFF;
+
+/* SL internal Error codes */
+
+/* Receive this error in case there are no resources to issue the command
+   If possible, increase the number of MAX_CUNCURENT_ACTIONS (result in memory increase)
+   If not, try again later */
+const int16_t SL_POOL_IS_EMPTY  = (-2000);
+
+/* Receive this error in case a given length for RX buffer was too small.
+   Receive payload was bigger than the given buffer size. Therefore, payload is cut according to receive size
+   Recommend to increase buffer size */
+const int16_t SL_ESMALLBUF      = (-2001);
+
+/* Receive this error in case zero length is supplied to a "get" API
+   Recommend to supply length according to requested information (view options defines for help) */
+const int16_t SL_EZEROLEN       = (-2002);
+
+/* User supplied invalid parameter */
+const int16_t SL_INVALPARAM     = (-2003);
+
+/* End of SL internal Error codes */
+
+/*****************************************************************************/
+/* Errors returned from the general error async event                        */
+/*****************************************************************************/        
+    
+/* Use bit 32: Lower bits of status variable are used for NWP events
+ *      1 in a 'status_variable', the device has completed the ping operation
+ *      0 in a 'status_variable', the device has not completed the ping operation
+ */
+//const uint32_t STATUS_BIT_PING_DONE = 31;
+
+/* Status bits - These are used to set/reset the corresponding bits in a 'status_variable' */
+typedef enum {
+    STATUS_BIT_CONNECTION =  0, /* If this bit is:
+                                 *      1 in a 'status_variable', the device is connected to the AP
+                                 *      0 in a 'status_variable', the device is not connected to the AP
+                                 */
+
+    STATUS_BIT_STA_CONNECTED,    /* If this bit is:
+                                  *      1 in a 'status_variable', client is connected to device
+                                  *      0 in a 'status_variable', client is not connected to device
+                                  */
+
+    STATUS_BIT_IP_ACQUIRED,       /* If this bit is:
+                                   *      1 in a 'status_variable', the device has acquired an IP
+                                   *      0 in a 'status_variable', the device has not acquired an IP
+                                   */
+
+    STATUS_BIT_IP_LEASED,           /* If this bit is:
+                                      *      1 in a 'status_variable', the device has leased an IP
+                                      *      0 in a 'status_variable', the device has not leased an IP
+                                      */
+
+    STATUS_BIT_CONNECTION_FAILED,   /* If this bit is:
+                                     *      1 in a 'status_variable', failed to connect to device
+                                     *      0 in a 'status_variable'
+                                     */
+
+    STATUS_BIT_P2P_NEG_REQ_RECEIVED,/* If this bit is:
+                                     *      1 in a 'status_variable', connection requested by remote wifi-direct device
+                                     *      0 in a 'status_variable',
+                                     */
+    STATUS_BIT_SMARTCONFIG_DONE,    /* If this bit is:
+                                     *      1 in a 'status_variable', smartconfig completed
+                                     *      0 in a 'status_variable', smartconfig event couldn't complete
+                                     */
+
+    STATUS_BIT_SMARTCONFIG_STOPPED,  /* If this bit is:
+                                     *      1 in a 'status_variable', smartconfig process stopped
+                                     *      0 in a 'status_variable', smartconfig process running
+                                     */
+                                     
+    STATUS_BIT_PING_DONE = 31
+                                     /* Use bit 32: Lower bits of status variable are used for NWP events
+                                      *      1 in a 'status_variable', the device has completed the ping operation
+                                      *      0 in a 'status_variable', the device has not completed the ping operation
+                                      */                                 
+
+} e_StatusBits;        
+    
+/* Application specific status/error codes */
+typedef enum {
+    LAN_CONNECTION_FAILED = -0x7D0,        /* Choosing this number to avoid overlap with host-driver's error codes */
+    INTERNET_CONNECTION_FAILED = LAN_CONNECTION_FAILED - 1,
+    DEVICE_NOT_IN_STATION_MODE = INTERNET_CONNECTION_FAILED - 1,
+    HTTP_SEND_ERROR = DEVICE_NOT_IN_STATION_MODE - 1,
+    HTTP_RECV_ERROR = HTTP_SEND_ERROR - 1,
+    HTTP_INVALID_RESPONSE = HTTP_RECV_ERROR -1,
+    SNTP_SEND_ERROR = DEVICE_NOT_IN_STATION_MODE - 1,
+    SNTP_RECV_ERROR = SNTP_SEND_ERROR - 1,
+    SNTP_SERVER_RESPONSE_ERROR = SNTP_RECV_ERROR - 1,
+    INVALID_HEX_STRING = DEVICE_NOT_IN_STATION_MODE - 1,
+    TCP_RECV_ERROR = INVALID_HEX_STRING - 1,
+    TCP_SEND_ERROR = TCP_RECV_ERROR - 1,
+    FILE_NOT_FOUND_ERROR = TCP_SEND_ERROR - 1,
+    INVALID_SERVER_RESPONSE = FILE_NOT_FOUND_ERROR - 1,
+    FORMAT_NOT_SUPPORTED = INVALID_SERVER_RESPONSE - 1,
+    FILE_WRITE_ERROR = FORMAT_NOT_SUPPORTED - 1,
+    INVALID_FILE = FILE_WRITE_ERROR - 1,
+
+    STATUS_CODE_MAX = -0xBB8
+} e_AppStatusCodes;    
+    
+    /* Send types */
+typedef enum {
+    SL_ERR_SENDER_HEALTH_MON,
+    SL_ERR_SENDER_CLI_UART,
+    SL_ERR_SENDER_SUPPLICANT,
+    SL_ERR_SENDER_NETWORK_STACK,
+    SL_ERR_SENDER_WLAN_DRV_IF,
+    SL_ERR_SENDER_WILINK,
+    SL_ERR_SENDER_INIT_APP,
+    SL_ERR_SENDER_NETX,
+    SL_ERR_SENDER_HOST_APD,
+    SL_ERR_SENDER_MDNS,
+    SL_ERR_SENDER_HTTP_SERVER,
+    SL_ERR_SENDER_DHCP_SERVER,
+    SL_ERR_SENDER_DHCP_CLIENT,
+    SL_ERR_DISPATCHER,
+    SL_ERR_NUM_SENDER_LAST=0xFF
+} SlErrorSender_e;
+
+/* Error codes */
+const int8_t SL_ERROR_STATIC_ADDR_SUBNET_ERROR                  = (-60);  /* network stack error*/
+const int8_t SL_ERROR_ILLEGAL_CHANNEL                           = (-61);  /* supplicant error */
+const int8_t SL_ERROR_SUPPLICANT_ERROR                          = (-72);  /* init error code */
+const int8_t SL_ERROR_HOSTAPD_INIT_FAIL                         = (-73);  /* init error code */
+const int8_t SL_ERROR_HOSTAPD_INIT_IF_FAIL                      = (-74);  /* init error code */
+const int8_t SL_ERROR_WLAN_DRV_INIT_FAIL                        = (-75);  /* init error code */
+const int8_t SL_ERROR_WLAN_DRV_START_FAIL                       = (-76);  /* wlan start error */
+const int8_t SL_ERROR_FS_FILE_TABLE_LOAD_FAILED                 = (-77);  /* init file system failed */
+const int8_t SL_ERROR_PREFERRED_NETWORKS_FILE_LOAD_FAILED       = (-78);  /* init file system failed */
+const int8_t SL_ERROR_HOSTAPD_BSSID_VALIDATION_ERROR            = (-79);  /* Ap configurations BSSID error */
+const int8_t SL_ERROR_HOSTAPD_FAILED_TO_SETUP_INTERFACE         = (-80);  /* Ap configurations interface error */
+const int8_t SL_ERROR_MDNS_ENABLE_FAIL                          = (-81);  /* mDNS enable failed                */
+const int8_t SL_ERROR_HTTP_SERVER_ENABLE_FAILED                 = (-82);  /* HTTP server enable failed         */
+const int8_t SL_ERROR_DHCP_SERVER_ENABLE_FAILED                 = (-83);  /* DHCP server enable failed         */
+const int8_t SL_ERROR_PREFERRED_NETWORK_LIST_FULL               = (-93);  /* supplicant error  */
+const int8_t SL_ERROR_PREFERRED_NETWORKS_FILE_WRITE_FAILED      = (-94);  /* supplicant error  */
+const int8_t SL_ERROR_DHCP_CLIENT_RENEW_FAILED                  = (-100); /* DHCP client error */
+/* WLAN Connection management status */
+const int8_t SL_ERROR_CON_MGMT_STATUS_UNSPECIFIED               = (-102);
+const int8_t SL_ERROR_CON_MGMT_STATUS_AUTH_REJECT               = (-103);
+const int8_t SL_ERROR_CON_MGMT_STATUS_ASSOC_REJECT              = (-104);
+const int8_t SL_ERROR_CON_MGMT_STATUS_SECURITY_FAILURE          = (-105);
+const int8_t SL_ERROR_CON_MGMT_STATUS_AP_DEAUTHENTICATE         = (-106);
+const int8_t SL_ERROR_CON_MGMT_STATUS_AP_DISASSOCIATE           = (-107);
+const int8_t SL_ERROR_CON_MGMT_STATUS_ROAMING_TRIGGER           = (-108);
+const int8_t SL_ERROR_CON_MGMT_STATUS_DISCONNECT_DURING_CONNECT = (-109);
+const int8_t SL_ERROR_CON_MGMT_STATUS_SG_RESELECT               = (-110);
+const int8_t SL_ERROR_CON_MGMT_STATUS_ROC_FAILURE               = (-111);
+const int8_t SL_ERROR_CON_MGMT_STATUS_MIC_FAILURE               = (-112);
+/* end of WLAN connection management error statuses */
+const int8_t SL_ERROR_WAKELOCK_ERROR_PREFIX                     = (-115);  /* Wake lock expired */
+const int8_t SL_ERROR_LENGTH_ERROR_PREFIX                       = (-116);  /* Uart header length error */
+const int8_t SL_ERROR_MDNS_CREATE_FAIL                          = (-121);  /* mDNS create failed */
+const int8_t SL_ERROR_GENERAL_ERROR                             = (-127);
+
+
+
+const int8_t SL_DEVICE_GENERAL_CONFIGURATION           = (1);
+const int8_t SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME = (11);
+const int8_t SL_DEVICE_GENERAL_VERSION                 = (12);
+const int8_t SL_DEVICE_STATUS                          = (2);
+
+/*
+    Declare the different event group classifications
+    The SimpleLink device send asynchronous events. Each event has a group
+    classification according to its nature.
+*/
+/* SL_EVENT_CLASS_WLAN connection user events */
+const int8_t SL_WLAN_CONNECT_EVENT                   =  (1);
+const int8_t SL_WLAN_DISCONNECT_EVENT                =  (2);
+/* WLAN Smart Config user events */
+const int8_t SL_WLAN_SMART_CONFIG_COMPLETE_EVENT     =  (3);
+const int8_t SL_WLAN_SMART_CONFIG_STOP_EVENT         =  (4);
+/* WLAN AP user events */
+const int8_t SL_WLAN_STA_CONNECTED_EVENT             =  (5);
+const int8_t SL_WLAN_STA_DISCONNECTED_EVENT          =  (6);
+/* WLAN P2P user events */
+const int8_t SL_WLAN_P2P_DEV_FOUND_EVENT             =  (7);
+const int8_t    SL_WLAN_P2P_NEG_REQ_RECEIVED_EVENT   =  (8);
+const int8_t SL_WLAN_CONNECTION_FAILED_EVENT         =  (9);
+/* SL_EVENT_CLASS_DEVICE user events */
+const int8_t SL_DEVICE_FATAL_ERROR_EVENT             =  (1);
+/* SL_EVENT_CLASS_BSD user events */
+const int8_t    SL_SOCKET_TX_FAILED_EVENT            =  (1);
+const int8_t SL_SOCKET_ASYNC_EVENT                   =  (2);
+/* SL_EVENT_CLASS_NETAPP user events */
+const int8_t    SL_NETAPP_IPV4_IPACQUIRED_EVENT      =  (1);
+const int8_t    SL_NETAPP_IPV6_IPACQUIRED_EVENT      =  (2);
+const int8_t SL_NETAPP_IP_LEASED_EVENT               =  (3);
+const int8_t SL_NETAPP_IP_RELEASED_EVENT             =  (4);
+
+/* Server Events */
+const int8_t SL_NETAPP_HTTPGETTOKENVALUE_EVENT       =   (1);
+const int8_t SL_NETAPP_HTTPPOSTTOKENVALUE_EVENT      =   (2);
+
+
+/*
+    Declare the different event group classifications for sl_DevGet
+    for getting status indications
+ */
+
+/* Events list to mask/unmask*/
+const int8_t SL_EVENT_CLASS_GLOBAL                   =  (0);
+const int8_t SL_EVENT_CLASS_DEVICE                   =  (1);
+const int8_t SL_EVENT_CLASS_WLAN                     =  (2);
+const int8_t SL_EVENT_CLASS_BSD                      =  (3);
+const int8_t SL_EVENT_CLASS_NETAPP                   =  (4);
+const int8_t SL_EVENT_CLASS_NETCFG                   =  (5);
+const int8_t SL_EVENT_CLASS_FS                       =  (6);
+
+
+/******************  DEVICE CLASS status ****************/
+const uint32_t EVENT_DROPPED_DEVICE_ASYNC_GENERAL_ERROR         = (0x00000001L);
+const uint32_t STATUS_DEVICE_SMART_CONFIG_ACTIVE                = (0x80000000L);
+
+/******************  WLAN CLASS status ****************/
+const uint32_t EVENT_DROPPED_WLAN_WLANASYNCONNECTEDRESPONSE     = (0x00000001L);
+const uint32_t EVENT_DROPPED_WLAN_WLANASYNCDISCONNECTEDRESPONSE = (0x00000002L);
+const uint32_t EVENT_DROPPED_WLAN_STA_CONNECTED                 = (0x00000004L);
+const uint32_t EVENT_DROPPED_WLAN_STA_DISCONNECTED              = (0x00000008L);
+const uint32_t STATUS_WLAN_STA_CONNECTED                        = (0x80000000L);
+
+/******************  NETAPP CLASS status ****************/
+const uint32_t EVENT_DROPPED_NETAPP_IPACQUIRED                  = (0x00000001L);
+const uint32_t EVENT_DROPPED_NETAPP_IPACQUIRED_V6               = (0x00000002L);
+const uint32_t EVENT_DROPPED_NETAPP_IP_LEASED                   = (0x00000004L);
+const uint32_t EVENT_DROPPED_NETAPP_IP_RELEASED                 = (0x00000008L);
+
+/******************  BSD CLASS status ****************/
+const uint32_t EVENT_DROPPED_SOCKET_TXFAILEDASYNCRESPONSE       = (0x00000001L);
+
+/******************  FS CLASS  ****************/
+
+/*****************************************************************************/
+/* Structure/Enum declarations                                               */
+/*****************************************************************************/
+
+#ifdef SL_IF_TYPE_UART
+typedef struct {
+    uint32_t             BaudRate;
+    uint8_t              FlowControlEnable;
+    uint8_t              CommPort;
+} SlUartIfParams_t;
+#endif
+
+typedef struct {
+    uint32_t               ChipId;
+    uint32_t               FwVersion[4];
+    uint8_t                PhyVersion[4];
+} _SlPartialVersion;
+
+typedef struct {
+    _SlPartialVersion ChipFwAndPhyVersion;
+    uint32_t               NwpVersion[4];
+    uint16_t               RomVersion;
+    uint16_t               Padding;
+} SlVersionFull;
+
+typedef struct {
+    int8_t                status;
+    SlErrorSender_e        sender;
+} sl_DeviceReport;
+
+typedef union {
+    sl_DeviceReport           deviceEvent;
+} _SlDeviceEventData_u;
+
+typedef struct {
+    uint32_t             Event;
+    _SlDeviceEventData_u EventData;
+} SlDeviceEvent_t;
+
+typedef struct {
+    /* time */
+    uint32_t                sl_tm_sec;
+    uint32_t                sl_tm_min;
+    uint32_t                sl_tm_hour;
+    /* date */
+    uint32_t                sl_tm_day; /* 1-31 */
+    uint32_t                sl_tm_mon; /* 1-12 */
+    uint32_t                sl_tm_year; /*  YYYY 4 digits  */
+    uint32_t                sl_tm_week_day; /* not required */
+    uint32_t                sl_tm_year_day; /* not required */
+    uint32_t                reserved[3];
+} SlDateTime_t;
+
+/******************************************************************************/
+/* Type declarations                                                          */
+/******************************************************************************/
+typedef void (*P_INIT_CALLBACK)(uint32_t Status);
+
+class cc3100_netcfg;
+
+class cc3100
+{
+
+public:
+
+    cc3100(PinName cc3100_irq, PinName cc3100_nHIB, PinName cc3100_cs, SPI cc3100_spi);
+
+    ~cc3100();
+
+    /*****************************************************************************/
+    /* Function prototypes                                                       */
+    /*****************************************************************************/
+    int32_t initializeAppVariables();
+    
+    int32_t establishConnectionWithAP(void);
+    
+    int32_t checkLanConnection(void);
+    
+    int32_t checkInternetConnection(void);
+    
+    int32_t createUDPConnection(void);
+    
+    int32_t createConnection(uint32_t DestinationIP);
+
+    int32_t getChunkSize(int32_t *len, uint8_t **p_Buff, uint32_t *chunk_size);
+    
+    int32_t hexToi(unsigned char *ptr);
+    
+//    int32_t getFile(void);
+    
+    int32_t disconnectFromAP(void);
+    
+    uint16_t itoa(int16_t cNum, uint8_t *cString);
+    
+    int32_t configureSimpleLinkToDefaultState(void);
+    
+    int16_t _sl_GetStartResponseConvert(uint32_t Status);
+
+    void _sl_HandleAsync_InitComplete(void *pVoidBuf); 
+    
+    bool IS_PING_DONE(uint32_t status_variable,const uint32_t bit);
+    bool IS_CONNECTED(uint32_t status_variable,const uint32_t bit);
+    bool IS_STA_CONNECTED(uint32_t status_variable,const uint32_t bit);
+    bool IS_IP_ACQUIRED(uint32_t status_variable,const uint32_t bit);
+    bool IS_IP_LEASED(uint32_t status_variable,const uint32_t bit);
+    bool IS_CONNECTION_FAILED(uint32_t status_variable,const uint32_t bit);
+    bool IS_P2P_NEG_REQ_RECEIVED(uint32_t status_variable,const uint32_t bit);
+    bool IS_SMARTCONFIG_DONE(uint32_t status_variable,const uint32_t bit);
+    bool IS_SMARTCONFIG_STOPPED(uint32_t status_variable,const uint32_t bit);
+    
+    
+    
+    void CLR_STATUS_BIT(uint32_t status_variable, const uint32_t bit);
+    void SET_STATUS_BIT(uint32_t status_variable, const uint32_t bit);
+    
+
+    /*!
+        \brief Start the SimpleLink device
+
+        This function initialize the communication interface, set the enable pin
+        of the device, and call to the init complete callback.
+
+        \param[in]      pIfHdl              Opened Interface Object. In case the interface
+                                            must be opened outside the SimpleLink Driver, the
+                                            user might give the handler to be used in \n
+                                            any access of the communication interface with the
+                                            device (UART/SPI). \n
+                                            The SimpleLink driver will open an interface port
+                                            only if this parameter is null! \n
+        \param[in]      pDevName            The name of the device to open. Could be used when
+                                            the pIfHdl is null, to transfer information to the
+                                            open interface function \n
+                                            This pointer could be used to pass additional information to
+                                            sl_IfOpen in case it is required (e.g. UART com port name)
+        \param[in]      pInitCallBack       Pointer to function that would be called
+                                            on completion of the initialization process.\n
+                                            If this parameter is NULL the function is
+                                            blocked until the device initialization
+                                            is completed, otherwise the function returns
+                                            immediately.
+
+        \return         Returns the current active role (STA/AP/P2P) or an error code:
+                        - ROLE_STA, ROLE_AP, ROLE_P2P in case of success,
+                          otherwise in failure one of the following is return:
+                        - ROLE_STA_ERR  (Failure to load MAC/PHY in STA role)
+                        - ROLE_AP_ERR  (Failure to load MAC/PHY in AP role)
+                        - ROLE_P2P_ERR  (Failure to load MAC/PHY in P2P role)
+
+
+         \sa             sl_Stop
+
+        \note           belongs to \ref basic_api
+
+        \warning        This function must be called before any other SimpleLink API is used, or after sl_Stop is called for reinit the device
+        \par            Example:
+        \code
+                       An example for open interface without callback routine. The interface name and handler are
+                       handled by the sl_IfOpen routine:
+
+                        if( sl_Start(NULL, NULL, NULL) < 0 )
+                       {
+                           LOG("Error opening interface to device\n");
+                       }
+        \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_Start)
+    int16_t sl_Start(const void* pIfHdl, int8_t*  pDevName, const P_INIT_CALLBACK pInitCallBack);
+#endif
+
+    /*!
+        \brief Stop the SimpleLink device
+
+        This function clears the enable pin of the device, closes the communication \n
+        interface and invokes the stop complete callback
+
+        \param[in]      timeout                       Stop timeout in msec. Should be used to give the device time to finish \n
+                                                      any transmission/reception that is not completed when the function was called. \n
+                        Additional options:
+                        - 0                             Enter to hibernate immediately \n
+                        - 0xFFFF                        Host waits for device's response before \n
+                                                        hibernating, without timeout protection \n
+                        - 0 < Timeout[msec] < 0xFFFF    Host waits for device's response before \n
+                                                        hibernating, with a defined timeout protection \n
+                                                        This timeout defines the max time to wait. The NWP \n
+                                                        response can be sent earlier than this timeout.
+
+        \return         On success, zero is returned. On error, -1 is returned
+
+        \sa             sl_Start
+
+        \note           This API will shutdown the device and invoke the "i/f close" function regardless \n
+                        if it was opened implicitly or explicitly. \n
+                        It is up to the platform interface library to properly handle interface close \n
+                        routine \n
+                        belongs to \ref basic_api \n
+        \warning
+    */
+#if _SL_INCLUDE_FUNC(sl_Stop)
+    int16_t sl_Stop(uint16_t timeout);
+#endif
+
+
+    /*!
+        \brief     Internal function for setting device configurations
+
+        \return    On success, zero is returned. On error, -1 is
+                   returned
+
+        \param[in] DeviceSetId   configuration id
+        \param[in] Option         configurations option
+        \param[in] ConfigLen     configurations len
+        \param[in] pValues         configurations values
+
+        \sa
+        \note
+        \warning
+        \par   Examples:
+        \code
+             Setting device time and date example:
+
+             SlDateTime_t dateTime= {0};
+             dateTime.sl_tm_day =   (uint32_t)23;          // Day of month (DD format) range 1-13
+             dateTime.sl_tm_mon =   (uint32_t)6;           // Month (MM format) in the range of 1-12
+             dateTime.sl_tm_year =  (uint32_t)2014;        // Year (YYYY format)
+             dateTime.sl_tm_hour =  (uint32_t)17;          // Hours in the range of 0-23
+             dateTime.sl_tm_min =   (uint32_t)55;          // Minutes in the range of 0-59
+             dateTime.sl_tm_sec =   (uint32_t)22;          // Seconds in the range of  0-59
+             sl_DevSet(SL_DEVICE_GENERAL_CONFIGURATION,
+                       SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME,
+                       sizeof(SlDateTime_t),
+                       (uint8_t *)(&dateTime));
+
+        \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_DevSet)
+    int32_t sl_DevSet(uint8_t DeviceSetId ,uint8_t Option,uint8_t ConfigLen, uint8_t *pValues);
+#endif
+
+    /*!
+        \brief      Internal function for getting device configurations
+        \return     On success, zero is returned. On error, -1 is
+                    returned
+        \param[in]  DeviceGetId   configuration id - example SL_DEVICE_STATUS
+        \param[out] pOption   Get configurations option, example for get status options
+                                - SL_EVENT_CLASS_GLOBAL
+                                - SL_EVENT_CLASS_DEVICE
+                                - SL_EVENT_CLASS_WLAN
+                                - SL_EVENT_CLASS_BSD
+                                - SL_EVENT_CLASS_NETAPP
+                                - SL_EVENT_CLASS_NETCFG
+                                - SL_EVENT_CLASS_FS
+        \param[out] pConfigLen   The length of the allocated memory as input, when the
+                                 function complete, the value of this parameter would be
+                                 the len that actually read from the device.\n
+                                 If the device return length that is longer from the input
+                                 value, the function will cut the end of the returned structure
+                                 and will return SL_ESMALLBUF
+        \param[out] pValues      Get configurations values
+        \sa
+        \note
+        \warning
+        \par        Examples:
+        \code
+         Example for getting WLAN class status:
+         uint32_t statusWlan;
+         uint8_t pConfigOpt;
+         uint8_t pConfigLen;
+         pConfigOpt = SL_EVENT_CLASS_WLAN;
+         sl_DevGet(SL_DEVICE_STATUS,&pConfigOpt,&pConfigLen,(uint8_t *)(&statusWlan));
+         Example for getting version:
+         SlVersionFull ver;
+         pConfigOpt = SL_DEVICE_GENERAL_VERSION;
+         sl_DevGet(SL_DEVICE_GENERAL_CONFIGURATION,&pConfigOpt,&pConfigLen,(uint8_t *)(&ver));
+         printf("CHIP %d\nMAC 31.%d.%d.%d.%d\nPHY %d.%d.%d.%d\nNWP %d.%d.%d.%d\nROM %d\nHOST %d.%d.%d.%d\n",
+                 ver.ChipFwAndPhyVersion.ChipId,
+                 ver.ChipFwAndPhyVersion.FwVersion[0],ver.ChipFwAndPhyVersion.FwVersion[1],
+                 ver.ChipFwAndPhyVersion.FwVersion[2],ver.ChipFwAndPhyVersion.FwVersion[3],
+                 ver.ChipFwAndPhyVersion.PhyVersion[0],ver.ChipFwAndPhyVersion.PhyVersion[1],
+                 ver.ChipFwAndPhyVersion.PhyVersion[2],ver.ChipFwAndPhyVersion.PhyVersion[3],
+                 ver.NwpVersion[0],ver.NwpVersion[1],ver.NwpVersion[2],ver.NwpVersion[3],
+                 ver.RomVersion,
+                 SL_MAJOR_VERSION_NUM,SL_MINOR_VERSION_NUM,SL_VERSION_NUM,SL_SUB_VERSION_NUM);
+
+         \endcode
+         \code
+             Getting Device time and date example:
+
+             SlDateTime_t dateTime =  {0};
+             int8_t configLen = sizeof(SlDateTime_t);
+             int8_t configOpt = SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME;
+             sl_DevGet(SL_DEVICE_GENERAL_CONFIGURATION,&configOpt, &configLen,(uint8_t *)(&dateTime));
+
+             printf("Day %d,Mon %d,Year %d,Hour %,Min %d,Sec %d\n",dateTime.sl_tm_day,dateTime.sl_tm_mon,dateTime.sl_tm_year
+                     dateTime.sl_tm_hour,dateTime.sl_tm_min,dateTime.sl_tm_sec);
+         \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_DevGet)
+    int32_t sl_DevGet(uint8_t DeviceGetId, uint8_t *pOption,uint8_t *pConfigLen, uint8_t *pValues);
+#endif
+
+
+    /*!
+        \brief          Set asynchronous event mask
+
+        Mask asynchronous events from the device. Masked events do not
+        generate asynchronous messages from the device.
+        By default - all events are active
+
+        \param[in]      EventClass          The classification groups that the
+                                            mask is referred to. Need to be one of
+                                            the following:
+                                            - SL_EVENT_CLASS_GLOBAL
+                                            - SL_EVENT_CLASS_DEVICE
+                                            - SL_EVENT_CLASS_WLAN
+                                            - SL_EVENT_CLASS_BSD
+                                            - SL_EVENT_CLASS_NETAPP
+                                            - SL_EVENT_CLASS_NETCFG
+                                            - SL_EVENT_CLASS_FS
+
+
+        \param[in]      Mask               Event Mask bitmap. Valid mask are (per group):
+                                            - SL_EVENT_CLASS_WLAN user events
+                                              - SL_WLAN_CONNECT_EVENT
+                                              - SL_WLAN_DISCONNECT_EVENT
+                                            - SL_EVENT_CLASS_DEVICE user events
+                                              - SL_DEVICE_FATAL_ERROR_EVENT
+                                            - SL_EVENT_CLASS_BSD user events
+                                              - SL_SOCKET_TX_FAILED_EVENT
+                                              - SL_SOCKET_ASYNC_EVENT
+                                            - SL_EVENT_CLASS_NETAPP user events
+                                              - SL_NETAPP_IPV4_IPACQUIRED_EVENT
+                                              - SL_NETAPP_IPV6_IPACQUIRED_EVENT
+
+        \return         On success, zero is returned. On error, -1 is returned
+
+        \sa             sl_EventMaskGet
+
+        \note           belongs to \ref ext_api
+
+        \warning
+        \par           Example:
+        \code
+
+        An example of masking connection/disconnection async events from WLAN class:
+                       sl_EventMaskSet(SL_EVENT_CLASS_WLAN, (SL_WLAN_CONNECT_EVENT | SL_WLAN_DISCONNECT_EVENT) );
+
+        \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_EventMaskSet)
+    int16_t sl_EventMaskSet(uint8_t EventClass , uint32_t Mask);
+#endif
+
+    /*!
+        \brief Get current event mask of the device
+
+        return the events bit mask from the device. In case that event is
+        masked, the device is not sending this event.
+
+        \param[in]      EventClass          The classification groups that the
+                                            mask is referred to. Need to be one of
+                                            the following:
+                                            - SL_EVENT_CLASS_GLOBAL
+                                            - SL_EVENT_CLASS_DEVICE
+                                            - SL_EVENT_CLASS_WLAN
+                                            - SL_EVENT_CLASS_BSD
+                                            - SL_EVENT_CLASS_NETAPP
+                                            - SL_EVENT_CLASS_NETCFG
+                                            - SL_EVENT_CLASS_FS
+
+        \param[out]      pMask              Pointer to Mask bitmap where the
+                                            value should be stored. Bitmasks are the same as in \ref sl_EventMaskSet
+
+        \return         On success, zero is returned. On error, -1 is returned
+
+        \sa             sl_EventMaskSet
+
+        \note           belongs to \ref ext_api
+
+        \warning
+        \par           Example:
+        \code
+
+        An example of getting an event mask for WLAN class
+        uint32_t maskWlan;
+                       sl_StatusGet(SL_EVENT_CLASS_WLAN,&maskWlan);
+
+       \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_EventMaskGet)
+    int16_t sl_EventMaskGet(uint8_t EventClass, uint32_t *pMask);
+#endif
+
+
+    /*!
+        \brief the simple link task entry
+
+        \Param
+        This function must be called from the main loop or from dedicated thread in
+        the following cases:
+            - Non-Os Platform - should be called from the mail loop
+            - Multi Threaded Platform when the user does not implement the external spawn functions -
+               should be called from dedicated thread allocated to the simplelink driver.
+               In this mode the function never return.
+
+        \return         None
+
+        \sa             sl_Stop
+
+        \note           belongs to \ref basic_api
+
+        \warning        This function must be called from a thread that is start running before
+                        any call to other simple link API
+    */
+#if _SL_INCLUDE_FUNC(sl_Task)
+    void sl_Task(void);
+#endif
+
+
+    /*!
+        \brief Setting the internal uart mode
+
+        \param[in]      pUartParams          Pointer to the uart configuration parameter set:
+                                             baudrate     - up to 711 Kbps
+                                             flow control - enable/disable
+                                             comm port    - the comm port number
+
+        \return         On success zero is returned, otherwise - Failed.
+
+        \sa             sl_Stop
+
+        \note           belongs to \ref basic_api
+
+        \warning        This function must consider the host uart capability
+    */
+#ifdef SL_IF_TYPE_UART
+#if _SL_INCLUDE_FUNC(sl_UartSetMode)
+    int16_t sl_UartSetMode(const SlUartIfParams_t* pUartParams);
+#endif
+#endif
+
+
+int32_t NetAppPingStart(SlPingStartCommand_t* pPingParams,uint8_t family,SlPingReport_t *pReport,const P_SL_DEV_PING_CALLBACK pPingCallback);
+
+int32_t NetAppSet(uint8_t AppId ,uint8_t Option,uint8_t OptionLen, uint8_t *pOptionValue);
+    
+int16_t NetCfgSet(uint8_t ConfigId ,uint8_t ConfigOpt, uint8_t ConfigLen, uint8_t *pValues);    
+
+int16_t WlanSet(uint16_t ConfigId ,uint16_t ConfigOpt,uint16_t ConfigLen, uint8_t *pValues);
+
+void SlNonOsMainLoopTask(void);
+
+int16_t WlanSetMode(const uint8_t mode);
+
+int32_t sock_Close(int16_t sd);
+
+private:
+    
+    cc3100_spi               _spi;
+    cc3100_driver            _driver;
+    cc3100_nonos             _nonos;
+    cc3100_wlan              _wlan;
+    cc3100_wlan_rx_filters   _wlan_filters;    
+    cc3100_netapp            _netapp;
+    cc3100_fs                _fs;
+    cc3100_netcfg            _netcfg;    
+    cc3100_socket            _socket;
+    cc3100_flowcont          _flowcont;
+
+
+protected:
+    
+
+};//class
+
+}//namespace mbed_cc3100
+
+/*!
+
+ Close the Doxygen group.
+ @}
+
+ */
+
+
+#endif  /*  __DEVICE_H__ */
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_driver.cpp	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,1367 @@
+/*
+* driver.c - CC31xx/CC32xx Host Driver Implementation
+*
+* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+*
+*
+*  Redistribution and use in source and binary forms, with or without
+*  modification, are permitted provided that the following conditions
+*  are met:
+*
+*    Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+*
+*    Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the
+*    distribution.
+*
+*    Neither the name of Texas Instruments Incorporated nor the names of
+*    its contributors may be used to endorse or promote products derived
+*    from this software without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+*  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+*  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+*  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+*  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+*  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+/*****************************************************************************/
+/* Include files                                                             */
+/*****************************************************************************/
+#include "cc3100_simplelink.h"
+#include "cc3100_protocol.h"
+#include "cc3100_driver.h"
+
+#include "fPtr_func.h"
+
+//#include "cc3100_device.h"
+
+/*****************************************************************************/
+/* Macro declarations                                                        */
+/*****************************************************************************/
+
+namespace mbed_cc3100 {
+
+#if (SL_MEMORY_MGMT == SL_MEMORY_MGMT_STATIC)
+typedef struct {
+    uint32_t      Align;
+    _SlDriverCb_t DriverCB;
+    uint8_t AsyncRespBuf[SL_ASYNC_MAX_MSG_LEN];
+} _SlStatMem_t;
+
+_SlStatMem_t g_StatMem;
+#endif
+
+
+_SlDriverCb_t* g_pCB = NULL;
+
+uint8_t gFirstCmdMode = 0;
+
+const _SlSyncPattern_t g_H2NSyncPattern = H2N_SYNC_PATTERN;
+const _SlSyncPattern_t g_H2NCnysPattern = H2N_CNYS_PATTERN;
+const _SlActionLookup_t _SlActionLookupTable[7] = {
+    {ACCEPT_ID, SL_OPCODE_SOCKET_ACCEPTASYNCRESPONSE, (_SlSpawnEntryFunc_t) &_sl_HandleAsync_Accept},
+    {CONNECT_ID, SL_OPCODE_SOCKET_CONNECTASYNCRESPONSE,(_SlSpawnEntryFunc_t) &_sl_HandleAsync_Connect},
+    {SELECT_ID, SL_OPCODE_SOCKET_SELECTASYNCRESPONSE,(_SlSpawnEntryFunc_t) &_sl_HandleAsync_Select},
+    {GETHOSYBYNAME_ID, SL_OPCODE_NETAPP_DNSGETHOSTBYNAMEASYNCRESPONSE,(_SlSpawnEntryFunc_t) &_sl_HandleAsync_DnsGetHostByName},
+    {GETHOSYBYSERVICE_ID, SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICEASYNCRESPONSE,(_SlSpawnEntryFunc_t) &_sl_HandleAsync_DnsGetHostByService},
+    {PING_ID, SL_OPCODE_NETAPP_PINGREPORTREQUESTRESPONSE, (_SlSpawnEntryFunc_t) &_sl_HandleAsync_PingResponse},
+    {START_STOP_ID, SL_OPCODE_DEVICE_STOP_ASYNC_RESPONSE,(_SlSpawnEntryFunc_t) &_sl_HandleAsync_Stop}
+
+};
+
+cc3100_driver::cc3100_driver(cc3100_nonos &nonos, cc3100_netapp &netapp, cc3100_flowcont &flowcont, cc3100_spi &spi)
+    :  _nonos(nonos),_netapp(netapp), _flowcont(flowcont), _spi(spi)
+{
+
+}
+
+cc3100_driver::~cc3100_driver()
+{
+
+}
+
+/*****************************************************************************/
+/* Variables                                                                 */
+/*****************************************************************************/
+
+/********************************************************************************/
+
+/*****************************************************************************/
+/* Internal functions                                                        */
+/*****************************************************************************/
+bool cc3100_driver::_SL_PENDING_RX_MSG(pDriver* pDriverCB){
+	
+	if((pDriverCB)->RxIrqCnt != (pDriverCB)->RxDoneCnt){
+	    return TRUE;
+ 	}else{
+	    return FALSE;
+	}
+}
+
+/*****************************************************************************
+_SlDrvDriverCBInit - init Driver Control Block
+*****************************************************************************/
+void cc3100_driver::_SlDrvDriverCBInit(void)
+{
+    
+    uint8_t Idx;
+
+#if (SL_MEMORY_MGMT == SL_MEMORY_MGMT_STATIC)
+    g_pCB = &(g_StatMem.DriverCB);
+#else
+    g_pCB = sl_Malloc(sizeof(_SlDriverCb_t));
+#endif
+   
+    MALLOC_OK_CHECK(g_pCB);
+    memset((g_pCB), 0, sizeof(_SlDriverCb_t));
+    
+    OSI_RET_OK_CHECK( _nonos.sl_SyncObjCreate(&g_pCB->CmdSyncObj, "CmdSyncObj") );
+    _nonos.sl_SyncObjClear(&g_pCB->CmdSyncObj);
+    
+    OSI_RET_OK_CHECK( _nonos.sl_LockObjCreate(&g_pCB->GlobalLockObj, "GlobalLockObj") );
+
+    OSI_RET_OK_CHECK( _nonos.sl_LockObjCreate(&g_pCB->ProtectionLockObj, "ProtectionLockObj") );
+    
+    _SlDrvObjInit();
+    for (Idx = 0; Idx < MAX_CONCURRENT_ACTIONS; Idx++) {
+        OSI_RET_OK_CHECK( _nonos.sl_SyncObjCreate(&g_pCB->ObjPool[Idx].SyncObj, "SyncObj") );
+        _nonos.sl_SyncObjClear(&g_pCB->ObjPool[Idx].SyncObj);
+    }
+    _flowcont._SlDrvFlowContInit();
+    gFirstCmdMode = 0;
+}
+
+/*****************************************************************************
+_SlDrvDriverCBDeinit - De init Driver Control Block
+*****************************************************************************/
+void cc3100_driver::_SlDrvDriverCBDeinit()
+{
+    uint8_t        Idx;
+    _flowcont._SlDrvFlowContDeinit();
+
+    OSI_RET_OK_CHECK( _nonos.sl_SyncObjDelete(&g_pCB->CmdSyncObj, 0) );
+
+    OSI_RET_OK_CHECK( _nonos.sl_LockObjDelete(&g_pCB->GlobalLockObj, 0) );
+
+    OSI_RET_OK_CHECK( _nonos.sl_LockObjDelete(&g_pCB->ProtectionLockObj, 0) );
+    for (Idx = 0; Idx < MAX_CONCURRENT_ACTIONS; Idx++) {
+        OSI_RET_OK_CHECK( _nonos.sl_SyncObjDelete(&g_pCB->ObjPool[Idx].SyncObj, 0) );
+    }
+
+    _SlDrvObjDeInit();
+
+#if (SL_MEMORY_MGMT == SL_MEMORY_MGMT_STATIC)
+    g_pCB = NULL;
+#else
+    sl_Free(g_pCB);
+#endif
+
+    g_pCB = NULL;
+}
+
+/*****************************************************************************
+_SlDrvRxIrqHandler - Interrupt handler
+*****************************************************************************/
+
+void cc3100_driver::_SlDrvRxIrqHandler(void *pValue)
+{
+    
+    
+    _spi.MaskIntHdlr();
+    g_pCB->RxIrqCnt++;
+    if (TRUE == g_pCB->IsCmdRespWaited) {
+        OSI_RET_OK_CHECK( _nonos.sl_SyncObjSignalFromIRQ(&g_pCB->CmdSyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE) );
+    } else {
+        _nonos._SlNonOsSpawn((_SlSpawnEntryFunc_t)&_SlDrvMsgReadSpawnCtx, NULL, 0);
+    }
+}
+
+/*****************************************************************************
+_SlDrvCmdOp
+*****************************************************************************/
+_SlReturnVal_t cc3100_driver::_SlDrvCmdOp(_SlCmdCtrl_t *pCmdCtrl,void* pTxRxDescBuff, _SlCmdExt_t *pCmdExt)
+{
+    
+    _SlReturnVal_t RetVal;
+    
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+    
+    g_pCB->IsCmdRespWaited = TRUE;
+    //SL_TRACE0(DBG_MSG, MSG_312, "_SlDrvCmdOp: call _SlDrvMsgWrite");
+    /* send the message */
+    g_pCB->FunctionParams.pCmdCtrl = pCmdCtrl;
+    g_pCB->FunctionParams.pTxRxDescBuff = (uint8_t*)pTxRxDescBuff;
+    g_pCB->FunctionParams.pCmdExt = pCmdExt;
+    
+    RetVal = _SlDrvMsgWrite();
+    
+    if(SL_OS_RET_CODE_OK == RetVal) {
+
+#ifndef SL_IF_TYPE_UART
+        /* Waiting for SPI to stabilize after first command */
+        if( 0 == gFirstCmdMode ) {           
+            gFirstCmdMode = 1;
+            wait_ms(2);
+        }
+#endif
+        
+        /* wait for respond */
+        RetVal = _SlDrvMsgReadCmdCtx(); /* will free global lock */
+        //SL_TRACE0(DBG_MSG, MSG_314, "_SlDrvCmdOp: exited _SlDrvMsgReadCmdCtx");
+        
+    } else {
+        OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+    }
+    return RetVal;
+}
+
+/*****************************************************************************
+_SlDrvCmdSend
+Send SL command without waiting for command response
+This function is unprotected and the caller should make
+sure global lock is active
+*****************************************************************************/
+_SlReturnVal_t cc3100_driver::_SlDrvCmdSend(_SlCmdCtrl_t *pCmdCtrl, void* pTxRxDescBuff, _SlCmdExt_t *pCmdExt)
+{
+    _SlReturnVal_t RetVal;
+
+    g_pCB->IsCmdRespWaited = FALSE;
+
+    SL_TRACE0(DBG_MSG, MSG_312, "_SlDrvCmdSend: call _SlDrvMsgWrite");
+    /*  send the message */
+    g_pCB->FunctionParams.pCmdCtrl = pCmdCtrl;
+    g_pCB->FunctionParams.pTxRxDescBuff = (uint8_t*)pTxRxDescBuff;
+    g_pCB->FunctionParams.pCmdExt = pCmdExt;
+
+    RetVal = _SlDrvMsgWrite();
+
+    return RetVal;
+}
+
+/*****************************************************************************
+_SlDrvDataReadOp
+*****************************************************************************/
+_SlReturnVal_t cc3100_driver::_SlDrvDataReadOp(_SlSd_t Sd, _SlCmdCtrl_t *pCmdCtrl, void* pTxRxDescBuff, _SlCmdExt_t *pCmdExt)
+{
+    _SlReturnVal_t RetVal;
+    uint8_t ObjIdx = MAX_CONCURRENT_ACTIONS;
+    _SlArgsData_t pArgsData;
+
+    /* Validate input arguments */
+    VERIFY_PROTOCOL(NULL != pCmdExt->pRxPayload);
+
+    /* If zero bytes is requested, return error. */
+    /*  This allows us not to fill remote socket's IP address in return arguments */
+    VERIFY_PROTOCOL(0 != pCmdExt->RxPayloadLen);
+
+    /* Validate socket */
+    if((Sd & BSD_SOCKET_ID_MASK) >= SL_MAX_SOCKETS) {
+        return SL_EBADF;
+    }
+
+    /*Use Obj to issue the command, if not available try later*/
+    ObjIdx = (uint8_t)_SlDrvWaitForPoolObj(RECV_ID, Sd & BSD_SOCKET_ID_MASK);
+
+    if (MAX_CONCURRENT_ACTIONS == ObjIdx) {
+        return SL_POOL_IS_EMPTY;
+    }
+
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+
+    pArgsData.pData = pCmdExt->pRxPayload;
+    pArgsData.pArgs =  (uint8_t *)pTxRxDescBuff;
+    g_pCB->ObjPool[ObjIdx].pRespArgs =  (uint8_t *)&pArgsData;
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+
+
+    /* Do Flow Control check/update for DataWrite operation */
+    OSI_RET_OK_CHECK( _nonos.sl_LockObjLock(&g_pCB->FlowContCB.TxLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER) );
+
+    /* Clear SyncObj for the case it was signalled before TxPoolCnt */
+    /* dropped below '1' (last Data buffer was taken)  */
+    /* OSI_RET_OK_CHECK( sl_SyncObjClear(&g_pCB->FlowContCB.TxSyncObj) ); */
+    _nonos.sl_SyncObjClear(&g_pCB->FlowContCB.TxSyncObj);
+
+    if(g_pCB->FlowContCB.TxPoolCnt <= FLOW_CONT_MIN) {
+
+        /* If TxPoolCnt was increased by other thread at this moment,
+        TxSyncObj won't wait here */
+        OSI_RET_OK_CHECK( _nonos.sl_SyncObjWait(&g_pCB->FlowContCB.TxSyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE, NON_OS_SYNC_OBJ_CLEAR_VALUE, SL_OS_WAIT_FOREVER) );
+    }
+
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+
+    VERIFY_PROTOCOL(g_pCB->FlowContCB.TxPoolCnt > FLOW_CONT_MIN);
+    g_pCB->FlowContCB.TxPoolCnt--;
+
+    OSI_RET_OK_CHECK( _nonos.sl_LockObjUnlock(&g_pCB->FlowContCB.TxLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE) );
+
+    /* send the message */
+    g_pCB->TempProtocolHeader.Opcode 	= pCmdCtrl->Opcode;
+    g_pCB->TempProtocolHeader.Len	= _SL_PROTOCOL_CALC_LEN(pCmdCtrl,pCmdExt);
+    g_pCB->FunctionParams.pCmdCtrl      = pCmdCtrl;
+    g_pCB->FunctionParams.pTxRxDescBuff = (uint8_t *)pTxRxDescBuff;
+    g_pCB->FunctionParams.pCmdExt       = pCmdExt;
+    RetVal =  _SlDrvMsgWrite();
+
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+
+    if(SL_OS_RET_CODE_OK == RetVal) {
+        /* Wait for response message. Will be signalled by _SlDrvMsgRead. */
+        OSI_RET_OK_CHECK(_nonos.sl_SyncObjWait(&g_pCB->ObjPool[ObjIdx].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE, NON_OS_SYNC_OBJ_CLEAR_VALUE, SL_OS_WAIT_FOREVER));
+    }
+
+    _SlDrvReleasePoolObj(ObjIdx);
+    return RetVal;
+}
+
+/* ******************************************************************************/
+/*   _SlDrvDataWriteOp                                                          */
+/* ******************************************************************************/
+_SlReturnVal_t cc3100_driver::_SlDrvDataWriteOp(_SlSd_t Sd, _SlCmdCtrl_t *pCmdCtrl, void* pTxRxDescBuff, _SlCmdExt_t *pCmdExt)
+{
+    printf("Debug _SlDrvDataWriteOp\r\n");
+    _SlReturnVal_t  RetVal = SL_EAGAIN; /*  initiated as SL_EAGAIN for the non blocking mode */
+    while( 1 ) {
+        /*  Do Flow Control check/update for DataWrite operation */        
+        OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(&g_pCB->FlowContCB.TxLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+        /*  Clear SyncObj for the case it was signalled before TxPoolCnt */
+        /*  dropped below '1' (last Data buffer was taken) */
+        /* OSI_RET_OK_CHECK( sl_SyncObjClear(&g_pCB->FlowContCB.TxSyncObj) ); */
+        _nonos.sl_SyncObjClear(&g_pCB->FlowContCB.TxSyncObj);
+        /*  we have indication that the last send has failed - socket is no longer valid for operations  */
+        if(g_pCB->SocketTXFailure & (1<<(Sd & BSD_SOCKET_ID_MASK))) {
+            OSI_RET_OK_CHECK( _nonos.sl_LockObjUnlock(&g_pCB->FlowContCB.TxLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE) );
+            return SL_SOC_ERROR;
+        }
+        //printf("Debug _SlDrvDataWriteOp 3\r\n");
+        if(g_pCB->FlowContCB.TxPoolCnt <= FLOW_CONT_MIN + 1) {
+            /*  we have indication that this socket is set as blocking and we try to  */
+            /*  unblock it - return an error */
+            if( g_pCB->SocketNonBlocking >> (Sd & BSD_SOCKET_ID_MASK) ) {
+                OSI_RET_OK_CHECK( _nonos.sl_LockObjUnlock(&g_pCB->FlowContCB.TxLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE) );
+                return RetVal;
+            }
+            /*  If TxPoolCnt was increased by other thread at this moment, */
+            /*  TxSyncObj won't wait here */
+            OSI_RET_OK_CHECK( _nonos.sl_SyncObjWait(&g_pCB->FlowContCB.TxSyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE, NON_OS_SYNC_OBJ_CLEAR_VALUE, SL_OS_WAIT_FOREVER) );
+        }
+
+        if(g_pCB->FlowContCB.TxPoolCnt > FLOW_CONT_MIN + 1 ) {
+            break;
+        } else {
+            OSI_RET_OK_CHECK( _nonos.sl_LockObjUnlock(&g_pCB->FlowContCB.TxLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE) );
+        }
+    }
+    OSI_RET_OK_CHECK( _nonos.sl_LockObjLock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER) );
+
+    VERIFY_PROTOCOL(g_pCB->FlowContCB.TxPoolCnt > FLOW_CONT_MIN + 1 );
+    g_pCB->FlowContCB.TxPoolCnt--;
+
+    OSI_RET_OK_CHECK( _nonos.sl_LockObjUnlock(&g_pCB->FlowContCB.TxLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE) );
+    
+    /*  send the message */
+    g_pCB->TempProtocolHeader.Opcode 	= pCmdCtrl->Opcode;
+    g_pCB->TempProtocolHeader.Len	= _SL_PROTOCOL_CALC_LEN(pCmdCtrl,pCmdExt);
+
+    g_pCB->FunctionParams.pCmdCtrl = pCmdCtrl;
+    g_pCB->FunctionParams.pTxRxDescBuff = (unsigned char*)pTxRxDescBuff;
+    g_pCB->FunctionParams.pCmdExt = pCmdExt;
+    
+    RetVal =  _SlDrvMsgWrite();
+    
+    OSI_RET_OK_CHECK( _nonos.sl_LockObjUnlock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE) );
+
+    return RetVal;
+}
+
+/* ******************************************************************************/
+/*  _SlDrvMsgWrite */
+/* ******************************************************************************/
+_SlReturnVal_t cc3100_driver::_SlDrvMsgWrite(void)
+{
+    
+    VERIFY_PROTOCOL(NULL != g_pCB->FunctionParams.pCmdCtrl);
+
+    g_pCB->TempProtocolHeader.Opcode 	= g_pCB->FunctionParams.pCmdCtrl->Opcode;
+    g_pCB->TempProtocolHeader.Len	= _SL_PROTOCOL_CALC_LEN(g_pCB->FunctionParams.pCmdCtrl,
+                                      g_pCB->FunctionParams.pCmdExt);
+    /*  */
+    if (g_pCB->RelayFlagsViaRxPayload == TRUE) {
+        g_pCB->TempProtocolHeader.Len = g_pCB->TempProtocolHeader.Len + g_pCB->FunctionParams.pCmdExt->RxPayloadLen;
+    }
+
+#ifdef SL_START_WRITE_STAT
+    sl_IfStartWriteSequence(g_pCB->FD);
+#endif
+
+#ifdef SL_IF_TYPE_UART
+    /*  Write long sync pattern */
+    _spi.spi_Write(g_pCB->FD, (uint8_t *)&g_H2NSyncPattern.Long, 2*SYNC_PATTERN_LEN);
+#else
+    /*  Write short sync pattern */
+    _spi.spi_Write(g_pCB->FD, (uint8_t *)&g_H2NSyncPattern.Short, SYNC_PATTERN_LEN);
+#endif
+
+    /*  Header */
+    _spi.spi_Write(g_pCB->FD, (uint8_t *)&g_pCB->TempProtocolHeader, _SL_CMD_HDR_SIZE);
+
+    /*  Descriptors */
+    if (g_pCB->FunctionParams.pTxRxDescBuff && g_pCB->FunctionParams.pCmdCtrl->TxDescLen > 0) {
+        _spi.spi_Write(g_pCB->FD, g_pCB->FunctionParams.pTxRxDescBuff,
+                           _SL_PROTOCOL_ALIGN_SIZE(g_pCB->FunctionParams.pCmdCtrl->TxDescLen));
+    }
+
+    /*  A special mode where Rx payload and Rx length are used as Tx as well */
+    /*  This mode requires no Rx payload on the response and currently used by fs_Close and sl_Send on */
+    /*  transceiver mode */
+    if (g_pCB->RelayFlagsViaRxPayload == TRUE ) {
+        g_pCB->RelayFlagsViaRxPayload = FALSE;
+        _spi.spi_Write(g_pCB->FD, g_pCB->FunctionParams.pCmdExt->pRxPayload,
+                           _SL_PROTOCOL_ALIGN_SIZE(g_pCB->FunctionParams.pCmdExt->RxPayloadLen));
+    }
+
+    /*  Payload */
+    if (g_pCB->FunctionParams.pCmdExt && g_pCB->FunctionParams.pCmdExt->TxPayloadLen > 0) {
+        /*  If the message has payload, it is mandatory that the message's arguments are protocol aligned. */
+        /*  Otherwise the aligning of arguments will create a gap between arguments and payload. */
+        VERIFY_PROTOCOL(_SL_IS_PROTOCOL_ALIGNED_SIZE(g_pCB->FunctionParams.pCmdCtrl->TxDescLen));
+
+        _spi.spi_Write(g_pCB->FD, g_pCB->FunctionParams.pCmdExt->pTxPayload,
+                           _SL_PROTOCOL_ALIGN_SIZE(g_pCB->FunctionParams.pCmdExt->TxPayloadLen));
+    }
+
+
+    _SL_DBG_CNT_INC(MsgCnt.Write);
+
+#ifdef SL_START_WRITE_STAT
+    sl_IfEndWriteSequence(g_pCB->FD);
+#endif
+
+    return SL_OS_RET_CODE_OK;
+}
+
+/* ******************************************************************************/
+/*  _SlDrvMsgRead  */
+/* ******************************************************************************/
+_SlReturnVal_t cc3100_driver::_SlDrvMsgRead(void)
+{
+    /*  alignment for small memory models */
+    union {
+        uint8_t   TempBuf[_SL_RESP_HDR_SIZE];
+        uint32_t  DummyBuf[2];
+    } uBuf;
+
+    uint8_t  TailBuffer[4];
+    uint16_t LengthToCopy;
+    uint16_t AlignedLengthRecv;
+    uint8_t  AlignSize;
+    
+    VERIFY_RET_OK(_SlDrvRxHdrRead((uint8_t*)(uBuf.TempBuf), &AlignSize));
+
+    /* 'Init Compelete' message bears no valid FlowControl info */
+    if(SL_OPCODE_DEVICE_INITCOMPLETE != OPCODE(uBuf.TempBuf)) {
+        g_pCB->FlowContCB.TxPoolCnt = ((_SlResponseHeader_t *)uBuf.TempBuf)->TxPoolCnt;
+        g_pCB->SocketNonBlocking = ((_SlResponseHeader_t *)uBuf.TempBuf)->SocketNonBlocking;
+        g_pCB->SocketTXFailure = ((_SlResponseHeader_t *)uBuf.TempBuf)->SocketTXFailure;
+
+        if(g_pCB->FlowContCB.TxPoolCnt > FLOW_CONT_MIN) {
+            OSI_RET_OK_CHECK(_nonos.sl_SyncObjSignal(&g_pCB->FlowContCB.TxSyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE));
+        }
+    }
+
+    _SlDrvClassifyRxMsg(OPCODE(uBuf.TempBuf));
+
+    switch(g_pCB->FunctionParams.AsyncExt.RxMsgClass) {
+        case ASYNC_EVT_CLASS:
+
+            VERIFY_PROTOCOL(NULL == g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+
+#if (SL_MEMORY_MGMT == SL_MEMORY_MGMT_STATIC)
+            g_pCB->FunctionParams.AsyncExt.pAsyncBuf = g_StatMem.AsyncRespBuf;
+#else
+            g_pCB->FunctionParams.AsyncExt.pAsyncBuf = sl_Malloc(SL_ASYNC_MAX_MSG_LEN);
+#endif
+            MALLOC_OK_CHECK(g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+
+            memcpy(g_pCB->FunctionParams.AsyncExt.pAsyncBuf, uBuf.TempBuf, _SL_RESP_HDR_SIZE);
+
+            /*  This is an Async message. Read the rest of it. */
+            if (_SL_PROTOCOL_ALIGN_SIZE(RSP_PAYLOAD_LEN(uBuf.TempBuf)) <= SL_ASYNC_MAX_PAYLOAD_LEN) {
+                AlignedLengthRecv = _SL_PROTOCOL_ALIGN_SIZE(RSP_PAYLOAD_LEN(uBuf.TempBuf));
+            } else {
+                AlignedLengthRecv = _SL_PROTOCOL_ALIGN_SIZE(SL_ASYNC_MAX_PAYLOAD_LEN);
+            }
+
+            if (RSP_PAYLOAD_LEN(uBuf.TempBuf) > 0) {
+                _spi.spi_Read(g_pCB->FD, g_pCB->FunctionParams.AsyncExt.pAsyncBuf + _SL_RESP_HDR_SIZE, AlignedLengthRecv);
+            }
+            /* In case ASYNC RX buffer length is smaller then the received data length, dump the rest */
+            if ((_SL_PROTOCOL_ALIGN_SIZE(RSP_PAYLOAD_LEN(uBuf.TempBuf)) > SL_ASYNC_MAX_PAYLOAD_LEN)) {
+                AlignedLengthRecv = _SL_PROTOCOL_ALIGN_SIZE(RSP_PAYLOAD_LEN(uBuf.TempBuf)) - SL_ASYNC_MAX_PAYLOAD_LEN;
+                while (AlignedLengthRecv > 0) {
+                    _spi.spi_Read(g_pCB->FD,TailBuffer,4);
+                    AlignedLengthRecv = AlignedLengthRecv - 4;
+                }
+            }
+            OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+
+            if ((SL_OPCODE_SOCKET_ACCEPTASYNCRESPONSE == OPCODE(uBuf.TempBuf)) || (SL_OPCODE_SOCKET_ACCEPTASYNCRESPONSE_V6 == OPCODE(uBuf.TempBuf)) || (SL_OPCODE_SOCKET_CONNECTASYNCRESPONSE == OPCODE(uBuf.TempBuf))) {
+                /* go over the active list if exist to find obj waiting for this Async event */
+                _SlFindAndSetActiveObj(OPCODE(uBuf.TempBuf),(((_SocketResponse_t *)(g_pCB->FunctionParams.AsyncExt.pAsyncBuf + _SL_RESP_HDR_SIZE))->sd) & BSD_SOCKET_ID_MASK);
+            } else {
+                _SlFindAndSetActiveObj(OPCODE(uBuf.TempBuf),SL_MAX_SOCKETS);
+            }
+            OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+
+            break;
+
+        case RECV_RESP_CLASS: {
+            uint8_t   ExpArgSize; /*  Expected size of Recv/Recvfrom arguments */
+
+            switch(OPCODE(uBuf.TempBuf)) {
+                case SL_OPCODE_SOCKET_RECVFROMASYNCRESPONSE:
+                    ExpArgSize = RECVFROM_IPV4_ARGS_SIZE;
+                    break;
+                case SL_OPCODE_SOCKET_RECVFROMASYNCRESPONSE_V6:
+                    ExpArgSize = RECVFROM_IPV6_ARGS_SIZE;
+                    break;
+                default:
+                    /* SL_OPCODE_SOCKET_RECVASYNCRESPONSE: */
+                    ExpArgSize = RECV_ARGS_SIZE;
+            }
+
+            /*  Read first 4 bytes of Recv/Recvfrom response to get SocketId and actual  */
+            /*  response data length */
+            _spi.spi_Read(g_pCB->FD, &uBuf.TempBuf[4], RECV_ARGS_SIZE);
+
+            /*  Validate Socket ID and Received Length value.  */
+            VERIFY_PROTOCOL((SD(&uBuf.TempBuf[4])& BSD_SOCKET_ID_MASK) < SL_MAX_SOCKETS);
+
+            OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+
+            /* go over the active list if exist to find obj waiting for this Async event */
+            VERIFY_RET_OK(_SlFindAndSetActiveObj(OPCODE(uBuf.TempBuf),SD(&uBuf.TempBuf[4]) & BSD_SOCKET_ID_MASK));
+
+            /*  Verify data is waited on this socket. The pArgs should have been set by _SlDrvDataReadOp(). */
+            VERIFY_SOCKET_CB(NULL !=  ((_SlArgsData_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pData))->pArgs);
+
+            memcpy( ((_SlArgsData_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs))->pArgs, &uBuf.TempBuf[4], RECV_ARGS_SIZE);
+
+            if(ExpArgSize > RECV_ARGS_SIZE) {
+                _spi.spi_Read(g_pCB->FD,
+                                  ((_SlArgsData_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs))->pArgs + RECV_ARGS_SIZE,
+                                  ExpArgSize - RECV_ARGS_SIZE);
+            }
+
+            /*  Here g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pData contains requested(expected) Recv/Recvfrom DataSize. */
+            /*  Overwrite requested DataSize with actual one. */
+            /*  If error is received, this information will be read from arguments. */
+            if(ACT_DATA_SIZE(&uBuf.TempBuf[4]) > 0) {
+                VERIFY_SOCKET_CB(NULL != ((_SlArgsData_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs))->pData);
+
+                /*  Read 4 bytes aligned from interface */
+                /*  therefore check the requested length and read only  */
+                /*  4 bytes aligned data. The rest unaligned (if any) will be read */
+                /*  and copied to a TailBuffer  */
+                LengthToCopy = ACT_DATA_SIZE(&uBuf.TempBuf[4]) & (3);
+                AlignedLengthRecv = ACT_DATA_SIZE(&uBuf.TempBuf[4]) & (~3);
+                if( AlignedLengthRecv >= 4) {
+                    _spi.spi_Read(g_pCB->FD,((_SlArgsData_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs))->pData,AlignedLengthRecv );
+                }
+                /*  copy the unaligned part, if any */
+                if( LengthToCopy > 0) {
+                    _spi.spi_Read(g_pCB->FD,TailBuffer,4);
+                    /*  copy TailBuffer unaligned part (1/2/3 bytes) */
+                    memcpy(((_SlArgsData_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs))->pData + AlignedLengthRecv,TailBuffer,LengthToCopy);
+                }
+            }
+            OSI_RET_OK_CHECK(_nonos.sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE));
+            OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+        }
+        break;
+
+        case CMD_RESP_CLASS:
+
+            /*  Some commands pass a maximum arguments size. */
+            /*  In this case Driver will send extra dummy patterns to NWP if */
+            /*  the response message is smaller than maximum. */
+            /*  When RxDescLen is not exact, using RxPayloadLen is forbidden! */
+            /*  If such case cannot be avoided - parse message here to detect */
+            /*  arguments/payload border. */
+            _spi.spi_Read(g_pCB->FD, g_pCB->FunctionParams.pTxRxDescBuff, _SL_PROTOCOL_ALIGN_SIZE(g_pCB->FunctionParams.pCmdCtrl->RxDescLen));
+
+            if((NULL != g_pCB->FunctionParams.pCmdExt) && (0 != g_pCB->FunctionParams.pCmdExt->RxPayloadLen)) {
+                /*  Actual size of command's response payload: <msg_payload_len> - <rsp_args_len> */
+                int16_t    ActDataSize = RSP_PAYLOAD_LEN(uBuf.TempBuf) - g_pCB->FunctionParams.pCmdCtrl->RxDescLen;
+
+                g_pCB->FunctionParams.pCmdExt->ActualRxPayloadLen = ActDataSize;
+
+                /* Check that the space prepared by user for the response data is sufficient. */
+                if(ActDataSize <= 0) {
+                    g_pCB->FunctionParams.pCmdExt->RxPayloadLen = 0;
+                } else {
+                    /* In case the user supplied Rx buffer length which is smaller then the received data length, copy according to user length */
+                    if (ActDataSize > g_pCB->FunctionParams.pCmdExt->RxPayloadLen) {
+                        LengthToCopy = g_pCB->FunctionParams.pCmdExt->RxPayloadLen & (3);
+                        AlignedLengthRecv = g_pCB->FunctionParams.pCmdExt->RxPayloadLen & (~3);
+                    } else {
+                        LengthToCopy = ActDataSize & (3);
+                        AlignedLengthRecv = ActDataSize & (~3);
+                    }
+                    /*  Read 4 bytes aligned from interface */
+                    /*  therefore check the requested length and read only  */
+                    /*  4 bytes aligned data. The rest unaligned (if any) will be read */
+                    /*  and copied to a TailBuffer  */
+
+                    if( AlignedLengthRecv >= 4) {
+                        _spi.spi_Read(g_pCB->FD,
+                                          g_pCB->FunctionParams.pCmdExt->pRxPayload,
+                                          AlignedLengthRecv );
+
+                    }
+                    /*  copy the unaligned part, if any */
+                    if( LengthToCopy > 0) {
+                        _spi.spi_Read(g_pCB->FD,TailBuffer,4);
+                        /*  copy TailBuffer unaligned part (1/2/3 bytes) */
+                        memcpy(g_pCB->FunctionParams.pCmdExt->pRxPayload + AlignedLengthRecv,
+                                  TailBuffer,
+                                  LengthToCopy);
+                        ActDataSize = ActDataSize-4;
+                    }
+                    /* In case the user supplied Rx buffer length which is smaller then the received data length, dump the rest */
+                    if (ActDataSize > g_pCB->FunctionParams.pCmdExt->RxPayloadLen) {
+                        /* calculate the rest of the data size to dump */
+                        AlignedLengthRecv = ActDataSize - (g_pCB->FunctionParams.pCmdExt->RxPayloadLen & (~3));
+                        while( AlignedLengthRecv > 0) {
+                            _spi.spi_Read(g_pCB->FD,TailBuffer, 4 );
+                            AlignedLengthRecv = AlignedLengthRecv - 4;
+                        }
+                    }
+                }
+            }
+            break;
+
+        default:
+            /*  DUMMY_MSG_CLASS: Flow control message has no payload. */
+            break;
+    }
+
+    if(AlignSize > 0) {
+        _spi.spi_Read(g_pCB->FD, uBuf.TempBuf, AlignSize);
+    }
+
+    _SL_DBG_CNT_INC(MsgCnt.Read);
+
+    /*  Unmask Interrupt call */
+    _spi.UnMaskIntHdlr();
+    
+    return SL_OS_RET_CODE_OK;
+}
+
+/* ******************************************************************************/
+/*  _SlAsyncEventGenericHandler */
+/* ******************************************************************************/
+void cc3100_driver::_SlAsyncEventGenericHandler(void)
+{
+    _SlResponseHeader_t      *pHdr = (_SlResponseHeader_t *)g_pCB->FunctionParams.AsyncExt.pAsyncBuf;
+    SlWlanEvent_t            wlanEvent;
+    SlNetAppEvent_t          netAppEvent;
+    SlSockEvent_t            sockAppEvent;
+     
+    if (NULL != g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler) {
+        switch(pHdr->GenHeader.Opcode) {
+    
+            case  SL_OPCODE_WLAN_P2P_DEV_FOUND: {
+                slPeerInfoAsyncResponse_t* pResp = (slPeerInfoAsyncResponse_t*)_SL_RESP_ARGS_START(g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+                wlanEvent.Event = SL_WLAN_P2P_DEV_FOUND_EVENT;
+                memcpy(wlanEvent.EventData.P2PModeDevFound.mac,pResp->mac, 6);
+                memcpy(wlanEvent.EventData.P2PModeDevFound.go_peer_device_name,pResp->go_peer_device_name,pResp->go_peer_device_name_len);
+                wlanEvent.EventData.P2PModeDevFound.go_peer_device_name_len = pResp->go_peer_device_name_len;
+                g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler(&wlanEvent);
+                
+                break;
+            }
+
+            case SL_OPCODE_WLAN_P2P_NEG_REQ_RECEIVED: {
+                slPeerInfoAsyncResponse_t* pResp = (slPeerInfoAsyncResponse_t*)_SL_RESP_ARGS_START(g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+
+                wlanEvent.Event = SL_WLAN_P2P_NEG_REQ_RECEIVED_EVENT;
+                memcpy(wlanEvent.EventData.P2PModeNegReqReceived.mac,pResp->mac, 6);
+                memcpy(wlanEvent.EventData.P2PModeNegReqReceived.go_peer_device_name,pResp->go_peer_device_name,pResp->go_peer_device_name_len);
+                wlanEvent.EventData.P2PModeNegReqReceived.go_peer_device_name_len = pResp->go_peer_device_name_len;
+                wlanEvent.EventData.P2PModeNegReqReceived.wps_dev_password_id = pResp->wps_dev_password_id;
+                g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler(&wlanEvent);
+                
+                break;
+            }
+            case SL_OPCODE_WLAN_CONNECTION_FAILED: {
+                slWlanConnFailureAsyncResponse_t* pResp = (slWlanConnFailureAsyncResponse_t*)_SL_RESP_ARGS_START(g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+
+                wlanEvent.Event = SL_WLAN_CONNECTION_FAILED_EVENT;
+                wlanEvent.EventData.P2PModewlanConnectionFailure.status = pResp->status;
+
+                g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler(&wlanEvent);
+                
+                break;
+            }
+
+            case SL_OPCODE_WLAN_WLANASYNCCONNECTEDRESPONSE: {
+                slWlanConnectAsyncResponse_t *pWlanResp = (slWlanConnectAsyncResponse_t*)_SL_RESP_ARGS_START(g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+                memset(&wlanEvent.EventData.STAandP2PModeWlanConnected,0,sizeof(slWlanConnectAsyncResponse_t));
+                wlanEvent.Event = SL_WLAN_CONNECT_EVENT;
+                wlanEvent.EventData.STAandP2PModeWlanConnected.connection_type = pWlanResp->connection_type;
+                memcpy(wlanEvent.EventData.STAandP2PModeWlanConnected.bssid, pWlanResp->bssid, 6);
+                memcpy(wlanEvent.EventData.STAandP2PModeWlanConnected.go_peer_device_name,pWlanResp->go_peer_device_name,pWlanResp->go_peer_device_name_len);
+                memcpy(wlanEvent.EventData.STAandP2PModeWlanConnected.ssid_name, pWlanResp->ssid_name, pWlanResp->ssid_len);
+                wlanEvent.EventData.STAandP2PModeWlanConnected.ssid_len = pWlanResp->ssid_len;
+                wlanEvent.EventData.STAandP2PModeWlanConnected.go_peer_device_name_len = pWlanResp->go_peer_device_name_len;
+
+                g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler(&wlanEvent);
+                
+                break;
+            }
+            case SL_OPCODE_WLAN_WLANASYNCDISCONNECTEDRESPONSE: {
+                slWlanConnectAsyncResponse_t *pWlanResp = (slWlanConnectAsyncResponse_t*)_SL_RESP_ARGS_START(g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+                memset(&wlanEvent.EventData.STAandP2PModeDisconnected,0,sizeof(slWlanConnectAsyncResponse_t));
+                wlanEvent.Event = SL_WLAN_DISCONNECT_EVENT;
+                wlanEvent.EventData.STAandP2PModeDisconnected.connection_type = pWlanResp->connection_type;
+                memcpy(wlanEvent.EventData.STAandP2PModeDisconnected.bssid, pWlanResp->bssid, 6);
+                memcpy(wlanEvent.EventData.STAandP2PModeDisconnected.go_peer_device_name,pWlanResp->go_peer_device_name,pWlanResp->go_peer_device_name_len);
+                memcpy(wlanEvent.EventData.STAandP2PModeDisconnected.ssid_name, pWlanResp->ssid_name, pWlanResp->ssid_len);
+                wlanEvent.EventData.STAandP2PModeDisconnected.ssid_len = pWlanResp->ssid_len;
+                wlanEvent.EventData.STAandP2PModeDisconnected.reason_code = pWlanResp->reason_code;
+                wlanEvent.EventData.STAandP2PModeDisconnected.go_peer_device_name_len = pWlanResp->go_peer_device_name_len;
+                g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler(&wlanEvent);
+                
+                break;
+            }
+            case SL_OPCODE_NETAPP_IPACQUIRED: {
+                SlIpV4AcquiredAsync_t *pIpV4 = (SlIpV4AcquiredAsync_t*)_SL_RESP_ARGS_START(g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+                netAppEvent.Event = SL_NETAPP_IPV4_IPACQUIRED_EVENT;
+                netAppEvent.EventData.ipAcquiredV4.ip = pIpV4->ip;
+                netAppEvent.EventData.ipAcquiredV4.gateway = pIpV4->gateway;
+                netAppEvent.EventData.ipAcquiredV4.dns = pIpV4->dns;
+                g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler((SlNetAppEvent_t*)&netAppEvent);
+                
+            }
+            break;
+            case SL_OPCODE_NETAPP_IPACQUIRED_V6: {
+                SlIpV6AcquiredAsync_t *pIpV6 = (SlIpV6AcquiredAsync_t*)_SL_RESP_ARGS_START(g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+                netAppEvent.Event =  SL_NETAPP_IPV6_IPACQUIRED_EVENT;
+                memcpy((void *)&netAppEvent.EventData.ipAcquiredV6.ip[0],(void *)&pIpV6->ip[0],sizeof(pIpV6->ip[0])*4);
+                g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler(&netAppEvent);
+               
+            }
+            break;
+
+            case SL_OPCODE_NETAPP_IP_LEASED: {
+                SlIpLeasedAsync_t *pIpV4 = (SlIpLeasedAsync_t*)_SL_RESP_ARGS_START(g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+                netAppEvent.Event = SL_NETAPP_IP_LEASED_EVENT;
+                netAppEvent.EventData.ipLeased.ip_address = pIpV4->ip_address;
+                netAppEvent.EventData.ipLeased.lease_time = pIpV4->lease_time;
+                memcpy(netAppEvent.EventData.ipLeased.mac, pIpV4->mac, 6);
+
+                g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler(&netAppEvent);
+            }
+            break;
+
+            case SL_OPCODE_NETAPP_IP_RELEASED: {
+                SlIpReleasedAsync_t *pIpV4 = (SlIpReleasedAsync_t *)_SL_RESP_ARGS_START(g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+                netAppEvent.Event = SL_NETAPP_IP_RELEASED_EVENT;
+                netAppEvent.EventData.ipReleased.ip_address = pIpV4->ip_address;
+                netAppEvent.EventData.ipReleased.reason = pIpV4->reason;
+                memcpy(netAppEvent.EventData.ipReleased.mac, pIpV4->mac, 6);
+
+                g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler(&netAppEvent);
+            }
+            break;
+
+            case SL_OPCODE_SOCKET_TXFAILEDASYNCRESPONSE: {
+                SlSockEventData_t *txfailparams = (SlSockEventData_t*)_SL_RESP_ARGS_START(g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+                sockAppEvent.Event =  SL_SOCKET_TX_FAILED_EVENT;
+                memcpy((void *)&sockAppEvent.EventData,(void *)txfailparams,sizeof(SlSockEventData_t));
+                g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler(&sockAppEvent);
+                
+            }
+            break;
+
+            case SL_OPCODE_SOCKET_SOCKETASYNCEVENT: {
+                SlSockEventData_t *socketAsyncEvent = (SlSockEventData_t*)_SL_RESP_ARGS_START(g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+                sockAppEvent.Event =  SL_SOCKET_ASYNC_EVENT;
+                sockAppEvent.EventData.socketAsyncEvent.sd = socketAsyncEvent->socketAsyncEvent.sd;
+                sockAppEvent.EventData.socketAsyncEvent.type = socketAsyncEvent->socketAsyncEvent.type; /* one of the possible types of socket */
+                sockAppEvent.EventData.socketAsyncEvent.val = socketAsyncEvent->socketAsyncEvent.val;
+                g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler(&sockAppEvent);
+                
+            }
+            break;
+
+            case SL_OPCODE_WLAN_SMART_CONFIG_START_ASYNC_RESPONSE: {
+                slSmartConfigStartAsyncResponse_t *pResp = (slSmartConfigStartAsyncResponse_t*)_SL_RESP_ARGS_START(g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+
+                wlanEvent.Event = SL_WLAN_SMART_CONFIG_COMPLETE_EVENT;
+                wlanEvent.EventData.smartConfigStartResponse.status = pResp->status;
+                wlanEvent.EventData.smartConfigStartResponse.ssid_len = pResp->ssid_len;
+                wlanEvent.EventData.smartConfigStartResponse.private_token_len = pResp->private_token_len;
+
+                memset(wlanEvent.EventData.smartConfigStartResponse.ssid, 0x00, sizeof(wlanEvent.EventData.smartConfigStartResponse.ssid));
+                memcpy(wlanEvent.EventData.smartConfigStartResponse.ssid, pResp->ssid, pResp->ssid_len);
+                /* if private data exist */
+                if (pResp->private_token_len) {
+                    memset(wlanEvent.EventData.smartConfigStartResponse.private_token, 0x00, sizeof(wlanEvent.EventData.smartConfigStartResponse.private_token));
+                    memcpy(wlanEvent.EventData.smartConfigStartResponse.private_token, pResp->private_token, pResp->private_token_len);
+                }
+
+                g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler(&wlanEvent);
+            }
+            break;
+
+            case SL_OPCODE_WLAN_SMART_CONFIG_STOP_ASYNC_RESPONSE: {
+                slSmartConfigStopAsyncResponse_t *pResp = (slSmartConfigStopAsyncResponse_t*)_SL_RESP_ARGS_START(g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+
+                wlanEvent.Event = SL_WLAN_SMART_CONFIG_STOP_EVENT;
+                wlanEvent.EventData.smartConfigStopResponse.status = pResp->status;
+
+                g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler(&wlanEvent);
+                
+            }
+            break;
+
+            case SL_OPCODE_WLAN_STA_CONNECTED: {
+                slPeerInfoAsyncResponse_t* pResp = (slPeerInfoAsyncResponse_t*)_SL_RESP_ARGS_START(g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+                memset(&wlanEvent.EventData.APModeStaConnected,0,sizeof(slPeerInfoAsyncResponse_t));
+                wlanEvent.Event = SL_WLAN_STA_CONNECTED_EVENT;
+                memcpy(wlanEvent.EventData.APModeStaConnected.mac,pResp->mac, 6);
+                memcpy(wlanEvent.EventData.APModeStaConnected.go_peer_device_name,pResp->go_peer_device_name,pResp->go_peer_device_name_len);
+                wlanEvent.EventData.APModeStaConnected.go_peer_device_name_len = pResp->go_peer_device_name_len;
+
+                memcpy(wlanEvent.EventData.APModeStaConnected.own_ssid,pResp->own_ssid,pResp->own_ssid_len);
+                wlanEvent.EventData.APModeStaConnected.own_ssid_len = pResp->own_ssid_len;
+                g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler(&wlanEvent);
+    
+            }
+            break;
+
+            case SL_OPCODE_WLAN_STA_DISCONNECTED: {
+                slPeerInfoAsyncResponse_t* pResp = (slPeerInfoAsyncResponse_t*)_SL_RESP_ARGS_START(g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+                memset(&wlanEvent.EventData.APModestaDisconnected,0,sizeof(slPeerInfoAsyncResponse_t));
+                wlanEvent.Event = SL_WLAN_STA_DISCONNECTED_EVENT;
+                memcpy(wlanEvent.EventData.APModestaDisconnected.mac,pResp->mac, 6);
+                memcpy(wlanEvent.EventData.APModestaDisconnected.go_peer_device_name,pResp->go_peer_device_name,pResp->go_peer_device_name_len);
+                wlanEvent.EventData.APModestaDisconnected.go_peer_device_name_len = pResp->go_peer_device_name_len;
+                g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler(&wlanEvent);
+            }
+            break;
+
+            case SL_OPCODE_NETAPP_PINGREPORTREQUESTRESPONSE: {
+                _sl_HandleAsync_PingResponse((void *)g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+            }
+            break;
+
+
+            default:
+                g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler(g_pCB->FunctionParams.AsyncExt.pAsyncBuf); 
+                break;
+        }
+    }
+}
+
+
+/* ******************************************************************************/
+/*  _SlDrvMsgReadCmdCtx  */
+/* ******************************************************************************/
+_SlReturnVal_t cc3100_driver::_SlDrvMsgReadCmdCtx(void)
+{
+
+    /*  after command response is received and isCmdRespWaited */
+    /*  flag is set FALSE, it is necessary to read out all */
+    /*  Async messages in Commands context, because ssiDma_IsrHandleSignalFromSlave */
+    /*  could have dispatched some Async messages to g_NwpIf.CmdSyncObj */
+    /*  after command response but before this response has been processed */
+    /*  by spi_singleRead and isCmdRespWaited was set FALSE. */
+    
+    while (TRUE == g_pCB->IsCmdRespWaited) {
+        
+        if(_SL_PENDING_RX_MSG(g_pCB)) {
+           
+            g_pCB->FunctionParams.AsyncExt.pAsyncBuf = NULL;/*  buffer must be allocated by _SlDrvMsgRead */
+            
+            g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler = NULL;
+           
+            g_pCB->FunctionParams.AsyncExt.RxMsgClass = (_SlRxMsgClass_e)(-1);/* init to illegal value and verify it's overwritten with the valid one */
+            
+            VERIFY_RET_OK(_SlDrvMsgRead());
+            g_pCB->RxDoneCnt++;
+           
+            if (CMD_RESP_CLASS == g_pCB->FunctionParams.AsyncExt.RxMsgClass) {
+                g_pCB->IsCmdRespWaited = FALSE;
+
+                /*  In case CmdResp has been read without  waiting on CmdSyncObj -  that */
+                /*  Sync object. That to prevent old signal to be processed. */
+                _nonos.sl_SyncObjClear(&g_pCB->CmdSyncObj);
+            } else if (ASYNC_EVT_CLASS == g_pCB->FunctionParams.AsyncExt.RxMsgClass) {
+                /*  If Async event has been read in CmdResp context, check whether */
+                /*  there is a handler for this event. If there is, spawn specific */
+                /*  handler. Otherwise free the event's buffer. */
+                /*  This way there will be no "dry shots" from CmdResp context to */
+                /*  temporary context, i.e less waste of CPU and faster buffer */
+                /*  release. */
+                _SlAsyncEventGenericHandler();
+
+#if (SL_MEMORY_MGMT == SL_MEMORY_MGMT_STATIC)
+                
+                g_pCB->FunctionParams.AsyncExt.pAsyncBuf = NULL;
+#else
+                free(g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+#endif
+            }
+        } else {
+            /* CmdSyncObj will be signaled by IRQ */
+            OSI_RET_OK_CHECK(_nonos.sl_SyncObjWait(&g_pCB->CmdSyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE, NON_OS_SYNC_OBJ_CLEAR_VALUE, SL_OS_WAIT_FOREVER));
+        }
+    }
+    
+    /*  If there are more pending Rx Msgs after CmdResp is received, */
+    /*  that means that these are Async, Dummy or Read Data Msgs. */
+    /*  Spawn _SlDrvMsgReadSpawnCtx to trigger reading these messages from */
+    /*  Temporary context. */
+    /* sl_Spawn is activated, using a different context */
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+    
+    if(_SL_PENDING_RX_MSG(g_pCB)) {
+      _nonos._SlNonOsSpawn((_SlSpawnEntryFunc_t)&_SlDrvMsgReadSpawnCtx, NULL, 0);
+    }
+    
+    return SL_OS_RET_CODE_OK;
+}
+
+/* ******************************************************************************/
+/*  _SlDrvMsgReadSpawnCtx                                                       */
+/* ******************************************************************************/
+
+_SlReturnVal_t cc3100_driver::_SlDrvMsgReadSpawnCtx_(void *pValue)
+{
+	
+#ifdef SL_POLLING_MODE_USED
+    int16_t retCode = OSI_OK;
+    //  for polling based systems 
+    do {
+        retCode = sl_LockObjLock(&g_pCB->GlobalLockObj, 0);
+        if ( OSI_OK != retCode ) {
+            if (TRUE == g_pCB->IsCmdRespWaited) {
+                OSI_RET_OK_CHECK( sl_SyncObjSignal(&g_pCB->CmdSyncObj) );
+                return SL_RET_CODE_OK;
+            }
+        }
+
+    } while (OSI_OK != retCode);
+
+#else
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER) );
+#endif
+
+    g_pCB->FunctionParams.AsyncExt.pAsyncBuf       = NULL;//  buffer must be allocated by _SlDrvMsgRead 
+    g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler = NULL;
+    g_pCB->FunctionParams.AsyncExt.RxMsgClass      = CMD_RESP_CLASS;// init to illegal value and verify it's overwritten with the valid one 
+
+    //  Messages might have been read by CmdResp context. Therefore after 
+    //  getting LockObj, check again where the Pending Rx Msg is still present. 
+    if(FALSE == (_SL_PENDING_RX_MSG(g_pCB))) {
+        OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+        return SL_RET_CODE_OK;
+    }
+
+    VERIFY_RET_OK(_SlDrvMsgRead());
+
+    g_pCB->RxDoneCnt++;
+
+    switch(g_pCB->FunctionParams.AsyncExt.RxMsgClass) {
+        case ASYNC_EVT_CLASS:
+            //  If got here and protected by LockObj a message is waiting  
+            //  to be read 
+            VERIFY_PROTOCOL(NULL != g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+
+            _SlAsyncEventGenericHandler();
+
+#if (SL_MEMORY_MGMT == SL_MEMORY_MGMT_STATIC)
+            g_pCB->FunctionParams.AsyncExt.pAsyncBuf = NULL;
+#else
+            sl_Free(g_pCB->FunctionParams.AsyncExt.pAsyncBuf);
+#endif
+            break;
+        case DUMMY_MSG_CLASS:
+        case RECV_RESP_CLASS:
+            // These types are legal in this context. Do nothing 
+            break;
+        case CMD_RESP_CLASS:
+            // Command response is illegal in this context. 
+            // No 'break' here: Assert! 
+        default:
+            VERIFY_PROTOCOL(0);
+    }
+
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->GlobalLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+
+    return(SL_RET_CODE_OK);
+}
+
+/* ******************************************************************************/
+/*  _SlDrvClassifyRxMsg */
+/* ******************************************************************************/
+void cc3100_driver::_SlDrvClassifyRxMsg(_SlOpcode_t Opcode)
+{
+    g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler = NULL;
+
+
+    /* Async event has received */
+    if (0 == (SL_OPCODE_SYNC & Opcode)) {
+        if (SL_OPCODE_DEVICE_DEVICEASYNCDUMMY == Opcode) {
+            g_pCB->FunctionParams.AsyncExt.RxMsgClass = DUMMY_MSG_CLASS;
+        } else if ( (SL_OPCODE_SOCKET_RECVASYNCRESPONSE == Opcode) || (SL_OPCODE_SOCKET_RECVFROMASYNCRESPONSE == Opcode) || (SL_OPCODE_SOCKET_RECVFROMASYNCRESPONSE_V6 == Opcode) ) {
+            g_pCB->FunctionParams.AsyncExt.RxMsgClass = RECV_RESP_CLASS;
+        } else {
+            g_pCB->FunctionParams.AsyncExt.RxMsgClass = ASYNC_EVT_CLASS;
+
+            /* set silo handler */
+            if (SL_OPCODE_SILO_DEVICE == (Opcode & SL_OPCODE_SILO_MASK)) {
+                g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler = (_SlSpawnEntryFunc_t)&_SlDrvDeviceEventHandler;
+            } else if (SL_OPCODE_SILO_WLAN == (Opcode & SL_OPCODE_SILO_MASK)) {
+#ifdef sl_WlanEvtHdlr
+                
+                g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler = (_SlSpawnEntryFunc_t)&sl_WlanEvtHdlr;
+#endif
+            } else if (SL_OPCODE_SILO_SOCKET == (Opcode & SL_OPCODE_SILO_MASK)) {
+
+#ifdef sl_SockEvtHdlr
+                
+                g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler = (_SlSpawnEntryFunc_t)&sl_SockEvtHdlr;
+#endif
+            } else if (SL_OPCODE_SILO_NETAPP == (Opcode & SL_OPCODE_SILO_MASK)) {
+
+                if ((SL_OPCODE_NETAPP_HTTPGETTOKENVALUE == Opcode) || (SL_OPCODE_NETAPP_HTTPPOSTTOKENVALUE == Opcode)) {
+                    g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler = (_SlSpawnEntryFunc_t)&_SlDrvNetAppEventHandler;
+                }
+#ifdef sl_NetAppEvtHdlr
+                else {
+                    g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler = (_SlSpawnEntryFunc_t)&sl_NetAppEvtHdlr;
+                }
+#endif
+            }
+            /* 			else if (SL_OPCODE_SILO_NVMEM == (Opcode & SL_OPCODE_SILO_MASK))   */
+            /* 			{ */
+            /* 			} */
+            /* 			else if (SL_OPCODE_SILO_NETCFG == (Opcode & SL_OPCODE_SILO_MASK))   */
+            /* 			{ */
+            /* 			} */
+            else {
+                //SL_ERROR_TRACE2(MSG_311, "ASSERT: _SlDrvClassifyRxMsg : invalid opcode = 0x%x = %i", Opcode, Opcode);
+                printf("ASSERT: _SlDrvClassifyRxMsg : invalid opcode = 0x%x = %i", Opcode, Opcode);
+            }
+        }
+    } else {
+        /* These may be Command responses only */
+        g_pCB->FunctionParams.AsyncExt.RxMsgClass = CMD_RESP_CLASS;
+    }
+}
+
+/* ******************************************************************************/
+/*  _SlDrvShiftDWord */
+/* ******************************************************************************/
+void cc3100_driver::_SlDrvShiftDWord(uint8_t *pBuf)
+{
+    uint8_t       ShiftIdx;
+    for(ShiftIdx = 0; ShiftIdx< 7; ShiftIdx++) {
+        pBuf[ShiftIdx] = pBuf[ShiftIdx+1];
+    }
+    pBuf[7] = 0;
+}
+
+/* ******************************************************************************/
+/*  _SlDrvRxHdrRead  */
+/* ******************************************************************************/
+_SlReturnVal_t  cc3100_driver::_SlDrvRxHdrRead(uint8_t *pBuf, uint8_t *pAlignSize)
+{
+    uint32_t       SyncCnt  = 0;
+    
+#ifndef SL_IF_TYPE_UART
+    /*  1. Write CNYS pattern to NWP when working in SPI mode only  */
+    _spi.spi_Write(g_pCB->FD, (uint8_t *)&g_H2NCnysPattern.Short, SYNC_PATTERN_LEN);
+#endif
+
+    /*  2. Read 4 bytes (protocol aligned) */
+    _spi.spi_Read(g_pCB->FD, &pBuf[0], 4);
+    _SL_DBG_SYNC_LOG(SyncCnt,pBuf);
+
+    /* Wait for SYNC_PATTERN_LEN from the device */
+    while ( ! N2H_SYNC_PATTERN_MATCH(pBuf, g_pCB->TxSeqNum) ) {
+        /*  3. Debug limit of scan */
+        VERIFY_PROTOCOL(SyncCnt < SL_SYNC_SCAN_THRESHOLD);
+
+        /*  4. Read next 4 bytes to Low 4 bytes of buffer */
+        if(0 == (SyncCnt % (uint32_t)SYNC_PATTERN_LEN)) {
+            _spi.spi_Read(g_pCB->FD, &pBuf[4], 4);
+            _SL_DBG_SYNC_LOG(SyncCnt,pBuf);
+        }
+
+        /*  5. Shift Buffer Up for checking if the sync is shifted */
+        _SlDrvShiftDWord(pBuf);
+
+        SyncCnt++;
+    }
+
+    /*  5. Sync pattern found. If needed, complete number of read bytes to multiple of 4 (protocol align) */
+    SyncCnt %= SYNC_PATTERN_LEN;
+
+    if(SyncCnt > 0) {
+        *(uint32_t *)&pBuf[0] = *(uint32_t *)&pBuf[4];
+        _spi.spi_Read(g_pCB->FD, &pBuf[SYNC_PATTERN_LEN - SyncCnt], (uint16_t)SyncCnt);
+    } else {
+        _spi.spi_Read(g_pCB->FD, &pBuf[0], 4);
+    }
+
+    /*  6. Scan for Double pattern. */
+    while ( N2H_SYNC_PATTERN_MATCH(pBuf, g_pCB->TxSeqNum) ) {
+        _SL_DBG_CNT_INC(Work.DoubleSyncPattern);
+        _spi.spi_Read(g_pCB->FD, &pBuf[0], SYNC_PATTERN_LEN);
+    }
+    g_pCB->TxSeqNum++;
+
+    /*  7. Here we've read Generic Header (4 bytes). Read the Resp Specific header (4 more bytes). */
+    _spi.spi_Read(g_pCB->FD, &pBuf[SYNC_PATTERN_LEN], _SL_RESP_SPEC_HDR_SIZE);
+
+    /*  8. Here we've read the entire Resp Header. */
+    /*     Return number bytes needed to be sent after read for NWP Rx 4-byte alignment (protocol alignment) */
+    *pAlignSize = (uint8_t)((SyncCnt > 0) ? (SYNC_PATTERN_LEN - SyncCnt) : 0);
+
+    return SL_RET_CODE_OK;
+}
+
+/* ***************************************************************************** */
+/*  _SlDrvBasicCmd */
+/* ***************************************************************************** */
+typedef union {
+    _BasicResponse_t	Rsp;
+} _SlBasicCmdMsg_u;
+
+int16_t cc3100_driver::_SlDrvBasicCmd(_SlOpcode_t Opcode)
+{
+    _SlBasicCmdMsg_u       Msg = {0};
+    _SlCmdCtrl_t           CmdCtrl;
+
+    CmdCtrl.Opcode = Opcode;
+    CmdCtrl.TxDescLen = 0;
+    CmdCtrl.RxDescLen = sizeof(_BasicResponse_t);
+
+
+    VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&CmdCtrl, &Msg, NULL));
+
+    return (int16_t)Msg.Rsp.status;
+}
+
+/* ***************************************************************************** */
+/*  _SlDrvWaitForPoolObj */
+/* ***************************************************************************** */
+int16_t cc3100_driver::_SlDrvWaitForPoolObj(uint32_t ActionID, uint8_t SocketID)
+{
+    uint8_t CurrObjIndex = MAX_CONCURRENT_ACTIONS;
+
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+    
+    /* Get free object  */
+    if (MAX_CONCURRENT_ACTIONS > g_pCB->FreePoolIdx) {
+        /* save the current obj index */
+        CurrObjIndex = g_pCB->FreePoolIdx;
+        /* set the new free index */
+        if (MAX_CONCURRENT_ACTIONS > g_pCB->ObjPool[CurrObjIndex].NextIndex) {
+            g_pCB->FreePoolIdx = g_pCB->ObjPool[CurrObjIndex].NextIndex;
+        } else {
+            /* No further free actions available */
+            g_pCB->FreePoolIdx = MAX_CONCURRENT_ACTIONS;
+        }
+    } else {
+        OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+        return CurrObjIndex;
+    }
+    g_pCB->ObjPool[CurrObjIndex].ActionID = (uint8_t)ActionID;
+    if (SL_MAX_SOCKETS > SocketID) {
+        g_pCB->ObjPool[CurrObjIndex].AdditionalData = SocketID;
+    }
+    /*In case this action is socket related, SocketID bit will be on
+    In case SocketID is set to SL_MAX_SOCKETS, the socket is not relevant to the action. In that case ActionID bit will be on */
+    while ( ( (SL_MAX_SOCKETS > SocketID) && (g_pCB->ActiveActionsBitmap & (1<<SocketID)) ) || ( (g_pCB->ActiveActionsBitmap & (1<<ActionID)) && (SL_MAX_SOCKETS == SocketID) ) ) {
+        //action in progress - move to pending list
+        g_pCB->ObjPool[CurrObjIndex].NextIndex = g_pCB->PendingPoolIdx;
+        g_pCB->PendingPoolIdx = CurrObjIndex;
+        OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+        //wait for action to be free
+        OSI_RET_OK_CHECK(_nonos.sl_SyncObjWait(&g_pCB->ObjPool[CurrObjIndex].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE, NON_OS_SYNC_OBJ_CLEAR_VALUE, SL_OS_WAIT_FOREVER));
+        //set params and move to active (remove from pending list at _SlDrvReleasePoolObj)
+        OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+    }
+    /*mark as active. Set socket as active if action is on socket, otherwise mark action as active*/
+    if (SL_MAX_SOCKETS > SocketID) {
+        g_pCB->ActiveActionsBitmap |= (1<<SocketID);
+    } else {
+        g_pCB->ActiveActionsBitmap |= (1<<ActionID);
+    }
+    /* move to active list  */
+    g_pCB->ObjPool[CurrObjIndex].NextIndex = g_pCB->ActivePoolIdx;
+    g_pCB->ActivePoolIdx = CurrObjIndex;
+    /* unlock */
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+    return CurrObjIndex;
+}
+
+/* ******************************************************************************/
+/*  _SlDrvReleasePoolObj */
+/* ******************************************************************************/
+void cc3100_driver::_SlDrvReleasePoolObj(uint8_t ObjIdx)
+{
+    uint8_t PendingIndex;
+
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+
+    /* go over the pending list and release other pending action if needed */
+    PendingIndex = g_pCB->PendingPoolIdx;
+    while(MAX_CONCURRENT_ACTIONS > PendingIndex) {
+        /* In case this action is socket related, SocketID is in use, otherwise will be set to SL_MAX_SOCKETS */
+        if ( (g_pCB->ObjPool[PendingIndex].ActionID == g_pCB->ObjPool[ObjIdx].ActionID) &&
+                ( (SL_MAX_SOCKETS == (g_pCB->ObjPool[PendingIndex].AdditionalData & BSD_SOCKET_ID_MASK)) ||
+                  ((SL_MAX_SOCKETS > (g_pCB->ObjPool[ObjIdx].AdditionalData & BSD_SOCKET_ID_MASK)) && ( (g_pCB->ObjPool[PendingIndex].AdditionalData & BSD_SOCKET_ID_MASK) == (g_pCB->ObjPool[ObjIdx].AdditionalData & BSD_SOCKET_ID_MASK) ))) ) {
+            /* remove from pending list */
+            _SlRemoveFromList(&g_pCB->PendingPoolIdx, PendingIndex);
+            OSI_RET_OK_CHECK(_nonos.sl_SyncObjSignal(&g_pCB->ObjPool[PendingIndex].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE));
+            break;
+        }
+        PendingIndex = g_pCB->ObjPool[PendingIndex].NextIndex;
+    }
+
+    if (SL_MAX_SOCKETS > (g_pCB->ObjPool[ObjIdx].AdditionalData & BSD_SOCKET_ID_MASK)) {
+        /* unset socketID  */
+        g_pCB->ActiveActionsBitmap &= ~(1<<(g_pCB->ObjPool[ObjIdx].AdditionalData & BSD_SOCKET_ID_MASK));
+    } else {
+        /* unset actionID  */
+        g_pCB->ActiveActionsBitmap &= ~(1<<g_pCB->ObjPool[ObjIdx].ActionID);
+    }
+
+    /* delete old data */
+    g_pCB->ObjPool[ObjIdx].pRespArgs = NULL;
+    g_pCB->ObjPool[ObjIdx].ActionID = 0;
+    g_pCB->ObjPool[ObjIdx].AdditionalData = SL_MAX_SOCKETS;
+
+    /* remove from active list */
+    _SlRemoveFromList(&g_pCB->ActivePoolIdx, ObjIdx);
+    /* move to free list */
+    g_pCB->ObjPool[ObjIdx].NextIndex = g_pCB->FreePoolIdx;
+    g_pCB->FreePoolIdx = ObjIdx;
+
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+}
+
+
+
+/* ******************************************************************************/
+/*  _SlDrvObjInit */
+/* ******************************************************************************/
+void cc3100_driver::_SlDrvObjInit(void)
+{
+    uint8_t Idx;
+
+    memset(&g_pCB->ObjPool[0],0,MAX_CONCURRENT_ACTIONS*sizeof(_SlPoolObj_t));
+    /* place all Obj in the free list */
+    g_pCB->FreePoolIdx = 0;
+    for (Idx = 0 ; Idx < MAX_CONCURRENT_ACTIONS ; Idx++) {
+        g_pCB->ObjPool[Idx].NextIndex = Idx + 1;
+        g_pCB->ObjPool[Idx].AdditionalData = SL_MAX_SOCKETS;
+    }
+
+    g_pCB->ActivePoolIdx = MAX_CONCURRENT_ACTIONS;
+    g_pCB->PendingPoolIdx = MAX_CONCURRENT_ACTIONS;
+
+}
+
+/* ******************************************************************************/
+/*  _SlDrvObjDeInit  */
+/* ******************************************************************************/
+void cc3100_driver::_SlDrvObjDeInit(void)
+{
+    g_pCB->FreePoolIdx = 0;
+    g_pCB->PendingPoolIdx = MAX_CONCURRENT_ACTIONS;
+    g_pCB->ActivePoolIdx = MAX_CONCURRENT_ACTIONS;
+
+}
+
+/* ******************************************************************************/
+/* _SlRemoveFromList  */
+/* ******************************************************************************/
+void cc3100_driver::_SlRemoveFromList(uint8_t *ListIndex, uint8_t ItemIndex)
+{
+    uint8_t Idx;
+    /* only one item in the list */
+    if (MAX_CONCURRENT_ACTIONS == g_pCB->ObjPool[*ListIndex].NextIndex) {
+        *ListIndex = MAX_CONCURRENT_ACTIONS;
+    }
+    /* need to remove the first item in the list and therefore update the global which holds this index */
+    else if (*ListIndex == ItemIndex) {
+        *ListIndex = g_pCB->ObjPool[ItemIndex].NextIndex;
+    } else {
+        Idx = *ListIndex;
+        while(MAX_CONCURRENT_ACTIONS > Idx) {
+            /* remove from list */
+            if (g_pCB->ObjPool[Idx].NextIndex == ItemIndex) {
+                g_pCB->ObjPool[Idx].NextIndex = g_pCB->ObjPool[ItemIndex].NextIndex;
+                break;
+            }
+            Idx = g_pCB->ObjPool[Idx].NextIndex;
+        }
+    }
+}
+
+/* ******************************************************************************/
+/*  _SlFindAndSetActiveObj                                                     */
+/* ******************************************************************************/
+_SlReturnVal_t cc3100_driver::_SlFindAndSetActiveObj(_SlOpcode_t  Opcode, uint8_t Sd)
+{
+    uint8_t ActiveIndex;
+
+    ActiveIndex = g_pCB->ActivePoolIdx;
+    /* go over the active list if exist to find obj waiting for this Async event */
+    while (MAX_CONCURRENT_ACTIONS > ActiveIndex) {
+        /* unset the Ipv4\IPv6 bit in the opcode if family bit was set  */
+        if (g_pCB->ObjPool[ActiveIndex].AdditionalData & SL_NETAPP_FAMILY_MASK) {
+            Opcode &= ~SL_OPCODE_IPV6;
+        }
+
+        if ((g_pCB->ObjPool[ActiveIndex].ActionID == RECV_ID) && (Sd == g_pCB->ObjPool[ActiveIndex].AdditionalData) &&
+                ( (SL_OPCODE_SOCKET_RECVASYNCRESPONSE == Opcode) || (SL_OPCODE_SOCKET_RECVFROMASYNCRESPONSE == Opcode) || (SL_OPCODE_SOCKET_RECVFROMASYNCRESPONSE_V6 == Opcode) ) ) {
+            g_pCB->FunctionParams.AsyncExt.ActionIndex = ActiveIndex;
+            return SL_RET_CODE_OK;
+        }
+        /* In case this action is socket related, SocketID is in use, otherwise will be set to SL_MAX_SOCKETS */
+        if ( (_SlActionLookupTable[ g_pCB->ObjPool[ActiveIndex].ActionID - MAX_SOCKET_ENUM_IDX].ActionAsyncOpcode == Opcode) &&
+                ( ((Sd == (g_pCB->ObjPool[ActiveIndex].AdditionalData & BSD_SOCKET_ID_MASK) ) && (SL_MAX_SOCKETS > Sd)) || (SL_MAX_SOCKETS == (g_pCB->ObjPool[ActiveIndex].AdditionalData & BSD_SOCKET_ID_MASK)) ) ) {
+            /* set handler */
+            g_pCB->FunctionParams.AsyncExt.AsyncEvtHandler = _SlActionLookupTable[ g_pCB->ObjPool[ActiveIndex].ActionID - MAX_SOCKET_ENUM_IDX].AsyncEventHandler;
+            g_pCB->FunctionParams.AsyncExt.ActionIndex = ActiveIndex;
+            return SL_RET_CODE_OK;
+        }
+        ActiveIndex = g_pCB->ObjPool[ActiveIndex].NextIndex;
+    }
+
+    return SL_RET_CODE_SELF_ERROR;
+}
+
+}//namespace mbed_cc3100
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_driver.h	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,286 @@
+/*
+ * driver.h - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+#ifndef DRIVER_INT_H_
+#define DRIVER_INT_H_
+
+#include "cc3100_simplelink.h"
+
+#include "cc3100_protocol.h"
+#include "cc3100_nonos.h"
+#include "cc3100_spi.h"
+#include "cc3100_netapp.h"
+#include "cc3100.h"
+
+
+/*****************************************************************************/
+/* Macro declarations                                                        */
+/*****************************************************************************/
+
+/*  2 LSB of the N2H_SYNC_PATTERN are for sequence number
+only in SPI interface
+support backward sync pattern */
+#define N2H_SYNC_PATTERN_SEQ_NUM_BITS            ((uint32_t)0x00000003) /* Bits 0..1    - use the 2 LBS for seq num */
+#define N2H_SYNC_PATTERN_SEQ_NUM_EXISTS          ((uint32_t)0x00000004) /* Bit  2       - sign that sequence number exists in the sync pattern */
+#define N2H_SYNC_PATTERN_MASK                    ((uint32_t)0xFFFFFFF8) /* Bits 3..31   - constant SYNC PATTERN */
+#define N2H_SYNC_SPI_BUGS_MASK                   ((uint32_t)0x7FFF7F7F) /* Bits 7,15,31 - ignore the SPI (8,16,32 bites bus) error bits  */
+#define BUF_SYNC_SPIM(pBuf)                      ((*(uint32_t *)(pBuf)) & N2H_SYNC_SPI_BUGS_MASK)
+#define N2H_SYNC_SPIM                            (N2H_SYNC_PATTERN    & N2H_SYNC_SPI_BUGS_MASK)
+#define N2H_SYNC_SPIM_WITH_SEQ(TxSeqNum)         ((N2H_SYNC_SPIM & N2H_SYNC_PATTERN_MASK) | N2H_SYNC_PATTERN_SEQ_NUM_EXISTS | ((TxSeqNum) & (N2H_SYNC_PATTERN_SEQ_NUM_BITS)))
+#define MATCH_WOUT_SEQ_NUM(pBuf)                 ( BUF_SYNC_SPIM(pBuf) ==  N2H_SYNC_SPIM )
+#define MATCH_WITH_SEQ_NUM(pBuf, TxSeqNum)       ( BUF_SYNC_SPIM(pBuf) == (N2H_SYNC_SPIM_WITH_SEQ(TxSeqNum)) )
+#define N2H_SYNC_PATTERN_MATCH(pBuf, TxSeqNum) \
+    ( \
+    (  (*((uint32_t *)pBuf) & N2H_SYNC_PATTERN_SEQ_NUM_EXISTS) && ( MATCH_WITH_SEQ_NUM(pBuf, TxSeqNum) ) )	|| \
+    ( !(*((uint32_t *)pBuf) & N2H_SYNC_PATTERN_SEQ_NUM_EXISTS) && ( MATCH_WOUT_SEQ_NUM(pBuf          ) ) )	   \
+    )
+
+#define OPCODE(_ptr)          (((_SlResponseHeader_t *)(_ptr))->GenHeader.Opcode)
+#define RSP_PAYLOAD_LEN(_ptr) (((_SlResponseHeader_t *)(_ptr))->GenHeader.Len - _SL_RESP_SPEC_HDR_SIZE)
+#define SD(_ptr)              (((_SocketAddrResponse_u *)(_ptr))->IpV4.sd)
+/*  Actual size of Recv/Recvfrom response data  */
+#define ACT_DATA_SIZE(_ptr)   (((_SocketAddrResponse_u *)(_ptr))->IpV4.statusOrLen)
+
+#define _SL_PROTOCOL_ALIGN_SIZE(msgLen)             (((msgLen)+3) & (~3))
+#define _SL_IS_PROTOCOL_ALIGNED_SIZE(msgLen)        (!((msgLen) & 3))
+#define _SL_PROTOCOL_CALC_LEN(pCmdCtrl,pCmdExt)     ((pCmdExt) ? \
+                                                     (_SL_PROTOCOL_ALIGN_SIZE(pCmdCtrl->TxDescLen) + _SL_PROTOCOL_ALIGN_SIZE(pCmdExt->TxPayloadLen)) : \
+                                                     (_SL_PROTOCOL_ALIGN_SIZE(pCmdCtrl->TxDescLen)))
+                                                     
+
+namespace mbed_cc3100 {
+	
+class cc3100;
+	
+/*****************************************************************************/
+/* Structure/Enum declarations                                               */
+/*****************************************************************************/
+//typedef void(*_SlSpawnEntryFunc_t)(void* pValue);
+
+typedef struct {
+    _SlOpcode_t      Opcode;
+    _SlArgSize_t     TxDescLen;
+    _SlArgSize_t     RxDescLen;
+} _SlCmdCtrl_t;
+
+typedef struct {
+    uint16_t  TxPayloadLen;
+    uint16_t  RxPayloadLen;
+    uint16_t  ActualRxPayloadLen;
+    uint8_t   *pTxPayload;
+    uint8_t   *pRxPayload;
+} _SlCmdExt_t;
+
+
+typedef struct _SlArgsData_t {
+    uint8_t	 *pArgs;
+    uint8_t  *pData;
+} _SlArgsData_t;
+
+
+typedef struct _SlPoolObj_t {
+    _SlSyncObj_t	      SyncObj;
+    uint8_t               *pRespArgs;
+    uint8_t			      ActionID;
+    uint8_t			      AdditionalData; /* use for socketID and one bit which indicate supprt IPV6 or not (1=support, 0 otherwise) */
+    uint8_t				  NextIndex;
+
+} _SlPoolObj_t;
+
+
+typedef enum {
+    SOCKET_0,
+    SOCKET_1,
+    SOCKET_2,
+    SOCKET_3,
+    SOCKET_4,
+    SOCKET_5,
+    SOCKET_6,
+    SOCKET_7,
+    MAX_SOCKET_ENUM_IDX,
+    ACCEPT_ID = MAX_SOCKET_ENUM_IDX,
+    CONNECT_ID,
+    SELECT_ID,
+    GETHOSYBYNAME_ID,
+    GETHOSYBYSERVICE_ID,
+    PING_ID,
+    START_STOP_ID,
+    RECV_ID
+} _SlActionID_e;
+
+typedef struct _SlActionLookup_t {
+    uint8_t					ActionID;
+    uint16_t				ActionAsyncOpcode;
+    _SlSpawnEntryFunc_t		AsyncEventHandler;
+
+} _SlActionLookup_t;
+
+
+typedef struct {
+    uint8_t         TxPoolCnt;
+    _SlLockObj_t    TxLockObj;
+    _SlSyncObj_t    TxSyncObj;
+} _SlFlowContCB_t;
+
+typedef enum {
+    RECV_RESP_CLASS,
+    CMD_RESP_CLASS,
+    ASYNC_EVT_CLASS,
+    DUMMY_MSG_CLASS
+} _SlRxMsgClass_e;
+
+typedef struct {
+    uint8_t                 *pAsyncBuf;         /* place to write pointer to buffer with CmdResp's Header + Arguments */
+    uint8_t					ActionIndex;
+    _SlSpawnEntryFunc_t     AsyncEvtHandler;    /* place to write pointer to AsyncEvent handler (calc-ed by Opcode)   */
+    _SlRxMsgClass_e         RxMsgClass;         /* type of Rx message                                                 */
+} AsyncExt_t;
+
+typedef struct {
+    _SlCmdCtrl_t         *pCmdCtrl;
+    uint8_t              *pTxRxDescBuff;
+    _SlCmdExt_t          *pCmdExt;
+    AsyncExt_t           AsyncExt;
+} _SlFunctionParams_t;
+
+typedef void (*P_INIT_CALLBACK)(uint32_t Status);
+
+typedef struct {
+    _SlFd_t                    FD;
+    _SlLockObj_t               GlobalLockObj;
+    _SlCommandHeader_t         TempProtocolHeader;
+    P_INIT_CALLBACK            pInitCallback;
+
+    _SlPoolObj_t               ObjPool[MAX_CONCURRENT_ACTIONS];
+    uint8_t					   FreePoolIdx;
+    uint8_t					   PendingPoolIdx;
+    uint8_t					   ActivePoolIdx;
+    uint32_t				   ActiveActionsBitmap;
+    _SlLockObj_t               ProtectionLockObj;
+
+    _SlSyncObj_t               CmdSyncObj;
+    uint8_t                    IsCmdRespWaited;
+
+    _SlFlowContCB_t            FlowContCB;
+
+    uint8_t                    TxSeqNum;
+    volatile uint8_t           RxIrqCnt;
+    uint8_t                    RxDoneCnt;
+    uint8_t                    SocketNonBlocking;
+    uint8_t                    SocketTXFailure;
+    uint8_t                    RelayFlagsViaRxPayload;
+    /* for stack reduction the parameters are globals */
+    _SlFunctionParams_t        FunctionParams;
+
+} _SlDriverCb_t;
+
+extern _SlDriverCb_t* g_pCB;
+typedef uint8_t _SlSd_t;
+
+class cc3100_driver
+{
+
+public:
+
+    cc3100_driver(cc3100_nonos &nonos, cc3100_netapp &netapp, cc3100_flowcont &flowcont, cc3100_spi &spi);
+
+    ~cc3100_driver();
+
+
+    /*****************************************************************************/
+    /* Function prototypes                                                       */
+    /*****************************************************************************/
+    typedef _SlDriverCb_t pDriver;
+    
+    bool _SL_PENDING_RX_MSG(pDriver* pDriverCB);
+    
+    void _SlDrvDriverCBInit(void);
+
+    void _SlDrvDriverCBDeinit(void);
+
+    void _SlDrvRxIrqHandler(void *pValue);
+
+    _SlReturnVal_t  _SlDrvCmdOp(_SlCmdCtrl_t *pCmdCtrl , void* pTxRxDescBuff , _SlCmdExt_t* pCmdExt);
+
+    _SlReturnVal_t  _SlDrvCmdSend(_SlCmdCtrl_t *pCmdCtrl , void* pTxRxDescBuff , _SlCmdExt_t* pCmdExt);
+
+    _SlReturnVal_t  _SlDrvDataReadOp(_SlSd_t Sd, _SlCmdCtrl_t *pCmdCtrl , void* pTxRxDescBuff , _SlCmdExt_t* pCmdExt);
+
+    _SlReturnVal_t  _SlDrvDataWriteOp(_SlSd_t Sd, _SlCmdCtrl_t *pCmdCtrl , void* pTxRxDescBuff , _SlCmdExt_t* pCmdExt);
+
+    int16_t  _SlDrvBasicCmd(_SlOpcode_t Opcode);
+
+    int16_t _SlDrvWaitForPoolObj(uint32_t ActionID, uint8_t SocketID);
+
+    void _SlDrvReleasePoolObj(uint8_t pObj);
+
+    void _SlDrvObjInit(void);
+
+    _SlReturnVal_t   _SlDrvMsgRead(void);
+
+    _SlReturnVal_t   _SlDrvMsgWrite(void);
+
+    _SlReturnVal_t   _SlDrvMsgReadCmdCtx(void);
+
+    _SlReturnVal_t   _SlDrvMsgReadSpawnCtx_(void *pValue);
+
+    void             _SlDrvClassifyRxMsg(_SlOpcode_t Opcode );
+
+    _SlReturnVal_t   _SlDrvRxHdrRead(uint8_t *pBuf, uint8_t *pAlignSize);
+
+    void             _SlDrvShiftDWord(uint8_t *pBuf);
+
+    void             _SlAsyncEventGenericHandler(void);
+
+    void			 _SlDrvObjDeInit(void);
+
+    void			 _SlRemoveFromList(uint8_t* ListIndex, uint8_t ItemIndex);
+
+    _SlReturnVal_t	 _SlFindAndSetActiveObj(_SlOpcode_t  Opcode, uint8_t Sd);
+
+private:
+
+    cc3100_nonos      &_nonos;
+    cc3100_netapp     &_netapp;
+    cc3100_flowcont   &_flowcont;
+    cc3100_spi        &_spi;
+
+};//class
+
+}//namespace mbed_cc3100
+
+#endif /* __DRIVER_INT_H__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_fs.cpp	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,397 @@
+/*
+ * fs.c - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+
+
+/*****************************************************************************/
+/* Include files                                                             */
+/*****************************************************************************/
+#include "cc3100_simplelink.h"
+#include "cc3100_protocol.h"
+#include "cc3100_driver.h"
+
+#include "cc3100_fs.h"
+
+/*****************************************************************************/
+/* Macro declarations                                                        */
+/*****************************************************************************/
+#define sl_min(a,b) (((a) < (b)) ? (a) : (b))
+#define MAX_NVMEM_CHUNK_SIZE  1460
+
+namespace mbed_cc3100 {
+
+cc3100_fs::cc3100_fs(cc3100_driver &driver)
+    : _driver(driver)
+{
+
+}
+
+cc3100_fs::~cc3100_fs()
+{
+
+}
+
+
+/*****************************************************************************/
+/* Internal functions                                                        */
+/*****************************************************************************/
+
+
+/*****************************************************************************/
+/* _sl_Strlen                                                                */
+/*****************************************************************************/
+uint16_t cc3100_fs::_sl_Strlen(const uint8_t *buffer)
+{
+    uint16_t len = 0;
+    if( buffer != NULL ) {
+        while(*buffer++) len++;
+    }
+    return len;
+}
+
+/*****************************************************************************/
+/* _sl_GetCreateFsMode                                                       */
+/*****************************************************************************/
+uint32_t cc3100_fs::_sl_GetCreateFsMode(uint32_t maxSizeInBytes,uint32_t accessFlags)
+{
+    uint32_t granIdx = 0;
+    uint32_t granNum = 0;
+    uint32_t granTable[_FS_MAX_MODE_SIZE_GRAN] = {256,1024,4096,16384,65536};
+    for(granIdx= _FS_MODE_SIZE_GRAN_256B ; granIdx< _FS_MAX_MODE_SIZE_GRAN; granIdx++) {
+        if( granTable[granIdx]*255 >= maxSizeInBytes )
+            break;
+    }
+    granNum = maxSizeInBytes/granTable[granIdx];
+    if( maxSizeInBytes % granTable[granIdx] != 0 )
+        granNum++;
+
+    return _FS_MODE(_FS_MODE_OPEN_WRITE_CREATE_IF_NOT_EXIST,  granIdx, granNum, accessFlags);
+}
+
+
+/*****************************************************************************/
+/* API functions                                                        */
+/*****************************************************************************/
+
+/*****************************************************************************/
+/*  sl_FsOpen */
+/*****************************************************************************/
+typedef union {
+    _FsOpenCommand_t	    Cmd;
+    _FsOpenResponse_t	    Rsp;
+} _SlFsOpenMsg_u;
+
+const _SlCmdCtrl_t _SlFsOpenCmdCtrl = {
+    SL_OPCODE_NVMEM_FILEOPEN,
+    sizeof(_FsOpenCommand_t),
+    sizeof(_FsOpenResponse_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_FsOpen)
+int32_t cc3100_fs::sl_FsOpen(uint8_t *pFileName,uint32_t AccessModeAndMaxSize, uint32_t *pToken,int32_t *pFileHandle)
+{
+    _SlReturnVal_t        RetVal;
+    _SlFsOpenMsg_u        Msg;
+    _SlCmdExt_t           CmdExt;
+
+    CmdExt.TxPayloadLen = (_sl_Strlen(pFileName)+4) & (~3); // add 4: 1 for NULL and the 3 for align
+    CmdExt.RxPayloadLen = 0;
+    CmdExt.pTxPayload = pFileName;
+    CmdExt.pRxPayload = NULL;
+
+    Msg.Cmd.Mode          =  AccessModeAndMaxSize;
+
+    if(pToken != NULL) {
+        Msg.Cmd.Token         = *pToken;
+    } else {
+        Msg.Cmd.Token         = 0;
+    }
+
+    RetVal = _driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlFsOpenCmdCtrl, &Msg, &CmdExt);
+    *pFileHandle = Msg.Rsp.FileHandle;
+    if (pToken != NULL) {
+        *pToken =      Msg.Rsp.Token;
+    }
+
+    /* in case of an error, return the erros file handler as an error code */
+    if( *pFileHandle < 0 ) {
+        return *pFileHandle;
+    }
+    return (int32_t)RetVal;
+}
+#endif
+
+/*****************************************************************************/
+/* sl_FsClose */
+/*****************************************************************************/
+typedef union {
+    _FsCloseCommand_t	    Cmd;
+    _BasicResponse_t	    Rsp;
+} _SlFsCloseMsg_u;
+
+const _SlCmdCtrl_t _SlFsCloseCmdCtrl = {
+    SL_OPCODE_NVMEM_FILECLOSE,
+    sizeof(_FsCloseCommand_t),
+    sizeof(_FsCloseResponse_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_FsClose)
+int16_t cc3100_fs::sl_FsClose(int32_t FileHdl, uint8_t*  pCeritificateFileName,uint8_t*  pSignature ,uint32_t SignatureLen)
+{
+    _SlFsCloseMsg_u Msg = {0};
+    _SlCmdExt_t         ExtCtrl;
+
+    Msg.Cmd.FileHandle             = FileHdl;
+    if( pCeritificateFileName != NULL ) {
+        Msg.Cmd.CertificFileNameLength = (_sl_Strlen(pCeritificateFileName)+4) & (~3); /* add 4: 1 for NULL and the 3 for align */
+    }
+    Msg.Cmd.SignatureLen           = SignatureLen;
+
+    ExtCtrl.TxPayloadLen = ((SignatureLen+3) & (~3)); /* align */
+    ExtCtrl.pTxPayload   = pSignature;
+    ExtCtrl.RxPayloadLen = (uint16_t)Msg.Cmd.CertificFileNameLength;
+    ExtCtrl.pRxPayload   = pCeritificateFileName; /* Add signature */
+
+    if(ExtCtrl.pRxPayload != NULL &&  ExtCtrl.RxPayloadLen != 0) {
+        g_pCB->RelayFlagsViaRxPayload = TRUE;
+    }
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlFsCloseCmdCtrl, &Msg, &ExtCtrl));
+
+    return (int16_t)((int16_t)Msg.Rsp.status);
+}
+#endif
+
+
+/*****************************************************************************/
+/* sl_FsRead */
+/*****************************************************************************/
+typedef union {
+    _FsReadCommand_t	    Cmd;
+    _FsReadResponse_t	    Rsp;
+} _SlFsReadMsg_u;
+
+const _SlCmdCtrl_t _SlFsReadCmdCtrl = {
+    SL_OPCODE_NVMEM_FILEREADCOMMAND,
+    sizeof(_FsReadCommand_t),
+    sizeof(_FsReadResponse_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_FsRead)
+int32_t cc3100_fs::sl_FsRead(int32_t FileHdl, uint32_t Offset, uint8_t*  pData, uint32_t Len)
+{
+    _SlFsReadMsg_u      Msg;
+    _SlCmdExt_t         ExtCtrl;
+    uint16_t      ChunkLen;
+    _SlReturnVal_t      RetVal =0;
+    int32_t                RetCount = 0;
+
+    ExtCtrl.TxPayloadLen = 0;
+    ExtCtrl.pTxPayload   = NULL;
+
+    ChunkLen = (uint16_t)sl_min(MAX_NVMEM_CHUNK_SIZE,Len);
+    ExtCtrl.RxPayloadLen = ChunkLen;
+    ExtCtrl.pRxPayload   = (uint8_t *)(pData);
+    Msg.Cmd.Offset       = Offset;
+    Msg.Cmd.Len          = ChunkLen;
+    Msg.Cmd.FileHandle   = FileHdl;
+    do {
+        RetVal = _driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlFsReadCmdCtrl, &Msg, &ExtCtrl);
+        if(SL_OS_RET_CODE_OK == RetVal) {
+            if( Msg.Rsp.status < 0) {
+                if( RetCount > 0) {
+                    return RetCount;
+                } else {
+                    return Msg.Rsp.status;
+                }
+            }
+            RetCount += (int32_t)Msg.Rsp.status;
+            Len -= ChunkLen;
+            Offset += ChunkLen;
+            Msg.Cmd.Offset      = Offset;
+            ExtCtrl.pRxPayload   += ChunkLen;
+            ChunkLen = (uint16_t)sl_min(MAX_NVMEM_CHUNK_SIZE,Len);
+            ExtCtrl.RxPayloadLen  = ChunkLen;
+            Msg.Cmd.Len           = ChunkLen;
+            Msg.Cmd.FileHandle  = FileHdl;
+        } else {
+            return RetVal;
+        }
+    } while(ChunkLen > 0);
+
+    return (int32_t)RetCount;
+}
+#endif
+
+/*****************************************************************************/
+/* sl_FsWrite */
+/*****************************************************************************/
+typedef union {
+    _FsWriteCommand_t	    Cmd;
+    _FsWriteResponse_t	    Rsp;
+} _SlFsWriteMsg_u;
+
+const _SlCmdCtrl_t _SlFsWriteCmdCtrl = {
+    SL_OPCODE_NVMEM_FILEWRITECOMMAND,
+    sizeof(_FsWriteCommand_t),
+    sizeof(_FsWriteResponse_t)
+};
+
+
+#if _SL_INCLUDE_FUNC(sl_FsWrite)
+int32_t cc3100_fs::sl_FsWrite(int32_t FileHdl, uint32_t Offset, uint8_t*  pData, uint32_t Len)
+{
+    _SlFsWriteMsg_u     Msg;
+    _SlCmdExt_t         ExtCtrl;
+    uint16_t      ChunkLen;
+    _SlReturnVal_t      RetVal;
+    int32_t                RetCount = 0;
+
+    ExtCtrl.RxPayloadLen = 0;
+    ExtCtrl.pRxPayload   = NULL;
+
+    ChunkLen = (uint16_t)sl_min(MAX_NVMEM_CHUNK_SIZE,Len);
+    ExtCtrl.TxPayloadLen = ChunkLen;
+    ExtCtrl.pTxPayload   = (uint8_t *)(pData);
+    Msg.Cmd.Offset      = Offset;
+    Msg.Cmd.Len          = ChunkLen;
+    Msg.Cmd.FileHandle  = FileHdl;
+
+    do {
+
+        RetVal = _driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlFsWriteCmdCtrl, &Msg, &ExtCtrl);
+        if(SL_OS_RET_CODE_OK == RetVal) {
+            if( Msg.Rsp.status < 0) {
+                if( RetCount > 0) {
+                    return RetCount;
+                } else {
+                    return Msg.Rsp.status;
+                }
+            }
+
+            RetCount += (int32_t)Msg.Rsp.status;
+            Len -= ChunkLen;
+            Offset += ChunkLen;
+            Msg.Cmd.Offset        = Offset;
+            ExtCtrl.pTxPayload   += ChunkLen;
+            ChunkLen = (uint16_t)sl_min(MAX_NVMEM_CHUNK_SIZE,Len);
+            ExtCtrl.TxPayloadLen  = ChunkLen;
+            Msg.Cmd.Len           = ChunkLen;
+            Msg.Cmd.FileHandle  = FileHdl;
+        } else {
+            return RetVal;
+        }
+    } while(ChunkLen > 0);
+
+    return (int32_t)RetCount;
+}
+#endif
+
+/*****************************************************************************/
+/* sl_FsGetInfo */
+/*****************************************************************************/
+typedef union {
+    _FsGetInfoCommand_t	    Cmd;
+    _FsGetInfoResponse_t    Rsp;
+} _SlFsGetInfoMsg_u;
+
+const _SlCmdCtrl_t _SlFsGetInfoCmdCtrl = {
+    SL_OPCODE_NVMEM_FILEGETINFOCOMMAND,
+    sizeof(_FsGetInfoCommand_t),
+    sizeof(_FsGetInfoResponse_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_FsGetInfo)
+int16_t cc3100_fs::sl_FsGetInfo(uint8_t *pFileName,uint32_t Token,SlFsFileInfo_t* pFsFileInfo)
+{
+    _SlFsGetInfoMsg_u    Msg;
+    _SlCmdExt_t          CmdExt;
+
+    CmdExt.TxPayloadLen = (_sl_Strlen(pFileName)+4) & (~3); /* add 4: 1 for NULL and the 3 for align  */
+    CmdExt.RxPayloadLen = 0;
+    CmdExt.pTxPayload   = pFileName;
+    CmdExt.pRxPayload   = NULL;
+    Msg.Cmd.Token       = Token;
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlFsGetInfoCmdCtrl, &Msg, &CmdExt));
+
+    pFsFileInfo->flags        = Msg.Rsp.flags;
+    pFsFileInfo->FileLen      = Msg.Rsp.FileLen;
+    pFsFileInfo->AllocatedLen = Msg.Rsp.AllocatedLen;
+    pFsFileInfo->Token[0]     = Msg.Rsp.Token[0];
+    pFsFileInfo->Token[1]     = Msg.Rsp.Token[1];
+    pFsFileInfo->Token[2]     = Msg.Rsp.Token[2];
+    pFsFileInfo->Token[3]     = Msg.Rsp.Token[3];
+    return  (int16_t)((int16_t)Msg.Rsp.Status);
+}
+#endif
+
+/*****************************************************************************/
+/* sl_FsDel */
+/*****************************************************************************/
+typedef union {
+    _FsDeleteCommand_t   	    Cmd;
+    _FsDeleteResponse_t	        Rsp;
+} _SlFsDeleteMsg_u;
+
+const _SlCmdCtrl_t _SlFsDeleteCmdCtrl = {
+    SL_OPCODE_NVMEM_FILEDELCOMMAND,
+    sizeof(_FsDeleteCommand_t),
+    sizeof(_FsDeleteResponse_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_FsDel)
+int16_t cc3100_fs::sl_FsDel(uint8_t *pFileName,uint32_t Token)
+{
+    _SlFsDeleteMsg_u Msg;
+    _SlCmdExt_t          CmdExt;
+
+    CmdExt.TxPayloadLen = (_sl_Strlen(pFileName)+4) & (~3); /* add 4: 1 for NULL and the 3 for align */
+    CmdExt.RxPayloadLen = 0;
+    CmdExt.pTxPayload   = pFileName;
+    CmdExt.pRxPayload   = NULL;
+    Msg.Cmd.Token       = Token;
+
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlFsDeleteCmdCtrl, &Msg, &CmdExt));
+
+    return  (int16_t)((int16_t)Msg.Rsp.status);
+}
+#endif
+
+}//namespace mbed_cc3100
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_fs.h	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,392 @@
+/*
+ * fs.h - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+#ifndef FS_H_
+#define FS_H_
+
+/*****************************************************************************/
+/* Include files                                                             */
+/*****************************************************************************/
+
+#include "cc3100_simplelink.h"
+
+/*!
+
+    \addtogroup FileSystem
+    @{
+
+*/
+
+/*****************************************************************************/
+/* Macro declarations                                                        */
+/*****************************************************************************/
+
+/* FS error codes */
+#define SL_FS_OK                                              (0)
+#define SL_FS_ERR_EMPTY_SFLASH                                (-67)
+#define SL_FS_ERR_FILE_IS_NOT_SECURE_AND_SIGN                 (-66)
+#define SL_FS_ERASING_FLASH                                   (-65)
+#define SL_FS_FILE_HAS_NOT_BEEN_CLOSE_CORRECTLY               (-64)
+#define SL_FS_WRONG_SIGNATURE                                 (-63)
+#define SL_FS_WRONG_SIGNATURE_OR_CERTIFIC_NAME_LENGTH         (-62)
+#define SL_FS_NOT_16_ALIGNED                                  (-61)
+#define SL_FS_CERT_CHAIN_ERROR                                (-60)
+#define SL_FS_FILE_NAME_EXIST                                 (-59)
+#define SL_FS_SECURITY_BUF_ALREADY_ALLOC                      (-58)
+#define SL_FS_SECURE_FILE_MUST_BE_COMMIT                      (-57)
+#define SL_FS_ERR_INCORRECT_OFFSET_ALIGNMENT                  (-56)
+#define SL_FS_ERR_FAILED_READ_NVMEM_HEADER                    (-55)
+#define SL_FS_WRONG_FILE_NAME                                 (-54)
+#define SL_FS_FILE_SYSTEM_IS_LOCKED                           (-53)
+#define SL_FS_SECURITY_ALLERT                                 (-52)
+#define SL_FS_FILE_UNVALID_FILE_SIZE                          (-51)
+#define SL_FS_ERR_TOKEN_IS_NOT_VALID                          (-50)
+#define SL_FS_NO_DEVICE_IS_LOADED                             (-49)
+#define SL_FS_DATA_ADDRESS_SHOUD_BE_IN_DATA_RAM               (-48)
+#define SL_FS_DATA_IS_NOT_ALIGNED                             (-47)
+#define SL_FS_ERR_OVERLAP_DETECTION_THRESHHOLD                (-46)
+#define SL_FS_FILE_HAS_RESERVED_NV_INDEX                      (-45)
+#define SL_FS_ERR_MAX_FS_FILES_IS_LARGER                      (-44)
+#define SL_FS_ERR_MAX_FS_FILES_IS_SMALLER                     (-43)
+#define SL_FS_FILE_MAX_SIZE_EXCEEDED                          (-42)
+#define SL_FS_INVALID_BUFFER_FOR_READ                         (-41)
+#define SL_FS_INVALID_BUFFER_FOR_WRITE                        (-40)
+#define SL_FS_ERR_FILE_IMAGE_IS_CORRUPTED                     (-39)
+#define SL_FS_ERR_SIZE_OF_FILE_EXT_EXCEEDED                   (-38)
+#define SL_FS_WARNING_FILE_NAME_NOT_KEPT                      (-37)
+#define SL_FS_ERR_DEVICE_IS_NOT_FORMATTED                     (-36)
+#define SL_FS_ERR_FAILED_WRITE_NVMEM_HEADER                   (-35)
+#define SL_FS_ERR_NO_AVAILABLE_NV_INDEX                       (-34)
+#define SL_FS_ERR_FAILED_TO_ALLOCATE_MEM                      (-33)
+#define SL_FS_ERR_FAILED_TO_READ_INTEGRITY_HEADER_2           (-32)
+#define SL_FS_ERR_FAILED_TO_READ_INTEGRITY_HEADER_1           (-31)
+#define SL_FS_ERR_NO_AVAILABLE_BLOCKS                         (-30)
+#define SL_FS_ERR_FILE_MAX_SIZE_BIGGER_THAN_EXISTING_FILE     (-29)
+#define SL_FS_ERR_FILE_EXISTS_ON_DIFFERENT_DEVICE_ID          (-28)
+#define SL_FS_ERR_INVALID_ACCESS_TYPE                         (-27)
+#define SL_FS_ERR_FILE_ALREADY_EXISTS                         (-26)
+#define SL_FS_ERR_PROGRAM                                     (-25)
+#define SL_FS_ERR_NO_ENTRIES_AVAILABLE                        (-24)
+#define SL_FS_ERR_FILE_ACCESS_IS_DIFFERENT                    (-23)
+#define SL_FS_ERR_BAD_FILE_MODE                               (-22)
+#define SL_FS_ERR_FAILED_READ_NVFILE                          (-21)
+#define SL_FS_ERR_FAILED_INIT_STORAGE                         (-20)
+#define SL_FS_ERR_CONTINUE_WRITE_MUST_BE_MOD_4                (-19)
+#define SL_FS_ERR_FAILED_LOAD_FILE                            (-18)
+#define SL_FS_ERR_INVALID_HANDLE                              (-17)
+#define SL_FS_ERR_FAILED_TO_WRITE                             (-16)
+#define SL_FS_ERR_OFFSET_OUT_OF_RANGE                         (-15)
+#define SL_FS_ERR_ALLOC                                       (-14)
+#define SL_FS_ERR_READ_DATA_LENGTH                            (-13)
+#define SL_FS_ERR_INVALID_FILE_ID                             (-12)
+#define SL_FS_ERR_FILE_NOT_EXISTS                             (-11)
+#define SL_FS_ERR_EMPTY_ERROR                                 (-10)
+#define SL_FS_ERR_INVALID_ARGS                                (-9)
+#define SL_FS_ERR_FAILED_TO_CREATE_FILE                       (-8)
+#define SL_FS_ERR_FS_ALREADY_LOADED                           (-7)
+#define SL_FS_ERR_UNKNOWN                                     (-6)
+#define SL_FS_ERR_FAILED_TO_CREATE_LOCK_OBJ                   (-5)
+#define SL_FS_ERR_DEVICE_NOT_LOADED                           (-4)
+#define SL_FS_ERR_INVALID_MAGIC_NUM                           (-3)
+#define SL_FS_ERR_FAILED_TO_READ                              (-2)
+#define SL_FS_ERR_NOT_SUPPORTED                               (-1)
+/* end of error codes */
+
+#define _FS_MODE_ACCESS_RESERVED_OFFSET                       (24)
+#define _FS_MODE_ACCESS_RESERVED_MASK                         (0xFF)
+#define _FS_MODE_ACCESS_FLAGS_OFFSET                          (16)
+#define _FS_MODE_ACCESS_FLAGS_MASK                            (0xFF)
+#define _FS_MODE_ACCESS_OFFSET                                (12)
+#define _FS_MODE_ACCESS_MASK                                  (0xF)
+#define _FS_MODE_OPEN_SIZE_GRAN_OFFSET                        (8)
+#define _FS_MODE_OPEN_SIZE_GRAN_MASK                          (0xF)
+#define _FS_MODE_OPEN_SIZE_OFFSET                             (0)
+#define _FS_MODE_OPEN_SIZE_MASK                               (0xFF)
+#define MAX_MODE_SIZE                                         (0xFF)
+#define _FS_MODE(Access, SizeGran, Size,Flags)        (uint32_t)(((uint32_t)((Access) & _FS_MODE_ACCESS_MASK)<<_FS_MODE_ACCESS_OFFSET) |  \
+                                                            ((uint32_t)((SizeGran) & _FS_MODE_OPEN_SIZE_GRAN_MASK)<<_FS_MODE_OPEN_SIZE_GRAN_OFFSET) | \
+                                                            ((uint32_t)((Size) & _FS_MODE_OPEN_SIZE_MASK)<<_FS_MODE_OPEN_SIZE_OFFSET) | \
+                                                            ((uint32_t)((Flags) & _FS_MODE_ACCESS_FLAGS_MASK)<<_FS_MODE_ACCESS_FLAGS_OFFSET))
+
+
+/*  sl_FsOpen options */
+/*  Open for Read */
+#define FS_MODE_OPEN_READ                                     _FS_MODE(_FS_MODE_OPEN_READ,0,0,0)
+/*  Open for Write (in case file exist) */
+#define FS_MODE_OPEN_WRITE                                    _FS_MODE(_FS_MODE_OPEN_WRITE,0,0,0)
+/* Open for Creating a new file */
+#define FS_MODE_OPEN_CREATE(maxSizeInBytes,accessModeFlags)   _sl_GetCreateFsMode(maxSizeInBytes,accessModeFlags)
+
+namespace mbed_cc3100 {
+
+/*****************************************************************************/
+/* Structure/Enum declarations                                               */
+/*****************************************************************************/
+typedef struct {
+    uint16_t flags;
+    uint32_t  FileLen;
+    uint32_t  AllocatedLen;
+    uint32_t  Token[4];
+} SlFsFileInfo_t;
+
+typedef enum {
+    _FS_MODE_OPEN_READ            = 0,
+    _FS_MODE_OPEN_WRITE,
+    _FS_MODE_OPEN_CREATE,
+    _FS_MODE_OPEN_WRITE_CREATE_IF_NOT_EXIST
+} SlFsFileOpenAccessType_e;
+
+typedef enum {
+    _FS_FILE_OPEN_FLAG_COMMIT  =  0x1,           /* MIRROR - for fail safe */
+    _FS_FILE_OPEN_FLAG_SECURE  =  0x2,           /* SECURE */
+    _FS_FILE_OPEN_FLAG_NO_SIGNATURE_TEST = 0x4,  /* Relevant to secure file only  */
+    _FS_FILE_OPEN_FLAG_STATIC  =           0x8,  /*  Relevant to secure file only */
+    _FS_FILE_OPEN_FLAG_VENDOR  =           0x10, /*  Relevant to secure file only */
+    _FS_FILE_PUBLIC_WRITE=                 0x20, /* Relevant to secure file only, the file can be opened for write without Token */
+    _FS_FILE_PUBLIC_READ =                 0x40  /* Relevant to secure file only, the file can be opened for read without Token  */
+} SlFileOpenFlags_e;
+
+typedef enum {
+    _FS_MODE_SIZE_GRAN_256B    = 0,   /*  MAX_SIZE = 64K  */
+    _FS_MODE_SIZE_GRAN_1KB,           /*  MAX_SIZE = 256K */
+    _FS_MODE_SIZE_GRAN_4KB,           /*  MAX_SZIE = 1M   */
+    _FS_MODE_SIZE_GRAN_16KB,          /*  MAX_SIZE = 4M   */
+    _FS_MODE_SIZE_GRAN_64KB,          /*  MAX_SIZE = 16M  */
+    _FS_MAX_MODE_SIZE_GRAN
+} _SlFsFileOpenMaxSizeGran_e;
+
+class cc3100_driver;
+
+class cc3100_fs
+{
+
+public:
+
+    cc3100_fs(cc3100_driver &driver);
+
+    ~cc3100_fs();
+
+    /*****************************************************************************/
+    /* Internal Function prototypes                                              */
+    /*****************************************************************************/
+    uint32_t _sl_GetCreateFsMode(uint32_t maxSizeInBytes,uint32_t accessFlags);
+    uint16_t _sl_Strlen(const uint8_t *buffer);
+
+    /*****************************************************************************/
+    /* Function prototypes                                                       */
+    /*****************************************************************************/
+
+    /*!
+        \brief open file for read or write from/to storage device
+
+        \param[in]      pFileName                  File Name buffer pointer
+        \param[in]      AccessModeAndMaxSize       Options: As described below
+        \param[in]      pToken                     Reserved for future use. Use NULL for this field
+        \param[out]     pFileHandle      Pointing on the file and used for read and write commands to the file
+
+         AccessModeAndMaxSize possible input                                                                        \n
+         FS_MODE_OPEN_READ                                        - Read a file                                                                  \n
+         FS_MODE_OPEN_WRITE                                       - Open for write for an existing file                                          \n
+         FS_MODE_OPEN_CREATE(maxSizeInBytes,accessModeFlags)      - Open for creating a new file. Max file size is defined in bytes.             \n
+                                                                    For optimal FS size, use max size in 4K-512 bytes steps (e.g. 3584,7680,117760)  \n
+                                                                    Several access modes bits can be combined together from SlFileOpenFlags_e enum
+
+        \return         On success, zero is returned. On error, an error code is returned
+
+        \sa             sl_FsRead sl_FsWrite sl_FsClose
+        \note           belongs to \ref basic_api
+        \warning
+        \par            Example:
+        \code
+           char*           DeviceFileName = "MyFile.txt";
+           unsigned long   MaxSize = 63 * 1024; //62.5K is max file size
+           long            DeviceFileHandle = -1;
+           long            RetVal;        //negative retval is an error
+           unsigned long   Offset = 0;
+           uint8_t   InputBuffer[100];
+
+           // Create a file and write data. The file in this example is secured, without signature and with a fail safe commit
+           RetVal = sl_FsOpen((uint8_t *)DeviceFileName,
+                                            FS_MODE_OPEN_CREATE(MaxSize , _FS_FILE_OPEN_FLAG_NO_SIGNATURE_TEST | _FS_FILE_OPEN_FLAG_COMMIT ),
+                                            NULL, &DeviceFileHandle);
+
+           Offset = 0;
+           //Preferred in secure file that the Offset and the length will be aligned to 16 bytes.
+           RetVal = sl_FsWrite( DeviceFileHandle, Offset, (uint8_t *)"HelloWorld", strlen("HelloWorld"));
+
+           RetVal = sl_FsClose(DeviceFileHandle, NULL, NULL , 0);
+
+           // open the same file for read, using the Token we got from the creation procedure above
+           RetVal = sl_FsOpen((uint8_t *)DeviceFileName,
+                                            FS_MODE_OPEN_READ,
+                                            NULL, &DeviceFileHandle);
+
+           Offset = 0;
+           RetVal = sl_FsRead( DeviceFileHandle, Offset, (uint8_t *)InputBuffer, strlen("HelloWorld"));
+
+           RetVal = sl_FsClose(DeviceFileHandle, NULL, NULL , 0);
+
+         \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_FsOpen)
+    int32_t sl_FsOpen(uint8_t *pFileName,uint32_t AccessModeAndMaxSize,uint32_t *pToken,int32_t *pFileHandle);
+#endif
+
+    /*!
+        \brief close file in storage device
+
+        \param[in]      FileHdl                 Pointer to the file (assigned from sl_FsOpen)
+        \param[in]      pCeritificateFileName   Reserved for future use. Use NULL.
+        \param[in]      pSignature              Reserved for future use. Use NULL.
+        \param[in]      SignatureLen            Reserved for future use. Use 0.
+
+
+        \return         On success, zero is returned.  On error, an error code is returned
+
+        \sa             sl_FsRead sl_FsWrite sl_FsOpen
+        \note           Call the fs_Close  with signature = 'A' signature len = 1 for activating an abort action
+        \warning
+        \par            Example:
+        \code
+        sl_FsClose(FileHandle,0,0,0);
+        \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_FsClose)
+    int16_t sl_FsClose(int32_t FileHdl,uint8_t* pCeritificateFileName,uint8_t* pSignature,uint32_t SignatureLen);
+#endif
+
+    /*!
+        \brief Read block of data from a file in storage device
+
+        \param[in]      FileHdl Pointer to the file (assigned from sl_FsOpen)
+        \param[in]      Offset  Offset to specific read block
+        \param[out]     pData   Pointer for the received data
+        \param[in]      Len     Length of the received data
+
+        \return         On success, returns the number of read bytes. On error, negative number is returned
+
+        \sa             sl_FsClose sl_FsWrite sl_FsOpen
+        \note           belongs to \ref basic_api
+        \warning
+        \par            Example:
+        \code
+        Status = sl_FsRead(FileHandle, 0, &readBuff[0], readSize);
+        \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_FsRead)
+    int32_t sl_FsRead(int32_t FileHdl,uint32_t Offset ,uint8_t*  pData,uint32_t Len);
+#endif
+
+    /*!
+        \brief write block of data to a file in storage device
+
+        \param[in]      FileHdl  Pointer to the file (assigned from sl_FsOpen)
+        \param[in]      Offset   Offset to specific block to be written
+        \param[in]      pData    Pointer the transmitted data to the storage device
+        \param[in]      Len      Length of the transmitted data
+
+        \return         On success, returns the number of written bytes.  On error, an error code is returned
+
+        \sa
+        \note           belongs to \ref basic_api
+        \warning
+        \par            Example:
+        \code
+        Status = sl_FsWrite(FileHandle, 0, &buff[0], readSize);
+        \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_FsWrite)
+    int32_t sl_FsWrite(int32_t FileHdl,uint32_t Offset,uint8_t*  pData,uint32_t Len);
+#endif
+
+    /*!
+        \brief get info on a file
+
+        \param[in]      pFileName    File name
+        \param[in]      Token        Reserved for future use. Use 0
+        \param[out]     pFsFileInfo Returns the File's Information: flags,file size, allocated size and Tokens
+
+        \return         On success, zero is returned.   On error, an error code is returned
+
+        \sa             sl_FsOpen
+        \note           belongs to \ref basic_api
+        \warning
+        \par            Example:
+        \code
+        Status = sl_FsGetInfo("FileName.html",0,&FsFileInfo);
+        \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_FsGetInfo)
+    int16_t sl_FsGetInfo(uint8_t *pFileName,uint32_t Token,SlFsFileInfo_t* pFsFileInfo);
+#endif
+
+    /*!
+        \brief Delete specific file from a storage or all files from a storage (format)
+
+        \param[in]      pFileName    File Name
+        \param[in]      Token        Reserved for future use. Use 0
+        \return         On success, zero is returned.  On error, an error code is returned
+
+        \sa
+        \note           belongs to \ref basic_api
+        \warning
+        \par            Example:
+        \code
+        Status = sl_FsDel("FileName.html",0);
+        \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_FsDel)
+    int16_t sl_FsDel(uint8_t *pFileName,uint32_t Token);
+#endif
+
+private:
+
+    cc3100_driver &_driver;
+
+};//class
+
+}//namespace mbed_cc3100
+
+/*!
+
+ Close the Doxygen group.
+ @}
+
+ */
+
+#endif /*  __FS_H__ */
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_netapp.cpp	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,955 @@
+/*
+ * netapp.c - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+
+
+/*****************************************************************************/
+/* Include files                                                             */
+/*****************************************************************************/
+#include "cc3100_simplelink.h"
+#include "cc3100_protocol.h"
+#include "cc3100_driver.h"
+
+#include "cc3100_netapp.h"
+#include "fPtr_func.h"
+
+/*****************************************************************************/
+/* Macro declarations                                                        */
+/*****************************************************************************/
+#define NETAPP_MDNS_OPTIONS_ADD_SERVICE_BIT					 ((uint32_t)0x1 << 31)
+
+#ifdef SL_TINY
+#define NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH         63
+#else
+#define NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH         255
+#endif
+
+namespace mbed_cc3100 {
+	
+cc3100_netapp::cc3100_netapp(cc3100_driver &driver, cc3100_nonos &nonos)
+    : _driver(driver), _nonos(nonos)
+{
+
+}
+
+cc3100_netapp::~cc3100_netapp()
+{
+
+}
+
+
+/*****************************************************************************/
+/* API functions                                                             */
+/*****************************************************************************/
+
+/*****************************************************************************
+ sl_NetAppStart
+*****************************************************************************/
+typedef union {
+    _NetAppStartStopCommand_t       Cmd;
+    _NetAppStartStopResponse_t   Rsp;
+} _SlNetAppStartStopMsg_u;
+
+const _SlCmdCtrl_t _SlNetAppStartCtrl = {
+    SL_OPCODE_NETAPP_START_COMMAND,
+    sizeof(_NetAppStartStopCommand_t),
+    sizeof(_NetAppStartStopResponse_t)
+};
+
+const _SlCmdCtrl_t _SlNetAppStopCtrl = {
+    SL_OPCODE_NETAPP_STOP_COMMAND,
+    sizeof(_NetAppStartStopCommand_t),
+    sizeof(_NetAppStartStopResponse_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_NetAppStart)
+int16_t cc3100_netapp::sl_NetAppStart(uint32_t AppBitMap)
+{
+    _SlNetAppStartStopMsg_u Msg;
+    Msg.Cmd.appId = AppBitMap;
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlNetAppStartCtrl, &Msg, NULL));
+
+    return Msg.Rsp.status;
+}
+#endif
+
+/*****************************************************************************
+ sl_NetAppStop
+*****************************************************************************/
+#if _SL_INCLUDE_FUNC(sl_NetAppStop)
+int16_t cc3100_netapp::sl_NetAppStop(uint32_t AppBitMap)
+{
+    _SlNetAppStartStopMsg_u Msg;
+    Msg.Cmd.appId = AppBitMap;
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlNetAppStopCtrl, &Msg, NULL));
+
+    return Msg.Rsp.status;
+}
+#endif
+
+
+/******************************************************************************/
+/* sl_NetAppGetServiceList */
+/******************************************************************************/
+typedef struct {
+    uint8_t  IndexOffest;
+    uint8_t  MaxServiceCount;
+    uint8_t  Flags;
+    int8_t  Padding;
+} NetappGetServiceListCMD_t;
+
+typedef union {
+    NetappGetServiceListCMD_t      Cmd;
+    _BasicResponse_t                Rsp;
+} _SlNetappGetServiceListMsg_u;
+
+const _SlCmdCtrl_t _SlGetServiceListeCtrl = {
+    SL_OPCODE_NETAPP_NETAPP_MDNS_LOOKUP_SERVICE,
+    sizeof(NetappGetServiceListCMD_t),
+    sizeof(_BasicResponse_t)
+};
+
+
+#if _SL_INCLUDE_FUNC(sl_NetAppGetServiceList)
+int16_t cc3100_netapp::sl_NetAppGetServiceList(uint8_t  IndexOffest,
+        uint8_t  MaxServiceCount,
+        uint8_t  Flags,
+        int8_t  *pBuffer,
+        uint32_t  RxBufferLength
+                                              )
+{
+    int32_t 					 retVal= 0;
+    _SlNetappGetServiceListMsg_u Msg;
+    _SlCmdExt_t                  CmdExt;
+    uint16_t               ServiceSize = 0;
+    uint16_t               BufferSize = 0;
+
+    /*
+    Calculate RX pBuffer size
+    WARNING:
+    if this size is BufferSize than 1480 error should be returned because there
+    is no place in the RX packet.
+    */
+    switch(Flags) {
+        case SL_NET_APP_FULL_SERVICE_WITH_TEXT_IPV4_TYPE:
+            ServiceSize =  sizeof(SlNetAppGetFullServiceWithTextIpv4List_t);
+            break;
+
+        case SL_NET_APP_FULL_SERVICE_IPV4_TYPE:
+            ServiceSize =  sizeof(SlNetAppGetFullServiceIpv4List_t);
+            break;
+
+        case SL_NET_APP_SHORT_SERVICE_IPV4_TYPE:
+            ServiceSize =  sizeof(SlNetAppGetShortServiceIpv4List_t);
+            break;
+
+        default:
+            ServiceSize =  sizeof(_BasicResponse_t);
+            break;
+    }
+
+
+
+    BufferSize =  MaxServiceCount * ServiceSize;
+
+    /*Check the size of the requested services is smaller than size of the user buffer.
+      If not an error is returned in order to avoid overwriting memory. */
+    if(RxBufferLength <= BufferSize) {
+        return SL_ERROR_NETAPP_RX_BUFFER_LENGTH_ERROR;
+    }
+
+    CmdExt.TxPayloadLen = 0;
+    CmdExt.RxPayloadLen = BufferSize;
+    CmdExt.pTxPayload = NULL;
+    CmdExt.pRxPayload = (uint8_t *)pBuffer;
+
+    Msg.Cmd.IndexOffest		= IndexOffest;
+    Msg.Cmd.MaxServiceCount = MaxServiceCount;
+    Msg.Cmd.Flags			= Flags;
+    Msg.Cmd.Padding			= 0;
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlGetServiceListeCtrl, &Msg, &CmdExt));
+    retVal = Msg.Rsp.status;
+
+    return (int16_t)retVal;
+}
+
+#endif
+
+/*****************************************************************************/
+/* sl_mDNSRegisterService */
+/*****************************************************************************/
+/*
+ * The below struct depicts the constant parameters of the command/API RegisterService.
+ *
+   1. ServiceLen                      - The length of the service should be smaller than NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH.
+   2. TextLen                         - The length of the text should be smaller than NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH.
+   3. port                            - The port on this target host.
+   4. TTL                             - The TTL of the service
+   5. Options                         - bitwise parameters:
+                                        bit 0  - is unique (means if the service needs to be unique)
+										bit 31  - for internal use if the service should be added or deleted (set means ADD).
+                                        bit 1-30 for future.
+
+   NOTE:
+
+   1. There are another variable parameter is this API which is the service name and the text.
+   2. According to now there is no warning and Async event to user on if the service is a unique.
+*
+ */
+
+
+typedef struct {
+    uint8_t   ServiceNameLen;
+    uint8_t   TextLen;
+    uint16_t  Port;
+    uint32_t   TTL;
+    uint32_t   Options;
+} NetappMdnsSetService_t;
+
+typedef union {
+    NetappMdnsSetService_t         Cmd;
+    _BasicResponse_t                Rsp;
+} _SlNetappMdnsRegisterServiceMsg_u;
+
+const _SlCmdCtrl_t _SlRegisterServiceCtrl = {
+    SL_OPCODE_NETAPP_MDNSREGISTERSERVICE,
+    sizeof(NetappMdnsSetService_t),
+    sizeof(_BasicResponse_t)
+};
+
+
+/******************************************************************************
+
+    sl_NetAppMDNSRegisterService
+
+    CALLER          user from its host
+
+
+    DESCRIPTION:
+                    Add/delete  service
+					The function manipulates the command that register the service and call
+					to the NWP in order to add/delete the service to/from the mDNS package and to/from the DB.
+
+					This register service is a service offered by the application.
+					This unregister service is a service offered by the application before.
+
+					The service name should be full service name according to RFC
+                    of the DNS-SD - means the value in name field in SRV answer.
+
+					Example for service name:
+                    1. PC1._ipp._tcp.local
+                    2. PC2_server._ftp._tcp.local
+
+                    If the option is_unique is set, mDNS probes the service name to make sure
+                    it is unique before starting to announce the service on the network.
+                    Instance is the instance portion of the service name.
+
+
+
+
+    PARAMETERS:
+
+                    The command is from constant parameters and variables parameters.
+
+					Constant parameters are:
+
+                    ServiceLen                          - The length of the service.
+                    TextLen                             - The length of the service should be smaller than 64.
+                    port                                - The port on this target host.
+                    TTL                                 - The TTL of the service
+                    Options                             - bitwise parameters:
+                                                            bit 0  - is unique (means if the service needs to be unique)
+                                                            bit 31  - for internal use if the service should be added or deleted (set means ADD).
+                                                            bit 1-30 for future.
+
+                   The variables parameters are:
+
+                    Service name(full service name)     - The service name.
+                                                          Example for service name:
+                                                          1. PC1._ipp._tcp.local
+                                                          2. PC2_server._ftp._tcp.local
+
+                    Text                                - The description of the service.
+                                                          should be as mentioned in the RFC
+                                                          (according to type of the service IPP,FTP...)
+
+					NOTE - pay attention
+
+						1. Temporary -  there is an allocation on stack of internal buffer.
+						Its size is NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH.
+						It means that the sum of the text length and service name length cannot be bigger than
+						NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH.
+						If it is - An error is returned.
+
+					    2. According to now from certain constraints the variables parameters are set in the
+					    attribute part (contain constant parameters)
+
+
+
+	  RETURNS:        Status - the immediate response of the command status.
+							   0 means success.
+
+
+
+******************************************************************************/
+#if _SL_INCLUDE_FUNC(sl_NetAppMDNSRegisterUnregisterService)
+int16_t cc3100_netapp::sl_NetAppMDNSRegisterUnregisterService(const char* pServiceName, uint8_t ServiceNameLen, const char* pText, uint8_t TextLen, uint16_t Port, uint32_t TTL, uint32_t Options)
+{
+
+    _SlNetappMdnsRegisterServiceMsg_u Msg;
+    _SlCmdExt_t	CmdExt ;
+    unsigned char ServiceNameAndTextBuffer[NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH];
+    unsigned char *TextPtr;
+
+    /*
+
+    NOTE - pay attention
+
+    	1. Temporary -  there is an allocation on stack of internal buffer.
+    	Its size is NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH.
+    	It means that the sum of the text length and service name length cannot be bigger than
+    	NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH.
+    	If it is - An error is returned.
+
+    	2. According to now from certain constraints the variables parameters are set in the
+    	attribute part (contain constant parameters)
+
+
+    */
+
+    /*build the attribute part of the command.
+      It contains the constant parameters of the command*/
+
+    Msg.Cmd.ServiceNameLen	= ServiceNameLen;
+    Msg.Cmd.Options			= Options;
+    Msg.Cmd.Port			= Port;
+    Msg.Cmd.TextLen			= TextLen;
+    Msg.Cmd.TTL				= TTL;
+
+    /*Build the payload part of the command
+     Copy the service name and text to one buffer.
+     NOTE - pay attention
+     			The size of the service length + the text length should be smaller than 255,
+     			Until the simplelink drive supports to variable length through SPI command. */
+    if(TextLen + ServiceNameLen > (NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH - 1 )) { /*-1 is for giving a place to set null termination at the end of the text*/
+        return -1;
+    }
+
+    memset(ServiceNameAndTextBuffer,0,NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH);
+
+
+    /*Copy the service name*/
+    memcpy(ServiceNameAndTextBuffer,
+              pServiceName,
+              ServiceNameLen);
+
+    if(TextLen > 0 ) {
+
+        TextPtr = &ServiceNameAndTextBuffer[ServiceNameLen];
+        /*Copy the text just after the service name*/
+        memcpy(TextPtr,
+                  pText,
+                  TextLen);
+
+
+    }
+
+    CmdExt.TxPayloadLen = (TextLen + ServiceNameLen);
+    CmdExt.RxPayloadLen = 0;
+    CmdExt.pTxPayload   = (uint8_t *)ServiceNameAndTextBuffer;
+    CmdExt.pRxPayload   = NULL;
+
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlRegisterServiceCtrl, &Msg, &CmdExt));
+
+    return (int16_t)Msg.Rsp.status;
+
+
+}
+#endif
+
+/**********************************************************************************************/
+#if _SL_INCLUDE_FUNC(sl_NetAppMDNSRegisterService)
+int16_t cc3100_netapp::sl_NetAppMDNSRegisterService(const char* pServiceName, uint8_t ServiceNameLen, const char* pText, uint8_t TextLen, uint16_t Port, uint32_t TTL, uint32_t Options)
+{
+
+    /*
+
+    NOTE - pay attention
+
+    1. Temporary -  there is an allocation on stack of internal buffer.
+    Its size is NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH.
+    It means that the sum of the text length and service name length cannot be bigger than
+    NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH.
+    If it is - An error is returned.
+
+    2. According to now from certain constraints the variables parameters are set in the
+    attribute part (contain constant parameters)
+
+    */
+
+    /*Set the add service bit in the options parameter.
+      In order not use different opcodes for the register service and unregister service
+      bit 31 in option is taken for this purpose. if it is set it means in NWP that the service should be added
+      if it is cleared it means that the service should be deleted and there is only meaning to pServiceName
+      and ServiceNameLen values. */
+    Options |=  NETAPP_MDNS_OPTIONS_ADD_SERVICE_BIT;
+
+    return  (sl_NetAppMDNSRegisterUnregisterService(	pServiceName, ServiceNameLen, pText, TextLen, Port, TTL, Options));
+
+
+}
+#endif
+/**********************************************************************************************/
+
+
+
+/**********************************************************************************************/
+#if _SL_INCLUDE_FUNC(sl_NetAppMDNSUnRegisterService)
+int16_t cc3100_netapp::sl_NetAppMDNSUnRegisterService(const char* pServiceName, uint8_t   ServiceNameLen)
+{
+    uint32_t    Options = 0;
+
+    /*
+
+    NOTE - pay attention
+
+    		The size of the service length  should be smaller than 255,
+    		Until the simplelink drive supports to variable length through SPI command.
+
+
+    */
+
+    /*Clear the add service bit in the options parameter.
+      In order not use different opcodes for the register service and unregister service
+      bit 31 in option is taken for this purpose. if it is set it means in NWP that the service should be added
+      if it is cleared it means that the service should be deleted and there is only meaning to pServiceName
+      and ServiceNameLen values.*/
+
+    Options &=  (~NETAPP_MDNS_OPTIONS_ADD_SERVICE_BIT);
+
+    return  (sl_NetAppMDNSRegisterUnregisterService(pServiceName, ServiceNameLen, NULL, 0, 0, 0, Options));
+
+
+}
+#endif
+/**********************************************************************************************/
+
+
+
+/*****************************************************************************/
+/* sl_DnsGetHostByService */
+/*****************************************************************************/
+/*
+ * The below struct depicts the constant parameters of the command/API sl_DnsGetHostByService.
+ *
+   1. ServiceLen                      - The length of the service should be smaller than 255.
+   2. AddrLen                         - TIPv4 or IPv6 (SL_AF_INET , SL_AF_INET6).
+*
+ */
+
+typedef struct {
+    uint8_t   ServiceLen;
+    uint8_t   AddrLen;
+    uint16_t  Padding;
+} _GetHostByServiceCommand_t;
+
+
+
+/*
+ * The below structure depict the constant parameters that are returned in the Async event answer
+ * according to command/API sl_DnsGetHostByService for IPv4 and IPv6.
+ *
+	1Status						- The status of the response.
+	2.Address						- Contains the IP address of the service.
+	3.Port							- Contains the port of the service.
+	4.TextLen						- Contains the max length of the text that the user wants to get.
+												it means that if the test of service is bigger that its value than
+												the text is cut to inout_TextLen value.
+										Output: Contain the length of the text that is returned. Can be full text or part
+												of the text (see above).
+
+*
+ 
+typedef struct {
+    uint16_t   Status;
+    uint16_t   TextLen;
+    uint32_t    Port;
+    uint32_t    Address;
+} _GetHostByServiceIPv4AsyncResponse_t;
+*/
+
+typedef struct {
+    uint16_t   Status;
+    uint16_t   TextLen;
+    uint32_t    Port;
+    uint32_t    Address[4];
+} _GetHostByServiceIPv6AsyncResponse_t;
+
+
+typedef union {
+    _GetHostByServiceIPv4AsyncResponse_t IpV4;
+    _GetHostByServiceIPv6AsyncResponse_t IpV6;
+} _GetHostByServiceAsyncResponseAttribute_u;
+
+typedef union {
+    _GetHostByServiceCommand_t      Cmd;
+    _BasicResponse_t                Rsp;
+} _SlGetHostByServiceMsg_u;
+
+const _SlCmdCtrl_t _SlGetHostByServiceCtrl = {
+    SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICE,
+    sizeof(_GetHostByServiceCommand_t),
+    sizeof(_BasicResponse_t)
+};
+
+
+
+/******************************************************************************/
+
+#if _SL_INCLUDE_FUNC(sl_NetAppDnsGetHostByService)
+int32_t cc3100_netapp::sl_NetAppDnsGetHostByService(unsigned char *pServiceName,	/* string containing all (or only part): name + subtype + service */
+        uint8_t ServiceLen,
+        uint8_t Family,			/* 4-IPv4 , 16-IPv6 */
+        uint32_t pAddr[],
+        uint32_t *pPort,
+        uint16_t *pTextLen, /* in: max len , out: actual len */
+        unsigned char *pText)
+{
+
+    _SlGetHostByServiceMsg_u         Msg;
+    _SlCmdExt_t                      CmdExt ;
+    _GetHostByServiceAsyncResponse_t AsyncRsp;
+    uint8_t ObjIdx = MAX_CONCURRENT_ACTIONS;
+
+    /*
+    	Note:
+    	1. The return's attributes are belonged to first service that is found.
+    	It can be other services with the same service name will response to
+    	the query. The results of these responses are saved in the peer cache of the NWP, and
+    	should be read by another API.
+
+    	2. Text length can be 120 bytes only - not more
+    	It is because of constraints in the NWP on the buffer that is allocated for the Async event.
+
+    	3.The API waits to Async event by blocking. It means that the API is finished only after an Async event
+    	is sent by the NWP.
+
+    	4.No rolling option!!! - only PTR type is sent.
+
+
+    */
+    /*build the attribute part of the command.
+      It contains the constant parameters of the command */
+
+    Msg.Cmd.ServiceLen = ServiceLen;
+    Msg.Cmd.AddrLen    = Family;
+
+    /*Build the payload part of the command
+      Copy the service name and text to one buffer.*/
+    CmdExt.TxPayloadLen = ServiceLen;
+    CmdExt.RxPayloadLen = 0;
+    CmdExt.pTxPayload   = (uint8_t *)pServiceName;
+    CmdExt.pRxPayload   = NULL;
+
+    /*set pointers to the output parameters (the returned parameters).
+      This pointers are belonged to local struct that is set to global Async response parameter.
+      It is done in order not to run more than one sl_DnsGetHostByService at the same time.
+      The API should be run only if global parameter is pointed to NULL. */
+    AsyncRsp.out_pText     = pText;
+    AsyncRsp.inout_TextLen = (uint16_t* )pTextLen;
+    AsyncRsp.out_pPort     = pPort;
+    AsyncRsp.out_pAddr     = (uint32_t *)pAddr;
+
+
+    /*Use Obj to issue the command, if not available try later */
+    ObjIdx = (uint8_t)_driver._SlDrvWaitForPoolObj(GETHOSYBYSERVICE_ID,SL_MAX_SOCKETS);
+
+    if (MAX_CONCURRENT_ACTIONS == ObjIdx) {
+        return SL_POOL_IS_EMPTY;
+    }
+
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+
+    g_pCB->ObjPool[ObjIdx].pRespArgs =  (uint8_t *)&AsyncRsp;
+
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+    /* set bit to indicate IPv6 address is expected */
+    if (SL_AF_INET6 == Family) {
+        g_pCB->ObjPool[ObjIdx].AdditionalData |= SL_NETAPP_FAMILY_MASK;
+    }
+    /* Send the command */
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlGetHostByServiceCtrl, &Msg, &CmdExt));
+
+
+
+    /* If the immediate reponse is O.K. than  wait for aSYNC event response. */
+    if(SL_RET_CODE_OK == Msg.Rsp.status) {
+        OSI_RET_OK_CHECK(_nonos.sl_SyncObjWait(&g_pCB->ObjPool[ObjIdx].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE, NON_OS_SYNC_OBJ_CLEAR_VALUE, SL_OS_WAIT_FOREVER));
+
+        /* If we are - it means that Async event was sent.
+           The results are copied in the Async handle return functions */
+
+        Msg.Rsp.status = AsyncRsp.Status;
+    }
+
+    _driver._SlDrvReleasePoolObj(ObjIdx);
+    return Msg.Rsp.status;
+}
+#endif
+
+/*****************************************************************************/
+/*  _sl_HandleAsync_DnsGetHostByAddr */
+/*****************************************************************************/
+void cc3100_netapp::_sl_HandleAsync_DnsGetHostByAddr(void *pVoidBuf)
+{
+    SL_TRACE0(DBG_MSG, MSG_303, "STUB: _sl_HandleAsync_DnsGetHostByAddr not implemented yet!");
+    return;
+}
+
+/*****************************************************************************/
+/* sl_DnsGetHostByName */
+/*****************************************************************************/
+typedef union {
+    _GetHostByNameIPv4AsyncResponse_t IpV4;
+    _GetHostByNameIPv6AsyncResponse_t IpV6;
+} _GetHostByNameAsyncResponse_u;
+
+typedef union {
+    _GetHostByNameCommand_t         Cmd;
+    _BasicResponse_t                Rsp;
+} _SlGetHostByNameMsg_u;
+
+const _SlCmdCtrl_t _SlGetHostByNameCtrl = {
+    SL_OPCODE_NETAPP_DNSGETHOSTBYNAME,
+    sizeof(_GetHostByNameCommand_t),
+    sizeof(_BasicResponse_t)
+};
+#if _SL_INCLUDE_FUNC(sl_NetAppDnsGetHostByName)
+int16_t cc3100_netapp::sl_NetAppDnsGetHostByName(unsigned char * hostname, uint16_t usNameLen, uint32_t*  out_ip_addr,uint8_t family)
+{
+    _SlGetHostByNameMsg_u           Msg;
+    _SlCmdExt_t                     ExtCtrl;
+    _GetHostByNameAsyncResponse_u   AsyncRsp;
+    uint8_t ObjIdx = MAX_CONCURRENT_ACTIONS;
+
+    ExtCtrl.TxPayloadLen = usNameLen;
+    ExtCtrl.RxPayloadLen = 0;
+    ExtCtrl.pTxPayload = (unsigned char *)hostname;
+    ExtCtrl.pRxPayload = 0;
+
+    Msg.Cmd.Len = usNameLen;
+    Msg.Cmd.family = family;
+
+    /*Use Obj to issue the command, if not available try later */
+    ObjIdx = (uint8_t)_driver._SlDrvWaitForPoolObj(GETHOSYBYNAME_ID,SL_MAX_SOCKETS);
+    if (MAX_CONCURRENT_ACTIONS == ObjIdx) {
+        printf("SL_POOL_IS_EMPTY \r\n");
+        return SL_POOL_IS_EMPTY;
+    }
+    
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+    
+    g_pCB->ObjPool[ObjIdx].pRespArgs =  (uint8_t *)&AsyncRsp;
+    /*set bit to indicate IPv6 address is expected */
+    if (SL_AF_INET6 == family) {
+        g_pCB->ObjPool[ObjIdx].AdditionalData |= SL_NETAPP_FAMILY_MASK;
+    }
+
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+    
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlGetHostByNameCtrl, &Msg, &ExtCtrl));
+
+    if(SL_RET_CODE_OK == Msg.Rsp.status) {
+        OSI_RET_OK_CHECK(_nonos.sl_SyncObjWait(&g_pCB->ObjPool[ObjIdx].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE, NON_OS_SYNC_OBJ_CLEAR_VALUE, SL_OS_WAIT_FOREVER));
+        Msg.Rsp.status = AsyncRsp.IpV4.status;
+
+        if(SL_OS_RET_CODE_OK == (int16_t)Msg.Rsp.status) {
+            memcpy((int8_t *)out_ip_addr, (signed char *)&AsyncRsp.IpV4.ip0, (SL_AF_INET == family) ? SL_IPV4_ADDRESS_SIZE : SL_IPV6_ADDRESS_SIZE);
+        }
+    }
+    _driver._SlDrvReleasePoolObj(ObjIdx);
+    return Msg.Rsp.status;
+}
+#endif
+
+void cc3100_netapp::CopyPingResultsToReport(_PingReportResponse_t *pResults,SlPingReport_t *pReport)
+{
+    pReport->PacketsSent     = pResults->numSendsPings;
+    pReport->PacketsReceived = pResults->numSuccsessPings;
+    pReport->MinRoundTime    = pResults->rttMin;
+    pReport->MaxRoundTime    = pResults->rttMax;
+    pReport->AvgRoundTime    = pResults->rttAvg;
+    pReport->TestTime        = pResults->testTime;
+}
+
+/*****************************************************************************/
+/* sl_PingStart */
+/*****************************************************************************/
+typedef union {
+    _PingStartCommand_t   Cmd;
+    _PingReportResponse_t  Rsp;
+} _SlPingStartMsg_u;
+
+
+typedef enum {
+    CMD_PING_TEST_RUNNING = 0,
+    CMD_PING_TEST_STOPPED
+} _SlPingStatus_e;
+
+P_SL_DEV_PING_CALLBACK  pPingCallBackFunc;
+
+#if _SL_INCLUDE_FUNC(sl_NetAppPingStart)
+int16_t cc3100_netapp::sl_NetAppPingStart(SlPingStartCommand_t* pPingParams,uint8_t family, SlPingReport_t *pReport, const P_SL_DEV_PING_CALLBACK pPingCallback)
+{
+
+    _SlCmdCtrl_t                CmdCtrl = {0, sizeof(_PingStartCommand_t), sizeof(_BasicResponse_t)};
+    _SlPingStartMsg_u           Msg;
+    _PingReportResponse_t       PingRsp;
+    uint8_t ObjIdx = MAX_CONCURRENT_ACTIONS;
+
+    if( 0 == pPingParams->Ip ) { // stop any ongoing ping
+        return _driver._SlDrvBasicCmd(SL_OPCODE_NETAPP_PINGSTOP);
+    }
+
+    if(SL_AF_INET == family) {
+        CmdCtrl.Opcode = SL_OPCODE_NETAPP_PINGSTART;
+        memcpy(&Msg.Cmd.ip0, &pPingParams->Ip, SL_IPV4_ADDRESS_SIZE);
+    } else {
+        CmdCtrl.Opcode = SL_OPCODE_NETAPP_PINGSTART_V6;
+        memcpy(&Msg.Cmd.ip0, &pPingParams->Ip, SL_IPV6_ADDRESS_SIZE);
+    }
+
+    Msg.Cmd.pingIntervalTime        = pPingParams->PingIntervalTime;
+    Msg.Cmd.PingSize                = pPingParams->PingSize;
+    Msg.Cmd.pingRequestTimeout      = pPingParams->PingRequestTimeout;
+    Msg.Cmd.totalNumberOfAttempts   = pPingParams->TotalNumberOfAttempts;
+    Msg.Cmd.flags                   = pPingParams->Flags;
+
+    if( pPingCallback ) {
+        pPingCallBackFunc = pPingCallback;
+    } else {
+        /*Use Obj to issue the command, if not available try later */
+        ObjIdx = (uint8_t)_driver._SlDrvWaitForPoolObj(PING_ID,SL_MAX_SOCKETS);
+        if (MAX_CONCURRENT_ACTIONS == ObjIdx) {
+            return SL_POOL_IS_EMPTY;
+        }
+        OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+        /* async response handler for non callback mode */
+        g_pCB->ObjPool[ObjIdx].pRespArgs = (uint8_t *)&PingRsp;
+        pPingCallBackFunc = NULL;
+        OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+    }
+
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp(&CmdCtrl, &Msg, NULL));
+    /*send the command*/
+    if(CMD_PING_TEST_RUNNING == (int16_t)Msg.Rsp.status || CMD_PING_TEST_STOPPED == (int16_t)Msg.Rsp.status ) {
+        /* block waiting for results if no callback function is used */
+        if( NULL == pPingCallback ) {
+            OSI_RET_OK_CHECK(_nonos.sl_SyncObjWait(&g_pCB->ObjPool[ObjIdx].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE, NON_OS_SYNC_OBJ_CLEAR_VALUE, SL_OS_WAIT_FOREVER));
+            if( SL_OS_RET_CODE_OK == (int16_t)PingRsp.status ) {
+                CopyPingResultsToReport(&PingRsp,pReport);
+            }
+            _driver._SlDrvReleasePoolObj(ObjIdx);
+        }
+    } else {
+        /* ping failure, no async response */
+        if( NULL == pPingCallback ) {
+            _driver._SlDrvReleasePoolObj(ObjIdx);
+        }
+    }
+
+    return Msg.Rsp.status;
+}
+#endif
+
+/*****************************************************************************/
+/* sl_NetAppSet */
+/*****************************************************************************/
+typedef union {
+    _NetAppSetGet_t    Cmd;
+    _BasicResponse_t   Rsp;
+} _SlNetAppMsgSet_u;
+
+const _SlCmdCtrl_t _SlNetAppSetCmdCtrl = {
+    SL_OPCODE_NETAPP_NETAPPSET,
+    sizeof(_NetAppSetGet_t),
+    sizeof(_BasicResponse_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_NetAppSet)
+int32_t cc3100_netapp::sl_NetAppSet(uint8_t AppId ,uint8_t Option,uint8_t OptionLen, uint8_t *pOptionValue)
+{
+
+    _SlNetAppMsgSet_u         Msg;
+    _SlCmdExt_t               CmdExt;
+
+    CmdExt.TxPayloadLen = (OptionLen+3) & (~3);
+    CmdExt.RxPayloadLen = 0;
+    CmdExt.pTxPayload = (uint8_t *)pOptionValue;
+    CmdExt.pRxPayload = NULL;
+
+
+    Msg.Cmd.AppId    = AppId;
+    Msg.Cmd.ConfigLen   = OptionLen;
+    Msg.Cmd.ConfigOpt   = Option;
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlNetAppSetCmdCtrl, &Msg, &CmdExt));
+
+    return (int16_t)Msg.Rsp.status;
+}
+#endif
+
+/*****************************************************************************/
+/* sl_NetAppSendTokenValue */
+/*****************************************************************************/
+typedef union {
+    sl_NetAppHttpServerSendToken_t    Cmd;
+    _BasicResponse_t   Rsp;
+} _SlNetAppMsgSendTokenValue_u;
+
+const _SlCmdCtrl_t _SlNetAppSendTokenValueCmdCtrl = {
+    SL_OPCODE_NETAPP_HTTPSENDTOKENVALUE,
+    sizeof(sl_NetAppHttpServerSendToken_t),
+    sizeof(_BasicResponse_t)
+};
+
+uint16_t cc3100_netapp::sl_NetAppSendTokenValue(slHttpServerData_t * Token_value)
+{
+
+    _SlNetAppMsgSendTokenValue_u    Msg;
+    _SlCmdExt_t						CmdExt;
+
+    CmdExt.TxPayloadLen = (Token_value->value_len+3) & (~3);
+    CmdExt.RxPayloadLen = 0;
+    CmdExt.pTxPayload = (uint8_t *) Token_value->token_value;
+    CmdExt.pRxPayload = NULL;
+
+    Msg.Cmd.token_value_len = Token_value->value_len;
+    Msg.Cmd.token_name_len = Token_value->name_len;
+    memcpy(&Msg.Cmd.token_name[0], Token_value->token_name, Token_value->name_len);
+
+
+    VERIFY_RET_OK(_driver._SlDrvCmdSend((_SlCmdCtrl_t *)&_SlNetAppSendTokenValueCmdCtrl, &Msg, &CmdExt));
+
+    return Msg.Rsp.status;
+}
+
+/*****************************************************************************/
+/* sl_NetAppGet */
+/*****************************************************************************/
+typedef union {
+    _NetAppSetGet_t	    Cmd;
+    _NetAppSetGet_t	    Rsp;
+} _SlNetAppMsgGet_u;
+
+const _SlCmdCtrl_t _SlNetAppGetCmdCtrl = {
+    SL_OPCODE_NETAPP_NETAPPGET,
+    sizeof(_NetAppSetGet_t),
+    sizeof(_NetAppSetGet_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_NetAppGet)
+int32_t cc3100_netapp::sl_NetAppGet(uint8_t AppId, uint8_t Option,uint8_t *pOptionLen, uint8_t *pOptionValue)
+{
+    _SlNetAppMsgGet_u         Msg;
+    _SlCmdExt_t               CmdExt;
+
+    if (*pOptionLen == 0) {
+        return SL_EZEROLEN;
+    }
+    CmdExt.TxPayloadLen = 0;
+    CmdExt.RxPayloadLen = *pOptionLen;
+    CmdExt.pTxPayload = NULL;
+    CmdExt.pRxPayload = (uint8_t *)pOptionValue;
+    CmdExt.ActualRxPayloadLen = 0;
+
+    Msg.Cmd.AppId    = AppId;
+    Msg.Cmd.ConfigOpt   = Option;
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlNetAppGetCmdCtrl, &Msg, &CmdExt));
+
+
+    if (CmdExt.RxPayloadLen < CmdExt.ActualRxPayloadLen) {
+        *pOptionLen = (uint8_t)CmdExt.RxPayloadLen;
+        return SL_ESMALLBUF;
+    } else {
+        *pOptionLen = (uint8_t)CmdExt.ActualRxPayloadLen;
+    }
+
+    return (int16_t)Msg.Rsp.Status;
+}
+#endif
+
+cc3100_flowcont::cc3100_flowcont(cc3100_driver &driver, cc3100_nonos &nonos)
+    : _driver(driver), _nonos(nonos)
+{
+
+}
+
+cc3100_flowcont::~cc3100_flowcont()
+{
+
+}
+
+/*****************************************************************************/
+/* _SlDrvFlowContInit */
+/*****************************************************************************/
+void cc3100_flowcont::_SlDrvFlowContInit(void)
+{
+    g_pCB->FlowContCB.TxPoolCnt = FLOW_CONT_MIN;
+
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjCreate(&g_pCB->FlowContCB.TxLockObj, "TxLockObj"));
+
+    OSI_RET_OK_CHECK(_nonos.sl_SyncObjCreate(&g_pCB->FlowContCB.TxSyncObj, "TxSyncObj"));
+}
+
+/*****************************************************************************/
+/* _SlDrvFlowContDeinit */
+/*****************************************************************************/
+void cc3100_flowcont::_SlDrvFlowContDeinit(void)
+{
+    g_pCB->FlowContCB.TxPoolCnt = 0;
+
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjDelete(&g_pCB->FlowContCB.TxLockObj, 0));
+
+    OSI_RET_OK_CHECK(_nonos.sl_SyncObjDelete(&g_pCB->FlowContCB.TxSyncObj, 0));
+}
+
+}//namespace mbed_cc3100
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_netapp.h	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,1078 @@
+/*
+ * netapp.h - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+#ifndef NETAPP_H_
+#define    NETAPP_H_
+
+/*****************************************************************************/
+/* Include files                                                             */
+/*****************************************************************************/
+
+#include "cc3100_simplelink.h"
+
+#include "cc3100_protocol.h"
+#include "cc3100_nonos.h"
+
+namespace mbed_cc3100 {
+
+/*!
+
+    \addtogroup netapp
+    @{
+
+*/
+
+/*****************************************************************************/
+/* Macro declarations                                                        */
+/*****************************************************************************/
+
+/*ERROR code*/
+const int16_t SL_ERROR_NETAPP_RX_BUFFER_LENGTH_ERROR      = (-230);
+
+/*  Http Server interface */
+const uint8_t MAX_INPUT_STRING                            =  (64); /*  because of WPA */
+
+const uint8_t MAX_AUTH_NAME_LEN                           =  (20);
+const uint8_t MAX_AUTH_PASSWORD_LEN                       =  (20);
+const uint8_t MAX_AUTH_REALM_LEN                          =  (20);
+
+const uint8_t MAX_DEVICE_URN_LEN                          =  (15+1);
+const uint8_t MAX_DOMAIN_NAME_LEN                         =  (24+1);
+
+const uint8_t MAX_ACTION_LEN                              =  (30);
+/* Important: in case the max len is changed, make sure the struct sl_NetAppHttpServerSendToken_t in protocol.h is padded correctly! */
+const uint8_t MAX_TOKEN_NAME_LEN                          =  (20);
+const uint8_t MAX_TOKEN_VALUE_LEN                         =  MAX_INPUT_STRING;
+
+const int16_t NETAPP_MAX_SERVICE_TEXT_SIZE                =  (256);
+const uint8_t NETAPP_MAX_SERVICE_NAME_SIZE                =  (60);
+const uint8_t NETAPP_MAX_SERVICE_HOST_NAME_SIZE           =  (64);
+
+
+/* Server Responses */
+const uint8_t SL_NETAPP_RESPONSE_NONE                     =  (0);
+const uint8_t SL_NETAPP_HTTPSETTOKENVALUE                 =  (1);
+
+const uint8_t SL_NETAPP_FAMILY_MASK                       =  (0x80);
+
+/* mDNS types */
+const uint32_t SL_NET_APP_MASK_IPP_TYPE_OF_SERVICE        =   (0x00000001);
+const uint32_t SL_NET_APP_MASK_DEVICE_INFO_TYPE_OF_SERVICE =  (0x00000002);
+const uint32_t SL_NET_APP_MASK_HTTP_TYPE_OF_SERVICE       =   (0x00000004);
+const uint32_t SL_NET_APP_MASK_HTTPS_TYPE_OF_SERVICE      =   (0x00000008);
+const uint32_t SL_NET_APP_MASK_WORKSATION_TYPE_OF_SERVICE =   (0x00000010);
+const uint32_t SL_NET_APP_MASK_GUID_TYPE_OF_SERVICE       =   (0x00000020);
+const uint32_t SL_NET_APP_MASK_H323_TYPE_OF_SERVICE       =   (0x00000040);
+const uint32_t SL_NET_APP_MASK_NTP_TYPE_OF_SERVICE        =   (0x00000080);
+const uint32_t SL_NET_APP_MASK_OBJECITVE_TYPE_OF_SERVICE  =   (0x00000100);
+const uint32_t SL_NET_APP_MASK_RDP_TYPE_OF_SERVICE        =   (0x00000200);
+const uint32_t SL_NET_APP_MASK_REMOTE_TYPE_OF_SERVICE     =   (0x00000400);
+const uint32_t SL_NET_APP_MASK_RTSP_TYPE_OF_SERVICE       =   (0x00000800);
+const uint32_t SL_NET_APP_MASK_SIP_TYPE_OF_SERVICE        =   (0x00001000);
+const uint32_t SL_NET_APP_MASK_SMB_TYPE_OF_SERVICE        =   (0x00002000);
+const uint32_t SL_NET_APP_MASK_SOAP_TYPE_OF_SERVICE       =   (0x00004000);
+const uint32_t SL_NET_APP_MASK_SSH_TYPE_OF_SERVICE        =   (0x00008000);
+const uint32_t SL_NET_APP_MASK_TELNET_TYPE_OF_SERVICE     =   (0x00010000);
+const uint32_t SL_NET_APP_MASK_TFTP_TYPE_OF_SERVICE       =   (0x00020000);
+const uint32_t SL_NET_APP_MASK_XMPP_CLIENT_TYPE_OF_SERVICE =  (0x00040000);
+const uint32_t SL_NET_APP_MASK_RAOP_TYPE_OF_SERVICE       =   (0x00080000);
+const uint32_t SL_NET_APP_MASK_ALL_TYPE_OF_SERVICE        =   (0xFFFFFFFF);
+
+/********************************************************************************************************/
+/* sl_NetAppDnsGetHostByName error codes     */
+
+const int16_t SL_NET_APP_DNS_QUERY_NO_RESPONSE            =  (-159);  /* DNS query failed, no response                        */
+const int16_t SL_NET_APP_DNS_NO_SERVER                    =  (-161);  /* No DNS server was specified                          */
+const int16_t SL_NET_APP_DNS_PARAM_ERROR                  =  (-162);  /* mDNS parameters error                                */
+const int16_t SL_NET_APP_DNS_QUERY_FAILED                 =  (-163);  /* DNS query failed; no DNS server sent an 'answer'     */
+const int16_t SL_NET_APP_DNS_INTERNAL_1                   =  (-164);
+const int16_t SL_NET_APP_DNS_INTERNAL_2                   =  (-165);
+const int16_t SL_NET_APP_DNS_MALFORMED_PACKET             =  (-166);  /* Improperly formed or corrupted DNS packet received   */
+const int16_t SL_NET_APP_DNS_INTERNAL_3                   =  (-167);
+const int16_t SL_NET_APP_DNS_INTERNAL_4                   =  (-168);
+const int16_t SL_NET_APP_DNS_INTERNAL_5                   =  (-169);
+const int16_t SL_NET_APP_DNS_INTERNAL_6                   =  (-170);
+const int16_t SL_NET_APP_DNS_INTERNAL_7                   =  (-171);
+const int16_t SL_NET_APP_DNS_INTERNAL_8                   =  (-172);
+const int16_t SL_NET_APP_DNS_INTERNAL_9                   =  (-173);
+const int16_t SL_NET_APP_DNS_MISMATCHED_RESPONSE          =  (-174);  /* Server response type does not match the query request*/
+const int16_t SL_NET_APP_DNS_INTERNAL_10                  =  (-175);
+const int16_t SL_NET_APP_DNS_INTERNAL_11                  =  (-176);
+const int16_t SL_NET_APP_DNS_NO_ANSWER                    =  (-177);  /* No response for one-shot query */
+const int16_t SL_NET_APP_DNS_NO_KNOWN_ANSWER              =  (-178);  /* No known answer for query */
+const int16_t SL_NET_APP_DNS_NAME_MISMATCH                =  (-179);  /* Illegal service name according to the RFC            */
+const int16_t SL_NET_APP_DNS_NOT_STARTED                  =  (-180);  /* mDNS is not running                                  */
+const int16_t SL_NET_APP_DNS_HOST_NAME_ERROR              =  (-181);  /* Host name error. Host name format is not allowed according to RFC 1033,1034,1035, 6763 */
+const int16_t SL_NET_APP_DNS_NO_MORE_ENTRIES              =  (-182);  /* No more entries be found.                            */
+
+const int16_t SL_NET_APP_DNS_MAX_SERVICES_ERROR           =  (-200);  /* Maximum advertise services are already configured    */
+const int16_t SL_NET_APP_DNS_IDENTICAL_SERVICES_ERROR     =  (-201);  /* Trying to register a service that is already exists  */
+const int16_t SL_NET_APP_DNS_NOT_EXISTED_SERVICE_ERROR    =  (-203);  /* Trying to delete service that does not existed       */
+const int16_t SL_NET_APP_DNS_ERROR_SERVICE_NAME_ERROR     =  (-204);  /* Illegal service name according to the RFC            */
+const int16_t SL_NET_APP_DNS_RX_PACKET_ALLOCATION_ERROR   =  (-205);  /* Retry request                                        */
+const int16_t SL_NET_APP_DNS_BUFFER_SIZE_ERROR            =  (-206);  /* List size buffer is bigger than internally allowed in the NWP */
+const int16_t SL_NET_APP_DNS_NET_APP_SET_ERROR            =  (-207);  /* Illegal length of one of the mDNS Set functions      */
+const int16_t SL_NET_APP_DNS_GET_SERVICE_LIST_FLAG_ERROR  =  (-208);
+const int16_t SL_NET_APP_DNS_NO_CONFIGURATION_ERROR       =  (-209);
+
+/* Set Dev name error codes  (NETAPP_SET_GET_DEV_CONF_OPT_DEVICE_URN) */
+const int16_t SL_ERROR_DEVICE_NAME_LEN_ERR                =   (-117);
+const int16_t SL_ERROR_DEVICE_NAME_INVALID                =   (-118);
+/* Set domain name error codes (NETAPP_SET_GET_DEV_CONF_OPT_DOMAIN_NAME) */
+const int16_t SL_ERROR_DOMAIN_NAME_LEN_ERR                =   (-119);
+const int16_t SL_ERROR_DOMAIN_NAME_INVALID                =   (-120);
+
+/********************************************************************************************************/
+
+/* NetApp application IDs */
+const uint8_t SL_NET_APP_HTTP_SERVER_ID                   =  (1);
+const uint8_t SL_NET_APP_DHCP_SERVER_ID                   =  (2);
+const uint8_t SL_NET_APP_MDNS_ID                          =  (4);
+const uint8_t SL_NET_APP_DNS_SERVER_ID                    =  (8);
+const uint8_t SL_NET_APP_DEVICE_CONFIG_ID                 =  (16);
+/* NetApp application set/get options */
+const uint8_t NETAPP_SET_DHCP_SRV_BASIC_OPT               =  (0);
+/* HTTP server set/get options */
+const uint8_t NETAPP_SET_GET_HTTP_OPT_PORT_NUMBER         =  (0);
+const uint8_t NETAPP_SET_GET_HTTP_OPT_AUTH_CHECK          =  (1);
+const uint8_t NETAPP_SET_GET_HTTP_OPT_AUTH_NAME           =  (2);
+const uint8_t NETAPP_SET_GET_HTTP_OPT_AUTH_PASSWORD       =  (3);
+const uint8_t NETAPP_SET_GET_HTTP_OPT_AUTH_REALM          =  (4);
+const uint8_t NETAPP_SET_GET_HTTP_OPT_ROM_PAGES_ACCESS    =  (5);
+
+const uint8_t NETAPP_SET_GET_MDNS_CONT_QUERY_OPT          =  (1);
+const uint8_t NETAPP_SET_GET_MDNS_QEVETN_MASK_OPT         =  (2);
+const uint8_t NETAPP_SET_GET_MDNS_TIMING_PARAMS_OPT       =  (3);
+
+/* DNS server set/get options */
+const uint8_t NETAPP_SET_GET_DNS_OPT_DOMAIN_NAME          =  (0);
+
+/* Device Config set/get options */
+const uint8_t NETAPP_SET_GET_DEV_CONF_OPT_DEVICE_URN      =  (0);
+const uint8_t NETAPP_SET_GET_DEV_CONF_OPT_DOMAIN_NAME     =  (1);
+
+
+/*****************************************************************************/
+/* Structure/Enum declarations                                               */
+/*****************************************************************************/
+/*
+ * The below structure depict the constant parameters that are returned in the Async event answer
+ * according to command/API sl_DnsGetHostByService for IPv4 and IPv6.
+ *
+    1Status                     - The status of the response.
+    2.Address                       - Contains the IP address of the service.
+    3.Port                          - Contains the port of the service.
+    4.TextLen                       - Contains the max length of the text that the user wants to get.
+                                                it means that if the test of service is bigger that its value than
+                                                the text is cut to inout_TextLen value.
+                                        Output: Contain the length of the text that is returned. Can be full text or part
+                                                of the text (see above).
+
+*
+ */
+typedef struct {
+    uint16_t   Status;
+    uint16_t   TextLen;
+    uint32_t    Port;
+    uint32_t    Address;
+} _GetHostByServiceIPv4AsyncResponse_t;
+
+/*
+ * The below struct contains pointers to the output parameters that the user gives
+ *
+ */
+typedef struct {
+    int16_t       Status;
+    uint32_t      *out_pAddr;
+    uint32_t      *out_pPort;
+    uint16_t      *inout_TextLen; // in: max len , out: actual len
+    unsigned char *out_pText;
+} _GetHostByServiceAsyncResponse_t;
+
+typedef struct {
+    uint32_t    PacketsSent;
+    uint32_t    PacketsReceived;
+    uint16_t    MinRoundTime;
+    uint16_t    MaxRoundTime;
+    uint16_t    AvgRoundTime;
+    uint32_t    TestTime;
+} SlPingReport_t;
+
+typedef struct {
+    uint32_t    PingIntervalTime;       /* delay between pings, in milliseconds */
+    uint16_t    PingSize;               /* ping packet size in bytes           */
+    uint16_t    PingRequestTimeout;     /* timeout time for every ping in milliseconds  */
+    uint32_t    TotalNumberOfAttempts;  /* max number of ping requests. 0 - forever    */
+    uint32_t    Flags;                  /* flag - 0 report only when finished, 1 - return response for every ping, 2 - stop after 1 successful ping.  */
+    uint32_t    Ip;                     /* IPv4 address or IPv6 first 4 bytes  */
+    uint32_t    Ip1OrPaadding;
+    uint32_t    Ip2OrPaadding;
+    uint32_t    Ip3OrPaadding;
+} SlPingStartCommand_t;
+
+typedef struct _slHttpServerString_t {
+    uint8_t     len;
+    uint8_t     *data;
+} slHttpServerString_t;
+
+typedef struct _slHttpServerData_t {
+    uint8_t     value_len;
+    uint8_t     name_len;
+    uint8_t     *token_value;
+    uint8_t     *token_name;
+} slHttpServerData_t;
+
+typedef struct _slHttpServerPostData_t {
+    slHttpServerString_t action;
+    slHttpServerString_t token_name;
+    slHttpServerString_t token_value;
+} slHttpServerPostData_t;
+
+typedef union {
+    slHttpServerString_t     httpTokenName; /* SL_NETAPP_HTTPGETTOKENVALUE */
+    slHttpServerPostData_t   httpPostData;  /* SL_NETAPP_HTTPPOSTTOKENVALUE */
+} SlHttpServerEventData_u;
+
+typedef union {
+    slHttpServerString_t token_value;
+} SlHttpServerResponsedata_u;
+
+typedef struct {
+    uint32_t                Event;
+    SlHttpServerEventData_u EventData;
+} SlHttpServerEvent_t;
+
+typedef struct {
+    uint32_t                   Response;
+    SlHttpServerResponsedata_u ResponseData;
+} SlHttpServerResponse_t;
+
+
+typedef struct {
+    uint32_t   lease_time;
+    uint32_t   ipv4_addr_start;
+    uint32_t   ipv4_addr_last;
+} SlNetAppDhcpServerBasicOpt_t;
+
+/*mDNS parameters*/
+typedef enum {
+    SL_NET_APP_FULL_SERVICE_WITH_TEXT_IPV4_TYPE = 1,
+    SL_NET_APP_FULL_SERVICE_IPV4_TYPE,
+    SL_NET_APP_SHORT_SERVICE_IPV4_TYPE
+
+} SlNetAppGetServiceListType_e;
+
+typedef struct {
+    uint32_t   service_ipv4;
+    uint16_t   service_port;
+    uint16_t   Reserved;
+} SlNetAppGetShortServiceIpv4List_t;
+
+typedef struct {
+    uint32_t   service_ipv4;
+    uint16_t   service_port;
+    uint16_t   Reserved;
+    uint8_t    service_name[NETAPP_MAX_SERVICE_NAME_SIZE];
+    uint8_t    service_host[NETAPP_MAX_SERVICE_HOST_NAME_SIZE];
+} SlNetAppGetFullServiceIpv4List_t;
+
+typedef struct {
+    uint32_t    service_ipv4;
+    uint16_t    service_port;
+    uint16_t    Reserved;
+    uint8_t     service_name[NETAPP_MAX_SERVICE_NAME_SIZE];
+    uint8_t     service_host[NETAPP_MAX_SERVICE_HOST_NAME_SIZE];
+    uint8_t     service_text[NETAPP_MAX_SERVICE_TEXT_SIZE];
+} SlNetAppGetFullServiceWithTextIpv4List_t;
+
+typedef struct {
+    /*The below parameters are used to configure the advertise times and interval
+    For example:
+        If:
+        Period is set to T
+        Repetitions are set to P
+        Telescopic factor is K=2
+        The transmission shall be:
+        advertise P times
+        wait T
+        advertise P times
+        wait 4 * T
+        advertise P time
+        wait 16 * T  ... (till max time reached / configuration changed / query issued)
+    */
+    uint32_t    t;              /* Number of ticks for the initial period. Default is 100 ticks for 1 second. */
+    uint32_t    p;              /* Number of repetitions. Default value is 1                                  */
+    uint32_t    k;              /* Telescopic factor. Default value is 2.                                     */
+    uint32_t    RetransInterval;/* Announcing retransmission interval                                         */
+    uint32_t    Maxinterval;     /* Announcing max period interval                                            */
+    uint32_t    max_time;       /* Announcing max time                                                        */
+} SlNetAppServiceAdvertiseTimingParameters_t;
+
+/*****************************************************************************/
+/* Types declarations                                               */
+/*****************************************************************************/
+typedef void (*P_SL_DEV_PING_CALLBACK)(SlPingReport_t*);
+extern P_SL_DEV_PING_CALLBACK  pPingCallBackFunc;
+
+/*****************************************************************************************
+*   NETAPP structs
+******************************************************************************************/
+
+
+typedef _BasicResponse_t _NetAppStartStopResponse_t;
+
+typedef struct {
+    uint32_t  appId;
+} _NetAppStartStopCommand_t;
+
+typedef struct {
+    uint16_t  Status;
+    uint16_t  AppId;
+    uint16_t  ConfigOpt;
+    uint16_t  ConfigLen;
+} _NetAppSetGet_t;
+typedef struct {
+    uint16_t  port_number;
+} _NetAppHttpServerGetSet_port_num_t;
+
+typedef struct {
+    uint8_t  auth_enable;
+} _NetAppHttpServerGetSet_auth_enable_t;
+
+typedef struct _sl_NetAppHttpServerGetToken_t {
+    uint8_t   token_name_len;
+    uint8_t   padd1;
+    uint16_t  padd2;
+} sl_NetAppHttpServerGetToken_t;
+
+typedef struct _sl_NetAppHttpServerSendToken_t {
+    uint8_t   token_value_len;
+    uint8_t   token_name_len;
+    uint8_t   token_name[MAX_TOKEN_NAME_LEN];
+    uint16_t  padd;
+} sl_NetAppHttpServerSendToken_t;
+
+typedef struct _sl_NetAppHttpServerPostToken_t {
+    uint8_t post_action_len;
+    uint8_t token_name_len;
+    uint8_t token_value_len;
+    uint8_t padding;
+} sl_NetAppHttpServerPostToken_t;
+
+
+typedef struct {
+    uint16_t Len;
+    uint8_t  family;
+    uint8_t  padding;
+} _GetHostByNameCommand_t;
+
+typedef struct {
+    uint16_t status;
+    uint16_t padding;
+    uint32_t ip0;
+    uint32_t ip1;
+    uint32_t ip2;
+    uint32_t ip3;
+} _GetHostByNameIPv6AsyncResponse_t;
+
+typedef struct {
+    uint16_t status;
+    uint8_t  padding1;
+    uint8_t  padding2;
+    uint32_t ip0;
+} _GetHostByNameIPv4AsyncResponse_t;
+
+typedef enum {
+    CTST_BSD_UDP_TX,
+    CTST_BSD_UDP_RX,
+    CTST_BSD_TCP_TX,
+    CTST_BSD_TCP_RX,
+    CTST_BSD_TCP_SERVER_BI_DIR,
+    CTST_BSD_TCP_CLIENT_BI_DIR,
+    CTST_BSD_UDP_BI_DIR,
+    CTST_BSD_RAW_TX,
+    CTST_BSD_RAW_RX,
+    CTST_BSD_RAW_BI_DIR,
+    CTST_BSD_SECURED_TCP_TX,
+    CTST_BSD_SECURED_TCP_RX,
+    CTST_BSD_SECURED_TCP_SERVER_BI_DIR,
+    CTST_BSD_SECURED_TCP_CLIENT_BI_DIR
+} CommTest_e;
+
+typedef struct _sl_protocol_CtestStartCommand_t {
+    uint32_t Test;
+    uint16_t DestPort;
+    uint16_t SrcPort;
+    uint32_t DestAddr[4];
+    uint32_t PayloadSize;
+    uint32_t timeout;
+    uint32_t csEnabled;
+    uint32_t secure;
+    uint32_t rawProtocol;
+    uint8_t  reserved1[4];
+} _CtestStartCommand_t;
+
+typedef struct {
+    uint8_t  test;
+    uint8_t  socket;
+    int16_t  status;
+    uint32_t startTime;
+    uint32_t endTime;
+    uint16_t txKbitsSec;
+    uint16_t rxKbitsSec;
+    uint32_t outOfOrderPackets;
+    uint32_t missedPackets;
+} _CtestAsyncResponse_t;
+
+typedef struct {
+    uint32_t pingIntervalTime;
+    uint16_t PingSize;
+    uint16_t pingRequestTimeout;
+    uint32_t totalNumberOfAttempts;
+    uint32_t flags;
+    uint32_t ip0;
+    uint32_t ip1OrPaadding;
+    uint32_t ip2OrPaadding;
+    uint32_t ip3OrPaadding;
+} _PingStartCommand_t;
+
+typedef struct {
+    uint16_t status;
+    uint16_t rttMin;
+    uint16_t rttMax;
+    uint16_t rttAvg;
+    uint32_t numSuccsessPings;
+    uint32_t numSendsPings;
+    uint32_t testTime;
+} _PingReportResponse_t;
+
+
+typedef struct {
+    uint32_t ip;
+    uint32_t gateway;
+    uint32_t dns;
+} _IpV4AcquiredAsync_t;
+
+
+typedef enum {
+    ACQUIRED_IPV6_LOCAL = 1,
+    ACQUIRED_IPV6_GLOBAL
+} IpV6AcquiredType_e;
+
+
+typedef struct {
+    uint32_t type;
+    uint32_t ip[4];
+    uint32_t gateway[4];
+    uint32_t dns[4];
+} _IpV6AcquiredAsync_t;
+
+
+typedef union {
+    _SocketCommand_t     EventMask;
+    _sendRecvCommand_t   DeviceInit;
+} _device_commands_t;
+
+
+class cc3100_netapp
+{
+
+public:
+
+    cc3100_netapp(cc3100_driver &driver, cc3100_nonos &nonos);
+
+    ~cc3100_netapp();
+
+    /*****************************************************************************/
+    /* Functions prototypes                                                      */
+    /*****************************************************************************/
+    int16_t sl_NetAppMDNSRegisterUnregisterService(const char* pServiceName,  uint8_t ServiceNameLen, const char* pText, uint8_t TextLen, uint16_t Port, uint32_t TTL, uint32_t Options);
+
+    void _sl_HandleAsync_DnsGetHostByAddr(void *pVoidBuf);
+
+    void CopyPingResultsToReport(_PingReportResponse_t *pResults,SlPingReport_t *pReport);
+
+    uint16_t sl_NetAppSendTokenValue(slHttpServerData_t * Token);
+
+
+    /*****************************************************************************/
+    /* Function prototypes                                                       */
+    /*****************************************************************************/
+
+
+    /*!
+        \brief Starts a network application
+
+        Gets and starts network application for the current WLAN mode
+
+        \param[in] AppBitMap      application bitmap, could be one or combination of the following: \n
+                                  - SL_NET_APP_HTTP_SERVER_ID
+                                  - SL_NET_APP_DHCP_SERVER_ID
+                                  - SL_NET_APP_MDNS_ID
+
+        \return                   On error, negative number is returned
+
+        \sa                       Stop one or more the above started applications using sl_NetAppStop
+        \note                     This command activates the application for the current WLAN mode (AP or STA)
+        \warning
+        \par                 Example:
+        \code
+        For example: Starting internal HTTP server + DHCP server:
+        sl_NetAppStart(SL_NET_APP_HTTP_SERVER_ID | SL_NET_APP_DHCP_SERVER_ID)
+
+        \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_NetAppStart)
+    int16_t sl_NetAppStart(uint32_t AppBitMap);
+#endif
+    /*!
+        \brief Stops a network application
+
+        Gets and stops network application for the current WLAN mode
+
+        \param[in] AppBitMap    application id, could be one of the following: \n
+                                - SL_NET_APP_HTTP_SERVER_ID
+                                - SL_NET_APP_DHCP_SERVER_ID
+                                - SL_NET_APP_MDNS_ID
+
+        \return                 On error, negative number is returned
+
+        \sa
+        \note                This command disables the application for the current active WLAN mode (AP or STA)
+        \warning
+        \par                 Example:
+        \code
+
+        For example: Stopping internal HTTP server:
+                             sl_NetAppStop(SL_NET_APP_HTTP_SERVER_ID);
+
+        \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_NetAppStop)
+    int16_t sl_NetAppStop(uint32_t AppBitMap);
+#endif
+
+    /*!
+        \brief Get host IP by name
+
+        Obtain the IP Address of machine on network, by machine name.
+
+        \param[in]  hostname        host name
+        \param[in]  usNameLen       name length
+        \param[out] out_ip_addr     This parameter is filled in with
+                                    host IP address. In case that host name is not
+                                    resolved, out_ip_addr is zero.
+        \param[in]  family          protocol family
+
+        \return                     On success, 0 is returned.
+                                    On error, negative is returned
+                                    SL_POOL_IS_EMPTY may be return in case there are no resources in the system
+                                    In this case try again later or increase MAX_CONCURRENT_ACTIONS
+                                    Possible DNS error codes:
+                                    - SL_NET_APP_DNS_QUERY_NO_RESPONSE
+                                    - SL_NET_APP_DNS_NO_SERVER
+                                    - SL_NET_APP_DNS_QUERY_FAILED
+                                    - SL_NET_APP_DNS_MALFORMED_PACKET
+                                    - SL_NET_APP_DNS_MISMATCHED_RESPONSE
+
+        \sa
+        \note   Only one sl_NetAppDnsGetHostByName can be handled at a time.
+                Calling this API while the same command is called from another thread, may result
+                in one of the two scenarios:
+                1. The command will wait (internal) until the previous command finish, and then be executed.
+                2. There are not enough resources and POOL_IS_EMPTY error will return.
+                In this case, MAX_CONCURRENT_ACTIONS can be increased (result in memory increase) or try
+                again later to issue the command.
+        \warning
+        \par  Example:
+        \code
+        uint32_t DestinationIP;
+        sl_NetAppDnsGetHostByName("www.google.com", strlen("www.google.com"), &DestinationIP,SL_AF_INET);
+
+        Addr.sin_family = SL_AF_INET;
+        Addr.sin_port = sl_Htons(80);
+        Addr.sin_addr.s_addr = sl_Htonl(DestinationIP);
+        AddrSize = sizeof(SlSockAddrIn_t);
+        SockID = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, 0);
+        \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_NetAppDnsGetHostByName)
+    int16_t sl_NetAppDnsGetHostByName(unsigned char * hostname, uint16_t usNameLen, uint32_t*  out_ip_addr,uint8_t family );
+#endif
+
+    /*!
+            \brief Return service attributes like IP address, port and text according to service name
+            \par
+            The user sets a service name Full/Part (see example below), and should get:
+            - IP of service
+            - The port of service
+            - The text of service
+
+            Hence it can make a connection to the specific service and use it.
+            It is similar to get host by name method.
+            It is done by a single shot query with PTR type on the service name.
+                      The command that is sent is from constant parameters and variables parameters.
+
+            \param[in]     pService                   Service name can be full or partial. \n
+                                                      Example for full service name:
+                                                      1. PC1._ipp._tcp.local
+                                                      2. PC2_server._ftp._tcp.local \n
+                                                      .
+                                                      Example for partial service name:
+                                                      1. _ipp._tcp.local
+                                                      2. _ftp._tcp.local
+
+            \param[in]    ServiceLen                  The length of the service name (in_pService).
+            \param[in]    Family                      IPv4 or IPv6 (SL_AF_INET , SL_AF_INET6).
+            \param[out]    pAddr                      Contains the IP address of the service.
+            \param[out]    pPort                      Contains the port of the service.
+            \param[out]    pTextLen                   Has 2 options. One as Input field and the other one as output:
+                                                      - Input: \n
+                                                      Contains the max length of the text that the user wants to get.\n
+                                                      It means that if the text len of service is bigger that its value than
+                                                      the text is cut to inout_TextLen value.
+                                                      - Output: \n
+                                                       Contain the length of the text that is returned. Can be full text or part of the text (see above).
+
+            \param[out]   pOut_pText     Contains the text of the service full or partial
+
+            \return       On success, zero is returned
+                          SL_POOL_IS_EMPTY may be return in case there are no resources in the system
+                          In this case try again later or increase MAX_CONCURRENT_ACTIONS
+                          In case No service is found error SL_NET_APP_DNS_NO_ANSWER will be returned
+
+            \note         The returns attributes belongs to the first service found.
+                          There may be other services with the same service name that will response to the query.
+                          The results of these responses are saved in the peer cache of the Device and should be read by another API.
+
+                          Only one sl_NetAppDnsGetHostByService can be handled at a time.
+                          Calling this API while the same command is called from another thread, may result
+                          in one of the two scenarios:
+                          1. The command will wait (internal) until the previous command finish, and then be executed.
+                          2. There are not enough resources and SL_POOL_IS_EMPTY error will return.
+                          In this case, MAX_CONCURRENT_ACTIONS can be increased (result in memory increase) or try
+                          again later to issue the command.
+
+            \warning      Text length can be 120 bytes only
+    */
+#if _SL_INCLUDE_FUNC(sl_NetAppDnsGetHostByService)
+    int32_t sl_NetAppDnsGetHostByService(unsigned char  *pServiceName, /*  string containing all (or only part): name + subtype + service */
+                                         uint8_t  ServiceLen,
+                                         uint8_t  Family,        /*  4-IPv4 , 16-IPv6  */
+                                         uint32_t pAddr[],
+                                         uint32_t *pPort,
+                                         uint16_t *pTextLen,     /*  in: max len , out: actual len */
+                                         unsigned char  *pText
+                                        );
+
+#endif
+
+    /*!
+            \brief Get service List
+            Insert into out pBuffer a list of peer's services that are the NWP.
+            The list is in a form of service struct. The user should chose the type
+            of the service struct like:
+                - Full service parameters with text.
+                - Full service parameters.
+                - Short service parameters (port and IP only) especially for tiny hosts.
+
+            The different types of struct are made to give the
+            Possibility to save memory in the host
+
+
+            The user also chose how many max services to get and start point index
+            NWP peer cache.
+            For example:
+                1.    Get max of 3 full services from index 0.Up to 3 full services
+                from index 0 are inserted into pBuffer (services that are in indexes 0,1,2).
+                2.    Get max of 4 full services from index 3.Up to 4 full services
+                from index 3 are inserted into pBuffer (services that are in indexes 3,4,5,6).
+                3.    Get max of 2 int services from index 6.Up to 2 int services
+                from index 6 are inserted into pBuffer (services that are in indexes 6,7).
+
+            See below - command parameters.
+
+            \param[in] indexOffset - The start index in the peer cache that from it the first service is returned.
+            \param[in] MaxServiceCount - The Max services that can be returned if existed or if not exceed the max index
+                          in the peer cache
+            \param[in] Flags - an ENUM number that means which service struct to use (means which types of service to fill)
+                            - use SlNetAppGetFullServiceWithTextIpv4List_t
+                            - use SlNetAppGetFullServiceIpv4List_t
+                            - use SlNetAppGetShortServiceIpv4List_t
+
+           \param[out]  Buffer - The Services are inserted into this buffer. In the struct form according to the bit that is set in the Flags
+                          input parameter.
+
+            \return    ServiceFoundCount - The number of the services that were inserted into the buffer. zero means no service is found
+                        negative number means an error
+            \sa           sl_NetAppMDNSRegisterService
+            \note
+            \warning
+                        if the out pBuffer size is bigger than an RX packet(1480), than
+                        an error is returned because there
+                        is no place in the RX packet.
+                        The size is a multiply of MaxServiceCount and size of service struct(that is set
+                        according to flag value).
+    */
+
+#if _SL_INCLUDE_FUNC(sl_NetAppGetServiceList)
+    int16_t sl_NetAppGetServiceList(uint8_t   IndexOffest,
+                                    uint8_t   MaxServiceCount,
+                                    uint8_t   Flags,
+                                    int8_t   *pBuffer,
+                                    uint32_t  RxBufferLength
+                                   );
+
+#endif
+
+    /*!
+            \brief Unregister mDNS service
+            This function deletes the mDNS service from the mDNS package and the database.
+
+            The mDNS service that is to be unregistered is a service that the application no longer wishes to provide. \n
+            The service name should be the full service name according to RFC
+            of the DNS-SD - meaning the value in name field in the SRV answer.
+
+            Examples for service names:
+            1. PC1._ipp._tcp.local
+            2. PC2_server._ftp._tcp.local
+
+            \param[in]    pServiceName            Full service name. \n
+                                                    Example for service name:
+                                                    1. PC1._ipp._tcp.local
+                                                    2. PC2_server._ftp._tcp.local
+            \param[in]    ServiceLen              The length of the service.
+            \return    On success, zero is returned
+            \sa          sl_NetAppMDNSRegisterService
+            \note
+            \warning
+            The size of the service length should be smaller than 255.
+    */
+#if _SL_INCLUDE_FUNC(sl_NetAppMDNSUnRegisterService)
+    int16_t sl_NetAppMDNSUnRegisterService(const char *pServiceName,uint8_t ServiceNameLen);
+#endif
+
+    /*!
+            \brief Register a new mDNS service
+            \par
+            This function registers a new mDNS service to the mDNS package and the DB.
+
+            This registered service is a service offered by the application.
+            The service name should be full service name according to RFC
+            of the DNS-SD - meaning the value in name field in the SRV answer.
+            Example for service name:
+            1. PC1._ipp._tcp.local
+            2. PC2_server._ftp._tcp.local
+
+            If the option is_unique is set, mDNS probes the service name to make sure
+            it is unique before starting to announce the service on the network.
+            Instance is the instance portion of the service name.
+
+            \param[in]  ServiceLen         The length of the service.
+            \param[in]  TextLen            The length of the service should be smaller than 64.
+            \param[in]  port               The port on this target host port.
+            \param[in]  TTL                The TTL of the service
+            \param[in]  Options            bitwise parameters: \n
+                                           - bit 0  - service is unique (means that the service needs to be unique)
+                                           - bit 31  - for internal use if the service should be added or deleted (set means ADD).
+                                           - bit 1-30 for future.
+
+            \param[in]    pServiceName              The service name.
+                                           Example for service name: \n
+                                                    1. PC1._ipp._tcp.local
+                                                    2. PC2_server._ftp._tcp.local
+
+            \param[in] pText                     The description of the service.
+                                                    should be as mentioned in the RFC
+                                                    (according to type of the service IPP,FTP...)
+
+            \return     On success, zero is returned
+                        Possible error codes:
+                        - Maximum advertise services are already configured.
+                                    Delete another existed service that is registered and then register again the new service
+                        - Trying to register a service that is already exists
+                        - Trying to delete service that does not existed
+                        - Illegal service name according to the RFC
+                        - Retry request
+                        - Illegal length of one of the mDNS Set functions
+                        - mDNS is not operational as the device has no IP.Connect the device to an AP to get an IP address.
+                        - mDNS parameters error
+                        - mDNS internal cache error
+                        - mDNS internal error
+                        - Adding a service is not allowed as it is already exist (duplicate service)
+                        - mDNS is not running
+                        - Host name error. Host name format is not allowed according to RFC 1033,1034,1035, 6763
+                        - List size buffer is bigger than internally allowed in the NWP (API get service list),
+                         change the APIsďż˝ parameters to decrease the size of the list
+
+
+            \sa              sl_NetAppMDNSUnRegisterService
+
+            \warning      1) Temporary -  there is an allocation on stack of internal buffer.
+                        Its size is NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH. \n
+                        It means that the sum of the text length and service name length cannot be bigger than
+                        NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH.\n
+                        If it is - An error is returned. \n
+                        2) According to now from certain constraints the variables parameters are set in the
+                        attribute part (contain constant parameters)
+    */
+#if _SL_INCLUDE_FUNC(sl_NetAppMDNSRegisterService)
+    int16_t sl_NetAppMDNSRegisterService( const char*  pServiceName,
+                                          uint8_t         ServiceNameLen,
+                                          const char*  pText,
+                                          uint8_t         TextLen,
+                                          uint16_t        Port,
+                                          uint32_t        TTL,
+                                          uint32_t        Options);
+#endif
+
+    /*!
+        \brief send ICMP ECHO_REQUEST to network hosts
+
+        Ping uses the ICMP protocol's mandatory ECHO_REQUEST
+
+        \param[in]   pPingParams     Pointer to the ping request structure: \n
+                                     - if flags parameter is set to 0, ping will report back once all requested pings are done (as defined by TotalNumberOfAttempts). \n
+                                     - if flags parameter is set to 1, ping will report back after every ping, for TotalNumberOfAttempts.
+                                     - if flags parameter is set to 2, ping will stop after the first successful ping, and report back for the successful ping, as well as any preceding failed ones.
+                                     For stopping an ongoing ping activity, set parameters IP address to 0
+
+        \param[in]   family          SL_AF_INET or  SL_AF_INET6
+        \param[out]  pReport         Ping pReport
+        \param[out]  pCallback       Callback function upon completion.
+                                     If callback is NULL, the API is blocked until data arrives
+
+
+        \return    On success, zero is returned. On error, -1 is returned
+                   SL_POOL_IS_EMPTY may be return in case there are no resources in the system
+                   In this case try again later or increase MAX_CONCURRENT_ACTIONS
+
+        \sa       sl_NetAppPingReport
+        \note      Only one sl_NetAppPingStart can be handled at a time.
+                  Calling this API while the same command is called from another thread, may result
+                      in one of the two scenarios:
+                  1. The command will wait (internal) until the previous command finish, and then be executed.
+                  2. There are not enough resources and SL_POOL_IS_EMPTY error will return.
+                  In this case, MAX_CONCURRENT_ACTIONS can be increased (result in memory increase) or try
+                  again later to issue the command.
+        \warning
+        \par      Example:
+        \code
+
+        An example of sending 20 ping requests and reporting results to a callback routine when
+                  all requests are sent:
+
+                  // callback routine
+                  void pingRes(SlPingReport_t* pReport)
+                  {
+                   // handle ping results
+                  }
+
+                  // ping activation
+                  void PingTest()
+                  {
+                     SlPingReport_t report;
+                     SlPingStartCommand_t pingCommand;
+
+                     pingCommand.Ip = SL_IPV4_VAL(10,1,1,200);     // destination IP address is 10.1.1.200
+                     pingCommand.PingSize = 150;                   // size of ping, in bytes
+                     pingCommand.PingIntervalTime = 100;           // delay between pings, in milliseconds
+                     pingCommand.PingRequestTimeout = 1000;        // timeout for every ping in milliseconds
+                     pingCommand.TotalNumberOfAttempts = 20;       // max number of ping requests. 0 - forever
+                     pingCommand.Flags = 0;                        // report only when finished
+
+                     sl_NetAppPingStart( &pingCommand, SL_AF_INET, &report, pingRes ) ;
+                 }
+
+        \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_NetAppPingStart)
+    int16_t sl_NetAppPingStart(SlPingStartCommand_t* pPingParams,uint8_t family,SlPingReport_t *pReport,const P_SL_DEV_PING_CALLBACK pPingCallback);
+#endif
+
+    /*!
+        \brief     Internal function for setting network application configurations
+
+        \return    On success, zero is returned. On error, -1 is
+                   returned
+
+        \param[in] AppId          Application id, could be one of the following: \n
+                                  - SL_NET_APP_HTTP_SERVER_ID
+                                  - SL_NET_APP_DHCP_SERVER_ID
+                                  - SL_NET_APP_DHCP_SERVER_ID
+
+        \param[in] SetOptions     set option, could be one of the following: \n
+                                  NETAPP_SET_BASIC_OPT
+
+        \param[in] OptionLen       option structure length
+
+        \param[in] pOptionValues   pointer to the option structure
+        \sa
+        \note
+        \warning
+        \par
+        \code
+            Set DHCP Server (AP mode) parameters example:
+
+            SlNetAppDhcpServerBasicOpt_t dhcpParams;
+            uint8_t outLen = sizeof(SlNetAppDhcpServerBasicOpt_t);
+            dhcpParams.lease_time      = 4096;                         // lease time (in seconds) of the IP Address
+            dhcpParams.ipv4_addr_start =  SL_IPV4_VAL(192,168,1,10);   // first IP Address for allocation. IP Address should be set as Hex number - i.e. 0A0B0C01 for (10.11.12.1)
+            dhcpParams.ipv4_addr_last  =  SL_IPV4_VAL(192,168,1,16);   // last IP Address for allocation. IP Address should be set as Hex number - i.e. 0A0B0C01 for (10.11.12.1)
+            sl_NetAppStop(SL_NET_APP_DHCP_SERVER_ID);                  // Stop DHCP server before settings
+            sl_NetAppSet(SL_NET_APP_DHCP_SERVER_ID, NETAPP_SET_DHCP_SRV_BASIC_OPT, outLen, (uint8_t* )&dhcpParams);  // set parameters
+            sl_NetAppStart(SL_NET_APP_DHCP_SERVER_ID);                 // Start DHCP server with new settings
+        \endcode
+        \code
+            Set Device URN name example:
+
+            Device name, maximum length of 33 characters
+            Device name affects URN name, own SSID name in AP mode, and WPS file "device name" in WPS I.E (STA-WPS / P2P)
+            In case no device URN name set, the default name is "mysimplelink"
+            Allowed characters in device name are: 'a - z' , 'A - Z' , '0-9' and '-'
+
+            uint8_t *my_device = "MY-SIMPLELINK-DEV";
+            sl_NetAppSet (SL_NET_APP_DEVICE_CONFIG_ID, NETAPP_SET_GET_DEV_CONF_OPT_DEVICE_URN, strlen(my_device), (uint8_t *) my_device);
+        \endcode
+
+    */
+#if _SL_INCLUDE_FUNC(sl_NetAppSet)
+    int32_t sl_NetAppSet(uint8_t AppId ,uint8_t Option,uint8_t OptionLen, uint8_t *pOptionValue);
+#endif
+
+    /*!
+        \brief     Internal function for getting network applications configurations
+
+        \return    On success, zero is returned. On error, -1 is
+                   returned
+
+        \param[in] AppId          Application id, could be one of the following: \n
+                                  - SL_NET_APP_HTTP_SERVER_ID
+                                  - SL_NET_APP_DHCP_SERVER_ID
+
+        \param[in] Options        Get option, could be one of the following: \n
+                                  NETAPP_SET_BASIC_OPT
+
+        \param[in] OptionLen     The length of the allocated memory as input, when the
+                                            function complete, the value of this parameter would be
+                                            the len that actually read from the device.
+                                            If the device return length that is longer from the input
+                                            value, the function will cut the end of the returned structure
+                                            and will return ESMALLBUF
+
+        \param[out] pValues      pointer to the option structure which will be filled with the response from the device
+
+        \sa
+        \note
+        \warning
+        \par
+        \code
+             Get DHCP Server parameters example:
+
+             SlNetAppDhcpServerBasicOpt_t dhcpParams;
+             uint8_t outLen = sizeof(SlNetAppDhcpServerBasicOpt_t);
+             sl_NetAppGet(SL_NET_APP_DHCP_SERVER_ID, NETAPP_SET_DHCP_SRV_BASIC_OPT, &outLen, (uint8_t* )&dhcpParams);
+
+             printf("DHCP Start IP %d.%d.%d.%d End IP %d.%d.%d.%d Lease time seconds %d\n",
+                SL_IPV4_BYTE(dhcpParams.ipv4_addr_start,3),SL_IPV4_BYTE(dhcpParams.ipv4_addr_start,2),
+                SL_IPV4_BYTE(dhcpParams.ipv4_addr_start,1),SL_IPV4_BYTE(dhcpParams.ipv4_addr_start,0),
+                SL_IPV4_BYTE(dhcpParams.ipv4_addr_last,3),SL_IPV4_BYTE(dhcpParams.ipv4_addr_last,2),
+                SL_IPV4_BYTE(dhcpParams.ipv4_addr_last,1),SL_IPV4_BYTE(dhcpParams.ipv4_addr_last,0),
+                dhcpParams.lease_time);
+        \endcode
+        \code
+             Get Device URN name example:
+             Maximum length of 33 characters of device name.
+             Device name affects URN name, own SSID name in AP mode, and WPS file "device name" in WPS I.E (STA-WPS / P2P)
+             in case no device URN name set, the default name is "mysimplelink"
+
+             uint8_t my_device_name[35];
+             sl_NetAppGet (SL_NET_APP_DEVICE_CONFIG_ID, NETAPP_SET_GET_DEV_CONF_OPT_DEVICE_URN, strlen(my_device_name), (uint8_t *)my_device_name);
+        \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_NetAppGet)
+    int32_t sl_NetAppGet(uint8_t AppId, uint8_t Option,uint8_t *pOptionLen, uint8_t *pOptionValue);
+#endif
+
+private:
+
+    cc3100_driver           &_driver;
+    cc3100_nonos            &_nonos;
+
+
+};//class
+
+/*****************************************************************************/
+/* Macro declarations                                                        */
+/*****************************************************************************/
+const uint8_t FLOW_CONT_MIN = 1;
+
+
+class cc3100_flowcont
+{
+
+public:
+
+    cc3100_flowcont(cc3100_driver &driver, cc3100_nonos &nonos);
+
+
+    ~cc3100_flowcont();
+
+
+    /*****************************************************************************/
+    /* Function prototypes                                                       */
+    /*****************************************************************************/
+    void _SlDrvFlowContInit(void);
+    void _SlDrvFlowContDeinit(void);
+
+private:
+
+    cc3100_driver &_driver;
+    cc3100_nonos  &_nonos;
+
+};//class
+}//namespace mbed_cc3100
+
+/*!
+
+ Close the Doxygen group.
+ @}
+
+ */
+
+#endif    /*  __NETAPP_H__ */
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_netcfg.cpp	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,157 @@
+/*
+* netcfg.c - CC31xx/CC32xx Host Driver Implementation
+*
+* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+*
+*
+*  Redistribution and use in source and binary forms, with or without
+*  modification, are permitted provided that the following conditions
+*  are met:
+*
+*    Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+*
+*    Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the
+*    distribution.
+*
+*    Neither the name of Texas Instruments Incorporated nor the names of
+*    its contributors may be used to endorse or promote products derived
+*    from this software without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+*  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+*  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+*  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+*  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+*  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+
+
+/*****************************************************************************/
+/* Include files                                                             */
+/*****************************************************************************/
+#include "cc3100_simplelink.h"
+#include "cc3100_protocol.h"
+#include "cc3100_driver.h"
+
+#include "cc3100_netcfg.h"
+
+namespace mbed_cc3100 {
+
+cc3100_netcfg::cc3100_netcfg(cc3100_driver &driver)
+    : _driver(driver)
+{
+
+}
+
+cc3100_netcfg::~cc3100_netcfg()
+{
+
+}
+
+/*****************************************************************************/
+/* sl_NetCfgSet */
+/*****************************************************************************/
+typedef union {
+    _NetCfgSetGet_t    Cmd;
+    _BasicResponse_t   Rsp;
+} _SlNetCfgMsgSet_u;
+
+const _SlCmdCtrl_t _SlNetCfgSetCmdCtrl = {
+    SL_OPCODE_DEVICE_NETCFG_SET_COMMAND,
+    sizeof(_NetCfgSetGet_t),
+    sizeof(_BasicResponse_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_NetCfgSet)
+int32_t cc3100_netcfg::sl_NetCfgSet(uint8_t ConfigId ,uint8_t ConfigOpt,uint8_t ConfigLen, uint8_t *pValues)
+{
+    _SlNetCfgMsgSet_u         Msg;
+    _SlCmdExt_t               CmdExt;
+
+    CmdExt.TxPayloadLen = (ConfigLen+3) & (~3);
+    CmdExt.RxPayloadLen = 0;
+    CmdExt.pTxPayload = (uint8_t *)pValues;
+    CmdExt.pRxPayload = NULL;
+
+
+    Msg.Cmd.ConfigId    = ConfigId;
+    Msg.Cmd.ConfigLen   = ConfigLen;
+    Msg.Cmd.ConfigOpt   = ConfigOpt;
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlNetCfgSetCmdCtrl, &Msg, &CmdExt));
+
+    return (int16_t)Msg.Rsp.status;
+}
+#endif
+
+uint32_t cc3100_netcfg::SL_IPV4_VAL(uint8_t add_3,uint8_t add_2,uint8_t add_1,uint8_t add_0){
+	
+	     return((((uint32_t)add_3 << 24) & 0xFF000000) | (((uint32_t)add_2 << 16) & 0xFF0000) | (((uint32_t)add_1 << 8) & 0xFF00) | ((uint32_t)add_0 & 0xFF) );
+}
+
+uint8_t cc3100_netcfg::SL_IPV4_BYTE(uint8_t val,uint8_t index){
+	                  
+	    return( (val >> (index*8)) & 0xFF );
+}	                  
+
+/*****************************************************************************/
+/* sl_NetCfgGet */
+/*****************************************************************************/
+typedef union {
+    _NetCfgSetGet_t	    Cmd;
+    _NetCfgSetGet_t	    Rsp;
+} _SlNetCfgMsgGet_u;
+
+const _SlCmdCtrl_t _SlNetCfgGetCmdCtrl = {
+    SL_OPCODE_DEVICE_NETCFG_GET_COMMAND,
+    sizeof(_NetCfgSetGet_t),
+    sizeof(_NetCfgSetGet_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_NetCfgGet)
+int32_t cc3100_netcfg::sl_NetCfgGet(uint8_t ConfigId, uint8_t *pConfigOpt,uint8_t *pConfigLen, uint8_t *pValues)
+{
+    _SlNetCfgMsgGet_u         Msg;
+    _SlCmdExt_t               CmdExt;
+
+    if (*pConfigLen == 0) {
+        return SL_EZEROLEN;
+    }
+    CmdExt.TxPayloadLen = 0;
+    CmdExt.RxPayloadLen = *pConfigLen;
+    CmdExt.pTxPayload = NULL;
+    CmdExt.pRxPayload = (uint8_t *)pValues;
+    CmdExt.ActualRxPayloadLen = 0;
+    Msg.Cmd.ConfigLen    = *pConfigLen;
+    Msg.Cmd.ConfigId     = ConfigId;
+
+    if( pConfigOpt ) {
+        Msg.Cmd.ConfigOpt   = (uint16_t)*pConfigOpt;
+    }
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlNetCfgGetCmdCtrl, &Msg, &CmdExt));
+
+    if( pConfigOpt ) {
+        *pConfigOpt = (uint8_t)Msg.Rsp.ConfigOpt;
+    }
+    if (CmdExt.RxPayloadLen < CmdExt.ActualRxPayloadLen) {
+        *pConfigLen = (uint8_t)CmdExt.RxPayloadLen;
+        return SL_ESMALLBUF;
+    } else {
+        *pConfigLen = (uint8_t)CmdExt.ActualRxPayloadLen;
+    }
+
+    return (int16_t)Msg.Rsp.Status;
+}
+#endif
+
+}//namespace mbed_cc3100
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_netcfg.h	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,288 @@
+/*
+ * netcfg.h - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+#ifndef NETCFG_H_
+#define NETCFG_H_
+
+/*****************************************************************************/
+/* Include files                                                             */
+/*****************************************************************************/
+#include "cc3100_simplelink.h"
+
+namespace mbed_cc3100 {
+
+/*!
+
+    \addtogroup netcfg
+    @{
+
+*/
+
+
+/*****************************************************************************/
+/* Macro declarations                                                        */
+/*****************************************************************************/
+const uint8_t SL_MAC_ADDR_LEN                       =   (6);
+const uint8_t IPCONFIG_MODE_DISABLE_IPV4            =   (0);
+const uint8_t IPCONFIG_MODE_ENABLE_IPV4             =   (1);
+
+/*****************************************************************************/
+/* Structure/Enum declarations                                               */
+/*****************************************************************************/
+typedef enum {
+    SL_MAC_ADDRESS_SET          = 1,
+    SL_MAC_ADDRESS_GET          = 2,
+    SL_IPV4_STA_P2P_CL_GET_INFO           = 3,
+    SL_IPV4_STA_P2P_CL_DHCP_ENABLE        = 4,
+    SL_IPV4_STA_P2P_CL_STATIC_ENABLE      = 5,
+    SL_IPV4_AP_P2P_GO_GET_INFO            = 6,
+    SL_IPV4_AP_P2P_GO_STATIC_ENABLE       = 7,
+    SL_SET_HOST_RX_AGGR                   = 8,
+    MAX_SETTINGS = 0xFF
+} Sl_NetCfg_e;
+
+
+typedef struct {
+    uint32_t  ipV4;
+    uint32_t  ipV4Mask;
+    uint32_t  ipV4Gateway;
+    uint32_t  ipV4DnsServer;
+} SlNetCfgIpV4Args_t;
+
+class cc3100_netcfg
+{
+
+public:
+
+    cc3100_netcfg(cc3100_driver  &driver);
+
+    ~cc3100_netcfg();
+
+
+    /*****************************************************************************/
+    /* Function prototypes                                                       */
+    /*****************************************************************************/
+
+    /*!
+        \brief     Internal function for setting network configurations
+
+        \return    On success, zero is returned. On error, -1 is
+                   returned
+
+        \param[in] ConfigId   configuration id
+        \param[in] ConfigOpt  configurations option
+        \param[in] ConfigLen  configurations len
+        \param[in] pValues    configurations values
+
+        \sa
+        \note
+        \warning
+
+        \par   Examples:
+        \code
+            SL_MAC_ADDRESS_SET:
+
+            Setting MAC address to the Device.
+            The new MAC address will override the default MAC address and it be saved in the FileSystem.
+            Requires restarting the device for updating this setting.
+
+            uint8_t MAC_Address[6];
+            MAC_Address[0] = 0x8;
+            MAC_Address[1] = 0x0;
+            MAC_Address[2] = 0x28;
+            MAC_Address[3] = 0x22;
+            MAC_Address[4] = 0x69;
+            MAC_Address[5] = 0x31;
+            sl_NetCfgSet(SL_MAC_ADDRESS_SET,1,SL_MAC_ADDR_LEN,(uint8_t *)newMacAddress);
+            sl_Stop(0);
+            sl_Start(NULL,NULL,NULL);
+        \endcode
+
+        \code
+            SL_IPV4_STA_P2P_CL_STATIC_ENABLE:
+
+            Setting a static IP address to the device working in STA mode or P2P client.
+            The IP address will be stored in the FileSystem.
+            In order to disable the static IP and get the address assigned from DHCP one should use SL_STA_P2P_CL_IPV4_DHCP_SET
+
+            SlNetCfgIpV4Args_t ipV4;
+            ipV4.ipV4          = (uint32_t)SL_IPV4_VAL(10,1,1,201);            // uint32_t IP address
+            ipV4.ipV4Mask      = (uint32_t)SL_IPV4_VAL(255,255,255,0);         // uint32_t Subnet mask for this STA/P2P
+            ipV4.ipV4Gateway   = (uint32_t)SL_IPV4_VAL(10,1,1,1);              // uint32_t Default gateway address
+            ipV4.ipV4DnsServer = (uint32_t)SL_IPV4_VAL(8,16,32,64);            // uint32_t DNS server address
+
+            sl_NetCfgSet(SL_IPV4_STA_P2P_CL_STATIC_ENABLE,IPCONFIG_MODE_ENABLE_IPV4,sizeof(SlNetCfgIpV4Args_t),(uint8_t *)&ipV4);
+            sl_Stop(0);
+            sl_Start(NULL,NULL,NULL);
+        \endcode
+
+        \code
+            SL_IPV4_STA_P2P_CL_DHCP_ENABLE:
+
+            Setting IP address by DHCP to FileSystem using WLAN sta mode or P2P client.
+                    This should be done once if using Serial Flash.
+                    This is the system's default mode for acquiring an IP address after WLAN connection.
+            uint8_t val = 1;
+            sl_NetCfgSet(SL_IPV4_STA_P2P_CL_DHCP_ENABLE,IPCONFIG_MODE_ENABLE_IPV4,1,&val);
+            sl_Stop(0);
+            sl_Start(NULL,NULL,NULL);
+        \endcode
+
+        \code
+            SL_IPV4_AP_P2P_GO_STATIC_ENABLE:
+
+            Setting a static IP address to the device working in AP mode or P2P go.
+            The IP address will be stored in the FileSystem. Requires restart.
+
+            SlNetCfgIpV4Args_t ipV4;
+            ipV4.ipV4          = (uint32_t)SL_IPV4_VAL(10,1,1,201);            // uint32_t IP address
+            ipV4.ipV4Mask      = (uint32_t)SL_IPV4_VAL(255,255,255,0);         // uint32_t Subnet mask for this AP/P2P
+            ipV4.ipV4Gateway   = (uint32_t)SL_IPV4_VAL(10,1,1,1);              // uint32_t Default gateway address
+            ipV4.ipV4DnsServer = (uint32_t)SL_IPV4_VAL(8,16,32,64);            // uint32_t DNS server address
+
+            sl_NetCfgSet(SL_IPV4_AP_P2P_GO_STATIC_ENABLE,IPCONFIG_MODE_ENABLE_IPV4,sizeof(SlNetCfgIpV4Args_t),(uint8_t *)&ipV4);
+            sl_Stop(0);
+            sl_Start(NULL,NULL,NULL);
+        \endcode
+
+
+    */
+#if _SL_INCLUDE_FUNC(sl_NetCfgSet)
+    int32_t sl_NetCfgSet(uint8_t ConfigId ,uint8_t ConfigOpt, uint8_t ConfigLen, uint8_t *pValues);
+#endif
+
+
+    /*!
+        \brief     Internal function for getting network configurations
+
+        \return    On success, zero is returned. On error, -1 is
+                   returned
+
+        \param[in] ConfigId      configuration id
+
+        \param[out] pConfigOpt   Get configurations option
+
+        \param[out] pConfigLen   The length of the allocated memory as input, when the
+                                            function complete, the value of this parameter would be
+                                 the len that actually read from the device.\n
+                                            If the device return length that is longer from the input
+                                            value, the function will cut the end of the returned structure
+                                            and will return ESMALLBUF
+
+        \param[out] pValues - get configurations values
+
+        \sa
+        \note
+        \warning
+        \par   Examples:
+        \code
+           SL_MAC_ADDRESS_GET:
+
+           Get the device MAC address.
+           The returned MAC address is taken from FileSystem first. If the MAC address was not set by SL_MAC_ADDRESS_SET, the default MAC address
+           is retrieved from HW.
+
+           uint8_t macAddressVal[SL_MAC_ADDR_LEN];
+           uint8_t macAddressLen = SL_MAC_ADDR_LEN;
+           sl_NetCfgGet(SL_MAC_ADDRESS_GET,NULL,&macAddressLen,(uint8_t *)macAddressVal);
+
+        \endcode
+
+        \code
+            SL_IPV4_STA_P2P_CL_GET_INFO:
+
+            Get IP address from WLAN station or P2P client. A DHCP flag is returned to indicate if the IP address is static or from DHCP.
+
+            uint8_t len = sizeof(SlNetCfgIpV4Args_t);
+            uint8_t dhcpIsOn = 0;
+            SlNetCfgIpV4Args_t ipV4 = {0};
+            sl_NetCfgGet(SL_IPV4_STA_P2P_CL_GET_INFO,&dhcpIsOn,&len,(uint8_t *)&ipV4);
+
+            printf("DHCP is %s IP %d.%d.%d.%d MASK %d.%d.%d.%d GW %d.%d.%d.%d DNS %d.%d.%d.%d\n",
+                    (dhcpIsOn > 0) ? "ON" : "OFF",
+                    SL_IPV4_BYTE(ipV4.ipV4,3),SL_IPV4_BYTE(ipV4.ipV4,2),SL_IPV4_BYTE(ipV4.ipV4,1),SL_IPV4_BYTE(ipV4.ipV4,0),
+                    SL_IPV4_BYTE(ipV4.ipV4Mask,3),SL_IPV4_BYTE(ipV4.ipV4Mask,2),SL_IPV4_BYTE(ipV4.ipV4Mask,1),SL_IPV4_BYTE(ipV4.ipV4Mask,0),
+                    SL_IPV4_BYTE(ipV4.ipV4Gateway,3),SL_IPV4_BYTE(ipV4.ipV4Gateway,2),SL_IPV4_BYTE(ipV4.ipV4Gateway,1),SL_IPV4_BYTE(ipV4.ipV4Gateway,0),
+                    SL_IPV4_BYTE(ipV4.ipV4DnsServer,3),SL_IPV4_BYTE(ipV4.ipV4DnsServer,2),SL_IPV4_BYTE(ipV4.ipV4DnsServer,1),SL_IPV4_BYTE(ipV4.ipV4DnsServer,0));
+
+        \endcode
+
+        \code
+            SL_IPV4_AP_P2P_GO_GET_INFO:
+
+            Get static IP address for AP or P2P go.
+
+            uint8_t len = sizeof(SlNetCfgIpV4Args_t);
+            uint8_t dhcpIsOn = 0; // this flag is meaningless on AP/P2P go.
+            SlNetCfgIpV4Args_t ipV4 = {0};
+            sl_NetCfgGet(SL_IPV4_AP_P2P_GO_GET_INFO,&dhcpIsOn,&len,(uint8_t *)&ipV4);
+
+            printf("IP %d.%d.%d.%d MASK %d.%d.%d.%d GW %d.%d.%d.%d DNS %d.%d.%d.%d\n",
+                    SL_IPV4_BYTE(ipV4.ipV4,3),SL_IPV4_BYTE(ipV4.ipV4,2),SL_IPV4_BYTE(ipV4.ipV4,1),SL_IPV4_BYTE(ipV4.ipV4,0),
+                    SL_IPV4_BYTE(ipV4.ipV4Mask,3),SL_IPV4_BYTE(ipV4.ipV4Mask,2),SL_IPV4_BYTE(ipV4.ipV4Mask,1),SL_IPV4_BYTE(ipV4.ipV4Mask,0),
+                    SL_IPV4_BYTE(ipV4.ipV4Gateway,3),SL_IPV4_BYTE(ipV4.ipV4Gateway,2),SL_IPV4_BYTE(ipV4.ipV4Gateway,1),SL_IPV4_BYTE(ipV4.ipV4Gateway,0),
+                    SL_IPV4_BYTE(ipV4.ipV4DnsServer,3),SL_IPV4_BYTE(ipV4.ipV4DnsServer,2),SL_IPV4_BYTE(ipV4.ipV4DnsServer,1),SL_IPV4_BYTE(ipV4.ipV4DnsServer,0));
+
+        \endcode
+
+
+    */
+#if _SL_INCLUDE_FUNC(sl_NetCfgGet)
+    int32_t sl_NetCfgGet(uint8_t ConfigId ,uint8_t *pConfigOpt, uint8_t *pConfigLen, uint8_t *pValues);
+#endif
+
+uint32_t SL_IPV4_VAL(uint8_t add_3,uint8_t add_2,uint8_t add_1,uint8_t add_0);
+uint8_t SL_IPV4_BYTE(uint8_t val,uint8_t index);
+
+private:
+
+    cc3100_driver  &_driver;
+    
+};//class
+
+}//namespace mbed_cc3100    
+
+    /*!
+
+     Close the Doxygen group.
+     @}
+
+     */
+
+
+#endif    /*  __NETCFG_H__ */
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_nonos.cpp	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,266 @@
+/*
+* nonos.c - CC31xx/CC32xx Host Driver Implementation
+*
+* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+*
+*
+*  Redistribution and use in source and binary forms, with or without
+*  modification, are permitted provided that the following conditions
+*  are met:
+*
+*    Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+*
+*    Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the
+*    distribution.
+*
+*    Neither the name of Texas Instruments Incorporated nor the names of
+*    its contributors may be used to endorse or promote products derived
+*    from this software without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+*  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+*  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+*  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+*  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+*  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+
+
+/*****************************************************************************/
+/* Include files                                                             */
+/*****************************************************************************/
+
+#ifndef SL_PLATFORM_MULTI_THREADED
+
+#include "cc3100_simplelink.h"
+#include "cc3100_nonos.h"
+#include "fPtr_func.h"
+
+namespace mbed_cc3100 {
+		
+const uint8_t NONOS_MAX_SPAWN_ENTRIES	=	5;		
+
+cc3100_nonos::cc3100_nonos(cc3100_driver &driver)
+    : _driver(driver)
+{
+    
+}
+
+cc3100_nonos::~cc3100_nonos()
+{
+
+}
+
+typedef struct {
+    _SlSpawnEntryFunc_t 		pEntry;
+    void* 						pValue;
+} _SlNonOsSpawnEntry_t;
+
+typedef struct {
+    _SlNonOsSpawnEntry_t	SpawnEntries[NONOS_MAX_SPAWN_ENTRIES];
+} _SlNonOsCB_t;
+
+_SlNonOsCB_t g_SlNonOsCB;
+
+
+_SlNonOsRetVal_t cc3100_nonos::_SlNonOsSemSet(_SlNonOsSemObj_t* pSemObj , _SlNonOsSemObj_t Value)
+{
+    *pSemObj = Value;
+    return NONOS_RET_OK;
+}
+
+_SlNonOsRetVal_t cc3100_nonos::_SlNonOsSemGet(_SlNonOsSemObj_t* pSyncObj, _SlNonOsSemObj_t WaitValue, _SlNonOsSemObj_t SetValue, _SlNonOsTime_t Timeout)
+{
+    
+    while (Timeout > 0) {
+        if (WaitValue == *pSyncObj) {
+            *pSyncObj = SetValue;            
+            break;
+        }
+        if (Timeout != NONOS_WAIT_FOREVER) {
+            Timeout--;
+        }
+        _SlNonOsMainLoopTask();
+        
+#ifdef _SlSyncWaitLoopCallback
+        if( __NON_OS_SYNC_OBJ_SIGNAL_VALUE == WaitValue ) {
+            if (WaitValue == *pSyncObj) {
+                *pSyncObj = SetValue;
+                break;
+            }
+            _SlSyncWaitLoopCallback();
+        }
+#endif
+
+    }
+
+    if (0 == Timeout) {        
+        return NONOS_RET_ERR;
+    } else {        
+        return NONOS_RET_OK;
+    }
+}
+
+
+_SlNonOsRetVal_t cc3100_nonos::_SlNonOsSpawn(_SlSpawnEntryFunc_t pEntry , void* pValue , uint32_t flags)
+{
+    int16_t i;
+    
+    for (i=0 ; i<NONOS_MAX_SPAWN_ENTRIES ; i++) {
+        _SlNonOsSpawnEntry_t* pE = &g_SlNonOsCB.SpawnEntries[i];
+
+        if (NULL == pE->pEntry) {
+            pE->pValue = pValue;
+            pE->pEntry = pEntry;
+            break;
+        }
+    }
+
+    return NONOS_RET_OK;
+}
+
+_SlNonOsRetVal_t cc3100_nonos::_SlNonOsMainLoopTask(void)
+{
+    int16_t i;
+      	
+    for (i=0 ; i<NONOS_MAX_SPAWN_ENTRIES ; i++) {
+        _SlNonOsSpawnEntry_t* pE = &g_SlNonOsCB.SpawnEntries[i];
+        _SlSpawnEntryFunc_t   pF = pE->pEntry;
+        
+        if (NULL != pF) {
+            if((g_pCB)->RxIrqCnt != (g_pCB)->RxDoneCnt) {                
+                _driver._SlDrvMsgReadSpawnCtx_(0);
+                //pF(0);/*(pValue);*//*Function pointer*/                
+            }
+            pE->pEntry = NULL;
+            pE->pValue = NULL;
+        }
+    }
+    
+    return NONOS_RET_OK;
+}
+/*
+_SlNonOsRetVal_t cc3100_nonos::sl_SyncObjCreate(_SlNonOsSemObj_t* pSemObj, _SlNonOsSemObj_t Value){//_SlNonOsSemSet(pSyncObj,NON_OS_SYNC_OBJ_CLEAR_VALUE)
+    
+    *pSemObj = Value;
+    return NONOS_RET_OK;
+
+}
+*/
+_SlNonOsRetVal_t cc3100_nonos::sl_SyncObjDelete(_SlNonOsSemObj_t* pSemObj, _SlNonOsSemObj_t Value){//_SlNonOsSemSet(pSyncObj,0)
+    
+    *pSemObj = Value;
+    return NONOS_RET_OK;
+}
+
+_SlNonOsRetVal_t cc3100_nonos::sl_SyncObjSignal(_SlNonOsSemObj_t* pSemObj, _SlNonOsSemObj_t Value){//_SlNonOsSemSet(pSyncObj,NON_OS_SYNC_OBJ_SIGNAL_VALUE)
+
+    *pSemObj = Value;
+    return NONOS_RET_OK;
+}
+    
+_SlNonOsRetVal_t cc3100_nonos::sl_SyncObjSignalFromIRQ(_SlNonOsSemObj_t* pSemObj, _SlNonOsSemObj_t Value){//_SlNonOsSemSet(pSyncObj,NON_OS_SYNC_OBJ_SIGNAL_VALUE)
+
+        *pSemObj = Value;
+        return NONOS_RET_OK;
+}
+/*    
+_SlNonOsRetVal_t cc3100_nonos::sl_LockObjCreate(_SlNonOsSemObj_t* pSemObj, _SlNonOsSemObj_t Value){//_SlNonOsSemSet(pLockObj,NON_OS_LOCK_OBJ_UNLOCK_VALUE)
+
+        *pSemObj = Value;
+        return NONOS_RET_OK;
+}        
+*/        
+_SlNonOsRetVal_t cc3100_nonos::sl_LockObjDelete(_SlNonOsSemObj_t* pSemObj, _SlNonOsSemObj_t Value){//_SlNonOsSemSet(pLockObj,0)
+
+    *pSemObj = Value;
+    return NONOS_RET_OK;
+}    
+           
+_SlNonOsRetVal_t cc3100_nonos::sl_LockObjUnlock(_SlNonOsSemObj_t* pSemObj, _SlNonOsSemObj_t Value){//_SlNonOsSemSet(pLockObj,NON_OS_LOCK_OBJ_UNLOCK_VALUE)
+
+    *pSemObj = Value;
+    return NONOS_RET_OK;
+}    
+    
+_SlNonOsRetVal_t cc3100_nonos::sl_SyncObjWait(_SlNonOsSemObj_t* pSyncObj, _SlNonOsSemObj_t WaitValue, _SlNonOsSemObj_t SetValue, _SlNonOsTime_t Timeout){//_SlNonOsSemGet(pSyncObj,NON_OS_SYNC_OBJ_SIGNAL_VALUE,NON_OS_SYNC_OBJ_CLEAR_VALUE,Timeout)
+
+//printf("_SlNonOsSemGet\r\n");
+    while (Timeout > 0) {
+        if (WaitValue == *pSyncObj) {
+            *pSyncObj = SetValue;            
+            break;
+        }
+        if (Timeout != NONOS_WAIT_FOREVER) {
+            Timeout--;
+        }
+        _SlNonOsMainLoopTask();
+        
+#ifdef _SlSyncWaitLoopCallback
+        if( __NON_OS_SYNC_OBJ_SIGNAL_VALUE == WaitValue ) {
+            if (WaitValue == *pSyncObj) {
+                *pSyncObj = SetValue;
+                break;
+            }
+            _SlSyncWaitLoopCallback();
+        }
+#endif
+
+    }
+
+    if (0 == Timeout) {        
+        return NONOS_RET_ERR;
+    } else {        
+        return NONOS_RET_OK;
+    }
+}
+
+_SlNonOsRetVal_t cc3100_nonos::sl_LockObjLock(_SlNonOsSemObj_t* pSyncObj, _SlNonOsSemObj_t WaitValue, _SlNonOsSemObj_t SetValue, _SlNonOsTime_t Timeout){//_SlNonOsSemGet(pLockObj,NON_OS_LOCK_OBJ_UNLOCK_VALUE,NON_OS_LOCK_OBJ_LOCK_VALUE,Timeout)
+
+    while (Timeout > 0) {
+        if (WaitValue == *pSyncObj) {
+            *pSyncObj = SetValue;            
+            break;
+        }
+        if (Timeout != NONOS_WAIT_FOREVER) {
+            Timeout--;
+        }
+        _SlNonOsMainLoopTask();
+        
+#ifdef _SlSyncWaitLoopCallback
+        if( __NON_OS_SYNC_OBJ_SIGNAL_VALUE == WaitValue ) {
+            if (WaitValue == *pSyncObj) {
+                *pSyncObj = SetValue;
+                break;
+            }
+            _SlSyncWaitLoopCallback();
+        }
+#endif
+
+    }
+
+    if (0 == Timeout) {        
+        return NONOS_RET_ERR;
+    } else {        
+        return NONOS_RET_OK;
+    }
+}
+
+
+
+#endif /*(SL_PLATFORM != SL_PLATFORM_NON_OS)*/
+
+}//namespace mbed_cc3100
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_nonos.h	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,326 @@
+/*
+ * nonos.h - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+#ifndef NONOS_H_
+#define	NONOS_H_
+
+#include "cc3100_simplelink.h"
+
+namespace mbed_cc3100 {
+	
+/*****************************************************************************/
+/* Macro declarations                                                        */
+/*****************************************************************************/
+
+
+#ifndef SL_PLATFORM_MULTI_THREADED
+
+/* This function call the user defined function, if defined, from the sync wait loop  */
+/* The use case of this function is to allow nonos system to call a user function to put the device into sleep */
+/* The wake up should be activated after getting an interrupt from the device to Host */
+/* The user function must return without blocking to prevent a delay on the event handling */
+/*
+#define _SlSyncWaitLoopCallback  UserSleepFunction
+*/
+
+const uint8_t NONOS_WAIT_FOREVER   			 =	0xFF;
+const uint8_t NONOS_NO_WAIT        			 =	0x01;
+
+const uint8_t NONOS_RET_OK                   =  (0);
+const int8_t  NONOS_RET_ERR                  =  (0xFF);
+const uint8_t OSI_OK                         =  NONOS_RET_OK;
+
+const uint8_t NON_OS_SYNC_OBJ_CLEAR_VALUE	 =	0x11;
+const uint8_t NON_OS_SYNC_OBJ_SIGNAL_VALUE	 =	0x22;
+const uint8_t NON_OS_LOCK_OBJ_UNLOCK_VALUE	 =	0x33;
+const uint8_t NON_OS_LOCK_OBJ_LOCK_VALUE	 =	0x44;
+
+#define _SlTime_t               _SlNonOsTime_t
+
+#define _SlSyncObj_t            _SlNonOsSemObj_t
+
+#define _SlLockObj_t            _SlNonOsSemObj_t
+
+const uint8_t SL_OS_WAIT_FOREVER   =   NONOS_WAIT_FOREVER;
+
+const uint8_t SL_OS_RET_CODE_OK    =   NONOS_RET_OK;
+
+const uint8_t SL_OS_NO_WAIT        =   NONOS_NO_WAIT;
+
+
+    /*****************************************************************************/
+    /* Function prototypes                                                       */
+    /*****************************************************************************/
+
+    /*!
+    	\brief 	This function creates a sync object
+
+    	The sync object is used for synchronization between different thread or ISR and
+    	a thread.
+
+    	\param	pSyncObj	-	pointer to the sync object control block
+
+    	\return upon successful creation the function return 0
+    			Otherwise, a negative value indicating the error code shall be returned
+    	\note
+    	\warning
+    */
+#define _SlNonOsSyncObjCreate(pSyncObj)			_SlNonOsSemSet(pSyncObj,NON_OS_SYNC_OBJ_CLEAR_VALUE)
+
+    /*!
+    	\brief 	This function deletes a sync object
+
+    	\param	pSyncObj	-	pointer to the sync object control block
+
+    	\return upon successful deletion the function should return 0
+    			Otherwise, a negative value indicating the error code shall be returned
+    	\note
+    	\warning
+    */
+//#define _SlNonOsSyncObjDelete(pSyncObj)			_SlNonOsSemSet(pSyncObj,0)
+
+    /*!
+    	\brief 		This function generates a sync signal for the object.
+
+    	All suspended threads waiting on this sync object are resumed
+
+    	\param		pSyncObj	-	pointer to the sync object control block
+
+    	\return 	upon successful signaling the function should return 0
+    				Otherwise, a negative value indicating the error code shall be returned
+    	\note		the function could be called from ISR context
+    	\warning
+    */
+//#define _SlNonOsSyncObjSignal(pSyncObj)			_SlNonOsSemSet(pSyncObj,NON_OS_SYNC_OBJ_SIGNAL_VALUE)
+
+    /*!
+    	\brief 	This function waits for a sync signal of the specific sync object
+
+    	\param	pSyncObj	-	pointer to the sync object control block
+    	\param	Timeout		-	numeric value specifies the maximum number of mSec to
+    							stay suspended while waiting for the sync signal
+    							Currently, the simple link driver uses only two values:
+    								- NONOS_WAIT_FOREVER
+    								- NONOS_NO_WAIT
+
+    	\return upon successful reception of the signal within the timeout window return 0
+    			Otherwise, a negative value indicating the error code shall be returned
+    	\note
+    	\warning
+    */
+//#define _SlNonOsSyncObjWait(pSyncObj , Timeout)	_SlNonOsSemGet(pSyncObj,NON_OS_SYNC_OBJ_SIGNAL_VALUE,NON_OS_SYNC_OBJ_CLEAR_VALUE,Timeout)
+
+    /*!
+    	\brief 	This function clears a sync object
+
+    	\param	pSyncObj	-	pointer to the sync object control block
+
+    	\return upon successful clearing the function should return 0
+    			Otherwise, a negative value indicating the error code shall be returned
+    	\note
+    	\warning
+    */
+//#define _SlNonOsSyncObjClear(pSyncObj)			_SlNonOsSemSet(pSyncObj,NON_OS_SYNC_OBJ_CLEAR_VALUE)
+
+    /*!
+    	\brief 	This function creates a locking object.
+
+    	The locking object is used for protecting a shared resources between different
+    	threads.
+
+    	\param	pLockObj	-	pointer to the locking object control block
+
+    	\return upon successful creation the function should return 0
+    			Otherwise, a negative value indicating the error code shall be returned
+    	\note
+    	\warning
+    */
+#define _SlNonOsLockObjCreate(pLockObj)			_SlNonOsSemSet(pLockObj,NON_OS_LOCK_OBJ_UNLOCK_VALUE)
+
+    /*!
+    	\brief 	This function deletes a locking object.
+
+    	\param	pLockObj	-	pointer to the locking object control block
+
+    	\return upon successful deletion the function should return 0
+    			Otherwise, a negative value indicating the error code shall be returned
+    	\note
+    	\warning
+    */
+//#define _SlNonOsLockObjDelete(pLockObj)			_SlNonOsSemSet(pLockObj,0)
+
+    /*!
+    	\brief 	This function locks a locking object.
+
+    	All other threads that call this function before this thread calls
+    	the _SlNonOsLockObjUnlock would be suspended
+
+    	\param	pLockObj	-	pointer to the locking object control block
+    	\param	Timeout		-	numeric value specifies the maximum number of mSec to
+    							stay suspended while waiting for the locking object
+    							Currently, the simple link driver uses only two values:
+    								- NONOS_WAIT_FOREVER
+    								- NONOS_NO_WAIT
+
+
+    	\return upon successful reception of the locking object the function should return 0
+    			Otherwise, a negative value indicating the error code shall be returned
+    	\note
+    	\warning
+    */
+//#define _SlNonOsLockObjLock(pLockObj , Timeout)	_SlNonOsSemGet(pLockObj,NON_OS_LOCK_OBJ_UNLOCK_VALUE,NON_OS_LOCK_OBJ_LOCK_VALUE,Timeout)
+
+    /*!
+    	\brief 	This function unlock a locking object.
+
+    	\param	pLockObj	-	pointer to the locking object control block
+
+    	\return upon successful unlocking the function should return 0
+    			Otherwise, a negative value indicating the error code shall be returned
+    	\note
+    	\warning
+    */
+//#define _SlNonOsLockObjUnlock(pLockObj)			_SlNonOsSemSet(pLockObj,NON_OS_LOCK_OBJ_UNLOCK_VALUE)
+
+/*****************************************************************************
+
+    Overwrite SimpleLink driver OS adaptation functions
+
+
+ *****************************************************************************/
+
+#undef sl_SyncObjCreate
+#define sl_SyncObjCreate(pSyncObj,pName)           _SlNonOsSemSet(pSyncObj,NON_OS_SYNC_OBJ_CLEAR_VALUE)
+
+#undef sl_LockObjCreate
+#define sl_LockObjCreate(pLockObj,pName)            _SlNonOsSemSet(pLockObj,NON_OS_LOCK_OBJ_UNLOCK_VALUE)
+	
+/*!
+	\brief type definition for the return values of this adaptation layer
+*/
+typedef int8_t _SlNonOsRetVal_t;
+
+/*!
+	\brief type definition for a time value
+*/
+typedef uint8_t _SlNonOsTime_t;
+
+/*!
+	\brief 	type definition for a sync object container
+
+	Sync object is object used to synchronize between two threads or thread and interrupt handler.
+	One thread is waiting on the object and the other thread send a signal, which then
+	release the waiting thread.
+	The signal must be able to be sent from interrupt context.
+	This object is generally implemented by binary semaphore or events.
+*/
+typedef uint8_t _SlNonOsSemObj_t;	
+	
+class cc3100_driver;
+
+class cc3100_nonos
+{
+
+public:
+
+    cc3100_nonos(cc3100_driver &driver);
+
+    ~cc3100_nonos();
+
+    /*!
+    	\brief 	This function call the pEntry callback from a different context
+
+    	\param	pEntry		-	pointer to the entry callback function
+
+    	\param	pValue		- 	pointer to any type of memory structure that would be
+    							passed to pEntry callback from the execution thread.
+
+    	\param	flags		- 	execution flags - reserved for future usage
+
+    	\return upon successful registration of the spawn the function return 0
+    			(the function is not blocked till the end of the execution of the function
+    			and could be returned before the execution is actually completed)
+    			Otherwise, a negative value indicating the error code shall be returned
+    	\note
+    	\warning
+    */
+    _SlNonOsRetVal_t _SlNonOsSpawn(_SlSpawnEntryFunc_t pEntry , void* pValue , uint32_t flags);
+
+
+    /*!
+    	\brief 	This function must be called from the main loop in non-os paltforms
+
+    	\param	None
+
+    	\return 0 - No more activities
+    			1 - Activity still in progress
+    	\note
+    	\warning
+    */
+    _SlNonOsRetVal_t _SlNonOsMainLoopTask(void);
+
+    _SlNonOsRetVal_t _SlNonOsSemGet(_SlNonOsSemObj_t* pSyncObj, _SlNonOsSemObj_t WaitValue, _SlNonOsSemObj_t SetValue, _SlNonOsTime_t Timeout);
+    _SlNonOsRetVal_t _SlNonOsSemSet(_SlNonOsSemObj_t* pSemObj , _SlNonOsSemObj_t Value);
+//    _SlNonOsRetVal_t _SlNonOsSpawn(_SlSpawnEntryFunc_t pEntry , void* pValue , uint32_t flags);
+//    _SlNonOsRetVal_t sl_SyncObjCreate(_SlNonOsSemObj_t* pSemObj, _SlNonOsSemObj_t NON_OS_SYNC_OBJ_CLEAR_VALUE);
+    _SlNonOsRetVal_t sl_SyncObjDelete(_SlNonOsSemObj_t* pSemObj, _SlNonOsSemObj_t );
+    _SlNonOsRetVal_t sl_SyncObjSignal(_SlNonOsSemObj_t* pSemObj, _SlNonOsSemObj_t NON_OS_SYNC_OBJ_SIGNAL_VALUE);
+    _SlNonOsRetVal_t sl_SyncObjSignalFromIRQ(_SlNonOsSemObj_t* pSemObj, _SlNonOsSemObj_t NON_OS_SYNC_OBJ_SIGNAL_VALUE);
+//    _SlNonOsRetVal_t sl_LockObjCreate(_SlNonOsSemObj_t* pSemObj, _SlNonOsSemObj_t NON_OS_LOCK_OBJ_UNLOCK_VALUE);
+    _SlNonOsRetVal_t sl_LockObjDelete(_SlNonOsSemObj_t* pSemObj, _SlNonOsSemObj_t );
+    _SlNonOsRetVal_t sl_LockObjUnlock(_SlNonOsSemObj_t* pSemObj, _SlNonOsSemObj_t NON_OS_LOCK_OBJ_UNLOCK_VALUE);
+    _SlNonOsRetVal_t sl_SyncObjWait(_SlNonOsSemObj_t* pSyncObj, _SlNonOsSemObj_t NON_OS_SYNC_OBJ_SIGNAL_VALUE, _SlNonOsSemObj_t NON_OS_SYNC_OBJ_CLEAR_VALUE, _SlNonOsTime_t Timeout);
+    _SlNonOsRetVal_t sl_LockObjLock(_SlNonOsSemObj_t* pSyncObj, _SlNonOsSemObj_t NON_OS_LOCK_OBJ_UNLOCK_VALUE, _SlNonOsSemObj_t NON_OS_LOCK_OBJ_LOCK_VALUE, _SlNonOsTime_t Timeout);
+    
+
+#if (defined(_SlSyncWaitLoopCallback))
+    void _SlSyncWaitLoopCallback(void);
+#endif
+
+private:
+
+    cc3100_driver &_driver;
+
+};//class
+
+}//namespace mbed_cc3100
+
+#endif /* !SL_PLATFORM_MULTI_THREADED */
+
+
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_objInclusion.h	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,318 @@
+/*
+ * objInclusion.h - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+#ifndef OBJINCLUSION_H_
+#define OBJINCLUSION_H_
+
+
+#include "cc3100_simplelink.h"
+
+
+/******************************************************************************
+
+ For future use
+
+*******************************************************************************/
+
+#define __inln        	/* if inline functions requiered: #define __inln inline */
+
+#define SL_DEVICE      	/* Device silo is currently always mandatory */
+
+
+
+/******************************************************************************
+
+ Qualifiers for package customizations
+
+*******************************************************************************/
+
+#if defined (SL_DEVICE)
+#define __dev   1
+#else
+#define __dev   0
+#endif
+
+#if defined (SL_DEVICE) && defined (SL_INC_EXT_API)
+#define __dev__ext   1
+#else
+#define __dev__ext   0
+#endif
+
+
+#if (!defined (SL_PLATFORM_MULTI_THREADED)) || (!defined (SL_PLATFORM_EXTERNAL_SPAWN))
+#define __int__spwn     1
+#else
+#define __int__spwn     0
+#endif
+
+#if defined (SL_INC_NET_APP_PKG)
+#define __nap    1
+#else
+#define __nap    0
+#endif
+
+#if defined  (SL_INC_NET_APP_PKG) && defined (SL_INC_SOCK_CLIENT_SIDE_API)
+#define __nap__clt  1
+#else
+#define __nap__clt  0
+#endif
+
+#if defined  (SL_INC_NET_APP_PKG) && defined (SL_INC_EXT_API)
+#define __nap__ext   1
+#else
+#define __nap__ext   0
+#endif
+
+#if defined (SL_INC_NET_CFG_PKG)
+#define __ncg        1
+#else
+#define __ncg        0
+#endif
+
+#if defined (SL_INC_NET_CFG_PKG) && defined (SL_INC_EXT_API)
+#define __ncg__ext        1
+#else
+#define __ncg__ext        0
+#endif
+
+#if defined (SL_INC_NVMEM_PKG)
+#define __nvm       1
+#else
+#define __nvm       0
+#endif
+
+#if defined (SL_INC_SOCKET_PKG)
+#define __sck        1
+#else
+#define __sck        0
+#endif
+
+#if defined  (SL_INC_SOCKET_PKG) && defined (SL_INC_EXT_API)
+#define __sck__ext    1
+#else
+#define __sck__ext    0
+#endif
+
+#if defined  (SL_INC_SOCKET_PKG) && defined (SL_INC_SOCK_SERVER_SIDE_API)
+#define __sck__srv     1
+#else
+#define __sck__srv     0
+#endif
+
+#if defined  (SL_INC_SOCKET_PKG) && defined (SL_INC_SOCK_CLIENT_SIDE_API)
+#define __sck__clt      1
+#else
+#define __sck__clt      0
+#endif
+
+#if defined  (SL_INC_SOCKET_PKG) && defined (SL_INC_SOCK_RECV_API)
+#define __sck__rcv     1
+#else
+#define __sck__rcv     0
+#endif
+
+#if defined  (SL_INC_SOCKET_PKG) && defined (SL_INC_SOCK_SEND_API)
+#define __sck__snd      1
+#else
+#define __sck__snd      0
+#endif
+
+#if defined (SL_INC_WLAN_PKG)
+#define __wln           1
+#else
+#define __wln           0
+#endif
+
+#if defined  (SL_INC_WLAN_PKG) && defined (SL_INC_EXT_API)
+#define __wln__ext      1
+#else
+#define __wln__ext      0
+#endif
+
+/* The return 1 is the function need to be included in the output */
+#define _SL_INCLUDE_FUNC(Name)		(_SL_INC_##Name)
+
+/* Driver */
+#define _SL_INC_sl_NetAppStart          __nap
+
+#define _SL_INC_sl_NetAppStop           __nap
+
+#define _SL_INC_sl_NetAppDnsGetHostByName     __nap__clt
+
+
+#define _SL_INC_sl_NetAppDnsGetHostByService			__nap__clt
+#define _SL_INC_sl_NetAppMDNSRegisterService		    __nap__clt
+#define _SL_INC_sl_NetAppMDNSUnRegisterService		    __nap__clt
+#define _SL_INC_sl_NetAppMDNSRegisterUnregisterService	__nap__clt
+#define _SL_INC_sl_NetAppGetServiceList	                __nap__clt
+
+
+#define _SL_INC_sl_DnsGetHostByAddr     __nap__ext
+
+#define _SL_INC_sl_NetAppPingStart      __nap
+
+#define _SL_INC_sl_NetAppPingReport     __nap
+
+/* FS */
+#define _SL_INC_sl_FsOpen               __nvm
+
+#define _SL_INC_sl_FsClose              __nvm
+
+#define _SL_INC_sl_FsRead               __nvm
+
+#define _SL_INC_sl_FsWrite              __nvm
+
+#define _SL_INC_sl_FsGetInfo            __nvm
+
+#define _SL_INC_sl_FsDel                __nvm
+
+/* netcfg */
+#define _SL_INC_sl_MacAdrrSet           __ncg
+
+#define _SL_INC_sl_MacAdrrGet           __ncg
+
+#define _SL_INC_sl_NetCfgGet            __ncg
+
+#define _SL_INC_sl_NetCfgSet            __ncg
+
+#define _SL_INC_sl_NetAppSet            __nap
+
+#define _SL_INC_sl_NetAppGet            __nap
+
+/* socket */
+#define _SL_INC_sl_Socket               __sck
+
+#define _SL_INC_sl_Close                __sck__ext
+
+#define _SL_INC_sl_Accept               __sck__srv
+
+#define _SL_INC_sl_Bind                 __sck
+
+#define _SL_INC_sl_Listen               __sck__srv
+
+#define _SL_INC_sl_Connect              __sck__clt
+
+#define _SL_INC_sl_Select               __sck
+
+#define _SL_INC_sl_SetSockOpt           __sck
+
+#define _SL_INC_sl_GetSockOpt           __sck__ext
+
+#define _SL_INC_sl_Recv                 __sck__rcv
+
+#define _SL_INC_sl_RecvFrom             __sck__rcv
+
+#define _SL_INC_sl_Write                __sck__snd
+
+#define _SL_INC_sl_Send                 __sck__snd
+
+#define _SL_INC_sl_SendTo               __sck__snd
+
+#define _SL_INC_sl_Htonl                __sck
+
+#define _SL_INC_sl_Htons                __sck
+
+/* wlan */
+#define _SL_INC_sl_WlanConnect           __wln__ext
+
+#define _SL_INC_sl_WlanDisconnect        __wln__ext
+
+#define _SL_INC_sl_WlanProfileAdd        __wln__ext
+
+#define _SL_INC_sl_WlanProfileGet        __wln__ext
+
+#define _SL_INC_sl_WlanProfileDel        __wln__ext
+
+#define _SL_INC_sl_WlanPolicySet         __wln__ext
+
+#define _SL_INC_sl_WlanPolicyGet         __wln__ext
+
+#define _SL_INC_sl_WlanGetNetworkList    __wln__ext
+
+#define _SL_INC_sl_WlanRxFilterAdd       __wln__ext
+
+#define _SL_INC_sl_WlanRxFilterSet       __wln__ext
+
+#define _SL_INC_sl_WlanRxFilterGet       __wln__ext
+
+#define _SL_INC_sl_SmartConfigStart      __wln
+
+#define _SL_INC_sl_SmartConfigOptSet     __wln__ext
+
+
+#define _SL_INC_sl_WlanSmartConfigStart  __wln
+
+#define _SL_INC_sl_WlanSmartConfigStop   __wln
+
+#define _SL_INC_sl_WlanSetMode			 __wln
+
+#define _SL_INC_sl_WlanSet			     __wln
+
+#define _SL_INC_sl_WlanGet			     __wln
+
+#define _SL_INC_sl_SmartConfigOptSet     __wln__ext
+
+#define _SL_INC_sl_SmartConfigOptGet     __wln__ext
+
+#define  _SL_INC_sl_WlanRxStatStart      __wln__ext
+
+#define _SL_INC_sl_WlanRxStatStop        __wln__ext
+
+#define _SL_INC_sl_WlanRxStatGet         __wln__ext
+
+
+/* device */
+#define _SL_INC_sl_Task                  __int__spwn
+
+#define _SL_INC_sl_Start                 __dev
+
+#define _SL_INC_sl_Stop                  __dev
+
+#define _SL_INC_sl_StatusGet             __dev
+
+#ifdef SL_IF_TYPE_UART
+#define _SL_INC_sl_UartSetMode			 __dev
+#endif
+
+#define _SL_INC_sl_EventMaskGet          __dev__ext
+
+#define _SL_INC_sl_EventMaskSet          __dev__ext
+
+#define _SL_INC_sl_DevGet			     __dev__ext
+
+#define _SL_INC_sl_DevSet			     __dev__ext
+
+#endif /*OBJINCLUSION_H_  */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_protocol.h	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,852 @@
+/*
+ * protocol.h - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+/*******************************************************************************\
+*
+*   FILE NAME:      protocol.h
+*
+*   DESCRIPTION:    Constant and data structure definitions and function
+*                   prototypes for the SL protocol module, which implements
+*                   processing of SimpleLink Commands.
+*
+*   AUTHOR:
+*
+\*******************************************************************************/
+
+#ifndef SL_PROTOCOL_TYPES_H_
+#define SL_PROTOCOL_TYPES_H_
+
+namespace mbed_cc3100 {
+
+/****************************************************************************
+**
+**  User I/F pools definitions
+**
+****************************************************************************/
+
+/****************************************************************************
+**
+**  Definitions for SimpleLink Commands
+**
+****************************************************************************/
+
+
+/* pattern for LE 8/16/32 or BE*/
+#define H2N_SYNC_PATTERN     {0xBBDDEEFF,0x4321,0x34,0x12}
+#define H2N_CNYS_PATTERN     {0xBBDDEEFF,0x8765,0x78,0x56}
+
+const uint32_t H2N_DUMMY_PATTERN         =  (uint32_t)0xFFFFFFFF;
+const uint32_t N2H_SYNC_PATTERN          =  (uint32_t)0xABCDDCBA;
+const uint32_t SYNC_PATTERN_LEN          =  (uint32_t)sizeof(uint32_t);
+const uint32_t UART_SET_MODE_MAGIC_CODE  =  (uint32_t)0xAA55AA55;
+#define SPI_16BITS_BUG(pattern)     (uint32_t)((uint32_t)pattern & (uint32_t)0xFFFF7FFF)
+#define SPI_8BITS_BUG(pattern)      (uint32_t)((uint32_t)pattern & (uint32_t)0xFFFFFF7F)
+
+
+
+typedef struct {
+    uint16_t Opcode;
+    uint16_t Len;
+} _SlGenericHeader_t;
+
+
+typedef struct {
+    uint32_t  Long;
+    uint16_t  Short;
+    uint8_t  Byte1;
+    uint8_t  Byte2;
+} _SlSyncPattern_t;
+
+typedef _SlGenericHeader_t _SlCommandHeader_t;
+
+typedef struct {
+    _SlGenericHeader_t  GenHeader;
+    uint8_t               TxPoolCnt;
+    uint8_t               DevStatus;
+    uint8_t               SocketTXFailure;
+    uint8_t               SocketNonBlocking;
+} _SlResponseHeader_t;
+
+#define _SL_RESP_SPEC_HDR_SIZE (sizeof(_SlResponseHeader_t) - sizeof(_SlGenericHeader_t))
+#define _SL_RESP_HDR_SIZE       sizeof(_SlResponseHeader_t)
+#define _SL_CMD_HDR_SIZE        sizeof(_SlCommandHeader_t)
+
+#define _SL_RESP_ARGS_START(_pMsg) (((_SlResponseHeader_t *)(_pMsg)) + 1)
+
+/* Used only in NWP! */
+typedef struct {
+    _SlCommandHeader_t  sl_hdr;
+    uint8_t   func_args_start;
+} T_SCMD;
+
+
+const uint8_t WLAN_CONN_STATUS_BIT  =  0x01;
+const uint8_t EVENTS_Q_STATUS_BIT   =  0x02;
+const uint8_t PENDING_RCV_CMD_BIT   =  0x04;
+const uint8_t FW_BUSY_PACKETS_BIT   =  0x08;
+
+const uint32_t INIT_STA_OK          =  0x11111111;
+const uint32_t INIT_STA_ERR         =  0x22222222;
+const uint32_t INIT_AP_OK           =  0x33333333;
+const uint32_t INIT_AP_ERR          =  0x44444444;
+const uint32_t INIT_P2P_OK          =  0x55555555;
+const uint32_t INIT_P2P_ERR         =  0x66666666;
+
+/****************************************************************************
+**  OPCODES
+****************************************************************************/
+const uint16_t SL_IPV4_IPV6_OFFSET                        =     ( 9 );
+const uint16_t SL_OPCODE_IPV4							  =     ( 0x0 << SL_IPV4_IPV6_OFFSET );
+const uint16_t SL_OPCODE_IPV6							  =     ( 0x1 << SL_IPV4_IPV6_OFFSET );
+
+const uint16_t SL_SYNC_ASYNC_OFFSET                       =     ( 10 );
+const uint16_t SL_OPCODE_SYNC							  =     (0x1 << SL_SYNC_ASYNC_OFFSET );
+const uint16_t SL_OPCODE_SILO_OFFSET                      =     ( 11 );
+const uint16_t SL_OPCODE_SILO_MASK                        =     ( 0xF << SL_OPCODE_SILO_OFFSET );
+const uint16_t SL_OPCODE_SILO_DEVICE                      =     ( 0x0 << SL_OPCODE_SILO_OFFSET );
+const uint16_t SL_OPCODE_SILO_WLAN                        =     ( 0x1 << SL_OPCODE_SILO_OFFSET );
+const uint16_t SL_OPCODE_SILO_SOCKET                      =     ( 0x2 << SL_OPCODE_SILO_OFFSET );
+const uint16_t SL_OPCODE_SILO_NETAPP                      =     ( 0x3 << SL_OPCODE_SILO_OFFSET );
+const uint16_t SL_OPCODE_SILO_NVMEM                       =     ( 0x4 << SL_OPCODE_SILO_OFFSET );
+const uint16_t SL_OPCODE_SILO_NETCFG                      =     ( 0x5 << SL_OPCODE_SILO_OFFSET );
+
+const uint16_t SL_FAMILY_SHIFT                            =     (0x4);
+const uint16_t SL_FLAGS_MASK                              =     (0xF);
+
+const uint16_t SL_OPCODE_DEVICE_INITCOMPLETE                         =      	0x0008;
+const uint16_t SL_OPCODE_DEVICE_STOP_COMMAND                         =      	0x8473;
+const uint16_t SL_OPCODE_DEVICE_STOP_RESPONSE                        =      	0x0473;
+const uint16_t SL_OPCODE_DEVICE_STOP_ASYNC_RESPONSE                  =      	0x0073;
+const uint16_t SL_OPCODE_DEVICE_DEVICEASYNCDUMMY                     =      	0x0063;
+
+const uint16_t SL_OPCODE_DEVICE_VERSIONREADCOMMAND	                 =          0x8470;
+const uint16_t SL_OPCODE_DEVICE_VERSIONREADRESPONSE	                 =          0x0470;
+const uint16_t SL_OPCODE_DEVICE_DEVICEASYNCFATALERROR                =      	0x0078;
+const uint16_t SL_OPCODE_WLAN_WLANCONNECTCOMMAND                     =      	0x8C80;
+const uint16_t SL_OPCODE_WLAN_WLANCONNECTRESPONSE                    =      	0x0C80;
+const uint16_t SL_OPCODE_WLAN_WLANASYNCCONNECTEDRESPONSE             =      	0x0880;
+const uint16_t SL_OPCODE_WLAN_P2P_DEV_FOUND                          =          0x0830;
+const uint16_t SL_OPCODE_WLAN_CONNECTION_FAILED                      =          0x0831;
+const uint16_t SL_OPCODE_WLAN_P2P_NEG_REQ_RECEIVED                   =          0x0832;
+
+const uint16_t SL_OPCODE_WLAN_WLANDISCONNECTCOMMAND                  =      	0x8C81;
+const uint16_t SL_OPCODE_WLAN_WLANDISCONNECTRESPONSE                 =      	0x0C81;
+const uint16_t SL_OPCODE_WLAN_WLANASYNCDISCONNECTEDRESPONSE          =      	0x0881;
+const uint16_t SL_OPCODE_WLAN_WLANCONNECTEAPCOMMAND                  =      	0x8C82;
+const uint16_t SL_OPCODE_WLAN_WLANCONNECTEAPCRESPONSE                =      	0x0C82;
+const uint16_t SL_OPCODE_WLAN_PROFILEADDCOMMAND                      =      	0x8C83;
+const uint16_t SL_OPCODE_WLAN_PROFILEADDRESPONSE                     =      	0x0C83;
+const uint16_t SL_OPCODE_WLAN_PROFILEGETCOMMAND                      =      	0x8C84;
+const uint16_t SL_OPCODE_WLAN_PROFILEGETRESPONSE                     =      	0x0C84;
+const uint16_t SL_OPCODE_WLAN_PROFILEDELCOMMAND                      =      	0x8C85;
+const uint16_t SL_OPCODE_WLAN_PROFILEDELRESPONSE                     =      	0x0C85;
+const uint16_t SL_OPCODE_WLAN_POLICYSETCOMMAND                       =      	0x8C86;
+const uint16_t SL_OPCODE_WLAN_POLICYSETRESPONSE                      =      	0x0C86;
+const uint16_t SL_OPCODE_WLAN_POLICYGETCOMMAND                       =      	0x8C87;
+const uint16_t SL_OPCODE_WLAN_POLICYGETRESPONSE                      =      	0x0C87;
+const uint16_t SL_OPCODE_WLAN_FILTERADD                              =      	0x8C88;
+const uint16_t SL_OPCODE_WLAN_FILTERADDRESPONSE                      =      	0x0C88;
+const uint16_t SL_OPCODE_WLAN_FILTERGET                              =      	0x8C89;
+const uint16_t SL_OPCODE_WLAN_FILTERGETRESPONSE                      =      	0x0C89;
+const uint16_t SL_OPCODE_WLAN_FILTERDELETE                           =      	0x8C8A;
+const uint16_t SL_OPCODE_WLAN_FILTERDELETERESPOSNE                   =      	0x0C8A;
+const uint16_t SL_OPCODE_WLAN_WLANGETSTATUSCOMMAND                   =      	0x8C8F;
+const uint16_t SL_OPCODE_WLAN_WLANGETSTATUSRESPONSE                  =      	0x0C8F;
+const uint16_t SL_OPCODE_WLAN_STARTTXCONTINUESCOMMAND                =      	0x8CAA;
+const uint16_t SL_OPCODE_WLAN_STARTTXCONTINUESRESPONSE               =      	0x0CAA;
+const uint16_t SL_OPCODE_WLAN_STOPTXCONTINUESCOMMAND                 =      	0x8CAB;
+const uint16_t SL_OPCODE_WLAN_STOPTXCONTINUESRESPONSE                =      	0x0CAB;
+const uint16_t SL_OPCODE_WLAN_STARTRXSTATCOMMAND                     =      	0x8CAC;
+const uint16_t SL_OPCODE_WLAN_STARTRXSTATRESPONSE                    =      	0x0CAC;
+const uint16_t SL_OPCODE_WLAN_STOPRXSTATCOMMAND                      =      	0x8CAD;
+const uint16_t SL_OPCODE_WLAN_STOPRXSTATRESPONSE                     =      	0x0CAD;
+const uint16_t SL_OPCODE_WLAN_GETRXSTATCOMMAND                       =      	0x8CAF;
+const uint16_t SL_OPCODE_WLAN_GETRXSTATRESPONSE                      =      	0x0CAF;
+const uint16_t SL_OPCODE_WLAN_POLICYSETCOMMANDNEW                    =      	0x8CB0;
+const uint16_t SL_OPCODE_WLAN_POLICYSETRESPONSENEW                   =      	0x0CB0;
+const uint16_t SL_OPCODE_WLAN_POLICYGETCOMMANDNEW                    =      	0x8CB1;
+const uint16_t SL_OPCODE_WLAN_POLICYGETRESPONSENEW                   =      	0x0CB1;
+
+const uint16_t SL_OPCODE_WLAN_SMART_CONFIG_START_COMMAND             =      	0x8CB2;
+const uint16_t SL_OPCODE_WLAN_SMART_CONFIG_START_RESPONSE            =      	0x0CB2;
+const uint16_t SL_OPCODE_WLAN_SMART_CONFIG_START_ASYNC_RESPONSE      =      	0x08B2;
+const uint16_t SL_OPCODE_WLAN_SMART_CONFIG_STOP_COMMAND              =      	0x8CB3;
+const uint16_t SL_OPCODE_WLAN_SMART_CONFIG_STOP_RESPONSE             =      	0x0CB3;
+const uint16_t SL_OPCODE_WLAN_SMART_CONFIG_STOP_ASYNC_RESPONSE       =      	0x08B3;
+const uint16_t SL_OPCODE_WLAN_SET_MODE                               =          0x8CB4;
+const uint16_t SL_OPCODE_WLAN_SET_MODE_RESPONSE                      =          0x0CB4;
+const uint16_t SL_OPCODE_WLAN_CFG_SET                                =          0x8CB5;
+const uint16_t SL_OPCODE_WLAN_CFG_SET_RESPONSE                       =          0x0CB5;
+const uint16_t SL_OPCODE_WLAN_CFG_GET                                =          0x8CB6;
+const uint16_t SL_OPCODE_WLAN_CFG_GET_RESPONSE                       =          0x0CB6;
+const uint16_t SL_OPCODE_WLAN_STA_CONNECTED                          =      	0x082E;
+const uint16_t SL_OPCODE_WLAN_STA_DISCONNECTED                       =      	0x082F;
+const uint16_t SL_OPCODE_WLAN_EAP_PROFILEADDCOMMAND                  =          0x8C67;
+const uint16_t SL_OPCODE_WLAN_EAP_PROFILEADDCOMMAND_RESPONSE         =          0x0C67;
+
+const uint16_t SL_OPCODE_SOCKET_SOCKET                               =      	0x9401;
+const uint16_t SL_OPCODE_SOCKET_SOCKETRESPONSE                       =      	0x1401;
+const uint16_t SL_OPCODE_SOCKET_CLOSE                                =      	0x9402;
+const uint16_t SL_OPCODE_SOCKET_CLOSERESPONSE                        =      	0x1402;
+const uint16_t SL_OPCODE_SOCKET_ACCEPT                               =      	0x9403;
+const uint16_t SL_OPCODE_SOCKET_ACCEPTRESPONSE                       =      	0x1403;
+const uint16_t SL_OPCODE_SOCKET_ACCEPTASYNCRESPONSE                  =      	0x1003;
+const uint16_t SL_OPCODE_SOCKET_ACCEPTASYNCRESPONSE_V6               =      	0x1203;
+const uint16_t SL_OPCODE_SOCKET_BIND                                 =      	0x9404;
+const uint16_t SL_OPCODE_SOCKET_BIND_V6                              =      	0x9604;
+const uint16_t SL_OPCODE_SOCKET_BINDRESPONSE                         =      	0x1404;
+const uint16_t SL_OPCODE_SOCKET_LISTEN                               =      	0x9405;
+const uint16_t SL_OPCODE_SOCKET_LISTENRESPONSE                       =      	0x1405;
+const uint16_t SL_OPCODE_SOCKET_CONNECT                              =      	0x9406;
+const uint16_t SL_OPCODE_SOCKET_CONNECT_V6                           =      	0x9606;
+const uint16_t SL_OPCODE_SOCKET_CONNECTRESPONSE                      =      	0x1406;
+const uint16_t SL_OPCODE_SOCKET_CONNECTASYNCRESPONSE                 =      	0x1006;
+const uint16_t SL_OPCODE_SOCKET_SELECT                               =      	0x9407;
+const uint16_t SL_OPCODE_SOCKET_SELECTRESPONSE                       =      	0x1407;
+const uint16_t SL_OPCODE_SOCKET_SELECTASYNCRESPONSE                  =      	0x1007;
+const uint16_t SL_OPCODE_SOCKET_SETSOCKOPT                           =      	0x9408;
+const uint16_t SL_OPCODE_SOCKET_SETSOCKOPTRESPONSE                   =      	0x1408;
+const uint16_t SL_OPCODE_SOCKET_GETSOCKOPT                           =      	0x9409;
+const uint16_t SL_OPCODE_SOCKET_GETSOCKOPTRESPONSE                   =      	0x1409;
+const uint16_t SL_OPCODE_SOCKET_RECV                                 =      	0x940A;
+const uint16_t SL_OPCODE_SOCKET_RECVASYNCRESPONSE                    =      	0x100A;
+const uint16_t SL_OPCODE_SOCKET_RECVFROM                             =      	0x940B;
+const uint16_t SL_OPCODE_SOCKET_RECVFROMASYNCRESPONSE                =      	0x100B;
+const uint16_t SL_OPCODE_SOCKET_RECVFROMASYNCRESPONSE_V6             =      	0x120B;
+const uint16_t SL_OPCODE_SOCKET_SEND                                 =      	0x940C;
+const uint16_t SL_OPCODE_SOCKET_SENDTO                               =      	0x940D;
+const uint16_t SL_OPCODE_SOCKET_SENDTO_V6                            =      	0x960D;
+const uint16_t SL_OPCODE_SOCKET_TXFAILEDASYNCRESPONSE                =      	0x100E;
+const uint16_t SL_OPCODE_SOCKET_SOCKETASYNCEVENT                     =          0x100F;
+const uint16_t SL_OPCODE_NETAPP_START_COMMAND                        =          0x9C0A;
+const uint16_t SL_OPCODE_NETAPP_START_RESPONSE                       =         	0x1C0A;
+const uint16_t SL_OPCODE_NETAPP_NETAPPSTARTRESPONSE                  =      	0x1C0A;
+const uint16_t SL_OPCODE_NETAPP_STOP_COMMAND                         =      	0x9C61;
+const uint16_t SL_OPCODE_NETAPP_STOP_RESPONSE                        =      	0x1C61;
+const uint16_t SL_OPCODE_NETAPP_NETAPPSET                            =	        0x9C0B;
+const uint16_t SL_OPCODE_NETAPP_NETAPPSETRESPONSE                    =	        0x1C0B;
+const uint16_t SL_OPCODE_NETAPP_NETAPPGET                            =	        0x9C27;
+const uint16_t SL_OPCODE_NETAPP_NETAPPGETRESPONSE                    =	        0x1C27;
+const uint16_t SL_OPCODE_NETAPP_DNSGETHOSTBYNAME                     =      	0x9C20;
+const uint16_t SL_OPCODE_NETAPP_DNSGETHOSTBYNAMERESPONSE             =      	0x1C20;
+const uint16_t SL_OPCODE_NETAPP_DNSGETHOSTBYNAMEASYNCRESPONSE        =      	0x1820;
+const uint16_t SL_OPCODE_NETAPP_DNSGETHOSTBYNAMEASYNCRESPONSE_V6     =      	0x1A20;
+const uint16_t SL_OPCODE_NETAPP_NETAPP_MDNS_LOOKUP_SERVICE           =          0x9C71;
+const uint16_t SL_OPCODE_NETAPP_NETAPP_MDNS_LOOKUP_SERVICE_RESPONSE  =          0x1C72;
+const uint16_t SL_OPCODE_NETAPP_MDNSREGISTERSERVICE                  =          0x9C34;
+const uint16_t SL_OPCODE_NETAPP_MDNSREGISTERSERVICERESPONSE          =          0x1C34;
+const uint16_t SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICE                 =          0x9C35;
+const uint16_t SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICERESPONSE         =          0x1C35;
+const uint16_t SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICEASYNCRESPONSE    =          0x1835;
+const uint16_t SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICEASYNCRESPONSE_V6 =          0x1A35;
+const uint16_t SL_OPCODE_NETAPP_DNSGETHOSTBYADDR                     =      	0x9C26;
+const uint16_t SL_OPCODE_NETAPP_DNSGETHOSTBYADDR_V6                  =      	0x9E26;
+const uint16_t SL_OPCODE_NETAPP_DNSGETHOSTBYADDRRESPONSE             =      	0x1C26;
+const uint16_t SL_OPCODE_NETAPP_DNSGETHOSTBYADDRASYNCRESPONSE        =      	0x1826;
+const uint16_t SL_OPCODE_NETAPP_PINGSTART                            =      	0x9C21;
+const uint16_t SL_OPCODE_NETAPP_PINGSTART_V6                         =      	0x9E21;
+const uint16_t SL_OPCODE_NETAPP_PINGSTARTRESPONSE                    =      	0x1C21;
+const uint16_t SL_OPCODE_NETAPP_PINGREPORTREQUEST                    =      	0x9C22;
+const uint16_t SL_OPCODE_NETAPP_PINGREPORTREQUESTRESPONSE            =      	0x1822;
+const uint16_t SL_OPCODE_NETAPP_PINGSTOP                             =      	0x9C23;
+const uint16_t SL_OPCODE_NETAPP_PINGSTOPRESPONSE                     =      	0x1C23;
+const uint16_t SL_OPCODE_NETAPP_ARPFLUSH                             =      	0x9C24;
+const uint16_t SL_OPCODE_NETAPP_ARPFLUSHRESPONSE                     =      	0x1C24;
+const uint16_t SL_OPCODE_NETAPP_IPACQUIRED                           =      	0x1825;
+const uint16_t SL_OPCODE_NETAPP_IPV4_LOST	                         =        	0x1832;
+const uint16_t SL_OPCODE_NETAPP_DHCP_IPV4_ACQUIRE_TIMEOUT            =      	0x1833;
+const uint16_t SL_OPCODE_NETAPP_IPACQUIRED_V6                        =      	0x1A25;
+const uint16_t SL_OPCODE_NETAPP_IPERFSTARTCOMMAND                    =      	0x9C28;
+const uint16_t SL_OPCODE_NETAPP_IPERFSTARTRESPONSE                   =      	0x1C28;
+const uint16_t SL_OPCODE_NETAPP_IPERFSTOPCOMMAND                     =      	0x9C29;
+const uint16_t SL_OPCODE_NETAPP_IPERFSTOPRESPONSE                    =      	0x1C29;
+const uint16_t SL_OPCODE_NETAPP_CTESTSTARTCOMMAND                    =      	0x9C2A;
+const uint16_t SL_OPCODE_NETAPP_CTESTSTARTRESPONSE                   =      	0x1C2A;
+const uint16_t SL_OPCODE_NETAPP_CTESTASYNCRESPONSE                   =      	0x182A;
+const uint16_t SL_OPCODE_NETAPP_CTESTSTOPCOMMAND                     =      	0x9C2B;
+const uint16_t SL_OPCODE_NETAPP_CTESTSTOPRESPONSE                    =      	0x1C2B;
+const uint16_t SL_OPCODE_NETAPP_IP_LEASED                            =      	0x182C;
+const uint16_t SL_OPCODE_NETAPP_IP_RELEASED                          =      	0x182D;
+const uint16_t SL_OPCODE_NETAPP_HTTPGETTOKENVALUE                    =      	0x182E;
+const uint16_t SL_OPCODE_NETAPP_HTTPSENDTOKENVALUE                   =      	0x9C2F;
+const uint16_t SL_OPCODE_NETAPP_HTTPPOSTTOKENVALUE                   =      	0x1830;
+const uint16_t SL_OPCODE_NVMEM_FILEOPEN                              =      	0xA43C;
+const uint16_t SL_OPCODE_NVMEM_FILEOPENRESPONSE                      =       	0x243C;
+const uint16_t SL_OPCODE_NVMEM_FILECLOSE                             =       	0xA43D;
+const uint16_t SL_OPCODE_NVMEM_FILECLOSERESPONSE                     =      	0x243D;
+const uint16_t SL_OPCODE_NVMEM_FILEREADCOMMAND                       =       	0xA440;
+const uint16_t SL_OPCODE_NVMEM_FILEREADRESPONSE                      =      	0x2440;
+const uint16_t SL_OPCODE_NVMEM_FILEWRITECOMMAND                      =      	0xA441;
+const uint16_t SL_OPCODE_NVMEM_FILEWRITERESPONSE                     =      	0x2441;
+const uint16_t SL_OPCODE_NVMEM_FILEGETINFOCOMMAND                    =      	0xA442;
+const uint16_t SL_OPCODE_NVMEM_FILEGETINFORESPONSE                   =      	0x2442;
+const uint16_t SL_OPCODE_NVMEM_FILEDELCOMMAND                        =      	0xA443;
+const uint16_t SL_OPCODE_NVMEM_FILEDELRESPONSE                       =      	0x2443;
+const uint16_t SL_OPCODE_NVMEM_NVMEMFORMATCOMMAND                    =      	0xA444;
+const uint16_t SL_OPCODE_NVMEM_NVMEMFORMATRESPONSE                   =      	0x2444;
+
+const uint16_t SL_OPCODE_DEVICE_SETDEBUGLEVELCOMMAND                 =      	0x846A;
+const uint16_t SL_OPCODE_DEVICE_SETDEBUGLEVELRESPONSE                =      	0x046A;
+
+const uint16_t SL_OPCODE_DEVICE_NETCFG_SET_COMMAND                 	 =          0x8432;
+const uint16_t SL_OPCODE_DEVICE_NETCFG_SET_RESPONSE                	 =          0x0432;
+const uint16_t SL_OPCODE_DEVICE_NETCFG_GET_COMMAND                 	 =          0x8433;
+const uint16_t SL_OPCODE_DEVICE_NETCFG_GET_RESPONSE                	 =          0x0433;
+/*  */
+const uint16_t SL_OPCODE_DEVICE_SETUARTMODECOMMAND                   =      	0x846B;
+const uint16_t SL_OPCODE_DEVICE_SETUARTMODERESPONSE                  =      	0x046B;
+const uint16_t SL_OPCODE_DEVICE_SSISIZESETCOMMAND	                 =          0x846B;
+const uint16_t SL_OPCODE_DEVICE_SSISIZESETRESPONSE	                 =          0x046B;
+
+/*  */
+const uint16_t SL_OPCODE_DEVICE_EVENTMASKSET                         =      	0x8464;
+const uint16_t SL_OPCODE_DEVICE_EVENTMASKSETRESPONSE                 =      	0x0464;
+const uint16_t SL_OPCODE_DEVICE_EVENTMASKGET                         =      	0x8465;
+const uint16_t SL_OPCODE_DEVICE_EVENTMASKGETRESPONSE                 =      	0x0465;
+
+const uint16_t SL_OPCODE_DEVICE_DEVICEGET                            =      	0x8466;
+const uint16_t SL_OPCODE_DEVICE_DEVICEGETRESPONSE                    =          0x0466;
+const uint16_t SL_OPCODE_DEVICE_DEVICESET							 =			0x84B7;
+const uint16_t SL_OPCODE_DEVICE_DEVICESETRESPONSE					 =			0x04B7;
+
+const uint16_t SL_OPCODE_WLAN_SCANRESULTSGETCOMMAND                  =      	0x8C8C;
+const uint16_t SL_OPCODE_WLAN_SCANRESULTSGETRESPONSE                 =      	0x0C8C;
+const uint16_t SL_OPCODE_WLAN_SMARTCONFIGOPTSET                      =      	0x8C8D;
+const uint16_t SL_OPCODE_WLAN_SMARTCONFIGOPTSETRESPONSE              =      	0x0C8D;
+const uint16_t SL_OPCODE_WLAN_SMARTCONFIGOPTGET                      =      	0x8C8E;
+const uint16_t SL_OPCODE_WLAN_SMARTCONFIGOPTGETRESPONSE              =      	0x0C8E;
+
+const uint16_t SL_OPCODE_FREE_BSD_RECV_BUFFER                        =          0xCCCB;
+const uint16_t SL_OPCODE_FREE_NON_BSD_READ_BUFFER                    =          0xCCCD;
+
+
+/* Rx Filters opcodes */
+const uint16_t SL_OPCODE_WLAN_WLANRXFILTERADDCOMMAND                 =          0x8C6C;
+const uint16_t SL_OPCODE_WLAN_WLANRXFILTERADDRESPONSE                =          0x0C6C;
+const uint16_t SL_OPCODE_WLAN_WLANRXFILTERSETCOMMAND                 =          0x8C6D;
+const uint16_t SL_OPCODE_WLAN_WLANRXFILTERSETRESPONSE                =          0x0C6D;
+const uint16_t SL_OPCODE_WLAN_WLANRXFILTERGETSTATISTICSINFOCOMMAND   =          0x8C6E;
+const uint16_t SL_OPCODE_WLAN_WLANRXFILTERGETSTATISTICSINFORESPONSE  =          0x0C6E;
+const uint16_t SL_OPCODE_WLAN_WLANRXFILTERGETCOMMAND                 =          0x8C6F;
+const uint16_t SL_OPCODE_WLAN_WLANRXFILTERGETRESPONSE                =          0x0C6F;
+const uint16_t SL_OPCODE_WLAN_WLANRXFILTERGETINFO                    =          0x8C70;
+const uint16_t SL_OPCODE_WLAN_WLANRXFILTERGETINFORESPONSE            =          0x0C70;
+
+
+/******************************************************************************************/
+/*   Device structs  */
+/******************************************************************************************/
+typedef uint32_t InitStatus_t;
+
+
+typedef struct {
+    int32_t Status;
+} InitComplete_t;
+
+typedef struct {
+    int16_t status;
+    uint16_t padding;
+
+} _BasicResponse_t;
+
+typedef struct {
+    uint16_t Timeout;
+    uint16_t padding;
+} _DevStopCommand_t;
+
+typedef struct {
+    uint32_t group;
+    uint32_t mask;
+} _DevMaskEventSetCommand_t;
+
+typedef _BasicResponse_t _DevMaskEventSetResponse_t;
+
+
+typedef struct {
+    uint32_t group;
+} _DevMaskEventGetCommand_t;
+
+
+typedef struct {
+    uint32_t group;
+    uint32_t mask;
+} _DevMaskEventGetResponse_t;
+
+
+typedef struct {
+    uint32_t group;
+} _DevStatusGetCommand_t;
+
+
+typedef struct {
+    uint32_t group;
+    uint32_t status;
+} _DevStatusGetResponse_t;
+
+typedef struct {
+    uint32_t  ChipId;
+    uint32_t  FwVersion[4];
+    uint8_t   PhyVersion[4];
+} _Device_VersionReadResponsePart_t;
+
+typedef struct {
+    _Device_VersionReadResponsePart_t part;
+    uint32_t                            NwpVersion[4];
+    uint16_t                            RomVersion;
+    uint16_t                            Padding;
+} _Device_VersionReadResponseFull_t;
+
+
+typedef struct {
+    uint32_t BaudRate;
+    uint8_t  FlowControlEnable;
+} _DevUartSetModeCommand_t;
+
+typedef _BasicResponse_t _DevUartSetModeResponse_t;
+
+/******************************************************/
+
+typedef struct {
+    uint8_t SsiSizeInBytes;
+    uint8_t Padding[3];
+} _StellarisSsiSizeSet_t;
+
+/*****************************************************************************************/
+/*   WLAN structs */
+/*****************************************************************************************/
+#define MAXIMAL_PASSWORD_LENGTH					(64)
+
+typedef struct {
+    uint8_t	SecType;
+    uint8_t	SsidLen;
+    uint8_t	Bssid[6];
+    uint8_t	PasswordLen;
+} _WlanConnectCommon_t;
+
+#define SSID_STRING(pCmd)       (int8_t *)((_WlanConnectCommon_t *)(pCmd) + 1)
+#define PASSWORD_STRING(pCmd)   (SSID_STRING(pCmd) + ((_WlanConnectCommon_t *)(pCmd))->SsidLen)
+
+typedef struct {
+    _WlanConnectCommon_t            Common;
+    uint8_t							UserLen;
+    uint8_t							AnonUserLen;
+    uint8_t   						CertIndex;
+    uint32_t  						EapBitmask;
+} _WlanConnectEapCommand_t;
+
+#define EAP_SSID_STRING(pCmd)       (int8_t *)((_WlanConnectEapCommand_t *)(pCmd) + 1)
+#define EAP_PASSWORD_STRING(pCmd)   (EAP_SSID_STRING(pCmd) + ((_WlanConnectEapCommand_t *)(pCmd))->Common.SsidLen)
+#define EAP_USER_STRING(pCmd)       (EAP_PASSWORD_STRING(pCmd) + ((_WlanConnectEapCommand_t *)(pCmd))->Common.PasswordLen)
+#define EAP_ANON_USER_STRING(pCmd)  (EAP_USER_STRING(pCmd) + ((_WlanConnectEapCommand_t *)(pCmd))->UserLen)
+
+
+typedef struct {
+    uint8_t	PolicyType;
+    uint8_t       Padding;
+    uint8_t	PolicyOption;
+    uint8_t	PolicyOptionLen;
+} _WlanPoliciySetGet_t;
+
+
+typedef struct {
+    uint32_t  minDwellTime;
+    uint32_t  maxDwellTime;
+    uint32_t  numProbeResponse;
+    uint32_t  G_Channels_mask;
+    int32_t   rssiThershold;
+    int32_t   snrThershold;
+    int32_t   defaultTXPower;
+    uint16_t  intervalList[16];
+} _WlanScanParamSetCommand_t;
+
+
+typedef struct {
+    int8_t	SecType;
+    uint8_t	SsidLen;
+    uint8_t	Priority;
+    uint8_t	Bssid[6];
+    uint8_t   PasswordLen;
+    uint8_t   WepKeyId;
+} _WlanAddGetProfile_t;
+
+
+typedef struct {
+    _WlanAddGetProfile_t              Common;
+    uint8_t                             UserLen;
+    uint8_t                             AnonUserLen;
+    uint8_t                             CertIndex;
+    uint16_t                            padding;
+    uint32_t                            EapBitmask;
+} _WlanAddGetEapProfile_t;
+
+#define PROFILE_SSID_STRING(pCmd)       ((int8_t *)((_WlanAddGetProfile_t *)(pCmd) + 1))
+#define PROFILE_PASSWORD_STRING(pCmd)   (PROFILE_SSID_STRING(pCmd) + ((_WlanAddGetProfile_t *)(pCmd))->SsidLen)
+
+#define EAP_PROFILE_SSID_STRING(pCmd)       (int8_t *)((_WlanAddGetEapProfile_t *)(pCmd) + 1)
+#define EAP_PROFILE_PASSWORD_STRING(pCmd)   (EAP_PROFILE_SSID_STRING(pCmd) + ((_WlanAddGetEapProfile_t *)(pCmd))->Common.SsidLen)
+#define EAP_PROFILE_USER_STRING(pCmd)       (EAP_PROFILE_PASSWORD_STRING(pCmd) + ((_WlanAddGetEapProfile_t *)(pCmd))->Common.PasswordLen)
+#define EAP_PROFILE_ANON_USER_STRING(pCmd)  (EAP_PROFILE_USER_STRING(pCmd) + ((_WlanAddGetEapProfile_t *)(pCmd))->UserLen)
+
+typedef struct {
+    uint8_t	index;
+    uint8_t	padding[3];
+} _WlanProfileDelGetCommand_t;
+
+typedef _BasicResponse_t _WlanGetNetworkListResponse_t;
+
+typedef struct {
+    uint8_t 	index;
+    uint8_t 	count;
+    int8_t 	padding[2];
+} _WlanGetNetworkListCommand_t;
+
+
+
+
+typedef struct {
+    uint32_t  						groupIdBitmask;
+    uint8_t                           cipher;
+    uint8_t                           publicKeyLen;
+    uint8_t                           group1KeyLen;
+    uint8_t                           group2KeyLen;
+} _WlanSmartConfigStartCommand_t;
+
+#define SMART_CONFIG_START_PUBLIC_KEY_STRING(pCmd)       ((int8_t *)((_WlanSmartConfigStartCommand_t *)(pCmd) + 1))
+#define SMART_CONFIG_START_GROUP1_KEY_STRING(pCmd)       ((int8_t *) (SMART_CONFIG_START_PUBLIC_KEY_STRING(pCmd) + ((_WlanSmartConfigStartCommand_t *)(pCmd))->publicKeyLen))
+#define SMART_CONFIG_START_GROUP2_KEY_STRING(pCmd)       ((int8_t *) (SMART_CONFIG_START_GROUP1_KEY_STRING(pCmd) + ((_WlanSmartConfigStartCommand_t *)(pCmd))->group1KeyLen))
+
+typedef	struct {
+    uint8_t	mode;
+    uint8_t   padding[3];
+} _WlanSetMode_t;
+
+
+
+
+typedef struct {
+    uint16_t  Status;
+    uint16_t  ConfigId;
+    uint16_t  ConfigOpt;
+    uint16_t  ConfigLen;
+} _WlanCfgSetGet_t;
+
+
+//wlan_rx_filters moved
+
+typedef struct {
+    uint16_t status;
+    uint8_t  WlanRole;     /* 0 = station, 2 = AP */
+    uint8_t  Ipv6Enabled;
+    uint8_t  Ipv6DhcpEnabled;
+
+    uint32_t ipV6Global[4];
+    uint32_t ipV6Local[4];
+    uint32_t ipV6DnsServer[4];
+    uint8_t  Ipv6DhcpState;
+
+} _NetappIpV6configRetArgs_t;
+
+
+typedef struct {
+    uint8_t  ipV4[4];
+    uint8_t  ipV4Mask[4];
+    uint8_t  ipV4Gateway[4];
+    uint8_t  ipV4DnsServer[4];
+    uint8_t  ipV4Start[4];
+    uint8_t  ipV4End[4];
+} _NetCfgIpV4AP_Args_t;
+
+
+
+typedef struct {
+    uint16_t status;
+    uint8_t  MacAddr[6];
+} _MAC_Address_SetGet_t;
+
+
+typedef struct {
+    uint16_t  Status;
+    uint16_t	ConfigId;
+    uint16_t	ConfigOpt;
+    uint16_t	ConfigLen;
+} _NetCfgSetGet_t;
+
+typedef struct {
+    uint16_t  Status;
+    uint16_t  DeviceSetId;
+    uint16_t  Option;
+    uint16_t  ConfigLen;
+} _DeviceSetGet_t;
+
+
+
+
+/******************************************************************************************/
+/*   Socket structs  */
+/******************************************************************************************/
+
+typedef struct {
+    uint8_t Domain;
+    uint8_t Type;
+    uint8_t Protocol;
+    uint8_t Padding;
+} _SocketCommand_t;
+
+
+typedef struct {
+    int16_t statusOrLen;
+    uint8_t  sd;
+    uint8_t  padding;
+} _SocketResponse_t;
+
+typedef struct {
+    uint8_t sd;
+    uint8_t family;
+    uint8_t padding1;
+    uint8_t padding2;
+} _AcceptCommand_t;
+
+
+typedef struct {
+    int16_t statusOrLen;
+    uint8_t sd;
+    uint8_t family;
+    uint16_t port;
+    uint16_t paddingOrAddr;
+    uint32_t address;
+} _SocketAddrAsyncIPv4Response_t;
+
+typedef struct {
+    int16_t statusOrLen;
+    uint8_t sd;
+    uint8_t family;
+    uint16_t port;
+    uint8_t address[6];
+} _SocketAddrAsyncIPv6EUI48Response_t;
+typedef struct {
+    int16_t statusOrLen;
+    uint8_t sd;
+    uint8_t family;
+    uint16_t port;
+    uint16_t paddingOrAddr;
+    uint32_t address[4];
+} _SocketAddrAsyncIPv6Response_t;
+
+
+typedef struct {
+    int16_t lenOrPadding;
+    uint8_t sd;
+    uint8_t FamilyAndFlags;
+    uint16_t port;
+    uint16_t paddingOrAddr;
+    uint32_t address;
+} _SocketAddrIPv4Command_t;
+
+typedef struct {
+    int16_t lenOrPadding;
+    uint8_t sd;
+    uint8_t FamilyAndFlags;
+    uint16_t port;
+    uint8_t address[6];
+} _SocketAddrIPv6EUI48Command_t;
+typedef struct {
+    int16_t lenOrPadding;
+    uint8_t sd;
+    uint8_t FamilyAndFlags;
+    uint16_t port;
+    uint16_t paddingOrAddr;
+    uint32_t address[4];
+} _SocketAddrIPv6Command_t;
+
+typedef union {
+    _SocketAddrIPv4Command_t IpV4;
+    _SocketAddrIPv6EUI48Command_t IpV6EUI48;
+#ifdef SL_SUPPORT_IPV6
+    _SocketAddrIPv6Command_t IpV6;
+#endif
+} _SocketAddrCommand_u;
+
+typedef union {
+    _SocketAddrAsyncIPv4Response_t IpV4;
+    _SocketAddrAsyncIPv6EUI48Response_t IpV6EUI48;
+#ifdef SL_SUPPORT_IPV6
+    _SocketAddrAsyncIPv6Response_t IpV6;
+#endif
+} _SocketAddrResponse_u;
+
+typedef struct {
+    uint8_t sd;
+    uint8_t backlog;
+    uint8_t padding1;
+    uint8_t padding2;
+} _ListenCommand_t;
+
+typedef struct {
+    uint8_t sd;
+    uint8_t padding0;
+    uint8_t padding1;
+    uint8_t padding2;
+} _CloseCommand_t;
+
+
+typedef struct {
+    uint8_t nfds;
+    uint8_t readFdsCount;
+    uint8_t writeFdsCount;
+    uint8_t padding;
+    uint16_t readFds;
+    uint16_t writeFds;
+    uint16_t tv_usec;
+    uint16_t tv_sec;
+} _SelectCommand_t;
+
+
+typedef struct {
+    uint16_t status;
+    uint8_t readFdsCount;
+    uint8_t writeFdsCount;
+    uint16_t readFds;
+    uint16_t writeFds;
+} _SelectAsyncResponse_t;
+
+typedef struct {
+    uint8_t sd;
+    uint8_t level;
+    uint8_t optionName;
+    uint8_t optionLen;
+} _setSockOptCommand_t;
+
+typedef struct {
+    uint8_t sd;
+    uint8_t level;
+    uint8_t optionName;
+    uint8_t optionLen;
+} _getSockOptCommand_t;
+
+typedef struct {
+    int16_t status;
+    uint8_t sd;
+    uint8_t optionLen;
+} _getSockOptResponse_t;
+
+
+typedef struct {
+    uint16_t StatusOrLen;
+    uint8_t  sd;
+    uint8_t FamilyAndFlags;
+} _sendRecvCommand_t;
+
+//netapp structs moved
+
+/*****************************************************************************************
+*   FS structs
+******************************************************************************************/
+
+typedef struct {
+    uint32_t FileHandle;
+    uint32_t Offset;
+    uint16_t Len;
+    uint16_t Padding;
+} _FsReadCommand_t;
+
+typedef struct {
+    uint32_t Mode;
+    uint32_t Token;
+} _FsOpenCommand_t;
+
+typedef struct {
+    uint32_t FileHandle;
+    uint32_t Token;
+} _FsOpenResponse_t;
+
+
+typedef struct {
+    uint32_t FileHandle;
+    uint32_t CertificFileNameLength;
+    uint32_t SignatureLen;
+} _FsCloseCommand_t;
+
+
+typedef _BasicResponse_t _FsReadResponse_t;
+typedef _BasicResponse_t _FsDeleteResponse_t;
+typedef _BasicResponse_t _FsCloseResponse_t;
+
+typedef struct {
+    uint16_t Status;
+    uint16_t flags;
+    uint32_t FileLen;
+    uint32_t AllocatedLen;
+    uint32_t Token[4];
+} _FsGetInfoResponse_t;
+
+typedef struct {
+    uint8_t DeviceID;
+    uint8_t Padding[3];
+} _FsFormatCommand_t;
+
+typedef _BasicResponse_t _FsFormatResponse_t;
+
+typedef struct {
+    uint32_t Token;
+} _FsDeleteCommand_t;
+
+typedef   _FsDeleteCommand_t  _FsGetInfoCommand_t;
+
+typedef struct {
+    uint32_t FileHandle;
+    uint32_t Offset;
+    uint16_t Len;
+    uint16_t Padding;
+} _FsWriteCommand_t;
+
+typedef _BasicResponse_t _FsWriteResponse_t;
+
+
+/*  Set Max Async Payload length depending on flavor (Tiny, Small, etc.)  */
+#define SL_ASYNC_MAX_PAYLOAD_LEN        160  /* size must be aligned to 4  */
+#define SL_ASYNC_MAX_MSG_LEN            (_SL_RESP_HDR_SIZE + SL_ASYNC_MAX_PAYLOAD_LEN)
+
+#define RECV_ARGS_SIZE                  (sizeof(_SocketResponse_t))
+#define RECVFROM_IPV4_ARGS_SIZE         (sizeof(_SocketAddrAsyncIPv4Response_t))
+#define RECVFROM_IPV6_ARGS_SIZE         (sizeof(_SocketAddrAsyncIPv6Response_t))
+
+#define SL_IPV4_ADDRESS_SIZE 			(sizeof(uint32_t))
+#define SL_IPV6_ADDRESS_SIZE 			(4 * sizeof(uint32_t))
+
+}//namespace mbed_cc3100
+
+#endif /*  _SL_PROTOCOL_TYPES_H_  */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_simplelink.h	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,580 @@
+/*
+ * simplelink.h - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+
+/*!
+    \mainpage SimpleLink Driver
+
+    \section intro_sec Introduction
+
+ The SimpleLink CC31xx/CC2xx family allows to add Wi-Fi and networking capabilities
+ to low-cost embedded products without having prior Wi-Fi, RF or networking expertise.
+ The CC31xx/CC32xx is an ideal solution for microcontroller-based sensor and control
+ applications such as home appliances, home automation and smart metering.
+ The CC31xx/CC32xx has integrated a comprehensive TCP/IP network stack, Wi-Fi driver and
+ security supplicant leading to easier portability to microcontrollers, to an
+ ultra-low memory footprint, all without compromising the capabilities and robustness
+ of the final application.
+
+
+
+ \section modules_sec Module Names
+ To make it simple, TI's SimpleLink CC31xx/CC32xx platform capabilities were divided into modules by topic (Silo).
+ These capabilities range from basic device management through wireless
+ network configuration, standard BSD socket and much more.
+ Listed below are the various modules in the SimpleLink CC31xx/CC32xx driver:
+     -# \ref device - controls the behaviour of the CC31xx/CC32xx device (start/stop, events masking and obtaining specific device status)
+     -# \ref wlan - controls the use of the WiFi WLAN module including:
+       - Connection features, such as: profiles, policies, SmartConfigďż˝
+       - Advanced WLAN features, such as: scans, rx filters and rx statistics collection
+     -# \ref socket - controls standard client/server sockets programming options and capabilities
+     -# \ref netapp - activates networking applications, such as: HTTP Server, DHCP Server, Ping, DNS and mDNS.
+     -# \ref netcfg - controls the configuration of the device addresses (i.e. IP and MAC addresses)
+     -# \ref FileSystem     - provides file system capabilities to TI's CC31XX that can be used by both the CC31XX device and the user.
+
+
+ \section         proting_sec     Porting Guide
+
+ The porting of the SimpleLink driver to any new platform is based on few simple steps.
+ This guide takes you through this process step by step. Please follow the instructions
+ carefully to avoid any problems during this process and to enable efficient and proper
+ work with the device.
+ Please notice that all modifications and porting adjustments of the driver should be
+ made in the user.h header file only.
+ Keep making any of the changes only in this file will ensure smoothly transaction to
+ new versions of the driver at the future!
+
+
+ \subsection     porting_step1   Step 1 - Create your own user.h file
+
+ The first step is to create a user.h file that will include your configurations and
+ adjustments. You can use the empty template provided as part of this driver or
+ you can choose to base your file on file from one of the wide range of examples
+ applications provided by Texas Instruments
+
+
+ \subsection    porting_step2   Step 2 - Select the capabilities set required for your application
+
+ Texas Instruments made a lot of efforts to build set of predefined capability sets that would
+ fit most of the target application.
+ It is recommended to try and choose one of this predefined capabilities set before going to
+ build your own customized set. If you find compatible set you can skip the rest of this step.
+
+ The available sets are:
+     -# SL_TINY     -   Compatible to be used on platforms with very limited resources. Provides
+                        the best in class foot print in terms of Code and Data consumption.
+     -# SL_SMALL    -   Compatible to most common networking applications. Provide the most
+                        common APIs with decent balance between code size, data size, functionality
+                        and performances
+     -# SL_FULL     -   Provide access to all SimpleLink functionalities
+
+
+ \subsection    porting_step3   Step 3 - Bind the device enable/disable output line
+
+ The enable/disable line (nHib) provide mechanism to enter the device into the least current
+ consumption mode. This mode could be used when no traffic is required (tx/rx).
+ when this line is not connected to any IO of the host this define should be left empty.
+ Not connecting this line results in ability to start the driver only once.
+
+
+ \subsection    porting_step4   Step 4 - Writing your interface communication driver
+
+ The SimpleLink device support several standard communication protocol among SPI and
+ UART. Depending on your needs and your hardware design, you should choose the
+ communication channel type.
+ The interface for this communication channel should include 4 simple access functions:
+ -# open
+ -# close
+ -# read
+ -# write
+
+ The way this driver would be implemented is directly effecting the efficiency and
+ the performances of the SimpleLink device on this platform.
+ If your system has DMA you should consider to use it in order to increase the utilization
+ of the communication channel
+ If you have enough memory resources you should consider using a buffer to increase the
+ efficiency of the write operations.
+
+
+ \subsection     porting_step5   Step 5 - Choose your memory management model
+
+ The SimpleLink driver support two memory models:
+     -# Static (default)
+     -# Dynamic
+
+ If you choose to work in dynamic model you will have to provide alloc and free functions
+ to be used by the Simple Link driver otherwise nothing need to be done.
+
+
+ \subsection     porting_step6   Step 6 - OS adaptation
+
+ The SimpleLink driver could run on two kind of platforms:
+     -# Non-Os / Single Threaded (default)
+     -# Multi-Threaded
+
+ If you choose to work in multi-threaded environment under operating system you will have to
+ provide some basic adaptation routines to allow the driver to protect access to resources
+ for different threads (locking object) and to allow synchronization between threads (sync objects).
+ In additional the driver support running without dedicated thread allocated solely to the simple
+ link driver. If you choose to work in this mode, you should also supply a spawn method that
+ will enable to run function on a temporary context.
+
+
+ \subsection     porting_step7   Step 7 - Set your asynchronous event handlers routines
+
+ The SimpleLink device generate asynchronous events in several situations.
+ These asynchronous events could be masked.
+ In order to catch these events you have to provide handler routines.
+ Please notice that if you not provide a handler routine and the event is received,
+ the driver will drop this event without any indication of this drop.
+
+
+ \subsection     porting_step8   Step 8 - Run diagnostic tools to validate the correctness of your porting
+
+ The driver is delivered with some porting diagnostic tools to simplify the porting validation process
+ and to reduce issues latter. It is very important to follow carefully this process.
+
+ The diagnostic process include:
+     -# Validating Interface Communication Driver
+     -# Validating OS adaptation layer
+     -# Validating HW integrity
+     -# Validating basic work with the device
+
+
+    \section sw_license License
+
+ *
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+
+
+#ifndef SIMPLELINK_H_
+#define SIMPLELINK_H_
+
+#include "mbed.h"
+#include "cc3100_user.h"
+
+namespace mbed_cc3100 {
+
+/*! \attention  Async event activation notes
+    Function prototypes for event callback handlers
+    Event handler function names should be defined in the user.h file
+    e.g.
+    "#define sl_WlanEvtHdlr   SLWlanEventHandler"
+    Indicates all WLAN events are handled by User func "SLWlanEventHandler"
+    Important notes:
+    1. Event handlers cannot activate another SimpleLink API from the event's context
+    2. Event's data is valid during event's context. Any application data
+       which is required for the user application should be copied or marked
+       into user's variables
+    3. It is not recommended to delay the execution of the event callback handler
+
+*/
+
+/*!
+
+    \addtogroup UserEvents
+    @{
+
+*/
+
+
+/*****************************************************************************/
+/* Macro declarations for Host Driver version                                */
+/*****************************************************************************/
+#define SL_DRIVER_VERSION   "1.0.0.1"
+#define SL_MAJOR_VERSION_NUM    1L
+#define SL_MINOR_VERSION_NUM    0L
+#define SL_VERSION_NUM          0L
+#define SL_SUB_VERSION_NUM      1L
+
+
+/*****************************************************************************/
+/* Macro declarations for predefined configurations                          */
+/*****************************************************************************/
+
+#ifdef SL_TINY
+#undef SL_INC_ARG_CHECK
+#undef SL_INC_EXT_API
+#undef SL_INC_SOCK_CLIENT_SIDE_API
+#undef SL_INC_SOCK_SEND_API
+#undef SL_INC_WLAN_PKG
+#undef SL_INC_NET_APP_PKG
+#undef SL_INC_NET_CFG_PKG
+#undef SL_INC_FS_PKG
+#define SL_INC_SOCK_SERVER_SIDE_API
+#define SL_INC_SOCK_RECV_API
+#define SL_INC_SOCKET_PKG
+#endif
+
+#ifdef SL_SMALL
+#undef SL_INC_EXT_API
+#undef SL_INC_NET_APP_PKG
+#undef SL_INC_NET_CFG_PKG
+#undef SL_INC_FS_PKG
+#define SL_INC_ARG_CHECK
+#define SL_INC_WLAN_PKG
+#define SL_INC_SOCKET_PKG
+#define SL_INC_SOCK_CLIENT_SIDE_API
+#define SL_INC_SOCK_SERVER_SIDE_API
+#define SL_INC_SOCK_RECV_API
+#define SL_INC_SOCK_SEND_API
+#endif
+
+#ifdef SL_FULL
+#define SL_INC_EXT_API
+#define SL_INC_NET_APP_PKG
+#define SL_INC_NET_CFG_PKG
+#define SL_INC_FS_PKG
+#define SL_INC_ARG_CHECK
+#define SL_INC_WLAN_PKG
+#define SL_INC_SOCKET_PKG
+#define SL_INC_SOCK_CLIENT_SIDE_API
+#define SL_INC_SOCK_SERVER_SIDE_API
+#define SL_INC_SOCK_RECV_API
+#define SL_INC_SOCK_SEND_API
+#endif
+
+#define SL_RET_CODE_OK                          (0)
+#define SL_RET_CODE_INVALID_INPUT               (-2)
+#define SL_RET_CODE_SELF_ERROR                  (-3)
+#define SL_RET_CODE_NWP_IF_ERROR                (-4)
+#define SL_RET_CODE_MALLOC_ERROR                (-5)
+
+#define sl_SyncObjClear(pObj)     sl_SyncObjWait(pObj,NON_OS_SYNC_OBJ_SIGNAL_VALUE,NON_OS_SYNC_OBJ_CLEAR_VALUE,SL_OS_NO_WAIT)
+
+#define SL_MAX_SOCKETS      (8)
+
+
+/*****************************************************************************/
+/* Types definitions                                                          */
+/*****************************************************************************/
+
+typedef void(*_SlSpawnEntryFunc_t)(void* pValue);
+
+#ifndef NULL
+#define NULL        (0)
+#endif
+
+#ifndef FALSE
+#define FALSE       (0)
+#endif
+
+#ifndef TRUE
+#define TRUE        (!FALSE)
+#endif
+
+#ifndef OK
+#define OK          (0)
+#endif
+
+//#ifndef _SL_USER_TYPES
+//#define _u8 unsigned char
+//#define _i8 signed char
+
+//#define _u16 unsigned short
+//#define _i16 signed short
+
+//#define _u32 unsigned long
+//#define _i32 signed long
+//#define _volatile volatile
+//#define _const    const
+//#endif
+
+typedef uint16_t  _SlOpcode_t;
+typedef uint8_t   _SlArgSize_t;
+typedef int16_t   _SlDataSize_t;
+typedef int16_t   _SlReturnVal_t;
+}//namespace mbed_cc3100
+/*****************************************************************************/
+/* Include files                                                             */
+/*****************************************************************************/
+
+#ifdef SL_PLATFORM_MULTI_THREADED
+#include "cc3100_spawn.h"
+#else
+#include "cc3100_nonos.h"
+#endif
+
+
+/*
+   objInclusion.h and user.h must be included before all api header files
+   objInclusion.h must be the last arrangement just before including the API header files
+   since it based on the other configurations to decide which object should be included
+*/
+#include "cc3100_objInclusion.h"
+#include "cc3100_trace.h"
+#include "cc3100_fs.h"
+#include "cc3100_socket.h"
+#include "cc3100_netapp.h"
+#include "cc3100_wlan.h"
+#include "cc3100.h"
+#include "cc3100_netcfg.h"
+#include "cc3100_wlan_rx_filters.h"
+
+namespace mbed_cc3100 {
+
+/* Async functions description*/
+
+/*!
+    \brief General async event for inspecting general events
+
+    \param[out]      pSlDeviceEvent   pointer to SlDeviceEvent_t
+
+    \par
+          Parameters: \n
+          <b>pSlDeviceEvent->Event = SL_DEVICE_FATAL_ERROR_EVENT </b>
+              - pSlDeviceEvent->EventData.deviceEvent fields:
+                  - status: An error code indication from the device
+                  - sender: The sender originator which is based on SlErrorSender_e enum
+
+    \par  Example:
+    \code
+    printf(General Event Handler - ID=%d Sender=%d\n\n",
+           pSlDeviceEvent->EventData.deviceEvent.status,  // status of the general event
+           pSlDeviceEvent->EventData.deviceEvent.sender); // sender type
+    \endcode
+*/
+//#if (defined(sl_GeneralEvtHdlr))
+//void sl_GeneralEvtHdlr(SlDeviceEvent_t *pSlDeviceEvent);
+//#endif
+
+
+/*!
+    \brief WLAN Async event handler
+
+    \param[out]      pSlWlanEvent   pointer to SlWlanEvent_t data
+
+    \par
+             Parameters:
+
+             - <b>pSlWlanEvent->Event = SL_WLAN_CONNECT_EVENT </b>, STA or P2P client connection indication event
+                 - pSlWlanEvent->EventData.STAandP2PModeWlanConnected main fields:
+                      - ssid_name
+                      - ssid_len
+                      - bssid
+                      - go_peer_device_name
+                      - go_peer_device_name_len
+
+             - <b>pSlWlanEvent->Event = SL_WLAN_DISCONNECT_EVENT </b>, STA or P2P client disconnection event
+                 - pSlWlanEvent->EventData.STAandP2PModeDisconnected main fields:
+                      - ssid_name
+                      - ssid_len
+                      - reason_code
+
+             - <b>pSlWlanEvent->Event = SL_WLAN_STA_CONNECTED_EVENT </b>, AP/P2P(Go) connected STA/P2P(Client)
+                  - pSlWlanEvent->EventData.APModeStaConnected fields:
+                      - go_peer_device_name
+                      - mac
+                      - go_peer_device_name_len
+                      - wps_dev_password_id
+                      - own_ssid:  relevant for event sta-connected only
+                      - own_ssid_len:  relevant for event sta-connected only
+
+             - <b>pSlWlanEvent->Event = SL_WLAN_STA_DISCONNECTED_EVENT </b>, AP/P2P(Go) disconnected STA/P2P(Client)
+                  - pSlWlanEvent->EventData.APModestaDisconnected fields:
+                      - go_peer_device_name
+                      - mac
+                      - go_peer_device_name_len
+                      - wps_dev_password_id
+                      - own_ssid:  relevant for event sta-connected only
+                      - own_ssid_len:  relevant for event sta-connected only
+
+             - <b>pSlWlanEvent->Event = SL_WLAN_SMART_CONFIG_COMPLETE_EVENT </b>
+                  - pSlWlanEvent->EventData.smartConfigStartResponse fields:
+                     - status
+                     - ssid_len
+                     - ssid
+                     - private_token_len
+                     - private_token
+
+             - <b>pSlWlanEvent->Event = SL_WLAN_SMART_CONFIG_STOP_EVENT </b>
+                     - pSlWlanEvent->EventData.smartConfigStopResponse fields:
+                         - status
+
+             - <b>pSlWlanEvent->Event = SL_WLAN_P2P_DEV_FOUND_EVENT </b>
+                     - pSlWlanEvent->EventData.P2PModeDevFound fields:
+                         - go_peer_device_name
+                         - mac
+                         - go_peer_device_name_len
+                         - wps_dev_password_id
+                         - own_ssid:  relevant for event sta-connected only
+                         - own_ssid_len:  relevant for event sta-connected only
+
+             - <b>pSlWlanEvent->Event = SL_WLAN_P2P_NEG_REQ_RECEIVED_EVENT </b>
+                      - pSlWlanEvent->EventData.P2PModeNegReqReceived fields
+                          - go_peer_device_name
+                          - mac
+                          - go_peer_device_name_len
+                          - wps_dev_password_id
+                          - own_ssid:  relevant for event sta-connected only
+
+             - <b>pSlWlanEvent->Event = SL_WLAN_CONNECTION_FAILED_EVENT </b>, P2P only
+                       - pSlWlanEvent->EventData.P2PModewlanConnectionFailure fields:
+                           - status
+*/
+//#if (defined(sl_WlanEvtHdlr))
+//void sl_WlanEvtHdlr(SlWlanEvent_t *pSlWlanEvent);
+//#endif
+
+
+/*!
+    \brief NETAPP Async event handler
+
+    \param[out]      pSlNetApp   pointer to SlNetAppEvent_t data
+
+    \par
+             Parameters:
+              - <b>pSlWlanEvent->Event = SL_NETAPP_IPV4_IPACQUIRED_EVENT</b>, IPV4 acquired event
+                  - pSlWlanEvent->EventData.ipAcquiredV4 fields:
+                       - ip
+                       - gateway
+                       - dns
+
+              - <b>pSlWlanEvent->Event = SL_NETAPP_IP_LEASED_EVENT</b>, AP or P2P go dhcp lease event
+                  - pSlWlanEvent->EventData.ipLeased  fields:
+                       - ip_address
+                       - lease_time
+                       - mac
+
+              - <b>pSlWlanEvent->Event = SL_NETAPP_IP_RELEASED_EVENT</b>, AP or P2P go dhcp ip release event
+                   - pSlWlanEvent->EventData.ipReleased fields
+                       - ip_address
+                       - mac
+                       - reason
+
+*/
+//#if (defined(sl_NetAppEvtHdlr))
+//void sl_NetAppEvtHdlr(SlNetAppEvent_t *pSlNetApp);
+//#endif
+
+/*!
+    \brief Socket Async event handler
+
+    \param[out]      pSlSockEvent   pointer to SlSockEvent_t data
+
+    \par
+             Parameters:\n
+             - <b>pSlSockEvent->Event = SL_SOCKET_TX_FAILED_EVENT</b>
+                 - pSlSockEvent->EventData fields:
+                     - sd
+                     - status
+             - <b>pSlSockEvent->Event = SL_SOCKET_ASYNC_EVENT</b>
+                - pSlSockEvent->EventData fields:
+                     - sd
+                     - type: SSL_ACCEPT  or RX_FRAGMENTATION_TOO_BIG or OTHER_SIDE_CLOSE_SSL_DATA_NOT_ENCRYPTED
+                     - val
+
+*/
+//#if (defined(sl_SockEvtHdlr))
+//void sl_SockEvtHdlr(SlSockEvent_t *pSlSockEvent);
+//#endif
+
+/*!
+    \brief HTTP server async event
+
+    \param[out] pSlHttpServerEvent   pointer to SlHttpServerEvent_t
+    \param[in] pSlHttpServerResponse pointer to SlHttpServerResponse_t
+
+    \par
+          Parameters: \n
+
+          - <b>pSlHttpServerEvent->Event = SL_NETAPP_HTTPGETTOKENVALUE_EVENT</b>
+             - pSlHttpServerEvent->EventData fields:
+                 - httpTokenName
+                     - data
+                     - len
+             - pSlHttpServerResponse->ResponseData fields:
+                     - data
+                     - len
+
+          - <b>pSlHttpServerEvent->Event = SL_NETAPP_HTTPPOSTTOKENVALUE_EVENT</b>
+              - pSlHttpServerEvent->EventData.httpPostData fields:
+                     - action
+                     - token_name
+                     - token_value
+              - pSlHttpServerResponse->ResponseData fields:
+                     - data
+                     - len
+
+*/
+//#if (defined(sl_HttpServerCallback))
+//void sl_HttpServerCallback(SlHttpServerEvent_t *pSlHttpServerEvent, SlHttpServerResponse_t *pSlHttpServerResponse);
+//#endif
+/*!
+
+ Close the Doxygen group.
+ @}
+
+ */
+
+}//namespace mbed_cc3100
+
+#endif    /*  __SIMPLELINK_H__ */
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_sl_common.h	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,96 @@
+/*
+ * sl_config.h - get time sample application
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef SL_CONFIG_H_
+#define SL_CONFIG_H_
+
+//*****************************************************************************
+//
+// If building with a C++ compiler, make all of the definitions in this header
+// have a C binding.
+//
+//*****************************************************************************
+
+/**/
+
+namespace mbed_cc3100 {
+
+#define LOOP_FOREVER() \
+            {\
+                while(1); \
+            }
+
+#define ASSERT_ON_ERROR(error_code) \
+            {\
+                /* Handling the error-codes is specific to the application */ \
+                if (error_code < 0) return error_code; \
+                /* else, continue w/ execution */ \
+            }
+
+
+/*
+ * Values for below macros shall be modified per the access-point's (AP) properties
+ * SimpleLink device will connect to following AP when the application is executed
+ */
+
+
+#define SSID_NAME       "OpenWrt"         /* Access point name to connect to. */
+#define SEC_TYPE        SL_SEC_TYPE_WPA_WPA2    /* Security type of the Access point */
+#define PASSKEY         "**********"                  /* Password in case of secure AP */
+#define PASSKEY_LEN     strlen(PASSKEY)  /* Password length in case of secure AP */
+
+/* Configuration of the device when it comes up in AP mode */
+#define SSID_AP_MODE       "mysimplelink"       /* SSID of the CC3100 in AP mode */
+#define PASSWORD_AP_MODE   ""                  /* Password of CC3100 AP */
+#define SEC_TYPE_AP_MODE   SL_SEC_TYPE_OPEN    /* Can take SL_SEC_TYPE_WEP or
+* SL_SEC_TYPE_WPA as well */
+
+/*
+ * Values for below macros shall be modified based on current time
+ */
+#define DATE        7      /* Current Date */
+#define MONTH       2       /* Month */
+#define YEAR        2015    /* Current year */
+#define HOUR        10      /* Time - hours */
+#define MINUTE      34      /* Time - minutes */
+#define SECOND      0       /* Time - seconds */
+
+#define SUCCESS             0
+
+}//namespace mbed_cc3100
+
+#endif /*__SL_CONFIG_H__*/
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_socket.cpp	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,965 @@
+/*
+ * socket.c - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+
+
+
+/*****************************************************************************/
+/* Include files                                                             */
+/*****************************************************************************/
+#include "cc3100_simplelink.h"
+#include "cc3100_protocol.h"
+#include "cc3100_driver.h"
+
+#include "cc3100_socket.h"
+
+namespace mbed_cc3100 {
+
+
+cc3100_socket::cc3100_socket(cc3100_driver &driver, cc3100_nonos &nonos)
+    : _driver(driver), _nonos(nonos)
+{
+
+}
+
+cc3100_socket::~cc3100_socket()
+{
+
+}
+
+/*******************************************************************************/
+/* Functions                                                                   */
+/*******************************************************************************/
+
+/* ******************************************************************************/
+/*  _sl_BuildAddress */
+/* ******************************************************************************/
+void cc3100_socket::_sl_BuildAddress(const SlSockAddr_t *addr, int16_t addrlen, _SocketAddrCommand_u *pCmd)
+{
+    /*  Note: parsing of family and port in the generic way for all IPV4, IPV6 and EUI48 */
+    /*  is possible as int32_t as these parameters are in the same offset and size for these */
+    /*  three families. */
+    pCmd->IpV4.FamilyAndFlags = (addr->sa_family << 4) & 0xF0;
+    pCmd->IpV4.port = ((SlSockAddrIn_t *)addr)->sin_port;
+
+    if(SL_AF_INET == addr->sa_family) {
+        pCmd->IpV4.address  = ((SlSockAddrIn_t *)addr)->sin_addr.s_addr;
+    } else if (SL_AF_INET6_EUI_48 == addr->sa_family ) {
+        memcpy( pCmd->IpV6EUI48.address,((SlSockAddrIn6_t *)addr)->sin6_addr._S6_un._S6_u8, 6);
+    }
+#ifdef SL_SUPPORT_IPV6
+    else {
+        memcpy(pCmd->IpV6.address, ((sockaddr_in6 *)addr)->sin6_addr._S6_un._S6_u32, 16 );
+    }
+#endif
+}
+
+/* ******************************************************************************/
+/*  _sl_TruncatePayloadByProtocol */
+/* ******************************************************************************/
+uint16_t cc3100_socket::_sl_TruncatePayloadByProtocol(const int16_t sd,const uint16_t length)
+{
+    uint16_t maxLength;
+
+    switch(sd & SL_SOCKET_PAYLOAD_TYPE_MASK) {
+        case SL_SOCKET_PAYLOAD_TYPE_UDP_IPV4:
+            maxLength = 1472;
+            break;
+
+        case SL_SOCKET_PAYLOAD_TYPE_TCP_IPV4:
+            maxLength = 1460;
+            break;
+
+        case SL_SOCKET_PAYLOAD_TYPE_UDP_IPV6:
+            maxLength = 1452;
+            break;
+
+        case SL_SOCKET_PAYLOAD_TYPE_TCP_IPV6:
+            maxLength = 1440;
+            break;
+        case SL_SOCKET_PAYLOAD_TYPE_TCP_IPV4_SECURE:
+        case SL_SOCKET_PAYLOAD_TYPE_UDP_IPV4_SECURE:
+            maxLength = 1402;
+            break;
+        case SL_SOCKET_PAYLOAD_TYPE_UDP_IPV6_SECURE:
+        case SL_SOCKET_PAYLOAD_TYPE_TCP_IPV6_SECURE:
+            maxLength = 1396;
+            break;
+        case SL_SOCKET_PAYLOAD_TYPE_RAW_TRANCEIVER:
+            maxLength = 1476;
+            break;
+        case SL_SOCKET_PAYLOAD_TYPE_RAW_PACKET:
+            maxLength = 1514;
+            break;
+        case SL_SOCKET_PAYLOAD_TYPE_RAW_IP4:
+            maxLength = 1480;
+            break;
+        default:
+            maxLength = 1440;
+            break;
+    }
+
+    if( length > maxLength ) {
+        return maxLength;
+    } else {
+        return length;
+    }
+}
+
+/*******************************************************************************/
+/*  _sl_ParseAddress */
+/*******************************************************************************/
+void cc3100_socket::_sl_ParseAddress(_SocketAddrResponse_u    *pRsp, SlSockAddr_t *addr, SlSocklen_t *addrlen)
+{
+    /*  Note: parsing of family and port in the generic way for all IPV4, IPV6 and EUI48 */
+    /*  is possible as long as these parameters are in the same offset and size for these */
+    /*  three families. */
+    addr->sa_family                 = pRsp->IpV4.family;
+    ((SlSockAddrIn_t *)addr)->sin_port = pRsp->IpV4.port;
+
+    *addrlen = (SL_AF_INET == addr->sa_family) ? sizeof(SlSockAddrIn_t) : sizeof(SlSockAddrIn6_t);
+
+    if(SL_AF_INET == addr->sa_family) {
+        ((SlSockAddrIn_t *)addr)->sin_addr.s_addr  = pRsp->IpV4.address;
+    } else if (SL_AF_INET6_EUI_48 == addr->sa_family ) {
+        memcpy(((SlSockAddrIn6_t *)addr)->sin6_addr._S6_un._S6_u8, pRsp->IpV6EUI48.address, 6);
+    }
+#ifdef SL_SUPPORT_IPV6
+    else {
+        memcpy(((sockaddr_in6 *)addr)->sin6_addr._S6_un._S6_u32, pRsp->IpV6.address, 16);
+    }
+#endif
+}
+
+/*******************************************************************************/
+/* sl_Socket */
+/*******************************************************************************/
+typedef union {
+    uint32_t                Dummy;
+    _SocketCommand_t 	Cmd;
+    _SocketResponse_t	Rsp;
+} _SlSockSocketMsg_u;
+
+const _SlCmdCtrl_t _SlSockSocketCmdCtrl = {
+    SL_OPCODE_SOCKET_SOCKET,
+    sizeof(_SocketCommand_t),
+    sizeof(_SocketResponse_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_Socket)
+int16_t cc3100_socket::sl_Socket(int16_t Domain, int16_t Type, int16_t Protocol)
+{
+    _SlSockSocketMsg_u  Msg;
+
+    Msg.Cmd.Domain	    = (uint8_t)Domain;
+    Msg.Cmd.Type     	= (uint8_t)Type;
+    Msg.Cmd.Protocol 	= (uint8_t)Protocol;
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlSockSocketCmdCtrl, &Msg, NULL));
+
+    if( Msg.Rsp.statusOrLen < 0 ) {
+        return( Msg.Rsp.statusOrLen );
+    } else {
+        return (int16_t)((uint8_t)Msg.Rsp.sd);
+    }
+}
+#endif
+
+/*******************************************************************************/
+/*  sl_Close  */
+/*******************************************************************************/
+typedef union {
+    _CloseCommand_t	    Cmd;
+    _SocketResponse_t	Rsp;
+} _SlSockCloseMsg_u;
+
+const _SlCmdCtrl_t _SlSockCloseCmdCtrl = {
+    SL_OPCODE_SOCKET_CLOSE,
+    sizeof(_CloseCommand_t),
+    sizeof(_SocketResponse_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_Close)
+int16_t cc3100_socket::sl_Close(int16_t sd)
+{
+    _SlSockCloseMsg_u   Msg;
+
+    Msg.Cmd.sd = (uint8_t)sd;
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlSockCloseCmdCtrl, &Msg, NULL));
+
+    return Msg.Rsp.statusOrLen;
+}
+#endif
+
+/*******************************************************************************/
+/*  sl_Bind */
+/*******************************************************************************/
+typedef union {
+    _SocketAddrCommand_u    Cmd;
+    _SocketResponse_t	    Rsp;
+} _SlSockBindMsg_u;
+
+#if _SL_INCLUDE_FUNC(sl_Bind)
+int16_t cc3100_socket::sl_Bind(int16_t sd, const SlSockAddr_t *addr, int16_t addrlen)
+{
+    _SlSockBindMsg_u    Msg;
+    _SlCmdCtrl_t         CmdCtrl = {0, 0, sizeof(_SocketResponse_t)};
+
+    switch(addr->sa_family) {
+        case SL_AF_INET :
+            CmdCtrl.Opcode = SL_OPCODE_SOCKET_BIND;
+            CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv4Command_t);
+            break;
+        case SL_AF_INET6_EUI_48:
+            CmdCtrl.Opcode = SL_OPCODE_SOCKET_BIND_V6;
+            CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv6EUI48Command_t);
+            break;
+#ifdef SL_SUPPORT_IPV6
+        case AF_INET6:
+            CmdCtrl.Opcode = SL_OPCODE_SOCKET_BIND_V6;
+            CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv6Command_t);
+            break;
+#endif
+        case SL_AF_RF   :
+        default:
+            return SL_RET_CODE_INVALID_INPUT;
+    }
+
+    Msg.Cmd.IpV4.lenOrPadding = 0;
+    Msg.Cmd.IpV4.sd = (uint8_t)sd;
+
+    _sl_BuildAddress(addr, addrlen, &Msg.Cmd);
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&CmdCtrl, &Msg, NULL));
+
+    return Msg.Rsp.statusOrLen;
+}
+#endif
+
+/*******************************************************************************/
+/*  sl_Sendto */
+/*******************************************************************************/
+typedef union {
+    _SocketAddrCommand_u    Cmd;
+    /*  no response for 'sendto' commands*/
+} _SlSendtoMsg_u;
+
+#if _SL_INCLUDE_FUNC(sl_SendTo)
+int16_t cc3100_socket::sl_SendTo(int16_t sd, const void *pBuf, int16_t Len, int16_t flags, const SlSockAddr_t *to, SlSocklen_t tolen)
+{
+    _SlSendtoMsg_u   Msg;
+    _SlCmdCtrl_t     CmdCtrl = {0, 0, 0};
+    _SlCmdExt_t      CmdExt;
+    uint16_t         ChunkLen;
+    int16_t          RetVal;
+
+    CmdExt.TxPayloadLen = (uint16_t)Len;
+    CmdExt.RxPayloadLen = 0;
+    CmdExt.pTxPayload = (unsigned char *)pBuf;
+    CmdExt.pRxPayload = NULL;
+
+
+    switch(to->sa_family) {
+        case SL_AF_INET:
+            CmdCtrl.Opcode = SL_OPCODE_SOCKET_SENDTO;
+            CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv4Command_t);
+            break;
+        case SL_AF_INET6_EUI_48:
+            CmdCtrl.Opcode = SL_OPCODE_SOCKET_BIND_V6;
+            CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv6EUI48Command_t);
+            break;
+#ifdef SL_SUPPORT_IPV6
+        case AF_INET6:
+            CmdCtrl.Opcode = SL_OPCODE_SOCKET_SENDTO_V6;
+            CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv6Command_t);
+            break;
+#endif
+        case SL_AF_RF:
+        default:
+            return SL_RET_CODE_INVALID_INPUT;
+    }
+
+    ChunkLen = _sl_TruncatePayloadByProtocol(sd,Len);
+    Msg.Cmd.IpV4.lenOrPadding = ChunkLen;
+    CmdExt.TxPayloadLen = ChunkLen;
+
+    Msg.Cmd.IpV4.sd = (unsigned char)sd;
+
+    _sl_BuildAddress(to, tolen, &Msg.Cmd);
+    
+    Msg.Cmd.IpV4.FamilyAndFlags |= flags & 0x0F;
+    
+    do {
+        RetVal = _driver._SlDrvDataWriteOp((_SlSd_t)sd, &CmdCtrl, &Msg, &CmdExt);
+        
+        if(SL_OS_RET_CODE_OK == RetVal) {
+            CmdExt.pTxPayload += ChunkLen;
+            ChunkLen = (uint16_t)((unsigned char *)pBuf + Len - CmdExt.pTxPayload);
+            ChunkLen = _sl_TruncatePayloadByProtocol(sd,ChunkLen);
+            CmdExt.TxPayloadLen = ChunkLen;
+            Msg.Cmd.IpV4.lenOrPadding = ChunkLen;
+        } else {
+            return RetVal;
+        }
+    } while(ChunkLen > 0);
+
+    return (int16_t)Len;
+}
+#endif
+
+/*******************************************************************************/
+/*  sl_Recvfrom */
+/*******************************************************************************/
+typedef union {
+    _sendRecvCommand_t	    Cmd;
+    _SocketAddrResponse_u	Rsp;
+} _SlRecvfromMsg_u;
+
+const _SlCmdCtrl_t _SlRecvfomCmdCtrl = {
+    SL_OPCODE_SOCKET_RECVFROM,
+    sizeof(_sendRecvCommand_t),
+    sizeof(_SocketAddrResponse_u)
+};
+
+#if _SL_INCLUDE_FUNC(sl_RecvFrom)
+int16_t cc3100_socket::sl_RecvFrom(int16_t sd, void *buf, int16_t Len, int16_t flags, SlSockAddr_t *from, SlSocklen_t *fromlen)
+{
+    _SlRecvfromMsg_u    Msg;
+    _SlCmdExt_t         CmdExt;
+    int16_t                 RetVal;
+
+    CmdExt.TxPayloadLen = 0;
+    CmdExt.RxPayloadLen = Len;
+    CmdExt.pTxPayload = NULL;
+    CmdExt.pRxPayload = (uint8_t *)buf;
+
+
+    Msg.Cmd.sd = (uint8_t)sd;
+    Msg.Cmd.StatusOrLen = Len;
+    /*  no size truncation in recv path */
+    CmdExt.RxPayloadLen = Msg.Cmd.StatusOrLen;
+
+    if(sizeof(SlSockAddrIn_t) == *fromlen) {
+        Msg.Cmd.FamilyAndFlags = SL_AF_INET;
+    } else if (sizeof(SlSockAddrIn6_t) == *fromlen) {
+        Msg.Cmd.FamilyAndFlags = SL_AF_INET6;
+    } else {
+        return SL_RET_CODE_INVALID_INPUT;
+    }
+
+    Msg.Cmd.FamilyAndFlags = (Msg.Cmd.FamilyAndFlags << 4) & 0xF0;
+    Msg.Cmd.FamilyAndFlags |= flags & 0x0F;
+
+    RetVal = _driver._SlDrvDataReadOp((_SlSd_t)sd, (_SlCmdCtrl_t *)&_SlRecvfomCmdCtrl, &Msg, &CmdExt);
+    if( RetVal != SL_OS_RET_CODE_OK ) {
+        return RetVal;
+    }
+
+    RetVal = Msg.Rsp.IpV4.statusOrLen;
+
+    if(RetVal >= 0) {
+        VERIFY_PROTOCOL(sd == Msg.Rsp.IpV4.sd);
+#if 0
+        _sl_ParseAddress(&Msg.Rsp, from, fromlen);
+#else
+        from->sa_family = Msg.Rsp.IpV4.family;
+        if(SL_AF_INET == from->sa_family) {
+            ((SlSockAddrIn_t *)from)->sin_port = Msg.Rsp.IpV4.port;
+            ((SlSockAddrIn_t *)from)->sin_addr.s_addr = Msg.Rsp.IpV4.address;
+            *fromlen = sizeof(SlSockAddrIn_t);
+        } else if (SL_AF_INET6_EUI_48 == from->sa_family ) {
+            ((SlSockAddrIn6_t *)from)->sin6_port  = Msg.Rsp.IpV6EUI48.port;
+            memcpy(((SlSockAddrIn6_t *)from)->sin6_addr._S6_un._S6_u8, Msg.Rsp.IpV6EUI48.address, 6);
+        }
+#ifdef SL_SUPPORT_IPV6
+        else if(AF_INET6 == from->sa_family) {
+            VERIFY_PROTOCOL(*fromlen >= sizeof(sockaddr_in6));
+
+            ((sockaddr_in6 *)from)->sin6_port = Msg.Rsp.IpV6.port;
+            memcpy(((sockaddr_in6 *)from)->sin6_addr._S6_un._S6_u32, Msg.Rsp.IpV6.address, 16);
+            *fromlen = sizeof(sockaddr_in6);
+        }
+#endif
+#endif
+    }
+
+    return (int16_t)RetVal;
+}
+#endif
+
+/*******************************************************************************/
+/*  sl_Connect */
+/*******************************************************************************/
+typedef union {
+    _SocketAddrCommand_u    Cmd;
+    _SocketResponse_t	    Rsp;
+} _SlSockConnectMsg_u;
+
+#if _SL_INCLUDE_FUNC(sl_Connect)
+int16_t cc3100_socket::sl_Connect(int16_t sd, const SlSockAddr_t *addr, int16_t addrlen)
+{
+    _SlSockConnectMsg_u  Msg;
+    _SlReturnVal_t       RetVal;
+    _SlCmdCtrl_t         CmdCtrl = {0, 0, sizeof(_SocketResponse_t)};
+    _SocketResponse_t    AsyncRsp;
+    uint8_t ObjIdx = MAX_CONCURRENT_ACTIONS;
+
+
+    switch(addr->sa_family) {
+        case SL_AF_INET :
+            CmdCtrl.Opcode = SL_OPCODE_SOCKET_CONNECT;
+            CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv4Command_t);
+            break;
+        case  SL_AF_INET6_EUI_48:
+            CmdCtrl.Opcode = SL_OPCODE_SOCKET_CONNECT_V6;
+            CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv6EUI48Command_t);
+            break;
+#ifdef SL_SUPPORT_IPV6
+        case AF_INET6:
+            CmdCtrl.Opcode = SL_OPCODE_SOCKET_CONNECT_V6;
+            CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv6Command_t);
+            break;
+#endif
+        case SL_AF_RF   :
+        default:
+            return SL_RET_CODE_INVALID_INPUT;
+    }
+
+    Msg.Cmd.IpV4.lenOrPadding = 0;
+    Msg.Cmd.IpV4.sd = (uint8_t)sd;
+
+    _sl_BuildAddress(addr, addrlen, &Msg.Cmd);
+
+    /* Use Obj to issue the command, if not available try later */
+    ObjIdx = (uint8_t)_driver._SlDrvWaitForPoolObj(CONNECT_ID, (uint8_t)(sd  & BSD_SOCKET_ID_MASK));
+
+    if (MAX_CONCURRENT_ACTIONS == ObjIdx) {
+        return SL_POOL_IS_EMPTY;
+    }
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+
+    g_pCB->ObjPool[ObjIdx].pRespArgs =  (uint8_t *)&AsyncRsp;
+
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+
+    /* send the command */
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&CmdCtrl, &Msg, NULL));
+    VERIFY_PROTOCOL(Msg.Rsp.sd == sd)
+
+    RetVal = Msg.Rsp.statusOrLen;
+
+    if(SL_RET_CODE_OK == RetVal) {
+        /*  wait for async and get Data Read parameters */
+        OSI_RET_OK_CHECK(_nonos.sl_SyncObjWait(&g_pCB->ObjPool[ObjIdx].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE, NON_OS_SYNC_OBJ_CLEAR_VALUE, SL_OS_WAIT_FOREVER));
+
+        VERIFY_PROTOCOL(AsyncRsp.sd == sd);
+
+        RetVal = AsyncRsp.statusOrLen;
+    }
+    _driver._SlDrvReleasePoolObj(ObjIdx);
+    return RetVal;
+}
+#endif
+
+/*******************************************************************************/
+/*  sl_Send */
+/*******************************************************************************/
+typedef union {
+    _sendRecvCommand_t    Cmd;
+    /*  no response for 'sendto' commands*/
+} _SlSendMsg_u;
+
+const _SlCmdCtrl_t _SlSendCmdCtrl = {
+    SL_OPCODE_SOCKET_SEND,
+    sizeof(_sendRecvCommand_t),
+    0
+};
+
+#if _SL_INCLUDE_FUNC(sl_Send)
+int16_t cc3100_socket::sl_Send(int16_t sd, const void *pBuf, int16_t Len, int16_t flags)
+{
+    _SlSendMsg_u   Msg;
+    _SlCmdExt_t    CmdExt;
+    uint16_t         ChunkLen;
+    int16_t            RetVal;
+    uint32_t         tempVal;
+    uint8_t  runSingleChunk = FALSE;
+
+    CmdExt.TxPayloadLen = Len;
+    CmdExt.RxPayloadLen = 0;
+    CmdExt.pTxPayload = (uint8_t *)pBuf;
+
+    /* Only for RAW transceiver type socket, relay the flags parameter in the 2 bytes (4 byte aligned) before the actual payload */
+    if ((sd & SL_SOCKET_PAYLOAD_TYPE_MASK) == SL_SOCKET_PAYLOAD_TYPE_RAW_TRANCEIVER) {
+        tempVal = flags;
+        CmdExt.pRxPayload = (uint8_t *)&tempVal;
+        CmdExt.RxPayloadLen = 4;
+        g_pCB->RelayFlagsViaRxPayload = TRUE;
+        runSingleChunk = TRUE;
+    } else {
+        CmdExt.pRxPayload = NULL;
+    }
+
+    ChunkLen = _sl_TruncatePayloadByProtocol(sd,Len);
+    CmdExt.TxPayloadLen = ChunkLen;
+
+    Msg.Cmd.StatusOrLen = ChunkLen;
+    Msg.Cmd.sd = (uint8_t)sd;
+    Msg.Cmd.FamilyAndFlags |= flags & 0x0F;
+
+    do {
+        RetVal = _driver._SlDrvDataWriteOp((uint8_t)sd, (_SlCmdCtrl_t *)&_SlSendCmdCtrl, &Msg, &CmdExt);
+        if(SL_OS_RET_CODE_OK == RetVal) {
+            CmdExt.pTxPayload += ChunkLen;
+            ChunkLen = (uint8_t *)pBuf + Len - CmdExt.pTxPayload;
+            ChunkLen = _sl_TruncatePayloadByProtocol(sd,ChunkLen);
+            CmdExt.TxPayloadLen = ChunkLen;
+            Msg.Cmd.StatusOrLen = ChunkLen;
+        } else {
+            return RetVal;
+        }
+    } while((ChunkLen > 0) && (runSingleChunk==FALSE));
+
+    return (int16_t)Len;
+}
+#endif
+
+/*******************************************************************************/
+/*  sl_Listen */
+/*******************************************************************************/
+typedef union {
+    _ListenCommand_t    Cmd;
+    _BasicResponse_t    Rsp;
+} _SlListenMsg_u;
+
+const _SlCmdCtrl_t _SlListenCmdCtrl = {
+    SL_OPCODE_SOCKET_LISTEN,
+    sizeof(_ListenCommand_t),
+    sizeof(_BasicResponse_t),
+};
+
+#if _SL_INCLUDE_FUNC(sl_Listen)
+int16_t cc3100_socket::sl_Listen(int16_t sd, int16_t backlog)
+{
+    _SlListenMsg_u  Msg;
+
+    Msg.Cmd.sd = (uint8_t)sd;
+    Msg.Cmd.backlog = (uint8_t)backlog;
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlListenCmdCtrl, &Msg, NULL));
+
+    return (int16_t)Msg.Rsp.status;
+}
+#endif
+
+/*******************************************************************************/
+/*  sl_Accept */
+/*******************************************************************************/
+typedef union {
+    _AcceptCommand_t    Cmd;
+    _SocketResponse_t   Rsp;
+} _SlSockAcceptMsg_u;
+
+const _SlCmdCtrl_t _SlAcceptCmdCtrl = {
+    SL_OPCODE_SOCKET_ACCEPT,
+    sizeof(_AcceptCommand_t),
+    sizeof(_BasicResponse_t),
+};
+
+#if _SL_INCLUDE_FUNC(sl_Accept)
+int16_t cc3100_socket::sl_Accept(int16_t sd, SlSockAddr_t *addr, SlSocklen_t *addrlen)
+{
+    _SlSockAcceptMsg_u      Msg;
+    _SlReturnVal_t          RetVal;
+    _SocketAddrResponse_u   AsyncRsp;
+
+    uint8_t ObjIdx = MAX_CONCURRENT_ACTIONS;
+
+
+    Msg.Cmd.sd = (uint8_t)sd;
+    Msg.Cmd.family = (sizeof(SlSockAddrIn_t) == *addrlen) ? SL_AF_INET : SL_AF_INET6;
+
+    /* Use Obj to issue the command, if not available try later */
+    ObjIdx = (uint8_t)_driver._SlDrvWaitForPoolObj(ACCEPT_ID, (uint8_t)(sd  & BSD_SOCKET_ID_MASK));
+
+    if (MAX_CONCURRENT_ACTIONS == ObjIdx) {
+        return SL_POOL_IS_EMPTY;
+    }
+
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+
+    g_pCB->ObjPool[ObjIdx].pRespArgs = (uint8_t *)&AsyncRsp;
+
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+    /* send the command */
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlAcceptCmdCtrl, &Msg, NULL));
+    VERIFY_PROTOCOL(Msg.Rsp.sd == sd);
+
+    RetVal = Msg.Rsp.statusOrLen;
+
+    if(SL_OS_RET_CODE_OK == RetVal) {
+        /*  wait for async and get Data Read parameters */
+        OSI_RET_OK_CHECK(_nonos.sl_SyncObjWait(&g_pCB->ObjPool[ObjIdx].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE, NON_OS_SYNC_OBJ_CLEAR_VALUE, SL_OS_WAIT_FOREVER));
+
+        VERIFY_PROTOCOL(AsyncRsp.IpV4.sd == sd);
+
+        RetVal = AsyncRsp.IpV4.statusOrLen;
+        if( (NULL != addr) && (NULL != addrlen) ) {
+#if 0 /*  Kept for backup */
+            _sl_ParseAddress(&AsyncRsp, addr, addrlen);
+#else
+            addr->sa_family = AsyncRsp.IpV4.family;
+
+            if(SL_AF_INET == addr->sa_family) {
+                if( *addrlen == sizeof( SlSockAddrIn_t ) ) {
+                    ((SlSockAddrIn_t *)addr)->sin_port         = AsyncRsp.IpV4.port;
+                    ((SlSockAddrIn_t *)addr)->sin_addr.s_addr  = AsyncRsp.IpV4.address;
+                } else {
+                    *addrlen = 0;
+                }
+            } else if (SL_AF_INET6_EUI_48 == addr->sa_family ) {
+                if( *addrlen == sizeof( SlSockAddrIn6_t ) ) {
+                    ((SlSockAddrIn6_t *)addr)->sin6_port                   = AsyncRsp.IpV6EUI48.port    ;
+                    /*  will be called from here and from _sl_BuildAddress*/
+                    memcpy(((SlSockAddrIn6_t *)addr)->sin6_addr._S6_un._S6_u8, AsyncRsp.IpV6EUI48.address, 6);
+                } else {
+                    *addrlen = 0;
+                }
+            }
+#ifdef SL_SUPPORT_IPV6
+            else {
+                if( *addrlen == sizeof( sockaddr_in6 ) ) {
+                    ((sockaddr_in6 *)addr)->sin6_port                   = AsyncRsp.IpV6.port    ;
+                    memcpy(((sockaddr_in6 *)addr)->sin6_addr._S6_un._S6_u32, AsyncRsp.IpV6.address, 16);
+                } else {
+                    *addrlen = 0;
+                }
+            }
+#endif
+#endif
+        }
+    }
+
+    _driver._SlDrvReleasePoolObj(ObjIdx);
+    return (int16_t)RetVal;
+}
+#endif
+
+
+/*******************************************************************************/
+/*  sl_Htonl */
+/*******************************************************************************/
+uint32_t cc3100_socket::sl_Htonl( uint32_t val )
+{
+    uint32_t i = 1;
+    int8_t *p = (int8_t *)&i;
+    if (p[0] == 1) { /* little endian */
+        p[0] = ((int8_t* )&val)[3];
+        p[1] = ((int8_t* )&val)[2];
+        p[2] = ((int8_t* )&val)[1];
+        p[3] = ((int8_t* )&val)[0];
+        return i;
+    } else { /* big endian */
+        return val;
+    }
+}
+
+/*******************************************************************************/
+/*  sl_Htonl */
+/*******************************************************************************/
+uint16_t cc3100_socket::sl_Htons( uint16_t val )
+{
+    int16_t i = 1;
+    int8_t *p = (int8_t *)&i;
+    if (p[0] == 1) { /* little endian */
+        p[0] = ((int8_t* )&val)[1];
+        p[1] = ((int8_t* )&val)[0];
+        return i;
+    } else { /* big endian */
+        return val;
+    }
+}
+
+/*******************************************************************************/
+/*  sl_Recv */
+/*******************************************************************************/
+typedef union {
+    _sendRecvCommand_t  Cmd;
+    _SocketResponse_t   Rsp;
+} _SlRecvMsg_u;
+
+const _SlCmdCtrl_t _SlRecvCmdCtrl = {
+    SL_OPCODE_SOCKET_RECV,
+    sizeof(_sendRecvCommand_t),
+    sizeof(_SocketResponse_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_Recv)
+int16_t cc3100_socket::sl_Recv(int16_t sd, void *pBuf, int16_t Len, int16_t flags)
+{
+    _SlRecvMsg_u    Msg;
+    _SlCmdExt_t     CmdExt;
+    _SlReturnVal_t status;
+
+    CmdExt.TxPayloadLen = 0;
+    CmdExt.RxPayloadLen = Len;
+    CmdExt.pTxPayload = NULL;
+    CmdExt.pRxPayload = (uint8_t *)pBuf;
+
+    Msg.Cmd.sd = (uint8_t)sd;
+    Msg.Cmd.StatusOrLen = Len;
+
+    /*  no size truncation in recv path */
+    CmdExt.RxPayloadLen = Msg.Cmd.StatusOrLen;
+
+    Msg.Cmd.FamilyAndFlags = flags & 0x0F;
+
+    status = _driver._SlDrvDataReadOp((_SlSd_t)sd, (_SlCmdCtrl_t *)&_SlRecvCmdCtrl, &Msg, &CmdExt);
+    if( status != SL_OS_RET_CODE_OK ) {
+        return status;
+    }
+
+    /*  if the Device side sends less than expected it is not the Driver's role */
+    /*  the returned value could be smaller than the requested size */
+    return (int16_t)Msg.Rsp.statusOrLen;
+}
+#endif
+
+/*******************************************************************************/
+/*  sl_SetSockOpt */
+/*******************************************************************************/
+typedef union {
+    _setSockOptCommand_t    Cmd;
+    _SocketResponse_t       Rsp;
+} _SlSetSockOptMsg_u;
+
+const _SlCmdCtrl_t _SlSetSockOptCmdCtrl = {
+    SL_OPCODE_SOCKET_SETSOCKOPT,
+    sizeof(_setSockOptCommand_t),
+    sizeof(_SocketResponse_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_SetSockOpt)
+int16_t cc3100_socket::sl_SetSockOpt(int16_t sd, int16_t level, int16_t optname, const void *optval, SlSocklen_t optlen)
+{
+    _SlSetSockOptMsg_u    Msg;
+    _SlCmdExt_t           CmdExt;
+
+    CmdExt.TxPayloadLen = optlen;
+    CmdExt.RxPayloadLen = 0;
+    CmdExt.pTxPayload = (uint8_t *)optval;
+    CmdExt.pRxPayload = NULL;
+
+    Msg.Cmd.sd = (uint8_t)sd;
+    Msg.Cmd.level = (uint8_t)level;
+    Msg.Cmd.optionLen = (uint8_t)optlen;
+    Msg.Cmd.optionName = (uint8_t)optname;
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlSetSockOptCmdCtrl, &Msg, &CmdExt));
+
+    return (int16_t)Msg.Rsp.statusOrLen;
+}
+#endif
+
+/*******************************************************************************/
+/*  sl_GetSockOpt */
+/*******************************************************************************/
+typedef union {
+    _getSockOptCommand_t    Cmd;
+    _getSockOptResponse_t   Rsp;
+} _SlGetSockOptMsg_u;
+
+const _SlCmdCtrl_t _SlGetSockOptCmdCtrl = {
+    SL_OPCODE_SOCKET_GETSOCKOPT,
+    sizeof(_getSockOptCommand_t),
+    sizeof(_getSockOptResponse_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_GetSockOpt)
+int16_t cc3100_socket::sl_GetSockOpt(int16_t sd, int16_t level, int16_t optname, void *optval, SlSocklen_t *optlen)
+{
+    _SlGetSockOptMsg_u    Msg;
+    _SlCmdExt_t           CmdExt;
+
+    if (*optlen == 0) {
+        return SL_EZEROLEN;
+    }
+    CmdExt.TxPayloadLen = 0;
+    CmdExt.RxPayloadLen = *optlen;
+    CmdExt.pTxPayload = NULL;
+    CmdExt.pRxPayload = (uint8_t*)optval;
+    CmdExt.ActualRxPayloadLen = 0;
+
+    Msg.Cmd.sd = (uint8_t)sd;
+    Msg.Cmd.level = (uint8_t)level;
+    Msg.Cmd.optionLen = (uint8_t)(*optlen);
+    Msg.Cmd.optionName = (uint8_t)optname;
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlGetSockOptCmdCtrl, &Msg, &CmdExt));
+
+    if (CmdExt.RxPayloadLen < CmdExt.ActualRxPayloadLen) {
+        *optlen = Msg.Rsp.optionLen;
+        return SL_ESMALLBUF;
+    } else {
+        *optlen = (uint8_t)CmdExt.ActualRxPayloadLen;
+    }
+    return (int16_t)Msg.Rsp.status;
+}
+#endif
+
+/*******************************************************************************/
+/*  sl_Select */
+/* ******************************************************************************/
+typedef union {
+    _SelectCommand_t   Cmd;
+    _BasicResponse_t   Rsp;
+} _SlSelectMsg_u;
+
+const _SlCmdCtrl_t _SlSelectCmdCtrl = {
+    SL_OPCODE_SOCKET_SELECT,
+    sizeof(_SelectCommand_t),
+    sizeof(_BasicResponse_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_Select)
+int16_t cc3100_socket::sl_Select(int16_t nfds, SlFdSet_t *readsds, SlFdSet_t *writesds, SlFdSet_t *exceptsds, SlTimeval_t *timeout)
+{
+    _SlSelectMsg_u          Msg;
+    _SelectAsyncResponse_t  AsyncRsp;
+    uint8_t ObjIdx = MAX_CONCURRENT_ACTIONS;
+
+    Msg.Cmd.nfds          = (uint8_t)nfds;
+    Msg.Cmd.readFdsCount  = 0;
+    Msg.Cmd.writeFdsCount = 0;
+
+    Msg.Cmd.readFds = 0;
+    Msg.Cmd.writeFds = 0;
+
+    if( readsds ) {
+        Msg.Cmd.readFds       = (uint16_t)readsds->fd_array[0];
+    }
+    if( writesds ) {
+        Msg.Cmd.writeFds      = (uint16_t)writesds->fd_array[0];
+    }
+    if( NULL == timeout ) {
+        Msg.Cmd.tv_sec = 0xffff;
+        Msg.Cmd.tv_usec = 0xffff;
+    } else {
+        if( 0xffff <= timeout->tv_sec ) {
+            Msg.Cmd.tv_sec = 0xffff;
+        } else {
+            Msg.Cmd.tv_sec = (uint16_t)timeout->tv_sec;
+        }
+        timeout->tv_usec = timeout->tv_usec >> 10;  /*  convert to milliseconds */
+        if( 0xffff <= timeout->tv_usec ) {
+            Msg.Cmd.tv_usec = 0xffff;
+        } else {
+            Msg.Cmd.tv_usec = (uint16_t)timeout->tv_usec;
+        }
+    }
+
+    /* Use Obj to issue the command, if not available try later */
+    ObjIdx = (uint8_t)_driver._SlDrvWaitForPoolObj(SELECT_ID, SL_MAX_SOCKETS);
+
+    if (MAX_CONCURRENT_ACTIONS == ObjIdx) {
+        return SL_POOL_IS_EMPTY;
+    }
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjLock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE, NON_OS_LOCK_OBJ_LOCK_VALUE, SL_OS_WAIT_FOREVER));
+
+    g_pCB->ObjPool[ObjIdx].pRespArgs =  (uint8_t *)&AsyncRsp;
+
+    OSI_RET_OK_CHECK(_nonos.sl_LockObjUnlock(&g_pCB->ProtectionLockObj, NON_OS_LOCK_OBJ_UNLOCK_VALUE));
+    /* send the command */
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlSelectCmdCtrl, &Msg, NULL));
+
+    if(SL_OS_RET_CODE_OK == (int16_t)Msg.Rsp.status) {
+        OSI_RET_OK_CHECK(_nonos.sl_SyncObjWait(&g_pCB->ObjPool[ObjIdx].SyncObj, NON_OS_SYNC_OBJ_SIGNAL_VALUE, NON_OS_SYNC_OBJ_CLEAR_VALUE, SL_OS_WAIT_FOREVER));
+        Msg.Rsp.status = AsyncRsp.status;
+
+        if(  ((int16_t)Msg.Rsp.status) >= 0 ) {
+            if( readsds ) {
+                readsds->fd_array[0]  = AsyncRsp.readFds;
+            }
+            if( writesds ) {
+                writesds->fd_array[0] = AsyncRsp.writeFds;
+            }
+        }
+    }
+
+    _driver._SlDrvReleasePoolObj(ObjIdx);
+    return (int16_t)Msg.Rsp.status;
+}
+
+/*  Select helper functions */
+/*******************************************************************************/
+/*  SL_FD_SET */
+/* ******************************************************************************/
+void cc3100_socket::SL_FD_SET(int16_t fd, SlFdSet_t *fdset)
+{
+    fdset->fd_array[0] |=  (1<< (fd & BSD_SOCKET_ID_MASK));
+}
+/*******************************************************************************/
+/*  SL_FD_CLR */
+/*******************************************************************************/
+void cc3100_socket::SL_FD_CLR(int16_t fd, SlFdSet_t *fdset)
+{
+    fdset->fd_array[0] &=  ~(1<< (fd & BSD_SOCKET_ID_MASK));
+}
+/*******************************************************************************/
+/*  SL_FD_ISSET */
+/*******************************************************************************/
+int16_t  cc3100_socket::SL_FD_ISSET(int16_t fd, SlFdSet_t *fdset)
+{
+    if( fdset->fd_array[0] & (1<< (fd & BSD_SOCKET_ID_MASK)) ) {
+        return 1;
+    }
+    return 0;
+}
+/*******************************************************************************/
+/*  SL_FD_ZERO */
+/*******************************************************************************/
+void cc3100_socket::SL_FD_ZERO(SlFdSet_t *fdset)
+{
+    fdset->fd_array[0] = 0;
+}
+
+#endif
+
+}//namespace mbed_cc3100
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_socket.h	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,1498 @@
+/*
+ * socket.h - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+#ifndef SL_SOCKET_H_
+#define SL_SOCKET_H_
+
+/*****************************************************************************/
+/* Include files                                                             */
+/*****************************************************************************/
+#include "cc3100_simplelink.h"
+#include "cc3100_protocol.h"
+
+namespace mbed_cc3100  {
+
+//#include "cc3100_driver.h"
+
+/*!
+
+    \addtogroup socket
+    @{
+
+*/
+
+/*****************************************************************************/
+/* Macro declarations                                                        */
+/*****************************************************************************/
+
+const uint8_t SL_FD_SETSIZE                      =   SL_MAX_SOCKETS;         /* Number of sockets to select on - same is max sockets!               */
+const uint8_t BSD_SOCKET_ID_MASK                 =    (0x0F);                 /* Index using the LBS 4 bits for socket id 0-7 */
+/* Define some BSD protocol constants.  */
+const uint8_t SL_SOCK_STREAM                     =    (1);                       /* TCP Socket                                                          */
+const uint8_t SL_SOCK_DGRAM                      =    (2);                       /* UDP Socket                                                          */
+const uint8_t SL_SOCK_RAW                        =    (3);                       /* Raw socket                                                          */
+const uint8_t SL_IPPROTO_TCP                     =    (6);                       /* TCP Raw Socket                                                      */
+const uint8_t SL_IPPROTO_UDP                     =    (17);                      /* UDP Raw Socket                                                      */
+const uint8_t SL_IPPROTO_RAW                     =    (255);                     /* Raw Socket                                                          */
+const uint8_t SL_SEC_SOCKET                      =    (100);                     /* Secured Socket Layer (SSL,TLS)                                      */
+
+/* Address families.  */
+const uint8_t     SL_AF_INET                     =    (2);                       /* IPv4 socket (UDP, TCP, etc)                                          */
+const uint8_t     SL_AF_INET6                    =    (3);                       /* IPv6 socket (UDP, TCP, etc)                                          */
+const uint8_t     SL_AF_INET6_EUI_48             =    (9);
+const uint8_t AF_INET                            =    SL_AF_INET;
+const uint8_t AF_INET6                           =    SL_AF_INET6;
+const uint8_t     SL_AF_RF                       =    (6);                       /* data include RF parameter, All layer by user (Wifi could be disconnected) */
+const uint8_t     SL_AF_PACKET                   =    (17);
+/* Protocol families, same as address families.  */
+const uint8_t     SL_PF_INET                     =    AF_INET;
+const uint8_t     SL_PF_INET6                    =    AF_INET6;
+const uint8_t     SL_INADDR_ANY                  =    (0);                       /*  bind any address  */
+
+/* error codes */
+const int8_t SL_SOC_ERROR                       =   (-1);  /* Failure.                                                             */
+const int8_t SL_SOC_OK                          =   ( 0);  /* Success.                                                             */
+const int8_t SL_INEXE                           =   (-8);   /* socket command in execution  */
+const int8_t SL_EBADF                           =   (-9);   /* Bad file number */
+const int8_t SL_ENSOCK                          =   (-10);  /* The system limit on the total number of open socket, has been reached */
+const int8_t SL_EAGAIN                          =   (-11);  /* Try again */
+const int8_t SL_EWOULDBLOCK                     =   SL_EAGAIN;
+const int8_t SL_ENOMEM                          =   (-12);  /* Out of memory */
+const int8_t SL_EACCES                          =   (-13);  /* Permission denied */
+const int8_t SL_EFAULT                          =   (-14);  /* Bad address */
+const int8_t SL_ECLOSE                          =   (-15);  /* close socket operation failed to transmit all queued packets */
+const int8_t SL_EALREADY_ENABLED                =   (-21);  /* Transceiver - Transceiver already ON. there could be only one */
+const int8_t SL_EINVAL                          =   (-22);  /* Invalid argument */
+const int8_t SL_EAUTO_CONNECT_OR_CONNECTING     =   (-69);  /* Transceiver - During connection, connected or auto mode started */
+const int8_t SL_CONNECTION_PENDING              =   (-72);  /* Transceiver - Device is connected, disconnect first to open transceiver */
+const int8_t SL_EUNSUPPORTED_ROLE               =   (-86);  /* Transceiver - Trying to start when WLAN role is AP or P2P GO */
+const int8_t SL_EDESTADDRREQ                    =   (-89);  /* Destination address required */
+const int8_t SL_EPROTOTYPE                      =   (-91);  /* Protocol wrong type for socket */
+const int8_t SL_ENOPROTOOPT                     =   (-92);  /* Protocol not available */
+const int8_t SL_EPROTONOSUPPORT                 =   (-93);  /* Protocol not supported */
+const int8_t SL_ESOCKTNOSUPPORT                 =   (-94);  /* Socket type not supported */
+const int8_t SL_EOPNOTSUPP                      =   (-95);  /* Operation not supported on transport endpoint */
+const int8_t SL_EAFNOSUPPORT                    =   (-97);  /* Address family not supported by protocol */
+const int8_t SL_EADDRINUSE                      =   (-98);  /* Address already in use */
+const int8_t SL_EADDRNOTAVAIL                   =   (-99);  /* Cannot assign requested address */
+const int8_t SL_ENETUNREACH                     =   (-101); /* Network is unreachable */
+const int8_t SL_ENOBUFS                         =   (-105); /* No buffer space available */
+const int8_t SL_EOBUFF                          =   SL_ENOBUFS;
+const int8_t SL_EISCONN                         =   (-106); /* Transport endpoint is already connected */
+const int8_t SL_ENOTCONN                        =   (-107); /* Transport endpoint is not connected */
+const int8_t SL_ETIMEDOUT                       =   (-110); /* Connection timed out */
+const int8_t SL_ECONNREFUSED                    =   (-111); /* Connection refused */
+const int8_t SL_EALREADY                        =   (-114); /* Non blocking connect in progress, try again */
+
+const int16_t SL_ESEC_RSA_WRONG_TYPE_E          =    (-130);  /* RSA wrong block type for RSA function */
+const int16_t SL_ESEC_RSA_BUFFER_E              =    (-131);  /* RSA buffer error, output too small or */
+const int16_t SL_ESEC_BUFFER_E                  =    (-132);  /* output buffer too small or input too large */
+const int16_t SL_ESEC_ALGO_ID_E                 =    (-133);  /* setting algo id error */
+const int16_t SL_ESEC_PUBLIC_KEY_E              =    (-134);  /* setting public key error */
+const int16_t SL_ESEC_DATE_E                    =    (-135);  /* setting date validity error */
+const int16_t SL_ESEC_SUBJECT_E                 =    (-136);  /* setting subject name error */
+const int16_t SL_ESEC_ISSUER_E                  =    (-137);  /* setting issuer  name error */
+const int16_t SL_ESEC_CA_TRUE_E                 =    (-138);  /* setting CA basic constraint true error */
+const int16_t SL_ESEC_EXTENSIONS_E              =    (-139);  /* setting extensions error */
+const int16_t SL_ESEC_ASN_PARSE_E               =    (-140);  /* ASN parsing error, invalid input */
+const int16_t SL_ESEC_ASN_VERSION_E             =    (-141);  /* ASN version error, invalid number */
+const int16_t SL_ESEC_ASN_GETINT_E              =    (-142);  /* ASN get big int16_t error, invalid data */
+const int16_t SL_ESEC_ASN_RSA_KEY_E             =    (-143);  /* ASN key init error, invalid input */
+const int16_t SL_ESEC_ASN_OBJECT_ID_E           =    (-144);  /* ASN object id error, invalid id */
+const int16_t SL_ESEC_ASN_TAG_NULL_E            =    (-145);  /* ASN tag error, not null */
+const int16_t SL_ESEC_ASN_EXPECT_0_E            =    (-146);  /* ASN expect error, not zero */
+const int16_t SL_ESEC_ASN_BITSTR_E              =    (-147);  /* ASN bit string error, wrong id */
+const int16_t SL_ESEC_ASN_UNKNOWN_OID_E         =    (-148);  /* ASN oid error, unknown sum id */
+const int16_t SL_ESEC_ASN_DATE_SZ_E             =    (-149);  /* ASN date error, bad size */
+const int16_t SL_ESEC_ASN_BEFORE_DATE_E         =    (-150);  /* ASN date error, current date before */
+const int16_t SL_ESEC_ASN_AFTER_DATE_E          =    (-151);  /* ASN date error, current date after */
+const int16_t SL_ESEC_ASN_SIG_OID_E             =    (-152);  /* ASN signature error, mismatched oid */
+const int16_t SL_ESEC_ASN_TIME_E                =    (-153);  /* ASN time error, unknown time type */
+const int16_t SL_ESEC_ASN_INPUT_E               =    (-154);  /* ASN input error, not enough data */
+const int16_t SL_ESEC_ASN_SIG_CONFIRM_E         =    (-155);  /* ASN sig error, confirm failure */
+const int16_t SL_ESEC_ASN_SIG_HASH_E            =    (-156);  /* ASN sig error, unsupported hash type */
+const int16_t SL_ESEC_ASN_SIG_KEY_E             =    (-157);  /* ASN sig error, unsupported key type */
+const int16_t SL_ESEC_ASN_DH_KEY_E              =    (-158);  /* ASN key init error, invalid input */
+const int16_t SL_ESEC_ASN_NTRU_KEY_E            =    (-159);  /* ASN ntru key decode error, invalid input */
+const int16_t SL_ESEC_ECC_BAD_ARG_E             =    (-170);  /* ECC input argument of wrong type */
+const int16_t SL_ESEC_ASN_ECC_KEY_E             =    (-171);  /* ASN ECC bad input */
+const int16_t SL_ESEC_ECC_CURVE_OID_E           =    (-172);  /* Unsupported ECC OID curve type */
+const int16_t SL_ESEC_BAD_FUNC_ARG              =    (-173);  /* Bad function argument provided */
+const int16_t SL_ESEC_NOT_COMPILED_IN           =    (-174);  /* Feature not compiled in */
+const int16_t SL_ESEC_UNICODE_SIZE_E            =    (-175);  /* Unicode password too big */
+const int16_t SL_ESEC_NO_PASSWORD               =    (-176);  /* no password provided by user */
+const int16_t SL_ESEC_ALT_NAME_E                =    (-177);  /* alt name size problem, too big */
+const int16_t SL_ESEC_AES_GCM_AUTH_E            =    (-180);  /* AES-GCM Authentication check failure */
+const int16_t SL_ESEC_AES_CCM_AUTH_E            =    (-181);  /* AES-CCM Authentication check failure */
+/* ssl tls security start with -300 offset */
+const int16_t SL_ESEC_CLOSE_NOTIFY              =    (-300); /* ssl/tls alerts */
+const int16_t SL_ESEC_UNEXPECTED_MESSAGE        =    (-310); /* ssl/tls alerts */
+const int16_t SL_ESEC_BAD_RECORD_MAC            =    (-320); /* ssl/tls alerts */
+const int16_t SL_ESEC_DECRYPTION_FAILED         =    (-321); /* ssl/tls alerts */
+const int16_t SL_ESEC_RECORD_OVERFLOW           =    (-322); /* ssl/tls alerts */
+const int16_t SL_ESEC_DECOMPRESSION_FAILURE     =    (-330); /* ssl/tls alerts */
+const int16_t SL_ESEC_HANDSHAKE_FAILURE         =    (-340); /* ssl/tls alerts */
+const int16_t SL_ESEC_NO_CERTIFICATE            =    (-341); /* ssl/tls alerts */
+const int16_t SL_ESEC_BAD_CERTIFICATE           =    (-342); /* ssl/tls alerts */
+const int16_t SL_ESEC_UNSUPPORTED_CERTIFICATE   =    (-343); /* ssl/tls alerts */
+const int16_t SL_ESEC_CERTIFICATE_REVOKED       =    (-344); /* ssl/tls alerts */
+const int16_t SL_ESEC_CERTIFICATE_EXPIRED       =    (-345); /* ssl/tls alerts */
+const int16_t SL_ESEC_CERTIFICATE_UNKNOWN       =    (-346); /* ssl/tls alerts */
+const int16_t SL_ESEC_ILLEGAL_PARAMETER         =    (-347); /* ssl/tls alerts */
+const int16_t SL_ESEC_UNKNOWN_CA                =    (-348); /* ssl/tls alerts */
+const int16_t SL_ESEC_ACCESS_DENIED             =    (-349); /* ssl/tls alerts */
+const int16_t SL_ESEC_DECODE_ERROR              =    (-350); /* ssl/tls alerts */
+const int16_t SL_ESEC_DECRYPT_ERROR             =    (-351); /* ssl/tls alerts */
+const int16_t SL_ESEC_EXPORT_RESTRICTION        =    (-360); /* ssl/tls alerts */
+const int16_t SL_ESEC_PROTOCOL_VERSION          =    (-370); /* ssl/tls alerts */
+const int16_t SL_ESEC_INSUFFICIENT_SECURITY     =    (-371); /* ssl/tls alerts */
+const int16_t SL_ESEC_INTERNAL_ERROR            =    (-380); /* ssl/tls alerts */
+const int16_t SL_ESEC_USER_CANCELLED            =    (-390); /* ssl/tls alerts */
+const int16_t SL_ESEC_NO_RENEGOTIATION          =    (-400); /* ssl/tls alerts */
+const int16_t SL_ESEC_UNSUPPORTED_EXTENSION     =    (-410); /* ssl/tls alerts */
+const int16_t SL_ESEC_CERTIFICATE_UNOBTAINABLE  =    (-411); /* ssl/tls alerts */
+const int16_t SL_ESEC_UNRECOGNIZED_NAME         =    (-412); /* ssl/tls alerts */
+const int16_t SL_ESEC_BAD_CERTIFICATE_STATUS_RESPONSE = (-413); /* ssl/tls alerts */
+const int16_t SL_ESEC_BAD_CERTIFICATE_HASH_VALUE =   (-414); /* ssl/tls alerts */
+/* propierty secure */
+const int16_t SL_ESECGENERAL                    =    (-450);  /* error secure level general error */
+const int16_t SL_ESECDECRYPT                    =    (-451);  /* error secure level, decrypt recv packet fail */
+const int16_t SL_ESECCLOSED                     =    (-452);  /* secure layrer is closed by other size , tcp is still connected  */
+const int16_t SL_ESECSNOVERIFY                  =    (-453);  /* Connected without server verification */
+const int16_t SL_ESECNOCAFILE                   =    (-454);  /* error secure level CA file not found*/
+const int16_t SL_ESECMEMORY                     =    (-455);  /* error secure level No memory  space available */
+const int16_t SL_ESECBADCAFILE                  =    (-456);  /* error secure level bad CA file */
+const int16_t SL_ESECBADCERTFILE                =    (-457);  /* error secure level bad Certificate file */
+const int16_t SL_ESECBADPRIVATEFILE             =    (-458);  /* error secure level bad private file */
+const int16_t SL_ESECBADDHFILE                  =    (-459);  /* error secure level bad DH file */
+const int16_t SL_ESECT00MANYSSLOPENED           =    (-460);  /* MAX SSL Sockets are opened */
+const int16_t SL_ESECDATEERROR                  =    (-461);  /* connected with certificate date verification error */
+const int16_t SL_ESECHANDSHAKETIMEDOUT          =    (-462);  /* connection timed out due to handshake time */
+
+/* end error codes */
+
+/* Max payload size by protocol */
+const uint8_t SL_SOCKET_PAYLOAD_TYPE_MASK       =     (0xF0);  /*4 bits type, 4 bits sockets id */
+const uint8_t SL_SOCKET_PAYLOAD_TYPE_UDP_IPV4   =     (0x00);  /* 1472 bytes */
+const uint8_t SL_SOCKET_PAYLOAD_TYPE_TCP_IPV4   =     (0x10);  /* 1460 bytes */
+const uint8_t SL_SOCKET_PAYLOAD_TYPE_UDP_IPV6   =     (0x20);  /* 1452 bytes */
+const uint8_t SL_SOCKET_PAYLOAD_TYPE_TCP_IPV6   =     (0x30);  /* 1440 bytes */
+const uint8_t SL_SOCKET_PAYLOAD_TYPE_UDP_IPV4_SECURE =(0x40);  /*            */
+const uint8_t SL_SOCKET_PAYLOAD_TYPE_TCP_IPV4_SECURE =(0x50);  /*            */
+const uint8_t SL_SOCKET_PAYLOAD_TYPE_UDP_IPV6_SECURE =(0x60);  /*            */
+const uint8_t SL_SOCKET_PAYLOAD_TYPE_TCP_IPV6_SECURE =(0x70);  /*            */
+const uint8_t SL_SOCKET_PAYLOAD_TYPE_RAW_TRANCEIVER  =(0x80);  /* 1536 bytes */
+const uint8_t SL_SOCKET_PAYLOAD_TYPE_RAW_PACKET =     (0x90);  /* 1536 bytes */
+const uint8_t SL_SOCKET_PAYLOAD_TYPE_RAW_IP4    =     (0xa0);
+const uint8_t SL_SOCKET_PAYLOAD_TYPE_RAW_IP6    =     (SL_SOCKET_PAYLOAD_TYPE_RAW_IP4 );
+
+
+
+const uint8_t SL_SOL_SOCKET        =  (1);   /* Define the socket option category. */
+const uint8_t SL_IPPROTO_IP        =  (2);   /* Define the IP option category.     */
+const uint8_t SL_SOL_PHY_OPT       =  (3);   /* Define the PHY option category.    */
+
+const uint8_t SL_SO_RCVBUF         =  (8);   /* Setting TCP receive buffer size */
+const uint8_t SL_SO_KEEPALIVE      =  (9);   /* Connections are kept alive with periodic messages */
+const uint8_t SL_SO_RCVTIMEO       =  (20);  /* Enable receive timeout */
+const uint8_t SL_SO_NONBLOCKING    =  (24);  /* Enable . disable nonblocking mode  */
+const uint8_t SL_SO_SECMETHOD      =  (25);  /* security metohd */
+const uint8_t SL_SO_SECURE_MASK    =  (26);  /* security mask */
+const uint8_t SL_SO_SECURE_FILES   =  (27);  /* security files */
+const uint8_t SL_SO_CHANGE_CHANNEL =  (28);  /* This option is available only when transceiver started */
+const uint8_t SL_SO_SECURE_FILES_PRIVATE_KEY_FILE_NAME =(30); /* This option used to configue secure file */
+const uint8_t SL_SO_SECURE_FILES_CERTIFICATE_FILE_NAME =(31); /* This option used to configue secure file */
+const uint8_t SL_SO_SECURE_FILES_CA_FILE_NAME      =    (32); /* This option used to configue secure file */
+const uint8_t SL_SO_SECURE_FILES_DH_KEY_FILE_NAME  =    (33); /* This option used to configue secure file */
+
+const uint8_t SL_IP_MULTICAST_IF   =  (60); /* Specify outgoing multicast interface */
+const uint8_t SL_IP_MULTICAST_TTL  =  (61); /* Specify the TTL value to use for outgoing multicast packet. */
+const uint8_t SL_IP_ADD_MEMBERSHIP =  (65); /* Join IPv4 multicast membership */
+const uint8_t SL_IP_DROP_MEMBERSHIP=  (66); /* Leave IPv4 multicast membership */
+const uint8_t SL_IP_HDRINCL        =  (67); /* Raw socket IPv4 header included. */
+const uint8_t SL_IP_RAW_RX_NO_HEADER =(68); /* Proprietary socket option that does not includeIPv4/IPv6 header (and extension headers) on received raw sockets*/
+const uint8_t SL_IP_RAW_IPV6_HDRINCL =(69); /* Transmitted buffer over IPv6 socket contains IPv6 header. */
+
+const uint8_t SL_SO_PHY_RATE           =   (100);   /* WLAN Transmit rate */
+const uint8_t SL_SO_PHY_TX_POWER       =   (101);   /* TX Power level */
+const uint8_t SL_SO_PHY_NUM_FRAMES_TO_TX = (102);   /* Number of frames to transmit */
+const uint8_t SL_SO_PHY_PREAMBLE       =   (103);   /* Preamble for transmission */
+
+const uint8_t SL_SO_SEC_METHOD_SSLV3                  =           (0);  /* security metohd SSL v3*/
+const uint8_t SL_SO_SEC_METHOD_TLSV1                  =           (1);  /* security metohd TLS v1*/
+const uint8_t SL_SO_SEC_METHOD_TLSV1_1                =           (2);  /* security metohd TLS v1_1*/
+const uint8_t SL_SO_SEC_METHOD_TLSV1_2                =           (3);  /* security metohd TLS v1_2*/
+const uint8_t SL_SO_SEC_METHOD_SSLv3_TLSV1_2          =           (4);  /* use highest possible version from SSLv3 - TLS 1.2*/
+const uint8_t SL_SO_SEC_METHOD_DLSV1                  =           (5);  /* security metohd DTL v1  */
+
+#define SL_SEC_MASK_SSL_RSA_WITH_RC4_128_SHA               (1 << 0)
+#define SL_SEC_MASK_SSL_RSA_WITH_RC4_128_MD5               (1 << 1)
+#define SL_SEC_MASK_TLS_RSA_WITH_AES_256_CBC_SHA           (1 << 2)
+#define SL_SEC_MASK_TLS_DHE_RSA_WITH_AES_256_CBC_SHA       (1 << 3)
+#define SL_SEC_MASK_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA     (1 << 4)
+#define SL_SEC_MASK_TLS_ECDHE_RSA_WITH_RC4_128_SHA         (1 << 5)
+#define SL_SEC_MASK_SECURE_DEFAULT                         ((SL_SEC_MASK_TLS_ECDHE_RSA_WITH_RC4_128_SHA  <<  1)  -  1) /*Is this var name correct? was SEC_MASK_TLS_ECDHE_RSA_WITH_RC4_128_SHA*/
+
+const uint32_t SL_MSG_DONTWAIT                       =            (0x00000008);  /* Nonblocking IO */
+
+/* AP DHCP Server - IP Release reason code */
+const uint8_t SL_IP_LEASE_PEER_RELEASE  =   (0);
+const uint8_t SL_IP_LEASE_PEER_DECLINE  =   (1);
+const uint8_t SL_IP_LEASE_EXPIRED       =   (2);
+
+/* possible types when receiving SL_SOCKET_ASYNC_EVENT*/
+const uint8_t SSL_ACCEPT                               = (1); /* accept failed due to ssl issue ( tcp pass) */
+const uint8_t RX_FRAGMENTATION_TOO_BIG                 = (2); /* connection less mode, rx packet fragmentation > 16K, packet is being released */
+const uint8_t OTHER_SIDE_CLOSE_SSL_DATA_NOT_ENCRYPTED  = (3); /* remote side down from secure to unsecure */
+
+
+
+#ifdef SL_INC_STD_BSD_API_NAMING
+
+#define FD_SETSIZE                          SL_FD_SETSIZE
+
+#define SOCK_STREAM                         SL_SOCK_STREAM
+#define SOCK_DGRAM                          SL_SOCK_DGRAM
+#define SOCK_RAW                            SL_SOCK_RAW
+#define IPPROTO_TCP                         SL_IPPROTO_TCP
+#define IPPROTO_UDP                         SL_IPPROTO_UDP
+#define IPPROTO_RAW                         SL_IPPROTO_RAW
+
+#define AF_INET6_EUI_48                     SL_AF_INET6_EUI_48
+#define AF_RF                               SL_AF_RF
+#define AF_PACKET                           SL_AF_PACKET
+
+#define PF_INET                             SL_PF_INET
+#define PF_INET6                            SL_PF_INET6
+
+#define INADDR_ANY                          SL_INADDR_ANY
+#define ERROR                               SL_SOC_ERROR
+#define INEXE                               SL_INEXE
+#define EBADF                               SL_EBADF
+#define ENSOCK                              SL_ENSOCK
+#define EAGAIN                              SL_EAGAIN
+#define EWOULDBLOCK                         SL_EWOULDBLOCK
+#define ENOMEM                              SL_ENOMEM
+#define EACCES                              SL_EACCES
+#define EFAULT                              SL_EFAULT
+#define EINVAL                              SL_EINVAL
+#define EDESTADDRREQ                        SL_EDESTADDRREQ
+#define EPROTOTYPE                          SL_EPROTOTYPE
+#define ENOPROTOOPT                         SL_ENOPROTOOPT
+#define EPROTONOSUPPORT                     SL_EPROTONOSUPPORT
+#define ESOCKTNOSUPPORT                     SL_ESOCKTNOSUPPORT
+#define EOPNOTSUPP                          SL_EOPNOTSUPP
+#define EAFNOSUPPORT                        SL_EAFNOSUPPORT
+#define EADDRINUSE                          SL_EADDRINUSE
+#define EADDRNOTAVAIL                       SL_EADDRNOTAVAIL
+#define ENETUNREACH                         SL_ENETUNREACH
+#define ENOBUFS                             SL_ENOBUFS
+#define EOBUFF                              SL_EOBUFF
+#define EISCONN                             SL_EISCONN
+#define ENOTCONN                            SL_ENOTCONN
+#define ETIMEDOUT                           SL_ETIMEDOUT
+#define ECONNREFUSED                        SL_ECONNREFUSED
+
+#define SOL_SOCKET                          SL_SOL_SOCKET
+#define IPPROTO_IP                          SL_IPPROTO_IP
+#define SO_KEEPALIVE                        SL_SO_KEEPALIVE
+
+#define SO_RCVTIMEO                         SL_SO_RCVTIMEO
+#define SO_NONBLOCKING                      SL_SO_NONBLOCKING
+
+#define IP_MULTICAST_IF                     SL_IP_MULTICAST_IF
+#define IP_MULTICAST_TTL                    SL_IP_MULTICAST_TTL
+#define IP_ADD_MEMBERSHIP                   SL_IP_ADD_MEMBERSHIP
+#define IP_DROP_MEMBERSHIP                  SL_IP_DROP_MEMBERSHIP
+
+#define socklen_t                           SlSocklen_t
+#define timeval                             SlTimeval_t
+#define sockaddr                            SlSockAddr_t
+#define in6_addr                            SlIn6Addr_t
+#define sockaddr_in6                        SlSockAddrIn6_t
+#define in_addr                             SlInAddr_t
+#define sockaddr_in                         SlSockAddrIn_t
+
+#define MSG_DONTWAIT                        SL_MSG_DONTWAIT
+
+#define FD_SET                              SL_FD_SET
+#define FD_CLR                              SL_FD_CLR
+#define FD_ISSET                            SL_FD_ISSET
+#define FD_ZERO                             SL_FD_ZERO
+#define fd_set                              SlFdSet_t
+
+#define socket                              sl_Socket
+#define close                               sl_Close
+#define accept                              sl_Accept
+#define bind                                sl_Bind
+#define listen                              sl_Listen
+#define connect                             sl_Connect
+#define select                              sl_Select
+#define setsockopt                          sl_SetSockOpt
+#define getsockopt                          sl_GetSockOpt
+#define recv                                sl_Recv
+#define recvfrom                            sl_RecvFrom
+#define write_                               sl_Write
+#define send                                sl_Send
+#define sendto                              sl_SendTo
+#define gethostbyname                       sl_NetAppDnsGetHostByName
+#define htonl                               sl_Htonl
+#define ntohl                               sl_Ntohl
+#define htons                               sl_Htons
+#define ntohs                               sl_Ntohs
+#endif
+
+
+/*****************************************************************************/
+/* Structure/Enum declarations                                               */
+/*****************************************************************************/
+
+/* Internet address   */
+typedef struct SlInAddr_t {
+#ifndef s_addr
+    uint32_t           s_addr;             /* Internet address 32 bits */
+#else
+    union S_un {
+        struct {
+            uint8_t s_b1,s_b2,s_b3,s_b4;
+        } S_un_b;
+        struct {
+            uint8_t s_w1,s_w2;
+        } S_un_w;
+        uint32_t S_addr;
+    } S_un;
+#endif
+} SlInAddr_t;
+
+
+/* sockopt */
+typedef struct {
+    uint32_t KeepaliveEnabled; /* 0 = disabled;1 = enabled; default = 1*/
+} SlSockKeepalive_t;
+
+typedef struct {
+    uint32_t ReuseaddrEnabled; /* 0 = disabled; 1 = enabled; default = 1*/
+} SlSockReuseaddr_t;
+
+typedef struct {
+    uint32_t Winsize;          /* receive window size for tcp sockets  */
+} SlSockWinsize_t;
+
+typedef struct {
+    uint32_t NonblockingEnabled;/* 0 = disabled;1 = enabled;default = 1*/
+} SlSockNonblocking_t;
+
+typedef struct {
+    uint8_t   sd;
+    uint8_t   type;
+    uint16_t  val;
+} SlSocketAsyncEvent_t;
+
+typedef struct {
+    int16_t          status;
+    uint16_t        sd;
+    SlSocketAsyncEvent_t socketAsyncEvent;
+} SlSockEventData_t;
+
+
+typedef struct {
+    uint32_t                    Event;
+    SlSockEventData_t       EventData;
+} SlSockEvent_t;
+
+
+typedef struct {
+    uint32_t    secureMask;
+} SlSockSecureMask;
+
+typedef struct {
+    uint8_t     secureMethod;
+} SlSockSecureMethod;
+
+typedef enum {
+    SL_BSD_SECURED_PRIVATE_KEY_IDX = 0,
+    SL_BSD_SECURED_CERTIFICATE_IDX,
+    SL_BSD_SECURED_CA_IDX,
+    SL_BSD_SECURED_DH_IDX
+} slBsd_secureSocketFilesIndex_e;
+
+typedef struct {
+    SlInAddr_t   imr_multiaddr;     /* The IPv4 multicast address to join */
+    SlInAddr_t   imr_interface;     /* The interface to use for this group */
+} SlSockIpMreq;
+
+
+/* sockopt */
+typedef uint32_t   SlTime_t;
+typedef uint32_t   SlSuseconds_t;
+
+typedef struct  {
+    SlTime_t          tv_sec;             /* Seconds      */
+    SlSuseconds_t     tv_usec;            /* Microseconds */
+} SlTimeval_t;
+
+typedef uint16_t SlSocklen_t;
+
+/* IpV4 socket address */
+typedef struct  {
+    uint16_t          sa_family;     /* Address family (e.g. , AF_INET)     */
+    uint8_t           sa_data[14];  /* Protocol- specific address information*/
+} SlSockAddr_t;
+
+
+/* IpV6 or Ipv6 EUI64 */
+typedef struct  {
+    union {
+        uint8_t   _S6_u8[16];
+        uint32_t  _S6_u32[4];
+    } _S6_un;
+} SlIn6Addr_t;
+
+typedef struct  {
+    uint16_t           sin6_family;                 /* AF_INET6 || AF_INET6_EUI_48*/
+    uint16_t           sin6_port;                   /* Transport layer port.  */
+    uint32_t           sin6_flowinfo;               /* IPv6 flow information. */
+    SlIn6Addr_t        sin6_addr;                   /* IPv6 address. */
+    uint32_t           sin6_scope_id;               /* set of interfaces for a scope. */
+} SlSockAddrIn6_t;
+
+/* Socket address, Internet style. */
+
+typedef struct  {
+    uint16_t              sin_family;         /* Internet Protocol (AF_INET).                    */
+    uint16_t              sin_port;           /* Address port (16 bits).                         */
+    SlInAddr_t            sin_addr;           /* Internet address (32 bits).                     */
+    int8_t                sin_zero[8];        /* Not used.                                       */
+} SlSockAddrIn_t;
+
+typedef struct {
+    uint32_t ip;
+    uint32_t gateway;
+    uint32_t dns;
+} SlIpV4AcquiredAsync_t;
+
+typedef struct {
+    uint32_t type;
+    uint32_t ip[4];
+    uint32_t gateway[4];
+    uint32_t dns[4];
+} SlIpV6AcquiredAsync_t;
+
+typedef struct {
+    uint32_t    ip_address;
+    uint32_t    lease_time;
+    uint8_t     mac[6];
+    uint16_t    padding;
+} SlIpLeasedAsync_t;
+
+typedef struct {
+    uint32_t    ip_address;
+    uint8_t     mac[6];
+    uint16_t    reason;
+} SlIpReleasedAsync_t;
+
+
+typedef union {
+    SlIpV4AcquiredAsync_t    ipAcquiredV4; /*SL_NETAPP_IPV4_IPACQUIRED_EVENT*/
+    SlIpV6AcquiredAsync_t    ipAcquiredV6; /*SL_NETAPP_IPV6_IPACQUIRED_EVENT*/
+    uint32_t                      sd;           /*SL_SOCKET_TX_FAILED_EVENT*/
+    SlIpLeasedAsync_t        ipLeased;     /* SL_NETAPP_IP_LEASED_EVENT   */
+    SlIpReleasedAsync_t      ipReleased;   /* SL_NETAPP_IP_RELEASED_EVENT */
+} SlNetAppEventData_u;
+
+typedef struct {
+    uint32_t                     Event;
+    SlNetAppEventData_u       EventData;
+} SlNetAppEvent_t;
+
+
+typedef struct sock_secureFiles {
+    uint8_t                     secureFiles[4];
+} SlSockSecureFiles_t;
+
+
+typedef struct SlFdSet_t {                  /* The select socket array manager */
+    uint32_t        fd_array[(SL_FD_SETSIZE + 31)/32]; /* Bit map of SOCKET Descriptors */
+} SlFdSet_t;
+
+typedef struct {
+    uint8_t   rate;               /* Recevied Rate  */
+    uint8_t   channel;            /* The received channel*/
+    int8_t    rssi;               /* The computed RSSI value in db of current frame */
+    uint8_t   padding;                                           /* pad to align to 32 bits */
+    uint32_t  timestamp;          /* Timestamp in microseconds,     */
+} SlTransceiverRxOverHead_t;
+
+class cc3100_nonos;
+
+class cc3100_socket
+{
+
+public:
+
+    cc3100_socket(cc3100_driver &driver, cc3100_nonos &nonos);
+
+    ~cc3100_socket();
+
+    /*******************************************************************************/
+    /* Functions prototypes                                                        */
+    /*******************************************************************************/
+    void   _sl_BuildAddress(const SlSockAddr_t *addr, int16_t addrlen, _SocketAddrCommand_u    *pCmd);
+    void   _sl_ParseAddress(_SocketAddrResponse_u *pRsp, SlSockAddr_t *addr, SlSocklen_t *addrlen);
+    uint16_t   _sl_TruncatePayloadByProtocol(const int16_t pSd,const uint16_t length);
+
+    /*****************************************************************************/
+    /* Function prototypes                                                       */
+    /*****************************************************************************/
+
+    /*!
+
+        \brief create an endpoint for communication
+
+        The socket function creates a new socket of a certain socket type, identified
+        by an integer number, and allocates system resources to it.
+        This function is called by the application layer to obtain a socket handle.
+
+        \param[in] domain           specifies the protocol family of the created socket.
+                                    For example:
+                                       AF_INET for network protocol IPv4
+                                       AF_RF for starting transceiver mode. Notes:
+                                       - sending and receiving any packet overriding 802.11 header
+                                       - for optimized power consumption the socket will be started in TX
+                                         only mode until receive command is activated
+                                       AF_INET6 for IPv6
+
+
+        \param[in] type              specifies the communication semantic, one of:
+                                       SOCK_STREAM (reliable stream-oriented service or Stream Sockets)
+                                       SOCK_DGRAM (datagram service or Datagram Sockets)
+                                       SOCK_RAW (raw protocols atop the network layer)
+                                       when used with AF_RF:
+                                                                         SOCK_DGRAM - L2 socket
+                                                                         SOCK_RAW - L1 socket - bypass WLAN CCA (Clear Channel Assessment)
+
+        \param[in] protocol         specifies a particular transport to be used with
+                                    the socket.
+                                    The most common are IPPROTO_TCP, IPPROTO_SCTP, IPPROTO_UDP,
+                                    IPPROTO_DCCP.
+                                    The value 0 may be used to select a default
+                                    protocol from the selected domain and type
+
+
+        \return                     On success, socket handle that is used for consequent socket operations.
+                                    A successful return code should be a positive number (int16)
+                                    On error, a negative (int16) value will be returned specifying the error code.
+                               SL_EAFNOSUPPORT  - illegal domain parameter
+                               SL_EPROTOTYPE  - illegal type parameter
+                               SL_EACCES   - permission denied
+                               SL_ENSOCK  - exceeded maximal number of socket
+                               SL_ENOMEM  - memory allocation error
+                               SL_EINVAL  - error in socket configuration
+                               SL_EPROTONOSUPPORT  - illegal protocol parameter
+                               SL_EOPNOTSUPP  - illegal combination of protocol and type parameters
+
+
+        \sa                         sl_Close
+        \note                       belongs to \ref basic_api
+        \warning
+    */
+#if _SL_INCLUDE_FUNC(sl_Socket)
+    int16_t sl_Socket(int16_t Domain, int16_t Type, int16_t Protocol);
+#endif
+
+    /*!
+        \brief gracefully close socket
+
+        This function causes the system to release resources allocated to a socket.  \n
+        In case of TCP, the connection is terminated.
+
+        \param[in] sd               socket handle (received in sl_Socket)
+
+        \return                        On success, zero is returned.
+                                    On error, a negative number is returned.
+
+        \sa                         sl_Socket
+        \note                       belongs to \ref ext_api
+        \warning
+    */
+#if _SL_INCLUDE_FUNC(sl_Close)
+    int16_t sl_Close(int16_t sd);
+#endif
+
+    /*!
+        \brief Accept a connection on a socket
+
+        This function is used with connection-based socket types (SOCK_STREAM).
+        It extracts the first connection request on the queue of pending
+        connections, creates a new connected socket, and returns a new file
+        descriptor referring to that socket.
+        The newly created socket is not in the listening state. The
+        original socket sd is unaffected by this call.
+        The argument sd is a socket that has been created with
+        sl_Socket(), bound to a local address with sl_Bind(), and is
+        listening for connections after a sl_Listen(). The argument \b
+        \e addr is a pointer to a sockaddr structure. This structure
+        is filled in with the address of the peer socket, as known to
+        the communications layer. The exact format of the address
+        returned addr is determined by the socket's address family.
+        The \b \e addrlen argument is a value-result argument: it
+        should initially contain the size of the structure pointed to
+        by addr, on return it will contain the actual length (in
+        bytes) of the address returned.
+
+        \param[in] sd               socket descriptor (handle)
+        \param[out] addr            the argument addr is a pointer
+                                    to a sockaddr structure. This
+                                    structure is filled in with the
+                                    address of the peer socket, as
+                                    known to the communications
+                                    layer. The exact format of the
+                                    address returned addr is
+                                    determined by the socket's
+                                    address\n
+                                    sockaddr:\n - code for the
+                                    address format. On this version
+                                    only AF_INET is supported.\n -
+                                    socket address, the length
+                                    depends on the code format
+        \param[out] addrlen         the addrlen argument is a value-result
+                                    argument: it should initially contain the
+                                    size of the structure pointed to by addr
+
+        \return                        On success, a socket handle.
+                                    On a non-blocking accept a possible negative value is SL_EAGAIN.
+                                    On failure, negative value.
+                                    SL_POOL_IS_EMPTY may be return in case there are no resources in the system
+                                     In this case try again later or increase MAX_CONCURRENT_ACTIONS
+
+        \sa                         sl_Socket  sl_Bind  sl_Listen
+        \note                       belongs to \ref server_side
+        \warning
+    */
+#if _SL_INCLUDE_FUNC(sl_Accept)
+    int16_t sl_Accept(int16_t sd, SlSockAddr_t *addr, SlSocklen_t *addrlen);
+#endif
+
+    /*!
+        \brief assign a name to a socket
+
+        This function gives the socket the local address addr.
+        addr is addrlen bytes long. Traditionally, this is called
+        When a socket is created with socket, it exists in a name
+        space (address family) but has no name assigned.
+        It is necessary to assign a local address before a SOCK_STREAM
+        socket may receive connections.
+
+        \param[in] sd                socket descriptor (handle)
+        \param[in] addr              specifies the destination
+                                    addrs\n sockaddr:\n - code for
+                                    the address format. On this
+                                    version only AF_INET is
+                                    supported.\n - socket address,
+                                    the length depends on the code
+                                    format
+        \param[in] addrlen          contains the size of the structure pointed to by addr
+
+        \return                        On success, zero is returned. On error, a negative error code is returned.
+
+        \sa                         sl_Socket  sl_Accept sl_Listen
+        \note                       belongs to \ref basic_api
+        \warning
+    */
+#if _SL_INCLUDE_FUNC(sl_Bind)
+    int16_t sl_Bind(int16_t sd, const SlSockAddr_t *addr, int16_t addrlen);
+#endif
+
+    /*!
+        \brief listen for connections on a socket
+
+        The willingness to accept incoming connections and a queue
+        limit for incoming connections are specified with listen(),
+        and then the connections are accepted with accept.
+        The listen() call applies only to sockets of type SOCK_STREAM
+        The backlog parameter defines the maximum length the queue of
+        pending connections may grow to.
+
+        \param[in] sd               socket descriptor (handle)
+        \param[in] backlog          specifies the listen queue depth.
+
+
+        \return                    On success, zero is returned. On error, a negative error code is returned.
+
+        \sa                         sl_Socket  sl_Accept  sl_Bind
+        \note                       belongs to \ref server_side
+        \warning
+    */
+#if _SL_INCLUDE_FUNC(sl_Listen)
+    int16_t sl_Listen(int16_t sd, int16_t backlog);
+#endif
+
+    /*!
+        \brief Initiate a connection on a socket
+
+        Function connects the socket referred to by the socket
+        descriptor sd, to the address specified by addr. The addrlen
+        argument specifies the size of addr. The format of the
+        address in addr is determined by the address space of the
+        socket. If it is of type SOCK_DGRAM, this call specifies the
+        peer with which the socket is to be associated; this address
+        is that to which datagrams are to be sent, and the only
+        address from which datagrams are to be received.  If the
+        socket is of type SOCK_STREAM, this call attempts to make a
+        connection to another socket. The other socket is specified
+        by address, which is an address in the communications space
+        of the socket.
+
+
+        \param[in] sd               socket descriptor (handle)
+        \param[in] addr             specifies the destination addr\n
+                                    sockaddr:\n - code for the
+                                    address format. On this version
+                                    only AF_INET is supported.\n -
+                                    socket address, the length
+                                    depends on the code format
+
+        \param[in] addrlen          contains the size of the structure pointed
+                                    to by addr
+
+        \return                     On success, a socket handle.
+                                    On a non-blocking connect a possible negative value is SL_EALREADY.
+                                    On failure, negative value.
+                                    SL_POOL_IS_EMPTY may be return in case there are no resources in the system
+                                      In this case try again later or increase MAX_CONCURRENT_ACTIONS
+
+        \sa                         sl_Socket
+        \note                       belongs to \ref client_side
+        \warning
+    */
+#if _SL_INCLUDE_FUNC(sl_Connect)
+    int16_t sl_Connect(int16_t sd, const SlSockAddr_t *addr, int16_t addrlen);
+#endif
+
+    /*!
+        \brief Monitor socket activity
+
+        Select allow a program to monitor multiple file descriptors,
+        waiting until one or more of the file descriptors become
+        "ready" for some class of I/O operation
+
+
+        \param[in]  nfds        the highest-numbered file descriptor in any of the
+                                three sets, plus 1.
+        \param[out] readsds     socket descriptors list for read monitoring and accept monitoring
+        \param[out] writesds    socket descriptors list for connect monitoring only, write monitoring is not supported
+        \param[out] exceptsds   socket descriptors list for exception monitoring, not supported.
+        \param[in]  timeout     is an upper bound on the amount of time elapsed
+                                before select() returns. Null or above 0xffff seconds means
+                                infinity timeout. The minimum timeout is 10 milliseconds,
+                                less than 10 milliseconds will be set automatically to 10 milliseconds.
+                                Max microseconds supported is 0xfffc00.
+
+        \return                    On success, select()  returns the number of
+                                file descriptors contained in the three returned
+                                descriptor sets (that is, the total number of bits that
+                                are set in readfds, writefds, exceptfds) which may be
+                                zero if the timeout expires before anything interesting
+                                happens. On error, a negative value is returned.
+                                readsds - return the sockets on which Read request will
+                                return without delay with valid data.
+                                writesds - return the sockets on which Write request
+                                will return without delay.
+                                exceptsds - return the sockets closed recently.
+                                SL_POOL_IS_EMPTY may be return in case there are no resources in the system
+                                   In this case try again later or increase MAX_CONCURRENT_ACTIONS
+
+        \sa     sl_Socket
+        \note   If the timeout value set to less than 5ms it will automatically set
+                to 5ms to prevent overload of the system
+                belongs to \ref basic_api
+
+                Only one sl_Select can be handled at a time.
+                Calling this API while the same command is called from another thread, may result
+                    in one of the two scenarios:
+                1. The command will wait (internal) until the previous command finish, and then be executed.
+                2. There are not enough resources and SL_POOL_IS_EMPTY error will return.
+                In this case, MAX_CONCURRENT_ACTIONS can be increased (result in memory increase) or try
+                again later to issue the command.
+
+        \warning
+    */
+#if _SL_INCLUDE_FUNC(sl_Select)
+    int16_t sl_Select(int16_t nfds, SlFdSet_t *readsds, SlFdSet_t *writesds, SlFdSet_t *exceptsds, SlTimeval_t *timeout);
+
+
+    /*!
+        \brief Select's SlFdSet_t SET function
+
+        Sets current socket descriptor on SlFdSet_t container
+    */
+    void SL_FD_SET(int16_t fd, SlFdSet_t *fdset);
+
+    /*!
+        \brief Select's SlFdSet_t CLR function
+
+        Clears current socket descriptor on SlFdSet_t container
+    */
+    void SL_FD_CLR(int16_t fd, SlFdSet_t *fdset);
+
+
+    /*!
+        \brief Select's SlFdSet_t ISSET function
+
+        Checks if current socket descriptor is set (TRUE/FALSE)
+
+        \return            Returns TRUE if set, FALSE if unset
+
+    */
+    int16_t  SL_FD_ISSET(int16_t fd, SlFdSet_t *fdset);
+
+    /*!
+        \brief Select's SlFdSet_t ZERO function
+
+        Clears all socket descriptors from SlFdSet_t
+    */
+    void SL_FD_ZERO(SlFdSet_t *fdset);
+
+
+
+#endif
+
+    /*!
+        \brief set socket options
+
+        This function manipulate the options associated with a socket.
+        Options may exist at multiple protocol levels; they are always
+        present at the uppermost socket level.
+
+        When manipulating socket options the level at which the option resides
+        and the name of the option must be specified.  To manipulate options at
+        the socket level, level is specified as SOL_SOCKET.  To manipulate
+        options at any other level the protocol number of the appropriate proto-
+        col controlling the option is supplied.  For example, to indicate that an
+        option is to be interpreted by the TCP protocol, level should be set to
+        the protocol number of TCP;
+
+        The parameters optval and optlen are used to access optval -
+        ues for setsockopt().  For getsockopt() they identify a
+        buffer in which the value for the requested option(s) are to
+        be returned.  For getsockopt(), optlen is a value-result
+        parameter, initially containing the size of the buffer
+        pointed to by option_value, and modified on return to
+        indicate the actual size of the value returned.  If no option
+        value is to be supplied or returned, option_value may be
+        NULL.
+
+        \param[in] sd               socket handle
+        \param[in] level            defines the protocol level for this option
+                                    - <b>SL_SOL_SOCKET</b>   Socket level configurations (L4, transport layer)
+                                    - <b>SL_IPPROTO_IP</b>   IP level configurations (L3, network layer)
+                                    - <b>SL_SOL_PHY_OPT</b>  Link level configurations (L2, link layer)
+        \param[in] optname          defines the option name to interrogate
+                                    - <b>SL_SOL_SOCKET</b>
+                                      - <b>SL_SO_KEEPALIVE</b>  \n
+                                                     Enable/Disable periodic keep alive.
+                                                     Keeps TCP connections active by enabling the periodic transmission of messages \n
+                                                     Timeout is 5 minutes.\n
+                                                     Default: Enabled \n
+                                                     This options takes SlSockKeepalive_t struct as parameter
+                                      - <b>SL_SO_RCVTIMEO</b>  \n
+                                                     Sets the timeout value that specifies the maximum amount of time an input function waits until it completes. \n
+                                                     Default: No timeout \n
+                                                     This options takes SlTimeval_t struct as parameter
+                                      - <b>SL_SO_RCVBUF</b>  \n
+                                                     Sets tcp max recv window size. \n
+                                                     This options takes SlSockWinsize_t struct as parameter
+                                      - <b>SL_SO_NONBLOCKING</b> \n
+                                                     Sets socket to non-blocking operation Impacts: connect, accept, send, sendto, recv and recvfrom. \n
+                                                     Default: Blocking.
+                                                     This options takes SlSockNonblocking_t struct as parameter
+                                      - <b>SL_SO_SECMETHOD</b> \n
+                                                     Sets method to tcp secured socket (SL_SEC_SOCKET) \n
+                                                     Default: SL_SO_SEC_METHOD_SSLv3_TLSV1_2 \n
+                                                     This options takes SlSockSecureMethod struct as parameter
+                                      - <b>SL_SO_SEC_MASK</b> \n
+                                                     Sets specific cipher to tcp secured socket (SL_SEC_SOCKET) \n
+                                                     Default: "Best" cipher suitable to method \n
+                                                     This options takes SlSockSecureMask struct as parameter
+                                      - <b>SL_SO_SECURE_FILES_CA_FILE_NAME</b> \n
+                                                     Map secured socket to CA file by name \n
+                                                     This options takes <b>uint8_t</b> buffer as parameter
+                                      - <b>SL_SO_SECURE_FILES_PRIVATE_KEY_FILE_NAME</b> \n
+                                                     Map secured socket to private key by name \n
+                                                     This options takes <b>uint8_t</b> buffer as parameter
+                                      - <b>SL_SO_SECURE_FILES_CERTIFICATE_FILE_NAME</b> \n
+                                                     Map secured socket to certificate file by name \n
+                                                     This options takes <b>uint8_t</b> buffer as parameter
+                                      - <b>SL_SO_SECURE_FILES_DH_KEY_FILE_NAME</b> \n
+                                                     Map secured socket to Diffie Hellman file by name \n
+                                                     This options takes <b>uint8_t</b> buffer as parameter
+                                      - <b>SL_SO_CHANGE_CHANNEL</b> \n
+                                                     Sets channel in transceiver mode.
+                                                     This options takes <b>uint32_t</b> as channel number parameter
+                                    - <b>SL_IPPROTO_IP</b>
+                                      - <b>SL_IP_MULTICAST_TTL</b> \n
+                                                     Set the time-to-live value of outgoing multicast packets for this socket. \n
+                                                     This options takes <b>uint8_t</b> as parameter
+                                      - <b>SL_IP_ADD_MEMBERSHIP</b> \n
+                                                     UDP socket, Join a multicast group. \n
+                                                     This options takes SlSockIpMreq struct as parameter
+                                      - <b>SL_IP_DROP_MEMBERSHIP</b> \n
+                                                     UDP socket, Leave a multicast group \n
+                                                     This options takes SlSockIpMreq struct as parameter
+                                      - <b>SL_IP_RAW_RX_NO_HEADER</b> \n
+                                                     Raw socket remove IP header from received data. \n
+                                                     Default: data includes ip header \n
+                                                     This options takes <b>uint32_t</b> as parameter
+                                      - <b>SL_IP_HDRINCL</b> \n
+                                                     RAW socket only, the IPv4 layer generates an IP header when sending a packet unless \n
+                                                     the IP_HDRINCL socket option is enabled on the socket.    \n
+                                                     When it is enabled, the packet must contain an IP header. \n
+                                                     Default: disabled, IPv4 header generated by Network Stack \n
+                                                     This options takes <b>uint32_t</b> as parameter
+                                      - <b>SL_IP_RAW_IPV6_HDRINCL</b> (inactive) \n
+                                                     RAW socket only, the IPv6 layer generates an IP header when sending a packet unless \n
+                                                     the IP_HDRINCL socket option is enabled on the socket. When it is enabled, the packet must contain an IP header \n
+                                                     Default: disabled, IPv4 header generated by Network Stack \n
+                                                     This options takes <b>uint32_t</b> as parameter
+                                    - <b>SL_SOL_PHY_OPT</b>
+                                      - <b>SL_SO_PHY_RATE</b> \n
+                                                     RAW socket, set WLAN PHY transmit rate \n
+                                                     The values are based on RateIndex_e    \n
+                                                     This options takes <b>uint32_t</b> as parameter
+                                      - <b>SL_SO_PHY_TX_POWER</b> \n
+                                                     RAW socket, set WLAN PHY TX power \n
+                                                     Valid rage is 1-15 \n
+                                                     This options takes <b>uint32_t</b> as parameter
+                                      - <b>SL_SO_PHY_NUM_FRAMES_TO_TX</b> \n
+                                                     RAW socket, set number of frames to transmit in transceiver mode.
+                                                     Default: 1 packet
+                                                     This options takes <b>uint32_t</b> as parameter
+                                      - <b>SL_SO_PHY_PREAMBLE</b> \n
+                                                     RAW socket, set WLAN PHY preamble for Long/Short\n
+                                                     This options takes <b>uint32_t</b> as parameter
+
+        \param[in] optval           specifies a value for the option
+        \param[in] optlen           specifies the length of the
+            option value
+
+        \return                     On success, zero is returned.
+                                    On error, a negative value is returned.
+        \sa     sl_getsockopt
+        \note   belongs to \ref basic_api
+        \warning
+        \par   Examples:
+        \par
+        <b> SL_SO_KEEPALIVE: </b>(disable Keepalive)
+        \code
+               SlSockKeepalive_t enableOption;
+               enableOption.KeepaliveEnabled = 0;
+               sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_KEEPALIVE, (uint8_t *)&enableOption,sizeof(enableOption));
+        \endcode
+        \par
+        <b> SL_SO_RCVTIMEO: </b>
+        \code
+               struct SlTimeval_t timeVal;
+               timeVal.tv_sec =  1;             // Seconds
+               timeVal.tv_usec = 0;             // Microseconds. 10000 microseconds resolution
+               sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_RCVTIMEO, (uint8_t *)&timeVal, sizeof(timeVal));    // Enable receive timeout
+        \endcode
+        \par
+        <b>    SL_SO_RCVBUF: </b>
+        \code
+               SlSockWinsize_t size;
+               size.Winsize = 3000;  // bytes
+               sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_RCVBUF, (uint8_t *)&size, sizeof(size));
+        \endcode
+        \par
+        <b>    SL_SO_NONBLOCKING: </b>
+        \code
+               SlSockNonblocking_t enableOption;
+               enableOption.NonblockingEnabled = 1;
+               sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_NONBLOCKING, (uint8_t *)&enableOption,sizeof(enableOption)); // Enable/disable nonblocking mode
+        \endcode
+        \par
+        <b>    SL_SO_SECMETHOD:</b>
+        \code
+               SlSockSecureMethod method;
+               method.secureMethod = SL_SO_SEC_METHOD_SSLV3;                                 // security method we want to use
+               SockID = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, SL_SEC_SOCKET);
+               sl_SetSockOpt(SockID, SL_SOL_SOCKET, SL_SO_SECMETHOD, (uint8_t *)&method, sizeof(method));
+        \endcode
+        \par
+        <b>   SL_SO_SECURE_MASK:</b>
+        \code
+               SlSockSecureMask cipher;
+               cipher.secureMask = SL_SEC_MASK_SSL_RSA_WITH_RC4_128_SHA;                   // cipher type
+               SockID = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, SL_SEC_SOCKET);
+               sl_SetSockOpt(SockID, SL_SOL_SOCKET, SL_SO_SEC_MASK,(uint8_t *)&cipher, sizeof(cipher));
+        \endcode
+        \par
+        <b>   SL_SO_SECURE_FILES_CA_FILE_NAME:</b>
+        \code
+               sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_SECURE_FILES_CA_FILE_NAME,"exuifaxCaCert.der",strlen("exuifaxCaCert.der"));
+         \endcode
+
+       \par
+        <b>   SL_SO_SECURE_FILES_PRIVATE_KEY_FILE_NAME:</b>
+         \code
+               sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_SECURE_FILES_PRIVATE_KEY_FILE_NAME,"myPrivateKey.der",strlen("myPrivateKey.der"));
+         \endcode
+
+       \par
+        <b>   SL_SO_SECURE_FILES_CERTIFICATE_FILE_NAME:</b>
+         \code
+               sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_SECURE_FILES_CERTIFICATE_FILE_NAME,"myCertificate.der",strlen("myCertificate.der"));
+         \endcode
+
+       \par
+        <b>   SL_SO_SECURE_FILES_DH_KEY_FILE_NAME:</b>
+         \code
+               sl_SetSockOpt(SockID,SL_SOL_SOCKET,SL_SO_SECURE_FILES_DH_KEY_FILE_NAME,"myDHinServerMode.der",strlen("myDHinServerMode.der"));
+         \endcode
+
+       \par
+        <b>   SL_IP_MULTICAST_TTL:</b>
+         \code
+               uint8_t ttl = 20;
+               sl_SetSockOpt(SockID, SL_IPPROTO_IP, SL_IP_MULTICAST_TTL, &ttl, sizeof(ttl));
+         \endcode
+
+       \par
+        <b>   SL_IP_ADD_MEMBERSHIP:</b>
+         \code
+               SlSockIpMreq mreq;
+               sl_SetSockOpt(SockID, SL_IPPROTO_IP, SL_IP_ADD_MEMBERSHIP, &mreq, sizeof(mreq));
+        \endcode
+
+       \par
+        <b>   SL_IP_DROP_MEMBERSHIP:</b>
+        \code
+               SlSockIpMreq mreq;
+               sl_SetSockOpt(SockID, SL_IPPROTO_IP, SL_IP_DROP_MEMBERSHIP, &mreq, sizeof(mreq));
+        \endcode
+
+       \par
+        <b>   SL_SO_CHANGE_CHANNEL:</b>
+        \code
+              uint32_t newChannel = 6; // range is 1-13
+              sl_SetSockOpt(SockID, SL_SOL_SOCKET, SL_SO_CHANGE_CHANNEL, &newChannel, sizeof(newChannel));
+        \endcode
+
+        \par
+        <b>   SL_IP_RAW_RX_NO_HEADER:</b>
+        \code
+              uint32_t header = 1;  // remove ip header
+              sl_SetSockOpt(SockID, SL_IPPROTO_IP, SL_IP_RAW_RX_NO_HEADER, &header, sizeof(header));
+        \endcode
+
+       \par
+        <b>   SL_IP_HDRINCL:</b>
+        \code
+             uint32_t header = 1;
+             sl_SetSockOpt(SockID, SL_IPPROTO_IP, SL_IP_HDRINCL, &header, sizeof(header));
+        \endcode
+       \par
+        <b>   SL_IP_RAW_IPV6_HDRINCL:</b>
+        \code
+              uint32_t header = 1;
+              sl_SetSockOpt(SockID, SL_IPPROTO_IP, SL_IP_RAW_IPV6_HDRINCL, &header, sizeof(header));
+        \endcode
+
+       \par
+        <b>   SL_SO_PHY_RATE:</b>
+        \code
+              uint32_t rate = 6; // see wlan.h RateIndex_e for values
+              sl_SetSockOpt(SockID, SL_SOL_PHY_OPT, SL_SO_PHY_RATE, &rate, sizeof(rate));
+        \endcode
+
+       \par
+        <b>   SL_SO_PHY_TX_POWER:</b>
+        \code
+              uint32_t txpower = 1; // valid range is 1-15
+              sl_SetSockOpt(SockID, SL_SOL_PHY_OPT, SL_SO_PHY_TX_POWER, &txpower, sizeof(txpower));
+        \endcode
+
+       \par
+        <b>   SL_SO_PHY_NUM_FRAMES_TO_TX:</b>
+        \code
+         	  uint32_t numframes = 1;
+              sl_SetSockOpt(SockID, SL_SOL_PHY_OPT, SL_SO_PHY_NUM_FRAMES_TO_TX, &numframes, sizeof(numframes));
+        \endcode
+
+       \par
+        <b>   SL_SO_PHY_PREAMBLE:</b>
+        \code
+              uint32_t preamble = 1;
+              sl_SetSockOpt(SockID, SL_SOL_PHY_OPT, SL_SO_PHY_PREAMBLE, &preamble, sizeof(preamble));
+        \endcode
+
+    */
+#if _SL_INCLUDE_FUNC(sl_SetSockOpt)
+    int16_t sl_SetSockOpt(int16_t sd, int16_t level, int16_t optname, const void *optval, SlSocklen_t optlen);
+#endif
+
+    /*!
+        \brief Get socket options
+
+        This function manipulate the options associated with a socket.
+        Options may exist at multiple protocol levels; they are always
+        present at the uppermost socket level.
+
+        When manipulating socket options the level at which the option resides
+        and the name of the option must be specified.  To manipulate options at
+        the socket level, level is specified as SOL_SOCKET.  To manipulate
+        options at any other level the protocol number of the appropriate proto-
+        col controlling the option is supplied.  For example, to indicate that an
+        option is to be interpreted by the TCP protocol, level should be set to
+        the protocol number of TCP;
+
+        The parameters optval and optlen are used to access optval -
+        ues for setsockopt().  For getsockopt() they identify a
+        buffer in which the value for the requested option(s) are to
+        be returned.  For getsockopt(), optlen is a value-result
+        parameter, initially containing the size of the buffer
+        pointed to by option_value, and modified on return to
+        indicate the actual size of the value returned.  If no option
+        value is to be supplied or returned, option_value may be
+        NULL.
+
+
+        \param[in]  sd              socket handle
+        \param[in]  level           defines the protocol level for this option
+        \param[in]  optname         defines the option name to interrogate
+        \param[out] optval          specifies a value for the option
+        \param[out] optlen          specifies the length of the
+                                    option value
+
+        \return                        On success, zero is returned.
+                                    On error, a negative value is returned.
+        \sa     sl_SetSockOpt
+        \note   See sl_SetSockOpt
+                belongs to \ref ext_api
+        \warning
+    */
+#if _SL_INCLUDE_FUNC(sl_GetSockOpt)
+    int16_t sl_GetSockOpt(int16_t sd, int16_t level, int16_t optname, void *optval, SlSocklen_t *optlen);
+#endif
+
+    /*!
+        \brief read data from TCP socket
+
+        function receives a message from a connection-mode socket
+
+        \param[in]  sd              socket handle
+        \param[out] buf             Points to the buffer where the
+                                    message should be stored.
+        \param[in]  Len             Specifies the length in bytes of
+                                    the buffer pointed to by the buffer argument.
+                                    Range: 1-16000 bytes
+        \param[in]  flags           Specifies the type of message
+                                    reception. On this version, this parameter is not
+                                    supported.
+
+        \return                     return the number of bytes received,
+                                    or a negative value if an error occurred.
+                                    using a non-blocking recv a possible negative value is SL_EAGAIN.
+                                    SL_POOL_IS_EMPTY may be return in case there are no resources in the system
+                                     In this case try again later or increase MAX_CONCURRENT_ACTIONS
+
+        \sa     sl_RecvFrom
+        \note                       belongs to \ref recv_api
+        \warning
+        \par        Examples:
+        \code       An example of receiving data using TCP socket:
+
+                    SlSockAddrIn_t  Addr;
+                    SlSockAddrIn_t  LocalAddr;
+                    int16_t AddrSize = sizeof(SlSockAddrIn_t);
+                    int16_t SockID, newSockID;
+                    int16_t Status;
+                    int8_t Buf[RECV_BUF_LEN];
+
+                    LocalAddr.sin_family = SL_AF_INET;
+                    LocalAddr.sin_port = sl_Htons(5001);
+                    LocalAddr.sin_addr.s_addr = 0;
+
+                    Addr.sin_family = SL_AF_INET;
+                    Addr.sin_port = sl_Htons(5001);
+                    Addr.sin_addr.s_addr = sl_Htonl(SL_IPV4_VAL(10,1,1,200));
+
+                    SockID = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, 0);
+                    Status = sl_Bind(SockID, (SlSockAddr_t *)&LocalAddr, AddrSize);
+                    Status = sl_Listen(SockID, 0);
+                    newSockID = sl_Accept(SockID, (SlSockAddr_t*)&Addr, (SlSocklen_t*) &AddrSize);
+                    Status = sl_Recv(newSockID, Buf, 1460, 0);
+        \endcode
+        \code      Example code for Rx transceiver mode using a raw socket
+                   int8_t buffer[1536];
+                   int16_t sd;
+                   uint16_t size;
+                   SlTransceiverRxOverHead_t *transHeader;
+                   sd = sl_Socket(SL_AF_RF,SL_SOCK_RAW,11); // channel 11
+                   while(1)
+                   {
+                      size = sl_Recv(sd,buffer,1536,0);
+                      transHeader = (SlTransceiverRxOverHead_t *)buffer;
+                      printf("RSSI is %d frame type is 0x%x size %d\n",transHeader->rssi,buffer[sizeof(SlTransceiverRxOverHead_t)],size);
+                   }
+        \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_Recv)
+    int16_t sl_Recv(int16_t sd, void *buf, int16_t Len, int16_t flags);
+#endif
+
+    /*!
+        \brief read data from socket
+
+        function receives a message from a connection-mode or
+        connectionless-mode socket
+
+        \param[in]  sd              socket handle
+        \param[out] buf             Points to the buffer where the message should be stored.
+        \param[in]  Len             Specifies the length in bytes of the buffer pointed to by the buffer argument.
+                                    Range: 1-16000 bytes
+        \param[in]  flags           Specifies the type of message
+                                    reception. On this version, this parameter is not
+                                    supported.
+        \param[in]  from            pointer to an address structure
+                                    indicating the source
+                                    address.\n sockaddr:\n - code
+                                    for the address format. On this
+                                    version only AF_INET is
+                                    supported.\n - socket address,
+                                    the length depends on the code
+                                    format
+        \param[in]  fromlen         source address structure
+                                    size. This parameter MUST be set to the size of the structure pointed to by addr.
+
+
+        \return                     return the number of bytes received,
+                                    or a negative value if an error occurred.
+                                    using a non-blocking recv a possible negative value is SL_EAGAIN.
+                                    SL_RET_CODE_INVALID_INPUT (-2) will be returned if fromlen has incorrect length.
+                                    SL_POOL_IS_EMPTY may be return in case there are no resources in the system
+                                     In this case try again later or increase MAX_CONCURRENT_ACTIONS
+
+        \sa     sl_Recv
+        \note                       belongs to \ref recv_api
+        \warning
+        \par        Example:
+        \code       An example of receiving data:
+
+                    SlSockAddrIn_t  Addr;
+                    SlSockAddrIn_t  LocalAddr;
+                    int16_t AddrSize = sizeof(SlSockAddrIn_t);
+                    int16_t SockID;
+                    int16_t Status;
+                    int8_t Buf[RECV_BUF_LEN];
+
+                    LocalAddr.sin_family = SL_AF_INET;
+                    LocalAddr.sin_port = sl_Htons(5001);
+                    LocalAddr.sin_addr.s_addr = 0;
+
+                    SockID = sl_Socket(SL_AF_INET,SL_SOCK_DGRAM, 0);
+                    Status = sl_Bind(SockID, (SlSockAddr_t *)&LocalAddr, AddrSize);
+                    Status = sl_RecvFrom(SockID, Buf, 1472, 0, (SlSockAddr_t *)&Addr, (SlSocklen_t*)&AddrSize);
+
+        \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_RecvFrom)
+    int16_t sl_RecvFrom(int16_t sd, void *buf, int16_t Len, int16_t flags, SlSockAddr_t *from, SlSocklen_t *fromlen);
+#endif
+
+    /*!
+        \brief write data to TCP socket
+
+        This function is used to transmit a message to another socket.
+        Returns immediately after sending data to device.
+        In case of TCP failure an async event SL_SOCKET_TX_FAILED_EVENT is going to
+        be received.
+        In case of a RAW socket (transceiver mode), extra 4 bytes should be reserved at the end of the
+        frame data buffer for WLAN FCS
+
+        \param[in] sd               socket handle
+        \param[in] buf              Points to a buffer containing
+                                    the message to be sent
+        \param[in] Len              message size in bytes. Range: 1-1460 bytes
+        \param[in] flags            Specifies the type of message
+                                    transmission. On this version, this parameter is not
+                                    supported for TCP.
+                                    For transceiver mode, the SL_RAW_RF_TX_PARAMS macro can be used to determine
+                                    transmission parameters (channel,rate,tx_power,preamble)
+
+
+        \return                     Return the number of bytes transmitted,
+                                    or -1 if an error occurred
+
+        \sa     sl_SendTo
+        \note                       belongs to \ref send_api
+        \warning
+        \par        Example:
+        \code       An example of sending data:
+
+                    SlSockAddrIn_t  Addr;
+                    int16_t AddrSize = sizeof(SlSockAddrIn_t);
+                    int16_t SockID;
+                    int16_t Status;
+                    int8_t Buf[SEND_BUF_LEN];
+
+                    Addr.sin_family = SL_AF_INET;
+                    Addr.sin_port = sl_Htons(5001);
+                    Addr.sin_addr.s_addr = sl_Htonl(SL_IPV4_VAL(10,1,1,200));
+
+                    SockID = sl_Socket(SL_AF_INET,SL_SOCK_STREAM, 0);
+                    Status = sl_Connect(SockID, (SlSockAddr_t *)&Addr, AddrSize);
+                    Status = sl_Send(SockID, Buf, 1460, 0 );
+
+        \endcode
+     */
+#if _SL_INCLUDE_FUNC(sl_Send )
+    int16_t sl_Send(int16_t sd, const void *buf, int16_t Len, int16_t flags);
+#endif
+
+    /*!
+        \brief write data to socket
+
+        This function is used to transmit a message to another socket
+        (connection less socket SOCK_DGRAM,  SOCK_RAW).
+        Returns immediately after sending data to device.
+        In case of transmission failure an async event SL_SOCKET_TX_FAILED_EVENT is going to
+        be received.
+
+        \param[in] sd               socket handle
+        \param[in] buf              Points to a buffer containing
+                                    the message to be sent
+        \param[in] Len              message size in bytes. Range: 1-1460 bytes
+        \param[in] flags            Specifies the type of message
+                                    transmission. On this version, this parameter is not
+                                    supported
+        \param[in] to               pointer to an address structure
+                                    indicating the destination
+                                    address.\n sockaddr:\n - code
+                                    for the address format. On this
+                                    version only AF_INET is
+                                    supported.\n - socket address,
+                                    the length depends on the code
+                                    format
+        \param[in] tolen            destination address structure size
+
+        \return                     Return the number of transmitted bytes,
+                                    or -1 if an error occurred
+
+        \sa     sl_Send
+        \note                       belongs to \ref send_api
+        \warning
+        \par        Example:
+        \code       An example of sending data:
+
+                    SlSockAddrIn_t  Addr;
+                    int16_t AddrSize = sizeof(SlSockAddrIn_t);
+                    int16_t SockID;
+                    int16_t Status;
+                    int8_t Buf[SEND_BUF_LEN];
+
+                    Addr.sin_family = SL_AF_INET;
+                    Addr.sin_port = sl_Htons(5001);
+                    Addr.sin_addr.s_addr = sl_Htonl(SL_IPV4_VAL(10,1,1,200));
+
+                    SockID = sl_Socket(SL_AF_INET,SL_SOCK_DGRAM, 0);
+                    Status = sl_SendTo(SockID, Buf, 1472, 0, (SlSockAddr_t *)&Addr, AddrSize);
+
+        \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_SendTo)
+    int16_t sl_SendTo(int16_t sd, const void *buf, int16_t Len, int16_t flags, const SlSockAddr_t *to, SlSocklen_t tolen);
+#endif
+
+    /*!
+        \brief Reorder the bytes of a 32-bit unsigned value
+
+        This function is used to Reorder the bytes of a 32-bit unsigned value from processor order to network order.
+
+        \param[in] var              variable to reorder
+
+        \return                     Return the reorder variable,
+
+        \sa     sl_SendTo  sl_Bind  sl_Connect  sl_RecvFrom  sl_Accept
+        \note                       belongs to \ref send_api
+        \warning
+    */
+#if _SL_INCLUDE_FUNC(sl_Htonl )
+    uint32_t sl_Htonl( uint32_t val );
+
+#define sl_Ntohl sl_Htonl  /* Reorder the bytes of a 16-bit unsigned value from network order to processor orde. */
+#endif
+
+    /*!
+        \brief Reorder the bytes of a 16-bit unsigned value
+
+        This function is used to Reorder the bytes of a 16-bit unsigned value from processor order to network order.
+
+        \param[in] var              variable to reorder
+
+        \return                     Return the reorder variable,
+
+        \sa     sl_SendTo  sl_Bind    sl_Connect  sl_RecvFrom  sl_Accept
+        \note                       belongs to \ref send_api
+        \warning
+    */
+#if _SL_INCLUDE_FUNC(sl_Htons )
+    uint16_t sl_Htons( uint16_t val );
+
+#define sl_Ntohs sl_Htons   /* Reorder the bytes of a 16-bit unsigned value from network order to processor orde. */
+#endif
+
+private:
+
+    cc3100_driver   &_driver;
+    cc3100_nonos    &_nonos;
+    
+};//class
+
+
+}//namespace mbed_cc3100    
+
+    /*!
+
+     Close the Doxygen group.
+     @}
+
+     */
+
+#endif /* __SOCKET_H__ */
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_spawn.cpp	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,194 @@
+/*
+ * spawn.c - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+
+
+/*****************************************************************************/
+/* Include files                                                             */
+/*****************************************************************************/
+#include "cc3100_simplelink.h"
+
+#include "cc3100_spawn.h"
+
+namespace mbed_cc3100 {
+
+#if (defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))
+
+#define _SL_MAX_INTERNAL_SPAWN_ENTRIES      10
+
+
+typedef struct _SlInternalSpawnEntry_t {
+    _SlSpawnEntryFunc_t 		        pEntry;
+    void* 						        pValue;
+    struct _SlInternalSpawnEntry_t*     pNext;
+} _SlInternalSpawnEntry_t;
+
+typedef struct {
+    _SlInternalSpawnEntry_t     SpawnEntries[_SL_MAX_INTERNAL_SPAWN_ENTRIES];
+    _SlInternalSpawnEntry_t*    pFree;
+    _SlInternalSpawnEntry_t*    pWaitForExe;
+    _SlInternalSpawnEntry_t*    pLastInWaitList;
+    _SlSyncObj_t                SyncObj;
+    _SlLockObj_t                LockObj;
+} _SlInternalSpawnCB_t;
+
+_SlInternalSpawnCB_t g_SlInternalSpawnCB;
+
+cc3100_spawn::cc3100_spawn()
+{
+
+}
+
+cc3100_spawn::~cc3100_spawn()
+{
+
+}
+
+
+void cc3100_spawn::_SlInternalSpawnTaskEntry()
+{
+    int16_t                     i;
+    _SlInternalSpawnEntry_t*    pEntry;
+    uint8_t                     LastEntry;
+
+    /* create and lock the locking object. lock in order to avoid race condition
+        on the first creation */
+    sl_LockObjCreate(&g_SlInternalSpawnCB.LockObj,"SlSpawnProtect");
+    sl_LockObjLock(&g_SlInternalSpawnCB.LockObj,SL_OS_NO_WAIT);
+
+    /* create and clear the sync object */
+    sl_SyncObjCreate(&g_SlInternalSpawnCB.SyncObj,"SlSpawnSync");
+    sl_SyncObjWait(&g_SlInternalSpawnCB.SyncObj,SL_OS_NO_WAIT);
+
+    g_SlInternalSpawnCB.pFree = &g_SlInternalSpawnCB.SpawnEntries[0];
+    g_SlInternalSpawnCB.pWaitForExe = NULL;
+    g_SlInternalSpawnCB.pLastInWaitList = NULL;
+
+    /* create the link list between the entries */
+    for (i=0 ; i<_SL_MAX_INTERNAL_SPAWN_ENTRIES - 1 ; i++) {
+        g_SlInternalSpawnCB.SpawnEntries[i].pNext = &g_SlInternalSpawnCB.SpawnEntries[i+1];
+        g_SlInternalSpawnCB.SpawnEntries[i].pEntry = NULL;
+    }
+    g_SlInternalSpawnCB.SpawnEntries[i].pNext = NULL;
+
+    sl_LockObjUnlock(&g_SlInternalSpawnCB.LockObj);
+
+
+    /* here we ready to execute entries */
+
+    while (TRUE) {
+        sl_SyncObjWait(&g_SlInternalSpawnCB.SyncObj,SL_OS_WAIT_FOREVER);
+        /* go over all entries that already waiting for execution */
+        LastEntry = FALSE;
+        do {
+            /* get entry to execute */
+            sl_LockObjLock(&g_SlInternalSpawnCB.LockObj,SL_OS_WAIT_FOREVER);
+
+            pEntry = g_SlInternalSpawnCB.pWaitForExe;
+            if ( NULL == pEntry ) {
+                sl_LockObjUnlock(&g_SlInternalSpawnCB.LockObj);
+                break;
+            }
+            g_SlInternalSpawnCB.pWaitForExe = pEntry->pNext;
+            if (pEntry == g_SlInternalSpawnCB.pLastInWaitList) {
+                g_SlInternalSpawnCB.pLastInWaitList = NULL;
+                LastEntry = TRUE;
+            }
+
+            sl_LockObjUnlock(&g_SlInternalSpawnCB.LockObj);
+
+
+            /* pEntry could be null in case that the sync was already set by some
+               of the entries during execution of earlier entry */
+            if (NULL != pEntry) {
+                pEntry->pEntry(pEntry->pValue);
+                /* free the entry */
+                sl_LockObjLock(&g_SlInternalSpawnCB.LockObj,SL_OS_WAIT_FOREVER);
+
+                pEntry->pNext = g_SlInternalSpawnCB.pFree;
+                g_SlInternalSpawnCB.pFree = pEntry;
+
+
+                if (NULL != g_SlInternalSpawnCB.pWaitForExe) {
+                    /* new entry received meanwhile */
+                    LastEntry = FALSE;
+                }
+
+                sl_LockObjUnlock(&g_SlInternalSpawnCB.LockObj);
+
+            }
+
+        } while (!LastEntry);
+    }
+}
+
+
+int16_t cc3100_spawn::_SlInternalSpawn(_SlSpawnEntryFunc_t pEntry , void* pValue , uint32_t flags)
+{
+    int16_t                         Res = 0;
+    _SlInternalSpawnEntry_t*    pSpawnEntry;
+
+    if (NULL == pEntry) {
+        Res = -1;
+    } else {
+        sl_LockObjLock(&g_SlInternalSpawnCB.LockObj,SL_OS_WAIT_FOREVER);
+
+        pSpawnEntry = g_SlInternalSpawnCB.pFree;
+        g_SlInternalSpawnCB.pFree = pSpawnEntry->pNext;
+
+        pSpawnEntry->pEntry = pEntry;
+        pSpawnEntry->pValue = pValue;
+        pSpawnEntry->pNext = NULL;
+
+        if (NULL == g_SlInternalSpawnCB.pWaitForExe) {
+            g_SlInternalSpawnCB.pWaitForExe = pSpawnEntry;
+            g_SlInternalSpawnCB.pLastInWaitList = pSpawnEntry;
+        } else {
+            g_SlInternalSpawnCB.pLastInWaitList->pNext = pSpawnEntry;
+            g_SlInternalSpawnCB.pLastInWaitList = pSpawnEntry;
+        }
+
+        sl_LockObjUnlock(&g_SlInternalSpawnCB.LockObj);
+        /* this sync is called after releasing the lock object to avoid unnecessary context switches */
+        sl_SyncObjSignal(&g_SlInternalSpawnCB.SyncObj);
+    }
+
+    return Res;
+}
+
+#endif
+
+}//namespace mbed_cc3100
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_spawn.h	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,75 @@
+/*
+ * spawn.h - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+#ifndef SPAWN_H_
+#define	SPAWN_H_
+
+
+namespace mbed_cc3100 {
+
+class cc3100_spawn
+{
+
+public:
+
+    cc3100_spawn() {
+
+    }
+
+    ~cc3100_spawn() {
+
+    }
+    
+#if (defined (SL_PLATFORM_MULTI_THREADED)) && (!defined (SL_PLATFORM_EXTERNAL_SPAWN))
+
+    void _SlInternalSpawnTaskEntry();
+    int16_t _SlInternalSpawn(_SlSpawnEntryFunc_t pEntry , void* pValue , uint32_t flags);
+
+#undef sl_Spawn
+#define sl_Spawn(pEntry,pValue,flags)               _SlInternalSpawn(pEntry,pValue,flags)
+
+#undef _SlTaskEntry
+#define _SlTaskEntry                                _SlInternalSpawnTaskEntry
+
+
+#endif
+
+};//class
+
+}//namespace mbed_cc3100
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_spi.cpp	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,202 @@
+/*
+ * spi.cpp mbed
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+#include "cc3100_simplelink.h"
+#include "cc3100_spi.h"
+
+
+namespace mbed_cc3100 {
+
+P_EVENT_HANDLER   pIraEventHandler = 0;
+uint8_t           IntIsMasked;
+
+cc3100_spi::cc3100_spi(PinName cc3100_irq, PinName cc3100_nHIB, PinName cc3100_cs, SPI cc3100_spi, cc3100_driver &driver)
+    : _wlan_irq(cc3100_irq), _wlan_nHIB(cc3100_nHIB), _wlan_cs(cc3100_cs), _wlan_spi(cc3100_spi), _driver(driver)
+{
+
+    _wlan_spi.format(8,1);
+    _wlan_spi.frequency(16000000);
+    _wlan_irq.rise(this, &cc3100_spi::IntSpiGPIOHandler);      //_SlDrvRxIrqHandler is triggered after IntSpiGPIOHandler
+    _wlan_nHIB = 0;
+    _wlan_cs = 1;
+    wait_ms(200);
+    
+    
+}
+
+cc3100_spi::~cc3100_spi()
+{
+
+}
+
+int cc3100_spi::spi_Close(Fd_t fd)
+{
+    // Disable WLAN Interrupt ...
+    cc3100_InterruptDisable();
+
+    return NONOS_RET_OK;
+}
+
+void cc3100_spi::cc3100_InterruptEnable()
+{
+    __enable_irq();
+}
+
+void cc3100_spi::cc3100_InterruptDisable()
+{
+    __disable_irq();
+}
+
+void cc3100_spi::CC3100_disable()
+{
+    _wlan_nHIB = 0;
+}
+
+void cc3100_spi::CC3100_enable()
+{
+    
+    _wlan_nHIB = 1;
+}
+
+Fd_t cc3100_spi::spi_Open(int8_t *ifName, uint32_t flags)
+{
+
+    // 50 ms delay
+    wait_ms(50);
+
+    // Enable WLAN interrupt
+    cc3100_InterruptEnable();
+
+    return NONOS_RET_OK;
+}
+
+int cc3100_spi::spi_Write(Fd_t fd, uint8_t *pBuff, int len)
+{
+
+    int len_to_return = len;
+
+    _wlan_cs = 0;
+
+    while(len) {
+        _wlan_spi.write(*pBuff++);
+        len--;
+    }
+
+    _wlan_cs = 1;
+
+    return len_to_return;
+}
+
+int cc3100_spi::spi_Read(Fd_t fd, uint8_t *pBuff, int len)
+{
+    int i = 0;
+
+    _wlan_cs = 0;
+
+    for (i = 0; i < len; i++) {
+        pBuff[i] = _wlan_spi.write(0xFF);
+    }
+
+    _wlan_cs = 1;
+    
+    return len;
+}
+
+void cc3100_spi::IntSpiGPIOHandler(void)
+{
+    
+    if(_wlan_irq){
+        _driver._SlDrvRxIrqHandler(0);
+    }
+}
+
+/*!
+    \brief register an interrupt handler for the host IRQ
+
+    \param[in]      InterruptHdl    -    pointer to interrupt handler function
+
+    \param[in]      pValue          -    pointer to a memory strcuture that is
+                    passed to the interrupt handler.
+
+    \return         upon successful registration, the function shall return 0.
+                    Otherwise, -1 shall be returned
+
+    \sa
+    \note           If there is already registered interrupt handler, the
+                    function should overwrite the old handler with the new one
+    \warning
+*/
+int cc3100_spi::registerInterruptHandler(P_EVENT_HANDLER InterruptHdl , void* pValue)
+{
+
+    pIraEventHandler = InterruptHdl;
+    return 0;
+}
+
+/*!
+    \brief     Unmasks the Host IRQ
+
+    \param[in]      none
+
+    \return         none
+
+    \warning
+*/
+void cc3100_spi::UnMaskIntHdlr()
+{
+    IntIsMasked = FALSE;
+}
+
+/*!
+    \brief      Masks the Host IRQ
+
+    \param[in]      none
+
+    \return         none
+
+    \warning
+*/
+void cc3100_spi::MaskIntHdlr()
+{
+    IntIsMasked = TRUE;
+}
+
+}//namespace mbed_cc3100
+
+
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_spi.h	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,273 @@
+/*
+ * spi.h - mbed
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+
+#ifndef SPI_H_
+#define SPI_H_
+
+#include "mbed.h"
+
+
+/*!
+    \brief   type definition for the spi channel file descriptor
+
+    \note    On each porting or platform the type could be whatever is needed
+            - integer, pointer to structure etc.
+*/
+typedef unsigned int Fd_t;
+
+typedef void (*P_EVENT_HANDLER)(void* pValue); 
+
+namespace mbed_cc3100 {
+    
+class cc3100_driver;    
+    
+class cc3100_spi
+{
+public:
+
+    cc3100_spi(PinName cc3100_irq, PinName cc3100_nHIB, PinName cc3100_cs, SPI cc3100_spi, cc3100_driver &driver);
+
+    ~cc3100_spi();
+
+
+    /*!
+        \brief          Enables the CC3100
+
+        \param[in]      none
+
+        \return         none
+
+        \note
+
+        \warning
+    */
+    void CC3100_enable();
+
+    /*!
+        \brief          Disables the CC3100
+
+        \param[in]      none
+
+        \return         none
+
+        \note
+
+        \warning
+    */
+    void CC3100_disable();
+
+    /*!
+        \brief          Enables the interrupt from the CC3100
+
+        \param[in]      none
+
+        \return         none
+
+        \note
+
+        \warning
+    */
+    void cc3100_InterruptEnable();
+
+    /*!
+        \brief          Disables the interrupt from the CC3100
+
+        \param[in]      none
+
+        \return         none
+
+        \note
+
+        \warning
+    */
+    void cc3100_InterruptDisable();
+
+    /*!
+        \brief open spi communication port to be used for communicating with a
+               SimpleLink device
+
+        Given an interface name and option flags, this function opens the spi
+        communication port and creates a file descriptor. This file descriptor can
+        be used afterwards to read and write data from and to this specific spi
+        channel.
+        The SPI speed, clock polarity, clock phase, chip select and all other
+        attributes are all set to hardcoded values in this function.
+
+        \param[in]      ifName    -    points to the interface name/path. The
+                        interface name is an optional attributes that the simple
+                        link driver receives on opening the device. in systems that
+                        the spi channel is not implemented as part of the os device
+                        drivers, this parameter could be NULL.
+        \param[in]      flags     -    option flags
+
+        \return         upon successful completion, the function shall open the spi
+                        channel and return a non-negative integer representing the
+                        file descriptor. Otherwise, -1 shall be returned
+
+        \sa             spi_Close , spi_Read , spi_Write
+        \note
+        \warning
+    */
+
+    Fd_t spi_Open(int8_t *ifName, uint32_t flags);
+
+    /*!
+        \brief closes an opened spi communication port
+
+        \param[in]      fd    -     file descriptor of an opened SPI channel
+
+        \return         upon successful completion, the function shall return 0.
+                        Otherwise, -1 shall be returned
+
+        \sa             spi_Open
+        \note
+        \warning
+    */
+    int spi_Close(Fd_t fd);
+
+    /*!
+        \brief attempts to read up to len bytes from SPI channel into a buffer
+               starting at pBuff.
+
+        \param[in]      fd     -    file descriptor of an opened SPI channel
+
+        \param[in]      pBuff  -    points to first location to start writing the
+                        data
+
+        \param[in]      len    -    number of bytes to read from the SPI channel
+
+        \return         upon successful completion, the function shall return 0.
+                        Otherwise, -1 shall be returned
+
+        \sa             spi_Open , spi_Write
+        \note
+        \warning
+    */
+    int spi_Read(Fd_t fd, uint8_t *pBuff, int len);
+
+    /*!
+        \brief attempts to write up to len bytes to the SPI channel
+
+        \param[in]      fd        -    file descriptor of an opened SPI channel
+
+        \param[in]      pBuff     -    points to first location to start getting the
+                        data from
+
+        \param[in]      len       -    number of bytes to write to the SPI channel
+
+        \return         upon successful completion, the function shall return 0.
+                        Otherwise, -1 shall be returned
+
+        \sa             spi_Open , spi_Read
+        \note           This function could be implemented as zero copy and return
+                        only upon successful completion of writing the whole buffer,
+                        but in cases that memory allocation is not too tight, the
+                        function could copy the data to internal buffer, return
+                        back and complete the write in parallel to other activities
+                        as long as the other SPI activities would be blocked untill
+                        the entire buffer write would be completed
+        \warning
+    */
+    int spi_Write(Fd_t fd, uint8_t *pBuff, int len);
+
+    /*!
+        \brief          The IntSpiGPIOHandler interrupt handler
+
+        \param[in]      none
+
+        \return         none
+
+        \note
+
+        \warning
+    */
+    void IntSpiGPIOHandler(void);
+
+    /*!
+        \brief register an interrupt handler for the host IRQ
+
+        \param[in]      InterruptHdl    -    pointer to interrupt handler function
+
+        \param[in]      pValue          -    pointer to a memory strcuture that is
+                        passed to the interrupt handler.
+
+        \return         upon successful registration, the function shall return 0.
+                        Otherwise, -1 shall be returned
+
+        \sa
+        \note           If there is already registered interrupt handler, the
+                        function should overwrite the old handler with the new one
+        \warning
+    */
+    int registerInterruptHandler(P_EVENT_HANDLER InterruptHdl , void* pValue);
+
+    /*!
+        \brief      Masks the Host IRQ
+
+        \param[in]      none
+
+        \return         none
+
+        \warning
+    */
+    void MaskIntHdlr();
+
+    /*!
+        \brief     Unmasks the Host IRQ
+
+        \param[in]      none
+
+        \return         none
+
+        \warning
+    */
+    void UnMaskIntHdlr();
+
+    
+private:
+
+    InterruptIn         _wlan_irq;
+    DigitalOut          _wlan_nHIB;
+    DigitalOut          _wlan_cs;
+    SPI                 _wlan_spi;
+    cc3100_driver       &_driver;
+
+
+};//class
+}//namespace mbed_cc3100
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_trace.h	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,183 @@
+/*
+ * trace.h - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+#ifndef SIMPLELINK_TRACE_H_
+#define SIMPLELINK_TRACE_H_
+
+
+#include "cc3100_simplelink.h"
+
+/*****************************************************************************/
+/* Macro declarations                                                        */
+/*****************************************************************************/
+
+/*  This macro is for use by other macros to form a fully valid C statement. */
+#define st(x)      do { x } while (__LINE__ == -1)
+
+#define SL_SYNC_SCAN_THRESHOLD  (( uint32_t )2000)
+
+#define _SlDrvAssert(line )  { while(1); }
+
+#define _SL_ASSERT(expr)            { if(!(expr)){_SlDrvAssert(__LINE__); } }
+#define _SL_ERROR(expr, error)      { if(!(expr)){return (error); } }
+
+#define SL_HANDLING_ASSERT          2
+#define SL_HANDLING_ERROR           1
+#define SL_HANDLING_NONE            0
+
+#define SL_SELF_COND_HANDLING       SL_HANDLING_ASSERT
+#define SL_PROTOCOL_HANDLING        SL_HANDLING_ASSERT
+#define SL_DRV_RET_CODE_HANDLING    SL_HANDLING_ASSERT
+#define SL_NWP_IF_HANDLING          SL_HANDLING_ASSERT
+#define SL_OSI_RET_OK_HANDLING      SL_HANDLING_ASSERT
+#define SL_MALLOC_OK_HANDLING       SL_HANDLING_ASSERT
+#define SL_USER_ARGS_HANDLING       SL_HANDLING_ASSERT
+
+#if (SL_DRV_RET_CODE_HANDLING == SL_HANDLING_ASSERT)
+#define VERIFY_RET_OK(Func)                     {_SlReturnVal_t _RetVal = (Func); _SL_ASSERT((_SlReturnVal_t)SL_OS_RET_CODE_OK == _RetVal)}
+#elif (SL_DRV_RET_CODE_HANDLING == SL_HANDLING_ERROR)
+#define VERIFY_RET_OK(Func)                     {_SlReturnVal_t _RetVal = (Func); if (SL_OS_RET_CODE_OK != _RetVal) return  _RetVal;}
+#else
+#define VERIFY_RET_OK(Func)                     (Func);
+#endif
+
+#if (SL_PROTOCOL_HANDLING == SL_HANDLING_ASSERT)
+#define VERIFY_PROTOCOL(expr)                   _SL_ASSERT(expr)
+#elif (SL_PROTOCOL_HANDLING == SL_HANDLING_ERROR)
+#define VERIFY_PROTOCOL(expr)                   _SL_ERROR(expr, SL_RET_CODE_PROTOCOL_ERROR)
+#else
+#define VERIFY_PROTOCOL(expr)
+#endif
+
+#if (defined(PROTECT_SOCKET_ASYNC_RESP) && (SL_SELF_COND_HANDLING == SL_HANDLING_ASSERT))
+#define VERIFY_SOCKET_CB(expr)                  _SL_ASSERT(expr)
+#elif (defined(PROTECT_SOCKET_ASYNC_RESP) && (SL_SELF_COND_HANDLING == SL_HANDLING_ERROR))
+#define VERIFY_SOCKET_CB(expr)                  _SL_ERROR(expr, SL_RET_CODE_SELF_ERROR)
+#else
+#define VERIFY_SOCKET_CB(expr)
+#endif
+
+#if (SL_NWP_IF_HANDLING == SL_HANDLING_ASSERT)
+//#define NWP_IF_WRITE_CHECK(fd,pBuff,len)       { int16_t RetSize, ExpSize = (len); RetSize = sl_IfWrite((fd),(pBuff),ExpSize); _SL_ASSERT(ExpSize == RetSize)}
+//#define NWP_IF_READ_CHECK(fd,pBuff,len)        { int16_t RetSize, ExpSize = (len); RetSize = sl_IfRead((fd),(pBuff),ExpSize);  _SL_ASSERT(ExpSize == RetSize)}
+#elif (SL_NWP_IF_HANDLING == SL_HANDLING_ERROR)
+//#define NWP_IF_WRITE_CHECK(fd,pBuff,len)       { _SL_ERROR((len == sl_IfWrite((fd),(pBuff),(len))), SL_RET_CODE_NWP_IF_ERROR);}
+//#define NWP_IF_READ_CHECK(fd,pBuff,len)        { _SL_ERROR((len == sl_IfRead((fd),(pBuff),(len))),  SL_RET_CODE_NWP_IF_ERROR);}
+#else
+//#define NWP_IF_WRITE_CHECK(fd,pBuff,len)       { sl_IfWrite((fd),(pBuff),(len));}
+//#define NWP_IF_READ_CHECK(fd,pBuff,len)        { sl_IfRead((fd),(pBuff),(len));}
+#endif
+
+#if (SL_OSI_RET_OK_HANDLING == SL_HANDLING_ASSERT)
+#define OSI_RET_OK_CHECK(Func)                  {_SlReturnVal_t _RetVal = (Func); _SL_ASSERT((_SlReturnVal_t)SL_OS_RET_CODE_OK == _RetVal)}
+#elif (SL_OSI_RET_OK_HANDLING == SL_HANDLING_ERROR)
+#define OSI_RET_OK_CHECK(Func)                  {_SlReturnVal_t _RetVal = (Func); if (SL_OS_RET_CODE_OK != _RetVal) return  _RetVal;}
+#else
+#define OSI_RET_OK_CHECK(Func)                  (Func);
+#endif
+
+#if (SL_MALLOC_OK_HANDLING == SL_HANDLING_ASSERT)
+#define MALLOC_OK_CHECK(Ptr)                    _SL_ASSERT(NULL != Ptr)
+#elif (SL_MALLOC_OK_HANDLING == SL_HANDLING_ERROR)
+#define MALLOC_OK_CHECK(Ptr)                    _SL_ERROR((NULL != Ptr), SL_RET_CODE_MALLOC_ERROR)
+#else
+#define MALLOC_OK_CHECK(Ptr)
+#endif
+
+#ifdef SL_INC_ARG_CHECK
+
+#if (SL_USER_ARGS_HANDLING == SL_HANDLING_ASSERT)
+#define ARG_CHECK_PTR(Ptr)                      _SL_ASSERT(NULL != Ptr)
+#elif (SL_USER_ARGS_HANDLING == SL_HANDLING_ERROR)
+#define ARG_CHECK_PTR(Ptr)                      _SL_ERROR((NULL != Ptr), SL_RET_CODE_INVALID_INPUT)
+#else
+#define ARG_CHECK_PTR(Ptr)
+#endif
+
+#else
+#define ARG_CHECK_PTR(Ptr)
+#endif
+
+//#define SL_DBG_TRACE_ENABLE
+#ifdef SL_DBG_TRACE_ENABLE
+#define SL_TRACE0(level,msg_id,str)                     printf(str)
+#define SL_TRACE1(level,msg_id,str,p1)                  printf(str,(p1))
+#define SL_TRACE2(level,msg_id,str,p1,p2)               printf(str,(p1),(p2))
+#define SL_TRACE3(level,msg_id,str,p1,p2,p3)            printf(str,(p1),(p2),(p3))
+#define SL_TRACE4(level,msg_id,str,p1,p2,p3,p4)         printf(str,(p1),(p2),(p3),(p4))
+#define SL_ERROR_TRACE(msg_id,str)                      printf(str)
+#define SL_ERROR_TRACE1(msg_id,str,p1)                  printf(str,(p1))
+#define SL_ERROR_TRACE2(msg_id,str,p1,p2)               printf(str,(p1),(p2))
+#define SL_ERROR_TRACE3(msg_id,str,p1,p2,p3)            printf(str,(p1),(p2),(p3))
+#define SL_ERROR_TRACE4(msg_id,str,p1,p2,p3,p4)         printf(str,(p1),(p2),(p3),(p4))
+#define SL_TRACE_FLUSH()
+#else
+#define SL_TRACE0(level,msg_id,str)
+#define SL_TRACE1(level,msg_id,str,p1)
+#define SL_TRACE2(level,msg_id,str,p1,p2)
+#define SL_TRACE3(level,msg_id,str,p1,p2,p3)
+#define SL_TRACE4(level,msg_id,str,p1,p2,p3,p4)
+#define SL_ERROR_TRACE(msg_id,str)
+#define SL_ERROR_TRACE1(msg_id,str,p1)
+#define SL_ERROR_TRACE2(msg_id,str,p1,p2)
+#define SL_ERROR_TRACE3(msg_id,str,p1,p2,p3)
+#define SL_ERROR_TRACE4(msg_id,str,p1,p2,p3,p4)
+#define SL_TRACE_FLUSH()
+#endif
+
+//#define SL_DBG_CNT_ENABLE
+#ifdef SL_DBG_CNT_ENABLE
+#define _SL_DBG_CNT_INC(Cnt)            g_DbgCnt. ## Cnt++
+#define _SL_DBG_SYNC_LOG(index,value)   {if(index < SL_DBG_SYNC_LOG_SIZE){*(uint32_t *)&g_DbgCnt.SyncLog[index] = *(uint32_t *)(value);}}
+
+#else
+#define _SL_DBG_CNT_INC(Cnt)
+#define _SL_DBG_SYNC_LOG(index,value)
+#endif
+
+#define SL_DBG_LEVEL_1                  1
+#define SL_DBG_LEVEL_2                  2
+#define SL_DBG_LEVEL_3                  4
+#define SL_DBG_LEVEL_MASK               (SL_DBG_LEVEL_2|SL_DBG_LEVEL_3)
+
+#define SL_INCLUDE_DBG_FUNC(Name)		((Name ## _DBG_LEVEL) & SL_DBG_LEVEL_MASK)
+
+#define _SlDrvPrintStat_DBG_LEVEL       SL_DBG_LEVEL_3
+#define _SlDrvOtherFunc_DBG_LEVEL       SL_DBG_LEVEL_1
+
+
+#endif /*__SIMPLELINK_TRACE_H__*/
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_user.h	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,1035 @@
+/*
+ * user.h - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+
+#ifndef USER_H_
+#define USER_H_
+
+/*!
+
+    \addtogroup Porting
+    @{
+
+*/
+
+/*!
+ ******************************************************************************
+
+    \defgroup       porting_user_include        User Include Files
+
+    This section IS NOT REQUIRED in case user provided primitives are handled
+    in makefiles or project configurations (IDE)
+
+    PORTING ACTION:
+        - Include all required header files for the definition of:
+            -# Transport layer library API (e.g. SPI, UART)
+            -# OS primitives definitions (e.g. Task spawn, Semaphores)
+            -# Memory management primitives (e.g. alloc, free)
+
+ ******************************************************************************
+ */
+
+#include <string.h>
+
+#ifndef SL_IF_TYPE_UART
+#include "cc3100_spi.h"
+#else
+#include "uart.h"
+#endif
+
+
+/*!
+ ******************************************************************************
+
+    \defgroup       porting_capabilities        Capability Set Definition
+
+    This section IS NOT REQUIRED in case one of the following pre defined
+    capabilities set is in use:
+    - SL_TINY
+    - SL_SMALL
+    - SL_FULL
+
+    PORTING ACTION:
+        - Define one of the pre-defined capabilities set or uncomment the
+          relevant definitions below to select the required capabilities
+    @{
+ *******************************************************************************
+ */
+ 
+#define SL_FULL 
+
+/*!
+	\def		MAX_CONCURRENT_ACTIONS
+
+    \brief      Defines the maximum number of concurrent action in the system
+				Min:1 , Max: 32
+
+                Actions which has async events as return, can be
+
+    \sa
+
+    \note       In case there are not enough resources for the actions needed in the system,
+	        	error is received: POOL_IS_EMPTY
+			    one option is to increase MAX_CONCURRENT_ACTIONS
+				(improves performance but results in memory consumption)
+		     	Other option is to call the API later (decrease performance)
+
+    \warning    In case of setting to one, recommend to use non-blocking recv\recvfrom to allow
+				multiple socket recv
+*/
+#define MAX_CONCURRENT_ACTIONS 10
+
+/*!
+	\def		CPU_FREQ_IN_MHZ
+    \brief      Defines CPU frequency for Host side, for better accuracy of busy loops, if any
+    \sa
+    \note
+
+    \warning    If not set the default CPU frequency is set to 200MHz
+                This option will be deprecated in future release
+*/
+/*
+#define CPU_FREQ_IN_MHZ        25
+*/
+
+
+/*!
+	\def		SL_INC_ARG_CHECK
+
+    \brief      Defines whether the SimpleLink driver perform argument check
+                or not
+
+                When defined, the SimpleLink driver perform argument check on
+                function call. Removing this define could reduce some code
+                size and improve slightly the performances but may impact in
+                unpredictable behaviour in case of invalid arguments
+
+    \sa
+
+    \note       belongs to \ref porting_sec
+
+    \warning    Removing argument check may cause unpredictable behaviour in
+                case of invalid arguments.
+                In this case the user is responsible to argument validity
+                (for example all handlers must not be NULL)
+*/
+#define SL_INC_ARG_CHECK
+
+
+/*!
+    \def		SL_INC_STD_BSD_API_NAMING
+
+    \brief      Defines whether SimpleLink driver should expose standard BSD
+                APIs or not
+
+                When defined, the SimpleLink driver in addition to its alternative
+                BSD APIs expose also standard BSD APIs.
+                Standard BSD API includes the following functions:
+                socket , close , accept , bind , listen	, connect , select ,
+                setsockopt	, getsockopt , recv , recvfrom , write , send , sendto ,
+                gethostbyname
+
+    \sa
+
+    \note       belongs to \ref porting_sec
+
+    \warning
+*/
+
+#define SL_INC_STD_BSD_API_NAMING
+
+
+/*!
+    \brief      Defines whether to include extended API in SimpleLink driver
+                or not
+
+                When defined, the SimpleLink driver will include also all
+                extended API of the included packages
+
+    \sa         ext_api
+
+    \note       belongs to \ref porting_sec
+
+    \warning
+*/
+#define SL_INC_EXT_API
+
+/*!
+    \brief      Defines whether to include WLAN package in SimpleLink driver
+                or not
+
+                When defined, the SimpleLink driver will include also
+                the WLAN package
+
+    \sa
+
+    \note       belongs to \ref porting_sec
+
+    \warning
+*/
+#define SL_INC_WLAN_PKG
+
+/*!
+    \brief      Defines whether to include SOCKET package in SimpleLink
+                driver or not
+
+                When defined, the SimpleLink driver will include also
+                the SOCKET package
+
+    \sa
+
+    \note       belongs to \ref porting_sec
+
+    \warning
+*/
+#define SL_INC_SOCKET_PKG
+
+/*!
+    \brief      Defines whether to include NET_APP package in SimpleLink
+                driver or not
+
+                When defined, the SimpleLink driver will include also the
+                NET_APP package
+
+    \sa
+
+    \note       belongs to \ref porting_sec
+
+    \warning
+*/
+#define SL_INC_NET_APP_PKG
+
+/*!
+    \brief      Defines whether to include NET_CFG package in SimpleLink
+                driver or not
+
+                When defined, the SimpleLink driver will include also
+                the NET_CFG package
+
+    \sa
+
+    \note       belongs to \ref porting_sec
+
+    \warning
+*/
+#define SL_INC_NET_CFG_PKG
+
+/*!
+    \brief      Defines whether to include NVMEM package in SimpleLink
+                driver or not
+
+                When defined, the SimpleLink driver will include also the
+                NVMEM package
+
+    \sa
+
+    \note       belongs to \ref porting_sec
+
+    \warning
+*/
+#define SL_INC_NVMEM_PKG
+
+/*!
+    \brief      Defines whether to include socket server side APIs
+                in SimpleLink driver or not
+
+                When defined, the SimpleLink driver will include also socket
+                server side APIs
+
+    \sa         server_side
+
+    \note
+
+    \warning
+*/
+#define SL_INC_SOCK_SERVER_SIDE_API
+
+/*!
+    \brief      Defines whether to include socket client side APIs in SimpleLink
+                driver or not
+
+                When defined, the SimpleLink driver will include also socket
+                client side APIs
+
+    \sa         client_side
+
+    \note       belongs to \ref porting_sec
+
+    \warning
+*/
+#define SL_INC_SOCK_CLIENT_SIDE_API
+
+/*!
+    \brief      Defines whether to include socket receive APIs in SimpleLink
+                driver or not
+
+                When defined, the SimpleLink driver will include also socket
+                receive side APIs
+
+    \sa         recv_api
+
+    \note       belongs to \ref porting_sec
+
+    \warning
+*/
+#define SL_INC_SOCK_RECV_API
+
+/*!
+    \brief      Defines whether to include socket send APIs in SimpleLink
+                driver or not
+
+                When defined, the SimpleLink driver will include also socket
+                send side APIs
+
+    \sa         send_api
+
+    \note       belongs to \ref porting_sec
+
+    \warning
+*/
+#define SL_INC_SOCK_SEND_API
+
+/*!
+
+ Close the Doxygen group.
+ @}
+
+ */
+
+
+/*!
+ ******************************************************************************
+
+    \defgroup   porting_enable_device       Device Enable/Disable IO
+
+    The enable/disable API provide mechanism to enable/disable the network processor
+
+
+    PORTING ACTION:
+        - None
+    @{
+
+ ******************************************************************************
+ */
+/*!
+    \brief		Preamble to the enabling the Network Processor.
+                        Placeholder to implement any pre-process operations
+                        before enabling networking operations.
+
+    \sa			sl_DeviceEnable
+
+    \note       belongs to \ref ported_sec
+
+*/
+#define sl_DeviceEnablePreamble()
+
+/*!
+    \brief		Enable the Network Processor
+
+    \sa			sl_DeviceDisable
+
+    \note       belongs to \ref porting_sec
+
+*/
+//#define sl_DeviceEnable       _spi->CC3100_enable
+
+/*!
+    \brief		Disable the Network Processor
+
+    \sa			sl_DeviceEnable
+
+    \note       belongs to \ref porting_sec
+*/
+//#define sl_DeviceDisable      _spi->CC3100_disable
+
+/*!
+
+ Close the Doxygen group.
+ @}
+
+ */
+
+/*!
+ ******************************************************************************
+
+    \defgroup   porting_interface         Hardware Transport Interface
+
+    The simple link device can work with different transport interfaces
+    (namely,SPI or UART). Texas Instruments provides single driver
+    that can work with all these types. This section binds the
+    physical transport interface with the SimpleLink driver
+
+
+    \note       Correct and efficient implementation of this driver is critical
+                for the performances of the SimpleLink device on this platform.
+
+
+    PORTING ACTION:
+        - None
+
+    @{
+
+ ******************************************************************************
+ */
+
+#define _SlFd_t                    int32_t
+
+/*!
+    \brief      Opens an interface communication port to be used for communicating
+                with a SimpleLink device
+
+	            Given an interface name and option flags, this function opens
+                the communication port and creates a file descriptor.
+                This file descriptor is used afterwards to read and write
+                data from and to this specific communication channel.
+	            The speed, clock polarity, clock phase, chip select and all other
+                specific attributes of the channel are all should be set to hardcoded
+                in this function.
+
+	\param	 	ifName  -   points to the interface name/path. The interface name is an
+                            optional attributes that the simple link driver receives
+                            on opening the driver (sl_Start).
+                            In systems that the spi channel is not implemented as
+                            part of the OS device drivers, this parameter could be NULL.
+
+	\param      flags   -   optional flags parameters for future use
+
+	\return     upon successful completion, the function shall open the channel
+                and return a non-negative integer representing the file descriptor.
+                Otherwise, -1 shall be returned
+
+    \sa         sl_IfClose , sl_IfRead , sl_IfWrite
+
+	\note       The prototype of the function is as follow:
+                    Fd_t xxx_IfOpen(char* pIfName , unsigned long flags);
+
+    \note       belongs to \ref porting_sec
+
+    \warning
+*/
+//#define sl_IfOpen                           _spi->spi_Open
+
+/*!
+    \brief      Closes an opened interface communication port
+
+	\param	 	fd  -   file descriptor of opened communication channel
+
+	\return		upon successful completion, the function shall return 0.
+			    Otherwise, -1 shall be returned
+
+    \sa         sl_IfOpen , sl_IfRead , sl_IfWrite
+
+	\note       The prototype of the function is as follow:
+                    int xxx_IfClose(Fd_t Fd);
+
+    \note       belongs to \ref porting_sec
+
+    \warning
+*/
+//#define sl_IfClose                          _spi->spi_Close
+
+/*!
+    \brief      Attempts to read up to len bytes from an opened communication channel
+                into a buffer starting at pBuff.
+
+	\param	 	fd      -   file descriptor of an opened communication channel
+
+	\param		pBuff   -   pointer to the first location of a buffer that contains enough
+                            space for all expected data
+
+	\param      len     -   number of bytes to read from the communication channel
+
+	\return     upon successful completion, the function shall return the number of read bytes.
+                Otherwise, 0 shall be returned
+
+    \sa         sl_IfClose , sl_IfOpen , sl_IfWrite
+
+
+	\note       The prototype of the function is as follow:
+                    int xxx_IfRead(Fd_t Fd , char* pBuff , int Len);
+
+    \note       belongs to \ref porting_sec
+
+    \warning
+*/
+//#define sl_IfRead                           _spi->spi_Read
+
+/*!
+    \brief attempts to write up to len bytes to the SPI channel
+
+	\param	 	fd      -   file descriptor of an opened communication channel
+
+	\param		pBuff   -   pointer to the first location of a buffer that contains
+                            the data to send over the communication channel
+
+	\param      len     -   number of bytes to write to the communication channel
+
+	\return     upon successful completion, the function shall return the number of sent bytes.
+				otherwise, 0 shall be returned
+
+    \sa         sl_IfClose , sl_IfOpen , sl_IfRead
+
+	\note       This function could be implemented as zero copy and return only upon successful completion
+                of writing the whole buffer, but in cases that memory allocation is not too tight, the
+                function could copy the data to internal buffer, return back and complete the write in
+                parallel to other activities as long as the other SPI activities would be blocked until
+                the entire buffer write would be completed
+
+               The prototype of the function is as follow:
+                    int xxx_IfWrite(Fd_t Fd , char* pBuff , int Len);
+
+    \note       belongs to \ref porting_sec
+
+    \warning
+*/
+//#define sl_IfWrite                          _spi->spi_Write
+
+/*!
+    \brief 		register an interrupt handler routine for the host IRQ
+
+	\param	 	InterruptHdl	-	pointer to interrupt handler routine
+
+	\param 		pValue			-	pointer to a memory structure that is passed
+									to the interrupt handler.
+
+	\return		upon successful registration, the function shall return 0.
+				Otherwise, -1 shall be returned
+
+    \sa
+
+	\note		If there is already registered interrupt handler, the function
+				should overwrite the old handler with the new one
+
+	\note       If the handler is a null pointer, the function should un-register the
+	            interrupt handler, and the interrupts can be disabled.
+
+    \note       belongs to \ref porting_sec
+
+    \warning
+*/
+//#define sl_IfRegIntHdlr(InterruptHdl , pValue) \
+//                                _spi->registerInterruptHandler(InterruptHdl , pValue)
+/*!
+    \brief 		Masks the Host IRQ
+
+    \sa		sl_IfUnMaskIntHdlr
+
+
+
+    \note       belongs to \ref porting_sec
+
+    \warning
+*/
+
+//#define sl_IfMaskIntHdlr()
+
+/*!
+    \brief 		Unmasks the Host IRQ
+
+    \sa		sl_IfMaskIntHdlr
+
+
+
+    \note       belongs to \ref porting_sec
+
+    \warning
+*/
+
+//#define sl_IfUnMaskIntHdlr()
+
+/*!
+    \brief 		Write Handers for statistics debug on write
+
+	\param	 	interface handler	-	pointer to interrupt handler routine
+
+
+	\return		no return value
+
+    \sa
+
+	\note		An optional hooks for monitoring before and after write info
+
+    \note       belongs to \ref porting_sec
+
+    \warning
+*/
+/*
+#define SL_START_WRITE_STAT
+*/
+
+#ifdef SL_START_WRITE_STAT
+#define sl_IfStartWriteSequence
+#define sl_IfEndWriteSequence
+#endif
+/*!
+
+ Close the Doxygen group.
+ @}
+
+ */
+
+/*!
+ ******************************************************************************
+
+    \defgroup   porting_mem_mgm             Memory Management
+
+    This section declare in which memory management model the SimpleLink driver
+    will run:
+        -# Static
+        -# Dynamic
+
+    This section IS NOT REQUIRED in case Static model is selected.
+
+    The default memory model is Static
+
+    PORTING ACTION:
+        - If dynamic model is selected, define the alloc and free functions.
+
+    @{
+
+ *****************************************************************************
+ */
+
+/*!
+    \brief      Defines whether the SimpleLink driver is working in dynamic
+                memory model or not
+
+                When defined, the SimpleLink driver use dynamic allocations
+                if dynamic allocation is selected malloc and free functions
+                must be retrieved
+
+    \sa
+
+    \note       belongs to \ref porting_sec
+
+    \warning
+*/
+/*
+#define SL_MEMORY_MGMT_DYNAMIC
+*/
+
+#ifdef SL_MEMORY_MGMT_DYNAMIC
+
+/*!
+    \brief
+
+    \sa
+
+    \note           belongs to \ref porting_sec
+
+    \warning
+*/
+#define sl_Malloc(Size)
+
+/*!
+    \brief
+
+    \sa
+
+    \note           belongs to \ref porting_sec
+
+    \warning
+*/
+#define sl_Free(pMem)
+
+#endif
+
+/*!
+
+ Close the Doxygen group.
+ @}
+
+ */
+
+/*!
+ ******************************************************************************
+
+    \defgroup   porting_os          Operating System (OS)
+
+    The simple link driver can run on multi-threaded environment as well
+    as non-os environment (main loop)
+
+    This section IS NOT REQUIRED in case you are working on non-os environment.
+
+    If you choose to work in multi-threaded environment under any operating system
+    you will have to provide some basic adaptation routines to allow the driver
+    to protect access to resources from different threads (locking object) and
+    to allow synchronization between threads (sync objects).
+
+    PORTING ACTION:
+        -# Uncomment SL_PLATFORM_MULTI_THREADED define
+        -# Bind locking object routines
+        -# Bind synchronization object routines
+        -# Optional - Bind spawn thread routine
+
+    @{
+
+ ******************************************************************************
+ */
+
+/*
+#define SL_PLATFORM_MULTI_THREADED
+*/
+
+#ifdef SL_PLATFORM_MULTI_THREADED
+
+/*!
+    \brief
+    \sa
+    \note           belongs to \ref porting_sec
+    \warning
+*/
+#define SL_OS_RET_CODE_OK
+
+/*!
+    \brief
+    \sa
+    \note           belongs to \ref porting_sec
+    \warning
+*/
+#define SL_OS_WAIT_FOREVER
+
+/*!
+    \brief
+    \sa
+    \note           belongs to \ref porting_sec
+    \warning
+*/
+#define SL_OS_NO_WAIT
+
+/*!
+	\brief type definition for a time value
+
+	\note	On each porting or platform the type could be whatever is needed - integer, pointer to structure etc.
+
+    \note       belongs to \ref porting_sec
+*/
+#define _SlTime_t
+
+/*!
+	\brief 	type definition for a sync object container
+
+	Sync object is object used to synchronize between two threads or thread and interrupt handler.
+	One thread is waiting on the object and the other thread send a signal, which then
+	release the waiting thread.
+	The signal must be able to be sent from interrupt context.
+	This object is generally implemented by binary semaphore or events.
+
+	\note	On each porting or platform the type could be whatever is needed - integer, structure etc.
+
+    \note       belongs to \ref porting_sec
+*/
+#define _SlSyncObj_t
+
+
+/*!
+	\brief 	This function creates a sync object
+
+	The sync object is used for synchronization between different thread or ISR and
+	a thread.
+
+	\param	pSyncObj	-	pointer to the sync object control block
+
+	\return upon successful creation the function should return 0
+			Otherwise, a negative value indicating the error code shall be returned
+
+    \note       belongs to \ref porting_sec
+	\warning
+*/
+#define sl_SyncObjCreate(pSyncObj,pName)
+
+
+/*!
+	\brief 	This function deletes a sync object
+
+	\param	pSyncObj	-	pointer to the sync object control block
+
+	\return upon successful deletion the function should return 0
+			Otherwise, a negative value indicating the error code shall be returned
+    \note       belongs to \ref porting_sec
+	\warning
+*/
+#define sl_SyncObjDelete(pSyncObj)
+
+
+/*!
+	\brief 		This function generates a sync signal for the object.
+
+	All suspended threads waiting on this sync object are resumed
+
+	\param		pSyncObj	-	pointer to the sync object control block
+
+	\return 	upon successful signalling the function should return 0
+				Otherwise, a negative value indicating the error code shall be returned
+	\note		the function could be called from ISR context
+	\warning
+*/
+#define sl_SyncObjSignal(pSyncObj)
+
+/*!
+	\brief 		This function generates a sync signal for the object from Interrupt
+
+	This is for RTOS that should signal from IRQ using a dedicated API
+
+	\param		pSyncObj	-	pointer to the sync object control block
+
+	\return 	upon successful signalling the function should return 0
+				Otherwise, a negative value indicating the error code shall be returned
+	\note		the function could be called from ISR context
+	\warning
+*/
+#define sl_SyncObjSignalFromIRQ(pSyncObj)
+/*!
+	\brief 	This function waits for a sync signal of the specific sync object
+
+	\param	pSyncObj	-	pointer to the sync object control block
+	\param	Timeout		-	numeric value specifies the maximum number of mSec to
+							stay suspended while waiting for the sync signal
+							Currently, the simple link driver uses only two values:
+								- OSI_WAIT_FOREVER
+								- OSI_NO_WAIT
+
+	\return upon successful reception of the signal within the timeout window return 0
+			Otherwise, a negative value indicating the error code shall be returned
+    \note       belongs to \ref porting_sec
+	\warning
+*/
+#define sl_SyncObjWait(pSyncObj,Timeout)
+
+/*!
+	\brief 	type definition for a locking object container
+
+	Locking object are used to protect a resource from mutual accesses of two or more threads.
+	The locking object should support reentrant locks by a signal thread.
+	This object is generally implemented by mutex semaphore
+
+	\note	On each porting or platform the type could be whatever is needed - integer, structure etc.
+    \note       belongs to \ref porting_sec
+*/
+#define _SlLockObj_t
+
+/*!
+	\brief 	This function creates a locking object.
+
+	The locking object is used for protecting a shared resources between different
+	threads.
+
+	\param	pLockObj	-	pointer to the locking object control block
+
+	\return upon successful creation the function should return 0
+			Otherwise, a negative value indicating the error code shall be returned
+    \note       belongs to \ref porting_sec
+	\warning
+*/
+#define sl_LockObjCreate(pLockObj,pName)
+
+/*!
+	\brief 	This function deletes a locking object.
+
+	\param	pLockObj	-	pointer to the locking object control block
+
+	\return upon successful deletion the function should return 0
+			Otherwise, a negative value indicating the error code shall be returned
+    \note       belongs to \ref porting_sec
+	\warning
+*/
+#define sl_LockObjDelete(pLockObj)
+
+/*!
+	\brief 	This function locks a locking object.
+
+	All other threads that call this function before this thread calls
+	the osi_LockObjUnlock would be suspended
+
+	\param	pLockObj	-	pointer to the locking object control block
+	\param	Timeout		-	numeric value specifies the maximum number of mSec to
+							stay suspended while waiting for the locking object
+							Currently, the simple link driver uses only two values:
+								- OSI_WAIT_FOREVER
+								- OSI_NO_WAIT
+
+
+	\return upon successful reception of the locking object the function should return 0
+			Otherwise, a negative value indicating the error code shall be returned
+    \note       belongs to \ref porting_sec
+	\warning
+*/
+#define sl_LockObjLock(pLockObj,Timeout)
+
+/*!
+	\brief 	This function unlock a locking object.
+
+	\param	pLockObj	-	pointer to the locking object control block
+
+	\return upon successful unlocking the function should return 0
+			Otherwise, a negative value indicating the error code shall be returned
+    \note       belongs to \ref porting_sec
+	\warning
+*/
+#define sl_LockObjUnlock(pLockObj)
+
+#endif
+/*!
+	\brief 	This function call the pEntry callback from a different context
+
+	\param	pEntry		-	pointer to the entry callback function
+
+	\param	pValue		- 	pointer to any type of memory structure that would be
+							passed to pEntry callback from the execution thread.
+
+	\param	flags		- 	execution flags - reserved for future usage
+
+	\return upon successful registration of the spawn the function should return 0
+			(the function is not blocked till the end of the execution of the function
+			and could be returned before the execution is actually completed)
+			Otherwise, a negative value indicating the error code shall be returned
+    \note       belongs to \ref porting_sec
+	\warning
+*/
+/*
+#define SL_PLATFORM_EXTERNAL_SPAWN
+*/
+
+#ifdef SL_PLATFORM_EXTERNAL_SPAWN
+#define sl_Spawn(pEntry,pValue,flags)
+#endif
+
+/*!
+
+ Close the Doxygen group.
+ @}
+
+ */
+
+
+/*!
+ ******************************************************************************
+
+    \defgroup       porting_events      Event Handlers
+
+    This section includes the asynchronous event handlers routines
+
+    PORTING ACTION:
+        -Uncomment the required handler and define your routine as the value
+        of this handler
+
+    @{
+
+ ******************************************************************************
+ */
+
+/*!
+    \brief
+
+    \sa
+
+    \note       belongs to \ref porting_sec
+
+    \warning
+*/
+#define sl_GeneralEvtHdlr       SimpleLinkGeneralEventHandler
+
+
+/*!
+    \brief          An event handler for WLAN connection or disconnection indication
+                    This event handles async WLAN events.
+                    Possible events are:
+                    SL_WLAN_CONNECT_EVENT - indicates WLAN is connected
+                    SL_WLAN_DISCONNECT_EVENT - indicates WLAN is disconnected
+    \sa
+
+    \note           belongs to \ref porting_sec
+
+    \warning
+*/
+#define sl_WlanEvtHdlr          SimpleLinkWlanEventHandler
+
+/*!
+    \brief          An event handler for IP address asynchronous event. Usually accepted after new WLAN connection.
+                    This event handles networking events.
+                    Possible events are:
+                    SL_NETAPP_IPV4_ACQUIRED - IP address was acquired (DHCP or Static)
+
+    \sa
+
+    \note           belongs to \ref porting_sec
+
+    \warning
+*/
+
+#define sl_NetAppEvtHdlr        SimpleLinkNetAppEventHandler
+
+/*!
+    \brief          A callback for HTTP server events.
+                    Possible events are:
+                    SL_NETAPP_HTTPGETTOKENVALUE - NWP requests to get the value of a specific token
+					SL_NETAPP_HTTPPOSTTOKENVALUE - NWP post to the host a new value for a specific token
+
+	\param			pServerEvent - Contains the relevant event information (SL_NETAPP_HTTPGETTOKENVALUE or SL_NETAPP_HTTPPOSTTOKENVALUE)
+
+	\param			pServerResponse - Should be filled by the user with the relevant response information (i.e SL_NETAPP_HTTPSETTOKENVALUE as a response to SL_NETAPP_HTTPGETTOKENVALUE event)
+
+    \sa
+
+    \note           belongs to \ref porting_sec
+
+    \warning
+*/
+
+#define sl_HttpServerCallback   SimpleLinkHttpServerCallback
+
+/*!
+    \brief
+
+    \sa
+
+    \note           belongs to \ref porting_sec
+
+    \warning
+*/
+#define sl_SockEvtHdlr          SimpleLinkSockEventHandler
+
+
+
+/*!
+
+ Close the Doxygen group.
+ @}
+
+ */
+
+#endif /* __USER_H__ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_wlan.cpp	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,923 @@
+/*
+* wlan.c - CC31xx/CC32xx Host Driver Implementation
+*
+* Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+*
+*
+*  Redistribution and use in source and binary forms, with or without
+*  modification, are permitted provided that the following conditions
+*  are met:
+*
+*    Redistributions of source code must retain the above copyright
+*    notice, this list of conditions and the following disclaimer.
+*
+*    Redistributions in binary form must reproduce the above copyright
+*    notice, this list of conditions and the following disclaimer in the
+*    documentation and/or other materials provided with the
+*    distribution.
+*
+*    Neither the name of Texas Instruments Incorporated nor the names of
+*    its contributors may be used to endorse or promote products derived
+*    from this software without specific prior written permission.
+*
+*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+*  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+*  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+*  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+*  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+*  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+*  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+*  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+*  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+*  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*
+*/
+
+
+
+/*****************************************************************************/
+/* Include files                                                             */
+/*****************************************************************************/
+#include "cc3100_simplelink.h"
+#include "cc3100_protocol.h"
+#include "cc3100_driver.h"
+
+#include "cc3100_wlan.h"
+#include "cc3100_wlan_rx_filters.h"
+
+/*****************************************************************************/
+/* Macro declarations                                                        */
+/*****************************************************************************/
+#define MAX_SSID_LEN           (32)
+#define MAX_KEY_LEN            (63)
+#define MAX_USER_LEN           (32)
+#define MAX_ANON_USER_LEN      (32)
+#define MAX_SMART_CONFIG_KEY   (16)
+
+namespace mbed_cc3100 {
+
+cc3100_wlan::cc3100_wlan(cc3100_driver &driver, cc3100_wlan_rx_filters  &wlan_filters)
+    : _driver(driver), _wlan_filters(wlan_filters)
+{
+
+}
+
+cc3100_wlan::~cc3100_wlan()
+{
+
+}
+
+/*****************************************************************************
+sl_WlanConnect
+*****************************************************************************/
+typedef struct {
+    _WlanConnectEapCommand_t    Args;
+    int8_t                        Strings[MAX_SSID_LEN + MAX_KEY_LEN + MAX_USER_LEN + MAX_ANON_USER_LEN];
+} _WlanConnectCmd_t;
+
+typedef union {
+    _WlanConnectCmd_t   Cmd;
+    _BasicResponse_t	Rsp;
+} _SlWlanConnectMsg_u;
+
+
+#if _SL_INCLUDE_FUNC(sl_WlanConnect)
+int16_t cc3100_wlan::sl_WlanConnect(signed char*  pName, int16_t NameLen, uint8_t *pMacAddr, SlSecParams_t* pSecParams , SlSecParamsExt_t* pSecExtParams)
+{
+    _SlWlanConnectMsg_u    Msg = {0};
+    _SlCmdCtrl_t           CmdCtrl = {0};
+
+    CmdCtrl.TxDescLen = 0;/* init */
+    CmdCtrl.RxDescLen = sizeof(_BasicResponse_t);
+
+    /* verify SSID length */
+    VERIFY_PROTOCOL(NameLen <= MAX_SSID_LEN);
+    /* update SSID length */
+    Msg.Cmd.Args.Common.SsidLen = (uint8_t)NameLen;
+    /* Profile with no security */
+    /* Enterprise security profile */
+    if (NULL != pSecExtParams) {
+        /* Update command opcode */
+        CmdCtrl.Opcode = SL_OPCODE_WLAN_WLANCONNECTEAPCOMMAND;
+        CmdCtrl.TxDescLen += sizeof(_WlanConnectEapCommand_t);
+        /* copy SSID */
+        memcpy(EAP_SSID_STRING(&Msg), pName, NameLen);
+        CmdCtrl.TxDescLen += NameLen;
+        /* Copy password if supplied */
+        if ((NULL != pSecParams) && (pSecParams->KeyLen > 0)) {
+            /* update security type */
+            Msg.Cmd.Args.Common.SecType = pSecParams->Type;
+            /* verify key length */
+            if (pSecParams->KeyLen > MAX_KEY_LEN) {
+                return SL_INVALPARAM;
+            }
+            /* update key length */
+            Msg.Cmd.Args.Common.PasswordLen = pSecParams->KeyLen;
+            ARG_CHECK_PTR(pSecParams->Key);
+            /* copy key		 */
+            memcpy(EAP_PASSWORD_STRING(&Msg), pSecParams->Key, pSecParams->KeyLen);
+            CmdCtrl.TxDescLen += pSecParams->KeyLen;
+        } else {
+            Msg.Cmd.Args.Common.PasswordLen = 0;
+        }
+        ARG_CHECK_PTR(pSecExtParams);
+        /* Update Eap bitmask */
+        Msg.Cmd.Args.EapBitmask = pSecExtParams->EapMethod;
+        /* Update Certificate file ID index - currently not supported */
+        Msg.Cmd.Args.CertIndex = pSecExtParams->CertIndex;
+        /* verify user length */
+        if (pSecExtParams->UserLen > MAX_USER_LEN) {
+            return SL_INVALPARAM;
+        }
+        Msg.Cmd.Args.UserLen = pSecExtParams->UserLen;
+        /* copy user name (identity) */
+        if(pSecExtParams->UserLen > 0) {
+            memcpy(EAP_USER_STRING(&Msg), pSecExtParams->User, pSecExtParams->UserLen);
+            CmdCtrl.TxDescLen += pSecExtParams->UserLen;
+        }
+        /* verify Anonymous user length  */
+        if (pSecExtParams->AnonUserLen > MAX_ANON_USER_LEN) {
+            return SL_INVALPARAM;
+        }
+        Msg.Cmd.Args.AnonUserLen = pSecExtParams->AnonUserLen;
+        /* copy Anonymous user */
+        if(pSecExtParams->AnonUserLen > 0) {
+            memcpy(EAP_ANON_USER_STRING(&Msg), pSecExtParams->AnonUser, pSecExtParams->AnonUserLen);
+            CmdCtrl.TxDescLen += pSecExtParams->AnonUserLen;
+        }
+
+    }
+
+    /* Regular or open security profile */
+    else {
+        /* Update command opcode */
+        CmdCtrl.Opcode = SL_OPCODE_WLAN_WLANCONNECTCOMMAND;
+        CmdCtrl.TxDescLen += sizeof(_WlanConnectCommon_t);
+        /* copy SSID */
+        memcpy(SSID_STRING(&Msg), pName, NameLen);
+        CmdCtrl.TxDescLen += NameLen;
+        /* Copy password if supplied */
+        if( NULL != pSecParams ) {
+            /* update security type */
+            Msg.Cmd.Args.Common.SecType = pSecParams->Type;
+            /* verify key length is valid */
+            if (pSecParams->KeyLen > MAX_KEY_LEN) {
+                return SL_INVALPARAM;
+            }
+            /* update key length */
+            Msg.Cmd.Args.Common.PasswordLen = pSecParams->KeyLen;
+            CmdCtrl.TxDescLen += pSecParams->KeyLen;
+            /* copy key (could be no key in case of WPS pin) */
+            if( NULL != pSecParams->Key ) {
+                memcpy(PASSWORD_STRING(&Msg), pSecParams->Key, pSecParams->KeyLen);
+            }
+        }
+        /* Profile with no security */
+        else {
+            Msg.Cmd.Args.Common.PasswordLen = 0;
+            Msg.Cmd.Args.Common.SecType = SL_SEC_TYPE_OPEN;
+        }
+    }
+    /* If BSSID is not null, copy to buffer, otherwise set to 0 */
+    if(NULL != pMacAddr) {
+        memcpy(Msg.Cmd.Args.Common.Bssid, pMacAddr, sizeof(Msg.Cmd.Args.Common.Bssid));
+    } else {
+        memset(Msg.Cmd.Args.Common.Bssid, 0, sizeof(Msg.Cmd.Args.Common.Bssid));
+    }
+
+    VERIFY_RET_OK ( _driver._SlDrvCmdOp(&CmdCtrl, &Msg, NULL));
+    return (int16_t)Msg.Rsp.status;
+}
+#endif
+
+/*******************************************************************************/
+/*   sl_Disconnect  */
+/* ******************************************************************************/
+#if _SL_INCLUDE_FUNC(sl_WlanDisconnect)
+int16_t cc3100_wlan::sl_WlanDisconnect(void)
+{
+    return _driver._SlDrvBasicCmd(SL_OPCODE_WLAN_WLANDISCONNECTCOMMAND);
+}
+#endif
+
+/******************************************************************************/
+/*  sl_PolicySet  */
+/******************************************************************************/
+typedef union {
+    _WlanPoliciySetGet_t    Cmd;
+    _BasicResponse_t	    Rsp;
+} _SlPolicyMsg_u;
+
+const _SlCmdCtrl_t _SlPolicySetCmdCtrl = {
+    SL_OPCODE_WLAN_POLICYSETCOMMAND,
+    sizeof(_WlanPoliciySetGet_t),
+    sizeof(_BasicResponse_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_WlanPolicySet)
+int16_t cc3100_wlan::sl_WlanPolicySet(uint8_t Type , const uint8_t Policy, uint8_t *pVal,uint8_t ValLen)
+{
+
+    _SlPolicyMsg_u         Msg;
+    _SlCmdExt_t            CmdExt;
+
+    CmdExt.TxPayloadLen = ValLen;
+    CmdExt.RxPayloadLen = 0;
+    CmdExt.pTxPayload = (uint8_t *)pVal;
+    CmdExt.pRxPayload = NULL;
+
+
+    Msg.Cmd.PolicyType        = Type;
+    Msg.Cmd.PolicyOption      = Policy;
+    Msg.Cmd.PolicyOptionLen   = ValLen;
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlPolicySetCmdCtrl, &Msg, &CmdExt));
+
+    return (int16_t)Msg.Rsp.status;
+}
+#endif
+
+
+/******************************************************************************/
+/*  sl_PolicyGet  */
+/******************************************************************************/
+typedef union {
+    _WlanPoliciySetGet_t	    Cmd;
+    _WlanPoliciySetGet_t	    Rsp;
+} _SlPolicyGetMsg_u;
+
+const _SlCmdCtrl_t _SlPolicyGetCmdCtrl = {
+    SL_OPCODE_WLAN_POLICYGETCOMMAND,
+    sizeof(_WlanPoliciySetGet_t),
+    sizeof(_WlanPoliciySetGet_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_WlanPolicyGet)
+int16_t cc3100_wlan::sl_WlanPolicyGet(uint8_t Type , uint8_t Policy,uint8_t *pVal,uint8_t *pValLen)
+{
+    _SlPolicyGetMsg_u      Msg;
+    _SlCmdExt_t            CmdExt;
+
+    if (*pValLen == 0) {
+        return SL_EZEROLEN;
+    }
+    CmdExt.TxPayloadLen = 0;
+    CmdExt.RxPayloadLen = *pValLen;
+    CmdExt.pTxPayload = NULL;
+    CmdExt.pRxPayload = pVal;
+    CmdExt.ActualRxPayloadLen = 0;
+
+
+    Msg.Cmd.PolicyType = Type;
+    Msg.Cmd.PolicyOption = Policy;
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlPolicyGetCmdCtrl, &Msg, &CmdExt));
+
+
+    if (CmdExt.RxPayloadLen < CmdExt.ActualRxPayloadLen) {
+        *pValLen = Msg.Rsp.PolicyOptionLen;
+        return SL_ESMALLBUF;
+    } else {
+        /*  no pointer valus, fill the results into int8_t */
+        *pValLen = (uint8_t)CmdExt.ActualRxPayloadLen;
+        if( 0 == CmdExt.ActualRxPayloadLen ) {
+            *pValLen = 1;
+            pVal[0] = Msg.Rsp.PolicyOption;
+        }
+    }
+    return (int16_t)SL_OS_RET_CODE_OK;
+}
+#endif
+
+
+/*******************************************************************************/
+/*  sl_ProfileAdd  */
+/*******************************************************************************/
+typedef struct {
+    _WlanAddGetEapProfile_t	Args;
+    int8_t                    Strings[MAX_SSID_LEN + MAX_KEY_LEN + MAX_USER_LEN + MAX_ANON_USER_LEN];
+} _SlProfileParams_t;
+
+typedef union {
+    _SlProfileParams_t	    Cmd;
+    _BasicResponse_t	    Rsp;
+} _SlProfileAddMsg_u;
+
+
+
+#if _SL_INCLUDE_FUNC(sl_WlanProfileAdd)
+int16_t cc3100_wlan::sl_WlanProfileAdd(int8_t*  pName, int16_t NameLen, uint8_t *pMacAddr, SlSecParams_t* pSecParams , SlSecParamsExt_t* pSecExtParams, uint32_t  Priority, uint32_t  Options)
+{
+    _SlProfileAddMsg_u      Msg;
+    _SlCmdCtrl_t           CmdCtrl = {0};
+    CmdCtrl.TxDescLen = 0;/* init */
+    CmdCtrl.RxDescLen = sizeof(_BasicResponse_t);
+
+    /* update priority */
+    Msg.Cmd.Args.Common.Priority = (uint8_t)Priority;
+    /* verify SSID length */
+    VERIFY_PROTOCOL(NameLen <= MAX_SSID_LEN);
+    /* update SSID length */
+    Msg.Cmd.Args.Common.SsidLen = (uint8_t)NameLen;
+
+
+    /* Enterprise security profile */
+    if  (NULL != pSecExtParams) {
+        /* Update command opcode */
+        CmdCtrl.Opcode = SL_OPCODE_WLAN_EAP_PROFILEADDCOMMAND;
+        CmdCtrl.TxDescLen += sizeof(_WlanAddGetEapProfile_t);
+
+        /* copy SSID */
+        memcpy(EAP_PROFILE_SSID_STRING(&Msg), pName, NameLen);
+        CmdCtrl.TxDescLen += NameLen;
+
+        /* Copy password if supplied */
+        if ((NULL != pSecParams) && (pSecParams->KeyLen > 0)) {
+            /* update security type */
+            Msg.Cmd.Args.Common.SecType = pSecParams->Type;
+
+            if( SL_SEC_TYPE_WEP == Msg.Cmd.Args.Common.SecType ) {
+                Msg.Cmd.Args.Common.WepKeyId = 0;
+            }
+
+            /* verify key length */
+            if (pSecParams->KeyLen > MAX_KEY_LEN) {
+                return SL_INVALPARAM;
+            }
+            VERIFY_PROTOCOL(pSecParams->KeyLen <= MAX_KEY_LEN);
+            /* update key length */
+            Msg.Cmd.Args.Common.PasswordLen = pSecParams->KeyLen;
+            CmdCtrl.TxDescLen += pSecParams->KeyLen;
+            ARG_CHECK_PTR(pSecParams->Key);
+            /* copy key  */
+            memcpy(EAP_PROFILE_PASSWORD_STRING(&Msg), pSecParams->Key, pSecParams->KeyLen);
+        } else {
+            Msg.Cmd.Args.Common.PasswordLen = 0;
+        }
+
+        ARG_CHECK_PTR(pSecExtParams);
+        /* Update Eap bitmask */
+        Msg.Cmd.Args.EapBitmask = pSecExtParams->EapMethod;
+        /* Update Certificate file ID index - currently not supported */
+        Msg.Cmd.Args.CertIndex = pSecExtParams->CertIndex;
+        /* verify user length */
+        if (pSecExtParams->UserLen > MAX_USER_LEN) {
+            return SL_INVALPARAM;
+        }
+        Msg.Cmd.Args.UserLen = pSecExtParams->UserLen;
+        /* copy user name (identity) */
+        if(pSecExtParams->UserLen > 0) {
+            memcpy(EAP_PROFILE_USER_STRING(&Msg), pSecExtParams->User, pSecExtParams->UserLen);
+            CmdCtrl.TxDescLen += pSecExtParams->UserLen;
+        }
+
+        /* verify Anonymous user length (for tunneled) */
+        if (pSecExtParams->AnonUserLen > MAX_ANON_USER_LEN) {
+            return SL_INVALPARAM;
+        }
+        Msg.Cmd.Args.AnonUserLen = pSecExtParams->AnonUserLen;
+
+        /* copy Anonymous user */
+        if(pSecExtParams->AnonUserLen > 0) {
+            memcpy(EAP_PROFILE_ANON_USER_STRING(&Msg), pSecExtParams->AnonUser, pSecExtParams->AnonUserLen);
+            CmdCtrl.TxDescLen += pSecExtParams->AnonUserLen;
+        }
+
+    }
+    /* Regular or open security profile */
+    else {
+        /* Update command opcode */
+        CmdCtrl.Opcode = SL_OPCODE_WLAN_PROFILEADDCOMMAND;
+        /* update commnad length */
+        CmdCtrl.TxDescLen += sizeof(_WlanAddGetProfile_t);
+
+        if (NULL != pName) {
+            /* copy SSID */
+            memcpy(PROFILE_SSID_STRING(&Msg), pName, NameLen);
+            CmdCtrl.TxDescLen += NameLen;
+        }
+
+        /* Copy password if supplied */
+        if( NULL != pSecParams ) {
+            /* update security type */
+            Msg.Cmd.Args.Common.SecType = pSecParams->Type;
+
+            if( SL_SEC_TYPE_WEP == Msg.Cmd.Args.Common.SecType ) {
+                Msg.Cmd.Args.Common.WepKeyId = 0;
+            }
+
+            /* verify key length */
+            if (pSecParams->KeyLen > MAX_KEY_LEN) {
+                return SL_INVALPARAM;
+            }
+            /* update key length */
+            Msg.Cmd.Args.Common.PasswordLen = pSecParams->KeyLen;
+            CmdCtrl.TxDescLen += pSecParams->KeyLen;
+            /* copy key (could be no key in case of WPS pin) */
+            if( NULL != pSecParams->Key ) {
+                memcpy(PROFILE_PASSWORD_STRING(&Msg), pSecParams->Key, pSecParams->KeyLen);
+            }
+        } else {
+            Msg.Cmd.Args.Common.SecType = SL_SEC_TYPE_OPEN;
+            Msg.Cmd.Args.Common.PasswordLen = 0;
+        }
+
+    }
+
+
+    /* If BSSID is not null, copy to buffer, otherwise set to 0  */
+    if(NULL != pMacAddr) {
+        memcpy(Msg.Cmd.Args.Common.Bssid, pMacAddr, sizeof(Msg.Cmd.Args.Common.Bssid));
+    } else {
+        memset(Msg.Cmd.Args.Common.Bssid, 0, sizeof(Msg.Cmd.Args.Common.Bssid));
+    }
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp(&CmdCtrl, &Msg, NULL));
+
+    return (int16_t)Msg.Rsp.status;
+}
+#endif
+
+/*******************************************************************************/
+/*   sl_ProfileGet */
+/*******************************************************************************/
+typedef union {
+    _WlanProfileDelGetCommand_t Cmd;
+    _SlProfileParams_t	        Rsp;
+} _SlProfileGetMsg_u;
+
+const _SlCmdCtrl_t _SlProfileGetCmdCtrl = {
+    SL_OPCODE_WLAN_PROFILEGETCOMMAND,
+    sizeof(_WlanProfileDelGetCommand_t),
+    sizeof(_SlProfileParams_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_WlanProfileGet)
+int16_t cc3100_wlan::sl_WlanProfileGet(int16_t Index,int8_t*  pName, int16_t *pNameLen, uint8_t *pMacAddr, SlSecParams_t* pSecParams, SlGetSecParamsExt_t* pEntParams, uint32_t *pPriority)
+{
+    _SlProfileGetMsg_u      Msg;
+    Msg.Cmd.index = (uint8_t)Index;
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlProfileGetCmdCtrl, &Msg, NULL));
+
+    pSecParams->Type = Msg.Rsp.Args.Common.SecType;
+    /* since password is not transferred in getprofile, password length should always be zero */
+    pSecParams->KeyLen = Msg.Rsp.Args.Common.PasswordLen;
+    if (NULL != pEntParams) {
+        pEntParams->UserLen = Msg.Rsp.Args.UserLen;
+        /* copy user name */
+        if (pEntParams->UserLen > 0) {
+            memcpy(pEntParams->User, EAP_PROFILE_USER_STRING(&Msg), pEntParams->UserLen);
+        }
+        pEntParams->AnonUserLen = Msg.Rsp.Args.AnonUserLen;
+        /* copy anonymous user name */
+        if (pEntParams->AnonUserLen > 0) {
+            memcpy(pEntParams->AnonUser, EAP_PROFILE_ANON_USER_STRING(&Msg), pEntParams->AnonUserLen);
+        }
+    }
+
+    *pNameLen  = Msg.Rsp.Args.Common.SsidLen;
+    *pPriority = Msg.Rsp.Args.Common.Priority;
+
+    if (NULL != Msg.Rsp.Args.Common.Bssid) {
+        memcpy(pMacAddr, Msg.Rsp.Args.Common.Bssid, sizeof(Msg.Rsp.Args.Common.Bssid));
+    }
+
+    memcpy(pName, EAP_PROFILE_SSID_STRING(&Msg), *pNameLen);
+
+    return (int16_t)Msg.Rsp.Args.Common.SecType;
+
+}
+#endif
+
+/*******************************************************************************/
+/*   sl_ProfileDel  */
+/*******************************************************************************/
+typedef union {
+    _WlanProfileDelGetCommand_t	    Cmd;
+    _BasicResponse_t	            Rsp;
+} _SlProfileDelMsg_u;
+
+const _SlCmdCtrl_t _SlProfileDelCmdCtrl = {
+    SL_OPCODE_WLAN_PROFILEDELCOMMAND,
+    sizeof(_WlanProfileDelGetCommand_t),
+    sizeof(_BasicResponse_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_WlanProfileDel)
+int16_t cc3100_wlan::sl_WlanProfileDel(int16_t Index)
+{
+    _SlProfileDelMsg_u Msg;
+
+    Msg.Cmd.index = (uint8_t)Index;
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlProfileDelCmdCtrl, &Msg, NULL));
+
+    return (int16_t)Msg.Rsp.status;
+}
+#endif
+
+/******************************************************************************/
+/*  sl_WlanGetNetworkList  */
+/******************************************************************************/
+typedef union {
+    _WlanGetNetworkListCommand_t    Cmd;
+    _WlanGetNetworkListResponse_t   Rsp;
+} _SlWlanGetNetworkListMsg_u;
+
+const _SlCmdCtrl_t _SlWlanGetNetworkListCtrl = {
+    SL_OPCODE_WLAN_SCANRESULTSGETCOMMAND,
+    sizeof(_WlanGetNetworkListCommand_t),
+    sizeof(_WlanGetNetworkListResponse_t)
+};
+
+
+#if _SL_INCLUDE_FUNC(sl_WlanGetNetworkList)
+int16_t cc3100_wlan::sl_WlanGetNetworkList(uint8_t Index, uint8_t Count, Sl_WlanNetworkEntry_t *pEntries)
+{
+    int16_t retVal = 0;
+    _SlWlanGetNetworkListMsg_u Msg;
+    _SlCmdExt_t    CmdExt;
+
+    if (Count == 0) {
+        return SL_EZEROLEN;
+    }
+    CmdExt.TxPayloadLen = 0;
+    CmdExt.RxPayloadLen = sizeof(Sl_WlanNetworkEntry_t)*(Count);
+    CmdExt.pTxPayload = NULL;
+    CmdExt.pRxPayload = (uint8_t *)pEntries;
+
+    Msg.Cmd.index = Index;
+    Msg.Cmd.count = Count;
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlWlanGetNetworkListCtrl, &Msg, &CmdExt));
+    retVal = Msg.Rsp.status;
+
+    return (int16_t)retVal;
+}
+#endif
+
+/*******************************************************************************/
+/*             sl_WlanRxStatStart                                              */
+/*******************************************************************************/
+#if _SL_INCLUDE_FUNC(sl_WlanRxStatStart)
+int16_t cc3100_wlan::sl_WlanRxStatStart(void)
+{
+    return _driver._SlDrvBasicCmd(SL_OPCODE_WLAN_STARTRXSTATCOMMAND);
+}
+#endif
+
+#if _SL_INCLUDE_FUNC(sl_WlanRxStatStop)
+int16_t cc3100_wlan::sl_WlanRxStatStop(void)
+{
+    return _driver._SlDrvBasicCmd(SL_OPCODE_WLAN_STOPRXSTATCOMMAND);
+}
+#endif
+
+#if _SL_INCLUDE_FUNC(sl_WlanRxStatGet)
+int16_t cc3100_wlan::sl_WlanRxStatGet(SlGetRxStatResponse_t *pRxStat,uint32_t Flags)
+{
+    _SlCmdCtrl_t            CmdCtrl = {SL_OPCODE_WLAN_GETRXSTATCOMMAND, 0, sizeof(SlGetRxStatResponse_t)};
+    memset(pRxStat,0,sizeof(SlGetRxStatResponse_t));
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&CmdCtrl, pRxStat, NULL));
+
+    return 0;
+}
+#endif
+
+
+
+/******************************************************************************/
+/*   sl_WlanSmartConfigStop                                                   */
+/******************************************************************************/
+#if _SL_INCLUDE_FUNC(sl_WlanSmartConfigStop)
+int16_t cc3100_wlan::sl_WlanSmartConfigStop(void)
+{
+    return _driver._SlDrvBasicCmd(SL_OPCODE_WLAN_SMART_CONFIG_STOP_COMMAND);
+}
+#endif
+
+
+/******************************************************************************/
+/*   sl_WlanSmartConfigStart                                                  */
+/******************************************************************************/
+
+
+typedef struct {
+    _WlanSmartConfigStartCommand_t	Args;
+    int8_t                            Strings[3 * MAX_SMART_CONFIG_KEY]; /* public key + groupId1 key + groupId2 key */
+} _SlSmartConfigStart_t;
+
+typedef union {
+    _SlSmartConfigStart_t	    Cmd;
+    _BasicResponse_t	        Rsp;
+} _SlSmartConfigStartMsg_u;
+
+const _SlCmdCtrl_t _SlSmartConfigStartCmdCtrl = {
+    SL_OPCODE_WLAN_SMART_CONFIG_START_COMMAND,
+    sizeof(_SlSmartConfigStart_t),
+    sizeof(_BasicResponse_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_WlanSmartConfigStart)
+int16_t cc3100_wlan::sl_WlanSmartConfigStart( const uint32_t    groupIdBitmask,
+        const uint8_t    cipher,
+        const uint8_t    publicKeyLen,
+        const uint8_t    group1KeyLen,
+        const uint8_t    group2KeyLen,
+        const uint8_t*    pPublicKey,
+        const uint8_t*    pGroup1Key,
+        const uint8_t*    pGroup2Key)
+{
+    _SlSmartConfigStartMsg_u      Msg;
+
+    Msg.Cmd.Args.groupIdBitmask = (uint8_t)groupIdBitmask;
+    Msg.Cmd.Args.cipher         = (uint8_t)cipher;
+    Msg.Cmd.Args.publicKeyLen   = (uint8_t)publicKeyLen;
+    Msg.Cmd.Args.group1KeyLen   = (uint8_t)group1KeyLen;
+    Msg.Cmd.Args.group2KeyLen   = (uint8_t)group2KeyLen;
+
+    /* copy keys (if exist) after command (one after another) */
+    memcpy(SMART_CONFIG_START_PUBLIC_KEY_STRING(&Msg), pPublicKey, publicKeyLen);
+    memcpy(SMART_CONFIG_START_GROUP1_KEY_STRING(&Msg), pGroup1Key, group1KeyLen);
+    memcpy(SMART_CONFIG_START_GROUP2_KEY_STRING(&Msg), pGroup2Key, group2KeyLen);
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlSmartConfigStartCmdCtrl , &Msg, NULL));
+
+    return (int16_t)Msg.Rsp.status;
+
+
+}
+#endif
+
+/*******************************************************************************/
+/*   sl_WlanSetMode  */
+/*******************************************************************************/
+typedef union {
+    _WlanSetMode_t		    Cmd;
+    _BasicResponse_t	    Rsp;
+} _SlwlanSetModeMsg_u;
+
+const _SlCmdCtrl_t _SlWlanSetModeCmdCtrl = {
+    SL_OPCODE_WLAN_SET_MODE,
+    sizeof(_WlanSetMode_t),
+    sizeof(_BasicResponse_t)
+};
+
+/* possible values are:
+WLAN_SET_STA_MODE   =   1
+WLAN_SET_AP_MODE    =   2
+WLAN_SET_P2P_MODE   =   3  */
+
+#if _SL_INCLUDE_FUNC(sl_WlanSetMode)
+int16_t cc3100_wlan::sl_WlanSetMode(const uint8_t mode)
+{
+    _SlwlanSetModeMsg_u      Msg;
+
+    Msg.Cmd.mode  = mode;
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlWlanSetModeCmdCtrl , &Msg, NULL));
+
+    return (int16_t)Msg.Rsp.status;
+
+}
+#endif
+
+/*******************************************************************************/
+/*   sl_WlanSet  */
+/* ******************************************************************************/
+typedef union {
+    _WlanCfgSetGet_t	    Cmd;
+    _BasicResponse_t	    Rsp;
+} _SlWlanCfgSetMsg_u;
+
+const _SlCmdCtrl_t _SlWlanCfgSetCmdCtrl = {
+    SL_OPCODE_WLAN_CFG_SET,
+    sizeof(_WlanCfgSetGet_t),
+    sizeof(_BasicResponse_t)
+};
+
+
+#if _SL_INCLUDE_FUNC(sl_WlanSet)
+int16_t cc3100_wlan::sl_WlanSet(uint16_t ConfigId ,uint16_t ConfigOpt,uint16_t ConfigLen, uint8_t *pValues)
+{
+    _SlWlanCfgSetMsg_u         Msg;
+    _SlCmdExt_t                CmdExt;
+
+    CmdExt.TxPayloadLen = (ConfigLen+3) & (~3);
+    CmdExt.RxPayloadLen = 0;
+    CmdExt.pTxPayload = (uint8_t *)pValues;
+    CmdExt.pRxPayload = NULL;
+
+
+    Msg.Cmd.ConfigId    = ConfigId;
+    Msg.Cmd.ConfigLen   = ConfigLen;
+    Msg.Cmd.ConfigOpt   = ConfigOpt;
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlWlanCfgSetCmdCtrl, &Msg, &CmdExt));
+
+    return (int16_t)Msg.Rsp.status;
+}
+#endif
+
+
+/******************************************************************************/
+/*  sl_WlanGet  */
+/******************************************************************************/
+typedef union {
+    _WlanCfgSetGet_t	    Cmd;
+    _WlanCfgSetGet_t	    Rsp;
+} _SlWlanCfgMsgGet_u;
+
+const _SlCmdCtrl_t _SlWlanCfgGetCmdCtrl = {
+    SL_OPCODE_WLAN_CFG_GET,
+    sizeof(_WlanCfgSetGet_t),
+    sizeof(_WlanCfgSetGet_t)
+};
+
+#if _SL_INCLUDE_FUNC(sl_WlanGet)
+int16_t cc3100_wlan::sl_WlanGet(uint16_t ConfigId, uint16_t *pConfigOpt,uint16_t *pConfigLen, uint8_t *pValues)
+{
+    _SlWlanCfgMsgGet_u        Msg;
+    _SlCmdExt_t               CmdExt;
+
+    if (*pConfigLen == 0) {
+        return SL_EZEROLEN;
+    }
+    CmdExt.TxPayloadLen = 0;
+    CmdExt.RxPayloadLen = *pConfigLen;
+    CmdExt.pTxPayload = NULL;
+    CmdExt.pRxPayload = (uint8_t *)pValues;
+    CmdExt.ActualRxPayloadLen = 0;
+
+    Msg.Cmd.ConfigId    = ConfigId;
+    if( pConfigOpt ) {
+        Msg.Cmd.ConfigOpt   = (uint16_t)*pConfigOpt;
+    }
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlWlanCfgGetCmdCtrl, &Msg, &CmdExt));
+
+    if( pConfigOpt ) {
+        *pConfigOpt = (uint8_t)Msg.Rsp.ConfigOpt;
+    }
+    if (CmdExt.RxPayloadLen < CmdExt.ActualRxPayloadLen) {
+        *pConfigLen = (uint8_t)CmdExt.RxPayloadLen;
+        return SL_ESMALLBUF;
+    } else {
+        *pConfigLen = (uint8_t)CmdExt.ActualRxPayloadLen;
+    }
+
+
+    return (int16_t)Msg.Rsp.Status;
+}
+#endif
+
+cc3100_wlan_rx_filters::cc3100_wlan_rx_filters(cc3100_driver &driver)
+    : _driver(driver)
+{
+
+}
+
+cc3100_wlan_rx_filters::~cc3100_wlan_rx_filters()
+{
+
+}
+
+/******************************************************************************/
+/*     RX filters message command response structures  */
+/******************************************************************************/
+
+/* Set command */
+typedef union {
+    _WlanRxFilterAddCommand_t	          Cmd;
+    _WlanRxFilterAddCommandReponse_t      Rsp;
+} _SlrxFilterAddMsg_u;
+
+const _SlCmdCtrl_t _SlRxFilterAddtCmdCtrl = {
+    SL_OPCODE_WLAN_WLANRXFILTERADDCOMMAND,
+    sizeof(_WlanRxFilterAddCommand_t),
+    sizeof(_WlanRxFilterAddCommandReponse_t)
+};
+
+
+/* Set command */
+typedef union _SlRxFilterSetMsg_u {
+    _WlanRxFilterSetCommand_t	            Cmd;
+    _WlanRxFilterSetCommandReponse_t        Rsp;
+} _SlRxFilterSetMsg_u;
+
+
+const _SlCmdCtrl_t _SlRxFilterSetCmdCtrl = {
+    SL_OPCODE_WLAN_WLANRXFILTERSETCOMMAND,
+    sizeof(_WlanRxFilterSetCommand_t),
+    sizeof(_WlanRxFilterSetCommandReponse_t)
+};
+
+/* Get command */
+typedef union _SlRxFilterGetMsg_u {
+    _WlanRxFilterGetCommand_t	            Cmd;
+    _WlanRxFilterGetCommandReponse_t        Rsp;
+} _SlRxFilterGetMsg_u;
+
+
+const _SlCmdCtrl_t _SlRxFilterGetCmdCtrl = {
+    SL_OPCODE_WLAN_WLANRXFILTERGETCOMMAND,
+    sizeof(_WlanRxFilterGetCommand_t),
+    sizeof(_WlanRxFilterGetCommandReponse_t)
+};
+
+
+/*******************************************************************************/
+/*     RX filters  */
+/*******************************************************************************/
+
+#if _SL_INCLUDE_FUNC(sl_WlanRxFilterAdd)
+SlrxFilterID_t cc3100_wlan_rx_filters::sl_WlanRxFilterAdd(	SlrxFilterRuleType_t RuleType,
+        SlrxFilterFlags_t 					FilterFlags,
+        const SlrxFilterRule_t* const 		Rule,
+        const SlrxFilterTrigger_t* const 	Trigger,
+        const SlrxFilterAction_t* const 	Action,
+        SlrxFilterID_t*                     pFilterId)
+{
+
+
+    _SlrxFilterAddMsg_u Msg;
+    Msg.Cmd.RuleType = RuleType;
+    /* filterId is zero */
+    Msg.Cmd.FilterId = 0;
+    Msg.Cmd.FilterFlags = FilterFlags;
+    memcpy( &(Msg.Cmd.Rule), Rule, sizeof(SlrxFilterRule_t) );
+    memcpy( &(Msg.Cmd.Trigger), Trigger, sizeof(SlrxFilterTrigger_t) );
+    memcpy( &(Msg.Cmd.Action), Action, sizeof(SlrxFilterAction_t) );
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlRxFilterAddtCmdCtrl, &Msg, NULL) );
+    *pFilterId = Msg.Rsp.FilterId;
+    return (int16_t)Msg.Rsp.Status;
+
+}
+#endif
+
+
+
+/*******************************************************************************/
+/*     RX filters    */
+/*******************************************************************************/
+#if _SL_INCLUDE_FUNC(sl_WlanRxFilterSet)
+int16_t cc3100_wlan_rx_filters::sl_WlanRxFilterSet(const SLrxFilterOperation_t RxFilterOperation,
+        const uint8_t*  const pInputBuffer,
+        uint16_t InputbufferLength)
+{
+    _SlRxFilterSetMsg_u   Msg;
+    _SlCmdExt_t           CmdExt;
+
+    CmdExt.TxPayloadLen = InputbufferLength;
+    CmdExt.pTxPayload   = (uint8_t *)pInputBuffer;
+    CmdExt.RxPayloadLen = 0;
+    CmdExt.pRxPayload   = (uint8_t *)NULL;
+
+    Msg.Cmd.RxFilterOperation = RxFilterOperation;
+    Msg.Cmd.InputBufferLength = InputbufferLength;
+
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlRxFilterSetCmdCtrl, &Msg, &CmdExt) );
+
+
+    return (int16_t)Msg.Rsp.Status;
+}
+#endif
+
+/******************************************************************************/
+/*     RX filters  */
+/******************************************************************************/
+#if _SL_INCLUDE_FUNC(sl_WlanRxFilterGet)
+int16_t cc3100_wlan_rx_filters::sl_WlanRxFilterGet(const SLrxFilterOperation_t RxFilterOperation,
+        uint8_t*  pOutputBuffer,
+        uint16_t OutputbufferLength)
+{
+    _SlRxFilterGetMsg_u   Msg;
+    _SlCmdExt_t           CmdExt;
+
+    if (OutputbufferLength == 0) {
+        return SL_EZEROLEN;
+    }
+    CmdExt.TxPayloadLen = 0;
+    CmdExt.pTxPayload   = NULL;
+    CmdExt.RxPayloadLen = OutputbufferLength;
+    CmdExt.pRxPayload   = (uint8_t *)pOutputBuffer;
+    CmdExt.ActualRxPayloadLen = 0;
+
+    Msg.Cmd.RxFilterOperation = RxFilterOperation;
+    Msg.Cmd.OutputBufferLength = OutputbufferLength;
+
+
+    VERIFY_RET_OK(_driver._SlDrvCmdOp((_SlCmdCtrl_t *)&_SlRxFilterGetCmdCtrl, &Msg, &CmdExt) );
+
+    if (CmdExt.RxPayloadLen < CmdExt.ActualRxPayloadLen) {
+        return SL_ESMALLBUF;
+    }
+
+    return (int16_t)Msg.Rsp.Status;
+}
+#endif
+
+}//namespace mbed_cc3100
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_wlan.h	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,1317 @@
+/*
+ * wlan.h - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+#ifndef WLAN_H_
+#define    WLAN_H_
+
+/*****************************************************************************/
+/* Include files                                                             */
+/*****************************************************************************/
+#include "cc3100_simplelink.h"
+
+namespace mbed_cc3100 {
+
+/*****************************************************************************/
+/* Macro declarations                                                        */
+/*****************************************************************************/
+
+/*!
+
+    \addtogroup wlan
+    @{
+
+*/
+
+const uint8_t SL_BSSID_LENGTH                                                                             =    (6);
+const uint8_t MAXIMAL_SSID_LENGTH                                                                         =    (32);
+
+const uint8_t NUM_OF_RATE_INDEXES                                                                         =    (20);
+const uint8_t SIZE_OF_RSSI_HISTOGRAM                                                                      =    (6);
+
+/* WLAN Disconnect Reason Codes */
+const uint8_t  SL_DISCONNECT_RESERVED_0                                                                   =    (0);
+const uint8_t  SL_DISCONNECT_UNSPECIFIED_REASON                                                           =    (1);
+const uint8_t  SL_PREVIOUS_AUTHENTICATION_NO_LONGER_VALID                                                 =    (2);
+const uint8_t  SL_DEAUTHENTICATED_BECAUSE_SENDING_STATION_IS_LEAVING                                      =    (3);
+const uint8_t  SL_DISASSOCIATED_DUE_TO_INACTIVITY                                                         =    (4);
+const uint8_t  SL_DISASSOCIATED_BECAUSE_AP_IS_UNABLE_TO_HANDLE_ALL_CURRENTLY_ASSOCIATED_STATIONS          =    (5);
+const uint8_t  SL_CLASS_2_FRAME_RECEIVED_FROM_NONAUTHENTICATED_STATION                                    =    (6);
+const uint8_t  SL_CLASS_3_FRAME_RECEIVED_FROM_NONASSOCIATED_STATION                                       =    (7);
+const uint8_t  SL_DISASSOCIATED_BECAUSE_SENDING_STATION_IS_LEAVING_BSS                                    =    (8);
+const uint8_t  SL_STATION_REQUESTING_ASSOCIATION_IS_NOT_AUTHENTICATED_WITH_RESPONDING_STATION             =    (9);
+const uint8_t  SL_DISASSOCIATED_BECAUSE_THE_INFORMATION_IN_THE_POWER_CAPABILITY_ELEMENT_IS_UNACCEPTABLE   =    (10);
+const uint8_t  SL_DISASSOCIATED_BECAUSE_THE_INFORMATION_IN_THE_SUPPORTED_CHANNELS_ELEMENT_IS_UNACCEPTABLE =    (11);
+const uint8_t  SL_DISCONNECT_RESERVED_1                                                                   =    (12);
+const uint8_t  SL_INVALID_INFORMATION_ELEMENT                                                             =    (13);
+const uint8_t  SL_MESSAGE_INTEGRITY_CODE_MIC_FAILURE                                                      =    (14);
+const uint8_t  SL_FOUR_WAY_HANDSHAKE_TIMEOUT                                                              =    (15);
+const uint8_t  SL_GROUP_KEY_HANDSHAKE_TIMEOUT                                                             =    (16);
+const uint8_t  SL_RE_ASSOCIATION_REQUEST_PROBE_RESPONSE_BEACON_FRAME                                      =    (17);
+const uint8_t  SL_INVALID_GROUP_CIPHER                                                                    =    (18);
+const uint8_t  SL_INVALID_PAIRWISE_CIPHER                                                                 =    (19);
+const uint8_t  SL_INVALID_AKMP                                                                            =    (20);
+const uint8_t  SL_UNSUPPORTED_RSN_INFORMATION_ELEMENT_VERSION                                             =    (21);
+const uint8_t  SL_INVALID_RSN_INFORMATION_ELEMENT_CAPABILITIES                                            =    (22);
+const uint8_t  SL_IEEE_802_1X_AUTHENTICATION_FAILED                                                       =    (23);
+const uint8_t  SL_CIPHER_SUITE_REJECTED_BECAUSE_OF_THE_SECURITY_POLICY                                    =    (24);
+const uint8_t  SL_DISCONNECT_RESERVED_2                                                                   =    (25);
+const uint8_t  SL_DISCONNECT_RESERVED_3                                                                   =    (26);
+const uint8_t  SL_DISCONNECT_RESERVED_4                                                                   =    (27);
+const uint8_t  SL_DISCONNECT_RESERVED_5                                                                   =    (28);
+const uint8_t  SL_DISCONNECT_RESERVED_6                                                                   =    (29);
+const uint8_t  SL_DISCONNECT_RESERVED_7                                                                   =    (30);
+const uint8_t  SL_DISCONNECT_RESERVED_8                                                                   =    (31);
+const uint8_t  SL_DISASSOCIATED_FOR_UNSPECIFIED_QOS_RELATED_REASON                                        =    (32);
+const uint8_t  SL_DISASSOCIATED_BECAUSE_QAP_LACKS_SUFFICIENT_BANDWIDTH_FOR_THIS_QSTA                      =    (33);
+const uint8_t  SL_DISASSOCIATED_BECAUSE_EXCESSIVE_NUMBER_OF_FRAMES_NEED_TO_BE_ACKNOWLEDGED                =    (34);
+const uint8_t  SL_DISASSOCIATED_BECAUSE_QSTA_IS_TRANSMITTING_OUTSIDE_THE_LIMITS_OF_ITS_TXOPS              =    (35);
+const uint8_t  SL_REQUESTED_FROM_PEER_QSTA_AS_THE_QSTA_IS_LEAVING_THE_QBSS                                =    (36);
+const uint8_t  SL_REQUESTED_FROM_PEER_QSTA_AS_IT_DOES_NO_WANT_TO_USE_THE_MECHANISM                        =    (37);
+const uint8_t  SL_REQUESTED_FROM_PEER_QSTA_AS_THE_QSTA_RECEIVED_FRAMES_SETUP_IS_REQUIRED                  =    (38);
+const uint8_t  SL_REQUESTED_FROM_PEER_QSTA_DUE_TO_TIMEOUT                                                 =    (39);
+const uint8_t  SL_PEER_QSTA_DOES_NOT_SUPPORT_THE_REQUESTED_CIPHER_SUITE                                   =    (40);
+const uint8_t  SL_CISCO_DEFINED                                                                           =    (98);
+const uint8_t  SL_CISCO_DEFINED_1                                                                         =    (99);
+const uint8_t  SL_ROAMING_TRIGGER_NONE                                                                    =    (100);
+const uint8_t  SL_ROAMING_TRIGGER_LOW_QUALITY_FOR_BG_SCAN                                                 =    (101);
+const uint8_t  SL_ROAMING_TRIGGER_HIGH_QUALITY_FOR_BG_SCAN                                                =    (102);
+const uint8_t  SL_ROAMING_TRIGGER_NORMAL_QUALITY_FOR_BG_SCAN                                              =    (103);
+const uint8_t  SL_ROAMING_TRIGGER_LOW_TX_RATE                                                             =    (104);
+const uint8_t  SL_ROAMING_TRIGGER_LOW_SNR                                                                 =    (105);
+const uint8_t  SL_ROAMING_TRIGGER_LOW_QUALITY                                                             =    (106);
+const uint8_t  SL_ROAMING_TRIGGER_TSPEC_REJECTED                                                          =    (107);
+const uint8_t  SL_ROAMING_TRIGGER_MAX_TX_RETRIES                                                          =    (108);
+const uint8_t  SL_ROAMING_TRIGGER_BSS_LOSS                                                                =    (109);
+const uint8_t  SL_ROAMING_TRIGGER_BSS_LOSS_DUE_TO_MAX_TX_RETRY                                            =    (110);
+const uint8_t  SL_ROAMING_TRIGGER_SWITCH_CHANNEL                                                          =    (111);
+const uint8_t  SL_ROAMING_TRIGGER_AP_DISCONNECT                                                           =    (112);
+const uint8_t  SL_ROAMING_TRIGGER_SECURITY_ATTACK                                                         =    (113);
+const uint8_t  SL_ROAMING_TRIGGER_MAX                                                                     =    (114);
+const uint8_t  SL_USER_INITIATED_DISCONNECTION                                                            =    (200);
+
+/* Wlan error codes */
+const int8_t  SL_ERROR_KEY_ERROR                                                                          =   (-3);
+const int8_t  SL_ERROR_INVALID_ROLE                                                                       =   (-71);
+const int8_t  SL_ERROR_INVALID_SECURITY_TYPE                                                              =   (-84);
+const int8_t  SL_ERROR_PASSPHRASE_TOO_LONG                                                                =   (-85);
+const int8_t  SL_ERROR_WPS_NO_PIN_OR_WRONG_PIN_LEN                                                        =   (-87);
+const int8_t  SL_ERROR_EAP_WRONG_METHOD                                                                   =   (-88);
+const int8_t  SL_ERROR_PASSWORD_ERROR                                                                     =   (-89);
+const int8_t  SL_ERROR_EAP_ANONYMOUS_LEN_ERROR                                                            =   (-90);
+const int8_t  SL_ERROR_SSID_LEN_ERROR                                                                     =   (-91);
+const int8_t  SL_ERROR_USER_ID_LEN_ERROR                                                                  =   (-92);
+const int8_t  SL_ERROR_ILLEGAL_WEP_KEY_INDEX                                                              =   (-95);
+const int8_t  SL_ERROR_INVALID_DWELL_TIME_VALUES                                                          =   (-96);
+const int8_t  SL_ERROR_INVALID_POLICY_TYPE                                                                =   (-97);
+const int8_t  SL_ERROR_PM_POLICY_INVALID_OPTION                                                           =   (-98);
+const int8_t  SL_ERROR_PM_POLICY_INVALID_PARAMS                                                           =   (-99);
+const int16_t  SL_ERROR_WIFI_ALREADY_DISCONNECTED                                                         =   (-129);
+const int8_t  SL_ERROR_WIFI_NOT_CONNECTED                                                                 =   (-59);
+
+
+
+const uint8_t SL_SEC_TYPE_OPEN                                                                            =    (0);
+const uint8_t SL_SEC_TYPE_WEP                                                                             =    (1);
+const uint8_t SL_SEC_TYPE_WPA                                                                             =    (2); /* deprecated */
+const uint8_t SL_SEC_TYPE_WPA_WPA2                                                                        =    (2);
+const uint8_t SL_SEC_TYPE_WPS_PBC                                                                         =    (3);
+const uint8_t SL_SEC_TYPE_WPS_PIN                                                                         =    (4);
+const uint8_t SL_SEC_TYPE_WPA_ENT                                                                         =    (5);
+const uint8_t SL_SEC_TYPE_P2P_PBC                                                                         =    (6);
+const uint8_t SL_SEC_TYPE_P2P_PIN_KEYPAD                                                                  =    (7);
+const uint8_t SL_SEC_TYPE_P2P_PIN_DISPLAY                                                                 =    (8);
+const uint8_t SL_SEC_TYPE_P2P_PIN_AUTO                                                                    =    (9); /* NOT Supported yet */
+
+
+
+const uint8_t SL_SCAN_SEC_TYPE_OPEN                                                                        =   (0);
+const uint8_t SL_SCAN_SEC_TYPE_WEP                                                                         =   (1);
+const uint8_t SL_SCAN_SEC_TYPE_WPA                                                                         =   (2);
+const uint8_t SL_SCAN_SEC_TYPE_WPA2                                                                        =   (3);
+
+
+
+const uint8_t TLS                           =     (0x1);
+const uint8_t MSCHAP                        =     (0x0);
+const uint8_t PSK                           =     (0x2);
+const uint8_t TTLS                          =     (0x10);
+const uint8_t PEAP0                         =     (0x20);
+const uint8_t PEAP1                         =     (0x40);
+const uint8_t FAST                          =     (0x80);
+
+const uint8_t FAST_AUTH_PROVISIONING        =     (0x02);
+const uint8_t FAST_UNAUTH_PROVISIONING      =     (0x01);
+const uint8_t FAST_NO_PROVISIONING          =     (0x00);
+
+const uint8_t EAPMETHOD_PHASE2_SHIFT        =     (8);
+const uint8_t EAPMETHOD_PAIRWISE_CIPHER_SHIFT =   (19);
+const uint8_t EAPMETHOD_GROUP_CIPHER_SHIFT  =     (27);
+
+const uint8_t WPA_CIPHER_CCMP               =     (0x1);
+const uint8_t WPA_CIPHER_TKIP               =     (0x2);
+const uint8_t CC31XX_DEFAULT_CIPHER         =     (WPA_CIPHER_CCMP | WPA_CIPHER_TKIP);
+
+#define EAPMETHOD(phase1,phase2,pairwise_cipher,group_cipher) \
+((phase1) | \
+ ((phase2) << EAPMETHOD_PHASE2_SHIFT ) |\
+ ((uint32_t)(pairwise_cipher) << EAPMETHOD_PAIRWISE_CIPHER_SHIFT ) |\
+ ((uint32_t)(group_cipher) << EAPMETHOD_GROUP_CIPHER_SHIFT ))
+
+/*                                                            phase1  phase2                     pairwise_cipher         group_cipher         */
+#define SL_ENT_EAP_METHOD_TLS                       EAPMETHOD(TLS   , 0                        , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
+#define SL_ENT_EAP_METHOD_TTLS_TLS                  EAPMETHOD(TTLS  , TLS                      , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
+#define SL_ENT_EAP_METHOD_TTLS_MSCHAPv2             EAPMETHOD(TTLS  , MSCHAP                   , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
+#define SL_ENT_EAP_METHOD_TTLS_PSK                  EAPMETHOD(TTLS  , PSK                      , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
+#define SL_ENT_EAP_METHOD_PEAP0_TLS                 EAPMETHOD(PEAP0 , TLS                      , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
+#define SL_ENT_EAP_METHOD_PEAP0_MSCHAPv2            EAPMETHOD(PEAP0 , MSCHAP                   , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
+#define SL_ENT_EAP_METHOD_PEAP0_PSK                 EAPMETHOD(PEAP0 , PSK                      , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
+#define SL_ENT_EAP_METHOD_PEAP1_TLS                 EAPMETHOD(PEAP1 , TLS                      , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
+#define SL_ENT_EAP_METHOD_PEAP1_MSCHAPv2            EAPMETHOD(PEAP1 , MSCHAP                   , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
+#define SL_ENT_EAP_METHOD_PEAP1_PSK                 EAPMETHOD(PEAP1 , PSK                      , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
+#define SL_ENT_EAP_METHOD_FAST_AUTH_PROVISIONING    EAPMETHOD(FAST  , FAST_AUTH_PROVISIONING   , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
+#define SL_ENT_EAP_METHOD_FAST_UNAUTH_PROVISIONING  EAPMETHOD(FAST  , FAST_UNAUTH_PROVISIONING , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
+#define SL_ENT_EAP_METHOD_FAST_NO_PROVISIONING      EAPMETHOD(FAST  , FAST_NO_PROVISIONING     , CC31XX_DEFAULT_CIPHER , CC31XX_DEFAULT_CIPHER)
+
+const uint8_t SL_LONG_PREAMBLE                  =  (0);
+const uint8_t SL_SHORT_PREAMBLE                 =  (1);
+
+const uint8_t SL_RAW_RF_TX_PARAMS_CHANNEL_SHIFT =  (0);
+const uint8_t SL_RAW_RF_TX_PARAMS_RATE_SHIFT    =  (6);
+const uint8_t SL_RAW_RF_TX_PARAMS_POWER_SHIFT   =  (11);
+const uint8_t SL_RAW_RF_TX_PARAMS_PREAMBLE_SHIFT = (15);
+
+#define SL_RAW_RF_TX_PARAMS(chan,rate,power,preamble) \
+    ((chan << SL_RAW_RF_TX_PARAMS_CHANNEL_SHIFT) | \
+    (rate << SL_RAW_RF_TX_PARAMS_RATE_SHIFT) | \
+    (power << SL_RAW_RF_TX_PARAMS_POWER_SHIFT) | \
+    (preamble << SL_RAW_RF_TX_PARAMS_PREAMBLE_SHIFT))
+
+
+/* wlan config application IDs */
+const uint8_t SL_WLAN_CFG_AP_ID                  =  (0);
+const uint8_t SL_WLAN_CFG_GENERAL_PARAM_ID       =  (1);
+const uint8_t SL_WLAN_CFG_P2P_PARAM_ID           =  (2);
+
+/* wlan AP Config set/get options */
+const uint8_t WLAN_AP_OPT_SSID                   =  (0);
+const uint8_t WLAN_AP_OPT_CHANNEL                =  (3);
+const uint8_t WLAN_AP_OPT_HIDDEN_SSID            =  (4);
+const uint8_t WLAN_AP_OPT_SECURITY_TYPE          =  (6);
+const uint8_t WLAN_AP_OPT_PASSWORD               =  (7);
+const uint8_t WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE = (9);
+const uint8_t WLAN_GENERAL_PARAM_OPT_STA_TX_POWER = (10);
+const uint8_t WLAN_GENERAL_PARAM_OPT_AP_TX_POWER  = (11);
+
+const uint8_t WLAN_P2P_OPT_DEV_NAME              =  (12);
+const uint8_t WLAN_P2P_OPT_DEV_TYPE              =  (13);
+const uint8_t WLAN_P2P_OPT_CHANNEL_N_REGS        =  (14);
+const uint8_t WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT = (16);
+const uint8_t WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS  = (18);      /* change the scan channels and RSSI threshold using this configuration option */
+
+/* SmartConfig CIPHER options */
+const uint8_t SMART_CONFIG_CIPHER_SFLASH         =  (0);      /* password is not delivered by the application. The Simple Manager should */
+/* check if the keys are stored in the Flash.                              */
+const uint8_t SMART_CONFIG_CIPHER_AES            =  (1);      /* AES (other types are not supported)                                     */
+const uint8_t SMART_CONFIG_CIPHER_NONE           =  (0xFF);   /* do not check in the flash                                               */
+
+
+const uint8_t SL_POLICY_CONNECTION               =  (0x10);
+const uint8_t SL_POLICY_SCAN                     =  (0x20);
+const uint8_t SL_POLICY_PM                       =  (0x30);
+const uint8_t SL_POLICY_P2P                      =  (0x40);
+
+#define VAL_2_MASK(position,value)           ((1 & (value))<<(position))
+#define MASK_2_VAL(position,mask)            (((1 << position) & (mask)) >> (position))
+
+#define SL_CONNECTION_POLICY(Auto,Fast,Open,anyP2P,autoSmartConfig)                (VAL_2_MASK(0,Auto) | VAL_2_MASK(1,Fast) | VAL_2_MASK(2,Open) | VAL_2_MASK(3,anyP2P) | VAL_2_MASK(4,autoSmartConfig))
+#define SL_SCAN_POLICY_EN(policy)            (MASK_2_VAL(0,policy))
+#define SL_SCAN_POLICY(Enable)               (VAL_2_MASK(0,Enable))
+
+
+const uint8_t SL_NORMAL_POLICY                   = (0);
+const uint8_t SL_LOW_LATENCY_POLICY              = (1);
+const uint8_t SL_LOW_POWER_POLICY                = (2);
+const uint8_t SL_ALWAYS_ON_POLICY                = (3);
+const uint8_t SL_LONG_SLEEP_INTERVAL_POLICY      = (4);
+
+const uint8_t SL_P2P_ROLE_NEGOTIATE              = (3);
+const uint8_t SL_P2P_ROLE_GROUP_OWNER            = (15);
+const uint8_t SL_P2P_ROLE_CLIENT                 = (0);
+
+const uint8_t SL_P2P_NEG_INITIATOR_ACTIVE        = (0);
+const uint8_t SL_P2P_NEG_INITIATOR_PASSIVE       = (1);
+const uint8_t SL_P2P_NEG_INITIATOR_RAND_BACKOFF  = (2);
+
+#define POLICY_VAL_2_OPTIONS(position,mask,policy)    ((mask & policy) << position )
+
+#define SL_P2P_POLICY(p2pNegType,p2pNegInitiator)   (POLICY_VAL_2_OPTIONS(0,0xF,(p2pNegType > SL_P2P_ROLE_GROUP_OWNER ? SL_P2P_ROLE_GROUP_OWNER : p2pNegType)) | \
+                                                     POLICY_VAL_2_OPTIONS(4,0x1,(p2pNegType > SL_P2P_ROLE_GROUP_OWNER ? 1:0)) | \
+                                                     POLICY_VAL_2_OPTIONS(5,0x3, p2pNegInitiator))
+
+
+/* Info elements */
+
+const uint8_t INFO_ELEMENT_DEFAULT_ID            =  (0); /* 221 will be used */
+
+/* info element size is up to 252 bytes (+ 3 bytes of OUI). */
+const uint8_t INFO_ELEMENT_MAX_SIZE              =  (252);
+
+/* For AP - the total length of all info elements is 300 bytes (for example - 4 info elements of 75 bytes each) */
+const uint16_t INFO_ELEMENT_MAX_TOTAL_LENGTH_AP  =   (300);
+/* For P2P - the total length of all info elements is 150 bytes (for example - 4 info elements of 40 bytes each) */
+const uint8_t INFO_ELEMENT_MAX_TOTAL_LENGTH_P2P_GO (160);
+
+const uint8_t INFO_ELEMENT_AP_ROLE               =  (0);
+const uint8_t INFO_ELEMENT_P2P_GO_ROLE           =  (1);
+
+/* we support up to 4 info elements per Role. */
+const uint8_t MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED = (4);
+
+const uint8_t INFO_ELEMENT_DEFAULT_OUI_0         =  (0x08);
+const uint8_t INFO_ELEMENT_DEFAULT_OUI_1         =  (0x00);
+const uint8_t INFO_ELEMENT_DEFAULT_OUI_2         =  (0x28);
+
+const uint32_t INFO_ELEMENT_DEFAULT_OUI          =   (0x000000);  /* 08, 00, 28 will be used */
+
+
+/*****************************************************************************/
+/* Structure/Enum declarations                                               */
+/*****************************************************************************/
+
+typedef enum {
+    RATE_1M         = 1,
+    RATE_2M         = 2,
+    RATE_5_5M       = 3,
+    RATE_11M        = 4,
+    RATE_6M         = 6,
+    RATE_9M         = 7,
+    RATE_12M        = 8,
+    RATE_18M        = 9,
+    RATE_24M        = 10,
+    RATE_36M        = 11,
+    RATE_48M        = 12,
+    RATE_54M        = 13,
+    RATE_MCS_0      = 14,
+    RATE_MCS_1      = 15,
+    RATE_MCS_2      = 16,
+    RATE_MCS_3      = 17,
+    RATE_MCS_4      = 18,
+    RATE_MCS_5      = 19,
+    RATE_MCS_6      = 20,
+    RATE_MCS_7      = 21,
+    MAX_NUM_RATES   = 0xFF
+} SlRateIndex_e;
+
+typedef enum {
+    DEV_PW_DEFAULT=0,
+    DEV_PW_PIN_KEYPAD=1,
+    DEV_PW_PUSH_BUTTON=4,
+    DEV_PW_PIN_DISPLAY=5
+} sl_p2p_dev_password_method;
+
+
+typedef struct {
+    uint32_t    status;
+    uint32_t    ssid_len;
+    uint8_t     ssid[32];
+    uint32_t    private_token_len;
+    uint8_t     private_token[32];
+} slSmartConfigStartAsyncResponse_t;
+
+typedef struct {
+    uint16_t    status;
+    uint16_t    padding;
+} slSmartConfigStopAsyncResponse_t;
+
+typedef struct {
+    uint16_t    status;
+    uint16_t    padding;
+} slWlanConnFailureAsyncResponse_t;
+
+typedef struct {
+    uint8_t     connection_type;/* 0-STA,3-P2P_CL */
+    uint8_t     ssid_len;
+    uint8_t     ssid_name[32];
+    uint8_t     go_peer_device_name_len;
+    uint8_t     go_peer_device_name[32];
+    uint8_t     bssid[6];
+    uint8_t     reason_code;
+    uint8_t     padding[2];
+} slWlanConnectAsyncResponse_t;
+
+typedef struct {
+    uint8_t     go_peer_device_name[32];
+    uint8_t     mac[6];
+    uint8_t     go_peer_device_name_len;
+    uint8_t     wps_dev_password_id;
+    uint8_t     own_ssid[32];/* relevant for event sta-connected only */
+    uint8_t     own_ssid_len;/* relevant for event sta-connected only */
+    uint8_t     padding[3];
+} slPeerInfoAsyncResponse_t;
+
+
+typedef union {
+    slSmartConfigStartAsyncResponse_t        smartConfigStartResponse; /*SL_WLAN_SMART_CONFIG_COMPLETE_EVENT*/
+    slSmartConfigStopAsyncResponse_t         smartConfigStopResponse;  /*SL_WLAN_SMART_CONFIG_STOP_EVENT */
+    slPeerInfoAsyncResponse_t                APModeStaConnected;       /* SL_WLAN_STA_CONNECTED_EVENT - relevant only in AP mode - holds information regarding a new STA connection */
+    slPeerInfoAsyncResponse_t                APModestaDisconnected;    /* SL_WLAN_STA_DISCONNECTED_EVENT - relevant only in AP mode - holds information regarding a STA disconnection */
+    slWlanConnectAsyncResponse_t             STAandP2PModeWlanConnected;   /* SL_WLAN_CONNECT_EVENT - relevant only in STA and P2P mode - holds information regarding a new connection */
+    slWlanConnectAsyncResponse_t             STAandP2PModeDisconnected;   /* SL_WLAN_DISCONNECT_EVENT - relevant only in STA and P2P mode - holds information regarding a disconnection */
+    slPeerInfoAsyncResponse_t                P2PModeDevFound;             /* SL_WLAN_P2P_DEV_FOUND_EVENT - relevant only in P2P mode */
+    slPeerInfoAsyncResponse_t                P2PModeNegReqReceived;       /* SL_WLAN_P2P_NEG_REQ_RECEIVED_EVENT - relevant only in P2P mode */
+    slWlanConnFailureAsyncResponse_t         P2PModewlanConnectionFailure;   /* SL_WLAN_CONNECTION_FAILED_EVENT - relevant only in P2P mode */
+
+} SlWlanEventData_u;
+
+typedef struct {
+    uint32_t     Event;
+    SlWlanEventData_u        EventData;
+} SlWlanEvent_t;
+
+
+typedef struct {
+    uint32_t  ReceivedValidPacketsNumber;                     /* sum of the packets that been received OK (include filtered) */
+    uint32_t  ReceivedFcsErrorPacketsNumber;                  /* sum of the packets that been dropped due to FCS error */
+    uint32_t  ReceivedPlcpErrorPacketsNumber;                 /* sum of the packets that been dropped due to PLCP error */
+    int16_t  AvarageDataCtrlRssi;                            /* average RSSI for all valid data packets received */
+    int16_t  AvarageMgMntRssi;                               /* average RSSI for all valid management packets received */
+    uint16_t  RateHistogram[NUM_OF_RATE_INDEXES];             /* rate histogram for all valid packets received */
+    uint16_t  RssiHistogram[SIZE_OF_RSSI_HISTOGRAM];          /* RSSI histogram from -40 until -87 (all below and above\n RSSI will appear in the first and last cells */
+    uint32_t  StartTimeStamp;                                 /* the time stamp started collecting the statistics in uSec */
+    uint32_t  GetTimeStamp;                                   /* the time stamp called the get statistics command */
+} SlGetRxStatResponse_t;
+
+
+typedef struct {
+    uint8_t ssid[MAXIMAL_SSID_LENGTH];
+    uint8_t ssid_len;
+    uint8_t sec_type;
+    uint8_t bssid[SL_BSSID_LENGTH];
+    int8_t rssi;
+    int8_t reserved[3];
+} Sl_WlanNetworkEntry_t;
+
+
+typedef struct {
+    uint8_t   Type;
+    int8_t*  Key;
+    uint8_t   KeyLen;
+} SlSecParams_t;
+
+typedef struct {
+    int8_t*  User;
+    uint8_t   UserLen;
+    int8_t*  AnonUser;
+    uint8_t   AnonUserLen;
+    uint8_t   CertIndex;  /* not supported */
+    uint32_t  EapMethod;
+} SlSecParamsExt_t;
+
+typedef struct {
+    int8_t   User[32];
+    uint8_t   UserLen;
+    int8_t   AnonUser[32];
+    uint8_t   AnonUserLen;
+    uint8_t   CertIndex;  //not supported
+    uint32_t  EapMethod;
+} SlGetSecParamsExt_t;
+
+typedef enum {
+    ROLE_STA   =   0,
+    ROLE_AP    =   2,
+    ROLE_P2P     =   3,
+    ROLE_STA_ERR =  -1,         /* Failure to load MAC/PHY in STA role */
+    ROLE_AP_ERR  =  -ROLE_AP,   /* Failure to load MAC/PHY in AP role */
+    ROLE_P2P_ERR =  -ROLE_P2P   /* Failure to load MAC/PHY in P2P role */
+} SlWlanMode_t;
+
+typedef struct {
+    uint32_t   G_Channels_mask;
+    int32_t   rssiThershold;
+} slWlanScanParamCommand_t;
+
+
+typedef struct {
+    uint8_t   id;
+    uint8_t   oui[3];
+    uint16_t  length;
+    uint8_t   data[252];
+} sl_protocol_InfoElement_t;
+
+typedef struct {
+    uint8_t                       index;  /* 0 - MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED */
+    uint8_t                       role;   /* bit0: AP = 0, GO = 1                    */
+    sl_protocol_InfoElement_t   ie;
+} sl_protocol_WlanSetInfoElement_t;
+
+
+class cc3100_wlan_rx_filters;
+class cc3100_wlan
+{
+
+public:
+
+    cc3100_wlan(cc3100_driver &driver, cc3100_wlan_rx_filters  &wlan_rx_filters);
+
+    ~cc3100_wlan();
+
+
+    /*****************************************************************************/
+    /* Function prototypes                                                                       */
+    /*****************************************************************************/
+
+
+    /*!
+        \brief Connect to wlan network as a station
+
+        \param[in]      sec_type    security types options: \n
+                                    - SL_SEC_TYPE_OPEN
+                                    - SL_SEC_TYPE_WEP
+                                    - SL_SEC_TYPE_WPA_WPA2
+                                    - SL_SEC_TYPE_WPA_ENT
+                                    - SL_SEC_TYPE_WPS_PBC
+                                    - SL_SEC_TYPE_WPS_PIN
+
+        \param[in]      pName       up to 32 bytes in case of STA the name is the SSID of the Access Point
+        \param[in]      NameLen     name length
+        \param[in]      pMacAddr    6 bytes for MAC address
+        \param[in]      pSecParams  Security parameters (use NULL key for SL_SEC_TYPE_OPEN)
+        \param[in]      pSecExtParams  Enterprise parameters (set NULL in case Enterprise parameters is not in use)
+
+        \return         On success, zero is returned. On error, negative is returned
+                        In case error number (-71) is returned, it indicates a connection was activated while the device it running in AP role
+
+        \sa             sl_WlanDisconnect
+        \note           belongs to \ref ext_api
+        \warning        In this version only single enterprise mode could be used
+                        SL_SEC_TYPE_WPA is a deprecated definition, the new definition is SL_SEC_TYPE_WPA_WPA2
+    */
+#if _SL_INCLUDE_FUNC(sl_WlanConnect)
+    int16_t sl_WlanConnect(signed char*  pName, int16_t NameLen, uint8_t *pMacAddr, SlSecParams_t* pSecParams , SlSecParamsExt_t* pSecExtParams);
+#endif
+
+    /*!
+        \brief wlan disconnect
+
+        Disconnect connection
+
+        \return         0 disconnected done, other already disconnected
+
+        \sa             sl_WlanConnect
+        \note           belongs to \ref ext_api
+        \warning
+    */
+#if _SL_INCLUDE_FUNC(sl_WlanDisconnect)
+    int16_t sl_WlanDisconnect(void);
+#endif
+
+    /*!
+        \brief add profile
+
+        When auto start is enabled, the device connects to a
+        station from the profiles table. Up to 7 profiles are
+        supported. If several profiles configured the device chose
+        the highest priority profile, within each priority group,
+        device will chose profile based on security policy, signal
+        strength, etc parameters.
+
+
+        \param[in]      pName          up to 32 bytes in case of STA the name is the
+                                       SSID of the Access Point
+                                       in case of P2P the name is the remote device name
+        \param[in]      NameLen     name length
+        \param[in]      pMacAddr    6 bytes for MAC address
+        \param[in]      pSecParams     Security parameters - security type
+                                       (SL_SEC_TYPE_OPEN,SL_SEC_TYPE_WEP,SL_SEC_TYPE_WPA_WPA2,
+                                        SL_SEC_TYPE_P2P_PBC,SL_SEC_TYPE_P2P_PIN_KEYPAD,SL_SEC_TYPE_P2P_PIN_DISPLAY, SL_SEC_TYPE_WPA_ENT), key, and key length
+                                       in case of p2p security type pin the key refers to pin code
+        \param[in]      pSecExtParams  Enterprise parameters - identity, identity length,
+                                       Anonymous, Anonymous length, CertIndex (not supported,
+                                       certificates need to be placed in a specific file ID),
+                                       EapMethod.Use NULL in case Enterprise parameters is not in use
+
+        \param[in]      Priority    profile priority. Lowest priority: 0
+        \param[in]      Options     Not supported
+
+        \return         On success, profile stored index is returned. On error, negative value is returned
+
+        \sa             sl_WlanProfileGet , sl_WlanProfileDel
+        \note           belongs to \ref ext_api
+        \warning        Only one Enterprise profile is supported.
+                        Please Note that in case of adding an existing profile (compared by pName,pMACAddr and security type)
+                        the old profile will be deleted and the same index will be returned.
+                        SL_SEC_TYPE_WPA is a deprecated definition, the new definition is SL_SEC_TYPE_WPA_WPA2
+
+    */
+#if _SL_INCLUDE_FUNC(sl_WlanProfileAdd)
+    int16_t sl_WlanProfileAdd(int8_t*  pName, int16_t NameLen, uint8_t *pMacAddr, SlSecParams_t* pSecParams , SlSecParamsExt_t* pSecExtParams, uint32_t  Priority, uint32_t  Options);
+#endif
+
+    /*!
+        \brief get profile
+
+        read profile from the device
+
+        \param[in]      Index          profile stored index, if index does not exists
+                                       error is return
+        \param[out]     pName          up to 32 bytes, in case of sta mode the name of the Access Point
+                                       in case of p2p mode the name of the Remote Device
+        \param[out]     pNameLen       name length
+        \param[out]     pMacAddr       6 bytes for MAC address
+        \param[out]     pSecParams     security parameters - security type
+                                       (LAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or
+                                       WLAN_SEC_WPA2, WLAN_SEC_P2P_PBC, WLAN_SEC_P2P_PIN_KEYPAD or WLAN_SEC_P2P_DISPLAY), key and key length are not
+                                       in case of p2p security type pin the key refers to pin code
+                                       return due to security reasons.
+        \param[out]     pSecExtParams  enterprise parameters - identity, identity
+                                       length, Anonymous, Anonymous length
+                                       CertIndex (not supported), EapMethod.
+        \param[out]     Priority       profile priority
+
+        \return         On success, Profile security type is returned (0 or positive number). On error, -1 is
+                        returned
+
+        \sa             sl_WlanProfileAdd , sl_WlanProfileDel
+        \note           belongs to \ref ext_api
+        \warning
+    */
+#if _SL_INCLUDE_FUNC(sl_WlanProfileGet)
+    int16_t sl_WlanProfileGet(int16_t Index,int8_t*  pName, int16_t *pNameLen, uint8_t *pMacAddr, SlSecParams_t* pSecParams, SlGetSecParamsExt_t* pSecExtParams, uint32_t *pPriority);
+#endif
+
+    /*!
+        \brief Delete WLAN profile
+
+        Delete WLAN profile
+
+        \param[in]   index  number of profile to delete.Possible values are 0 to 6.
+                     Index value 255 will delete all saved profiles
+
+        \return  On success, zero is returned. On error, -1 is
+                   returned
+
+        \sa   sl_WlanProfileAdd , sl_WlanProfileGet
+        \note           belongs to \ref ext_api
+        \warning
+    */
+#if _SL_INCLUDE_FUNC(sl_WlanProfileDel)
+    int16_t sl_WlanProfileDel(int16_t Index);
+#endif
+
+    /*!
+        \brief Set policy values
+
+        \param[in]      Type      Type of policy to be modified. The Options are:\n
+                                  - SL_POLICY_CONNECTION
+                                  - SL_POLICY_SCAN
+                                  - SL_POLICY_PM
+                                  - SL_POLICY_P2P
+        \param[in]      Policy    The option value which depends on action type
+        \param[in]      pVal      An optional value pointer
+        \param[in]      ValLen    An optional value length, in bytes
+        \return         On success, zero is returned. On error, -1 is
+                        returned
+        \sa             sl_WlanPolicyGet
+        \note           belongs to \ref ext_api
+        \warning
+        \par
+        SL_POLICY_CONNECTION type defines three options available to connect the CC31xx device to the AP: \n
+
+        -  If Auto Connect is set, the CC31xx device tries to automatically reconnect to one of its stored profiles, each time the connection fails or the device is rebooted.\n
+           To set this option, use: \n
+           <b> sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(1,0,0,0,0),NULL,0) </b>
+        -  If Fast Connect is set, the CC31xx device tries to establish a fast connection to AP. \n
+           To set this option, use: \n
+           <b> sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(0,1,0,0,0),NULL,0) </b>
+        -  (relevant for P2P mode only) - If Any P2P is set,  CC31xx/CC32xx device tries to automatically connect to the first P2P device available, \n
+           supporting push button only. To set this option, use: \n
+           <b> sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(0,0,0,1,0),NULL,0) </b>
+        -  For auto smart config upon restart (any command from Host will end this state) use: \n
+           <b> sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(0,0,0,0,1),NULL,0) </b> \n
+        The options above could be combined to a single action, if more than one action is required. \n
+        \par
+        SL_POLICY_SCAN defines system scan time interval in case there is no connection. Default interval is 10 minutes. \n
+        After settings scan interval, an immediate scan is activated. The next scan will be based on the interval settings. \n
+                        -  For example, setting scan interval to 1 minute interval use: \n
+                           uint32_t intervalInSeconds = 60;    \n
+                           #define SL_SCAN_ENABLE  1       \n<b>
+                           sl_WlanPolicySet(SL_POLICY_SCAN,SL_SCAN_ENABLE, (uint8_t *)&intervalInSeconds,sizeof(intervalInSeconds)); </b>\n
+
+                        -  For example, disable scan:    \n
+                           #define SL_SCAN_DISABLE  0     \n<b>
+                           sl_WlanPolicySet(SL_POLICY_SCAN,SL_SCAN_DISABLE,0,0); </b>\n
+        \par
+        SL_POLICY_PM defines a power management policy for Station mode only:
+                        -  For setting normal power management (default) policy use: <b> sl_WlanPolicySet(SL_POLICY_PM , SL_NORMAL_POLICY, NULL,0) </b>
+                        -  For setting low latency power management policy use: <b> sl_WlanPolicySet(SL_POLICY_PM , SL_LOW_LATENCY_POLICY, NULL,0) </b>
+                        -  For setting low power management policy use: <b> sl_WlanPolicySet(SL_POLICY_PM , SL_LOW_POWER_POLICY, NULL,0) </b>
+                        -  For setting always on power management policy use: <b> sl_WlanPolicySet(SL_POLICY_PM , SL_ALWAYS_ON_POLICY, NULL,0) </b>
+                        -  For setting Long Sleep Interval policy use: \n
+                                uint16_t PolicyBuff[4] = {0,0,800,0}; // PolicyBuff[2] is max sleep time in mSec \n<b>
+                                sl_WlanPolicySet(SL_POLICY_PM , SL_LONG_SLEEP_INTERVAL_POLICY, (uint8_t*)PolicyBuff,sizeof(PolicyBuff));  </b>\n
+
+        SL_POLICY_P2P defines p2p negotiation policy parameters for P2P role:
+                        - To set intent negotiation value, set on of the following:
+                            SL_P2P_ROLE_NEGOTIATE   - intent 3
+                            SL_P2P_ROLE_GROUP_OWNER - intent 15
+                            SL_P2P_ROLE_CLIENT      - intent 0
+                        - To set negotiation initiator value (initiator policy of first negotiation action frame), set on of the following:
+                            SL_P2P_NEG_INITIATOR_ACTIVE
+                            SL_P2P_NEG_INITIATOR_PASSIVE
+                            SL_P2P_NEG_INITIATOR_RAND_BACKOFF
+                        For example: \n
+                        <b>sl_WlanPolicySet(SL_POLICY_P2P, SL_P2P_POLICY(SL_P2P_ROLE_NEGOTIATE,SL_P2P_NEG_INITIATOR_RAND_BACKOFF),NULL,0) </b>
+
+    */
+#if _SL_INCLUDE_FUNC(sl_WlanPolicySet)
+    int16_t sl_WlanPolicySet(uint8_t Type , const uint8_t Policy, uint8_t *pVal,uint8_t ValLen);
+#endif
+    /*!
+        \brief get policy values
+
+        \param[in]      Type     SL_POLICY_CONNECTION, SL_POLICY_SCAN, SL_POLICY_PM,SL_POLICY_P2P \n
+
+        \param[in]      Policy   argument may be set to any value \n
+
+        \param[out]     The returned values, depends on each policy type, will be stored in the allocated buffer pointed by pVal
+                        with a maximum buffer length set by the calling function and pointed to by argument *pValLen
+
+        \return         On success, zero is returned. On error, -1 is returned
+
+        \sa             sl_WlanPolicySet
+
+        \note           belongs to \ref ext_api
+
+        \warning        The value pointed by the argument *pValLen should be set to a value different from 0 and
+                        greater than the buffer length returned from the SL device. Otherwise, an error will be returned.
+
+    */
+#if _SL_INCLUDE_FUNC(sl_WlanPolicyGet)
+    int16_t sl_WlanPolicyGet(uint8_t Type , uint8_t Policy,uint8_t *pVal,uint8_t *pValLen);
+#endif
+    /*!
+        \brief Gets the WLAN scan operation results
+
+        Gets scan results , gets entry from scan result table
+
+        \param[in]   Index - Starting index identifier (range 0-19) for getting scan results
+        \param[in]   Count - How many entries to fetch. Max is (20-"Index").
+        \param[out]  pEntries - pointer to an allocated Sl_WlanNetworkEntry_t.
+                                the number of array items should match "Count"
+                                sec_type: SL_SCAN_SEC_TYPE_OPEN, SL_SCAN_SEC_TYPE_WEP, SL_SCAN_SEC_TYPE_WPA or SL_SCAN_SEC_TYPE_WPA2
+
+
+        \return  Number of valid networks list items
+
+        \sa
+        \note       belongs to \ref ext_api
+        \warning    This command do not initiate any active scanning action
+        \par        Example:
+        \code       An example of fetching max 10 results:
+
+                    Sl_WlanNetworkEntry_t netEntries[10];
+                    int16_t resultsCount = sl_WlanGetNetworkList(0,10,&netEntries[0]);
+                    for(i=0; i< resultsCount; i++)
+                    {
+                          printf("%s\n",netEntries[i].ssid);
+                    }
+        \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_WlanGetNetworkList)
+    int16_t sl_WlanGetNetworkList(uint8_t Index, uint8_t Count, Sl_WlanNetworkEntry_t *pEntries);
+#endif
+
+    /*!
+        \brief   Start collecting wlan RX statistics, for unlimited time.
+
+        \return  On success, zero is returned. On error, -1 is returned
+
+        \sa     sl_WlanRxStatStop      sl_WlanRxStatGet
+        \note   belongs to \ref ext_api
+        \warning  This API is deprecated and should be removed for next release
+        \par        Example:
+        \code       Getting wlan RX statistics:
+
+        void RxStatCollectTwice()
+        {
+            SlGetRxStatResponse_t rxStat;
+            int16_t rawSocket;
+            int8_t DataFrame[200];
+            struct SlTimeval_t timeval;
+            timeval.tv_sec =  0;             // Seconds
+            timeval.tv_usec = 20000;         // Microseconds. 10000 microseconds resolution
+
+            sl_WlanRxStatStart();  // set statistics mode
+
+            rawSocket = sl_Socket(SL_AF_RF, SL_SOCK_RAW, eChannel);
+            // set timeout - in case we have no activity for the specified channel
+            sl_SetSockOpt(rawSocket,SL_SOL_SOCKET,SL_SO_RCVTIMEO, &timeval, sizeof(timeval));    // Enable receive timeout
+            status = sl_Recv(rawSocket, DataFrame, sizeof(DataFrame), 0);
+
+            Sleep(1000); // sleep for 1 sec
+            sl_WlanRxStatGet(&rxStat,0); // statistics has been cleared upon read
+            Sleep(1000); // sleep for 1 sec
+            sl_WlanRxStatGet(&rxStat,0);
+
+        }
+        \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_WlanRxStatStart)
+    int16_t sl_WlanRxStatStart(void);
+#endif
+
+
+    /*!
+        \brief    Stop collecting wlan RX statistic, (if previous called sl_WlanRxStatStart)
+
+        \return   On success, zero is returned. On error, -1 is returned
+
+        \sa     sl_WlanRxStatStart      sl_WlanRxStatGet
+        \note           belongs to \ref ext_api
+        \warning  This API is deprecated and should be removed for next release
+    */
+#if _SL_INCLUDE_FUNC(sl_WlanRxStatStop)
+    int16_t sl_WlanRxStatStop(void);
+#endif
+
+
+    /*!
+        \brief Get wlan RX statistics. upon calling this command, the statistics counters will be cleared.
+
+        \param[in]  Flags should be 0  ( not applicable right now, will be added the future )
+        \param[in]  pRxStat a pointer to SlGetRxStatResponse_t filled with Rx statistics results
+        \return     On success, zero is returned. On error, -1 is returned
+
+        \sa   sl_WlanRxStatStart  sl_WlanRxStatStop
+        \note           belongs to \ref ext_api
+        \warning
+    */
+#if _SL_INCLUDE_FUNC(sl_WlanRxStatGet)
+    int16_t sl_WlanRxStatGet(SlGetRxStatResponse_t *pRxStat,uint32_t Flags);
+#endif
+
+
+    /*!
+        \brief Stop Smart Config procedure. Once Smart Config will be stopped,
+               Asynchronous event will be received - SL_OPCODE_WLAN_SMART_CONFIG_STOP_ASYNC_RESPONSE.
+
+        \param[in]  none
+        \param[out] none
+
+        \return     0 - if Stop Smart Config is about to be executed without errors.
+
+        \sa         sl_WlanSmartConfigStart
+        \note           belongs to \ref ext_api
+        \warning      This API is deprecated and should be removed for next release
+
+    */
+#if _SL_INCLUDE_FUNC(sl_WlanSmartConfigStop)
+    int16_t sl_WlanSmartConfigStop(void);
+#endif
+
+    /*!
+        \brief  Start Smart Config procedure
+        \par
+                The target of the procedure is to let the                      \n
+                device to gain the network parameters: SSID and Password (if network is secured)             \n
+                and to connect to it once located in the network range.                                      \n
+                An external application should be used on a device connected to any mobile network.          \n
+                The external application will transmit over the air the network parameters in secured manner.\n
+                The Password may be decrypted using a Key.                                                   \n
+                The decryption method may be decided in the command or embedded in the Flash.                \n
+                The procedure can be activated for 1-3 group ID in the range of BIT_0 - BIT_15 where the default group ID id 0 (BIT_0) \n
+                Once Smart Config has ended successfully, Asynchronous event will be received -              \n
+                SL_OPCODE_WLAN_SMART_CONFIG_START_ASYNC_RESPONSE.                                            \n
+                The Event will hold the SSID and an extra field that might have been delivered as well (i.e. - device name)
+
+        \param[in]  groupIdBitmask - each bit represent a group ID that should be searched.
+                                     The Default group ID id BIT_0. 2 more group can be searched
+                                     in addition. The range is BIT_0 - BIT_15.
+        \param[in]  chiper - 0: check in flash, 1 - AES, 0xFF - do not check in flash
+        \param[in]  publicKeyLen - public key len (used for the default group ID - BIT_0)
+        \param[in]  group1KeyLen - group ID1 length
+        \param[in]  group2KeyLen - group ID2 length
+        \param[in]  publicKey    - public key (used for the default group ID - BIT_0)
+        \param[in]  group1Key    - group ID1 key
+        \param[in]  group2Key    - group ID2 key
+
+        \param[out] none
+
+        \return     0 - if Smart Config started successfully.
+
+        \sa         sl_WlanSmartConfigStop
+        \note           belongs to \ref ext_api
+        \warning
+        \par
+        \code       An example of starting smart Config on group ID's 0 + 1 + 2
+
+                    sl_WlanSmartConfigStart(7,      //group ID's (BIT_0 | BIT_1 | BIT_2)
+                                            1,      //decrypt key by AES method
+                                            16,     //decryption key length for group ID0
+                                            16,     //decryption key length for group ID1
+                                            16,     //decryption key length for group ID2
+                                            "Key0Key0Key0Key0", //decryption key for group ID0
+                                            "Key1Key1Key1Key1", //decryption key for group ID1
+                                            "Key2Key2Key2Key2"  //decryption key for group ID2
+                                            );
+        \endcode
+    */
+#if _SL_INCLUDE_FUNC(sl_WlanSmartConfigStart)
+    int16_t sl_WlanSmartConfigStart(const uint32_t    groupIdBitmask,
+                                    const uint8_t    cipher,
+                                    const uint8_t    publicKeyLen,
+                                    const uint8_t    group1KeyLen,
+                                    const uint8_t    group2KeyLen,
+                                    const uint8_t*    publicKey,
+                                    const uint8_t*    group1Key,
+                                    const uint8_t*    group2Key);
+#endif
+
+
+    /*!
+        \brief Wlan set mode
+
+        Setting WLAN mode
+
+        \param[in] mode - WLAN mode to start the CC31xx device. Possible options are:
+                        - ROLE_STA - for WLAN station mode
+                        - ROLE_AP  - for WLAN AP mode
+                        - ROLE_P2P  -for WLAN P2P mode
+        \return   0 - if mode was set correctly
+        \sa        sl_Start sl_Stop
+        \note           belongs to \ref ext_api
+        \warning   After setting the mode the system must be restarted for activating the new mode
+        \par       Example:
+        \code
+                    //Switch from any role to STA:
+                    sl_WlanSetMode(ROLE_STA);
+                    sl_Stop(0);
+                    sl_Start(NULL,NULL,NULL);
+        \endcode
+
+    */
+#if _SL_INCLUDE_FUNC(sl_WlanSetMode)
+    int16_t sl_WlanSetMode(const uint8_t mode);
+#endif
+
+
+    /*!
+        \brief     Internal function for setting WLAN configurations
+
+        \return    On success, zero is returned. On error one of the following error codes  returned:
+                   - CONF_ERROR                        (-1)
+                   - CONF_NVMEM_ACCESS_FAILED          (-2)
+                   - CONF_OLD_FILE_VERSION             (-3)
+                   - CONF_ERROR_NO_SUCH_COUNTRY_CODE   (-4)
+
+
+        \param[in] ConfigId -  configuration id
+                              - <b>SL_WLAN_CFG_AP_ID</b>
+                              - <b>SL_WLAN_CFG_GENERAL_PARAM_ID</b>
+                              - <b>SL_WLAN_CFG_P2P_PARAM_ID</b>
+
+        \param[in] ConfigOpt - configurations option
+                              - <b>SL_WLAN_CFG_AP_ID</b>
+                                  - <b>WLAN_AP_OPT_SSID</b> \n
+                                          Set SSID for AP mode. \n
+                                          This options takes <b>uint8_t</b> buffer as parameter
+                                  - <b>WLAN_AP_OPT_CHANNEL</b> \n
+                                          Set channel for AP mode. \n
+                                          The channel is dependant on the country code which is set. i.e. for "US" the channel should be in the range of [1-11] \n
+                                          This option takes <b>uint8_t</b> as a parameter
+                                  - <b>WLAN_AP_OPT_HIDDEN_SSID</b> \n
+                                          Set Hidden SSID Mode for AP mode.Hidden options: \n
+                                             0: disabled \n
+                                             1: Send empty (length=0) SSID in beacon and ignore probe request for broadcast SSID \n
+                                             2: Clear SSID (ASCII 0), but keep the original length (this may be required with some \n
+                                                clients that do not support empty SSID) and ignore probe requests for broadcast SSID \n
+                                          This option takes <b>uint8_t</b> as a parameter
+                                  - <b>WLAN_AP_OPT_SECURITY_TYPE</b> \n
+                                          Set Security type for AP mode. Security options are:
+                                          - Open security: SL_SEC_TYPE_OPEN
+                                          - WEP security:  SL_SEC_TYPE_WEP
+                                          - WPA security:  SL_SEC_TYPE_WPA_WPA2  \n
+                                          This option takes <b>uint8_t</b> pointer as a parameter
+                                  - <b>WLAN_AP_OPT_PASSWORD</b> \n
+                                          Set Password for for AP mode (for WEP or for WPA): \n
+                                          Password - for WPA: 8 - 63 characters \n
+                                          for WEP: 5 / 13 characters (ascii) \n
+                                          This options takes <b>uint8_t</b> buffer as parameter
+                              - <b>SL_WLAN_CFG_GENERAL_PARAM_ID</b>
+                                  - <b>WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE</b> \n
+                                          Set Country Code for AP mode \n
+                                          This options takes <b>uint8_t</b> 2 bytes buffer as parameter
+                                  - <b>WLAN_GENERAL_PARAM_OPT_STA_TX_POWER</b> \n
+                                          Set STA mode Tx power level \n
+                                          Number between 0-15, as dB offset from max power (0 will set MAX power) \n
+                                          This options takes <b>uint8_t</b> as parameter
+                                  - <b>WLAN_GENERAL_PARAM_OPT_AP_TX_POWER</b>
+                                          Set AP mode Tx power level \n
+                                          Number between 0-15, as dB offset from max power (0 will set MAX power) \n
+                                          This options takes <b>uint8_t</b> as parameter
+                                  - <b>WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT</b>
+                                          Set Info Element for AP mode. \n
+                                          The Application can set up to MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED info elements per Role (AP / P2P GO).  \n
+                                          To delete an info element use the relevant index and length = 0. \n
+                                          The Application can set up to MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED to the same role. \n
+                                          However, for AP - no more than INFO_ELEMENT_MAX_TOTAL_LENGTH_AP bytes can be stored for all info elements. \n
+                                          For P2P GO - no more than INFO_ELEMENT_MAX_TOTAL_LENGTH_P2P_GO bytes can be stored for all info elements.  \n
+                                          This option takes sl_protocol_WlanSetInfoElement_t as parameter
+                              - <b>SL_WLAN_CFG_P2P_PARAM_ID</b>
+                                  - <b>WLAN_P2P_OPT_DEV_TYPE</b> \n
+                                          Set P2P Device type.Maximum length of 17 characters. Device type is published under P2P I.E, \n
+                                          allows to make devices easier to recognize. \n
+                                          In case no device type is set, the default type is "1-0050F204-1"  \n
+                                          This options takes <b>uint8_t</b> buffer as parameter
+                                  - <b>WLAN_P2P_OPT_CHANNEL_N_REGS</b> \n
+                                         Set P2P Channels. \n
+                                         listen channel (either 1/6/11 for 2.4GHz) \n
+                                         listen regulatory class (81 for 2.4GHz)   \n
+                                         oper channel (either 1/6/11 for 2.4GHz)   \n
+                                         oper regulatory class (81 for 2.4GHz)     \n
+                                         listen channel and regulatory class will determine the device listen channel during p2p find listen phase \n
+                                         oper channel and regulatory class will determine the operating channel preferred by this device (in case it is group owner this will be the operating channel) \n
+                                         channels should be one of the social channels (1/6/11). In case no listen/oper channel selected, a random 1/6/11 will be selected.
+                                         This option takes pointer to <b>uint8_t[4]</b> as parameter
+
+        \param[in] ConfigLen - configurations len
+
+        \param[in] pValues -   configurations values
+
+        \sa
+        \note
+        \warning
+        \par   Examples:
+        \par
+              <b> WLAN_AP_OPT_SSID: </b>
+        \code
+                uint8_t  str[33];
+                memset(str, 0, 33);
+                memcpy(str, ssid, len);  // ssid string of 32 characters
+                sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SSID, strlen(ssid), str);
+        \endcode
+       \par
+              <b> WLAN_AP_OPT_CHANNEL: </b>
+        \code
+                uint8_t  val = channel;
+                sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_CHANNEL, 1, (uint8_t *)&val);
+        \endcode
+        \par
+              <b>  WLAN_AP_OPT_HIDDEN_SSID: </b>
+         \code
+                uint8_t  val = hidden;
+                sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_HIDDEN_SSID, 1, (uint8_t *)&val);
+        \endcode
+        \par
+              <b> WLAN_AP_OPT_SECURITY_TYPE: </b>
+         \code
+               uint8_t  val = SL_SEC_TYPE_WPA_WPA2;
+               sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SECURITY_TYPE, 1, (uint8_t *)&val);
+        \endcode
+        \par
+              <b>  WLAN_AP_OPT_PASSWORD: </b>
+         \code
+               uint8_t  str[65];
+               uint16_t  len = strlen(password);
+               memset(str, 0, 65);
+               memcpy(str, password, len);
+               sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_PASSWORD, len, (uint8_t *)str);
+        \endcode
+        \par
+             <b> WLAN_GENERAL_PARAM_OPT_STA_TX_POWER: </b>
+         \code
+             uint8_t  stapower=(uint8_t)power;
+             sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_STA_TX_POWER,1,(uint8_t *)&stapower);
+        \endcode
+       \par
+              <b> WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE: </b>
+        \code
+                uint8_t*  str = (uint8_t *) country;  // string of 2 characters. i.e. - "US"
+                sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE, 2, str);
+        \endcode
+       \par
+              <b> WLAN_GENERAL_PARAM_OPT_AP_TX_POWER: </b>
+        \code
+             uint8_t  appower=(uint8_t)power;
+             sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_AP_TX_POWER,1,(uint8_t *)&appower);
+        \endcode
+       \par
+              <b> WLAN_P2P_OPT_DEV_TYPE: </b>
+        \code
+             uint8_t   str[17];
+             uint16_t  len = strlen(device_type);
+             memset(str, 0, 17);
+             memcpy(str, device_type, len);
+             sl_WlanSet(SL_WLAN_CFG_P2P_PARAM_ID, WLAN_P2P_OPT_DEV_TYPE, len, str);
+        \endcode
+        \par
+              <b> WLAN_P2P_OPT_CHANNEL_N_REGS: </b>
+        \code
+            uint8_t  str[4];
+            str[0] = (uint8_t)11;           // listen channel
+            str[1] = (uint8_t)81;            // listen regulatory class
+            str[2] = (uint8_t)6;            // oper channel
+            str[3] = (uint8_t)81;            // oper regulatory class
+            sl_WlanSet(SL_WLAN_CFG_P2P_PARAM_ID, WLAN_P2P_OPT_CHANNEL_N_REGS, 4, str);
+        \endcode
+       \par
+              <b> WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT: </b>
+         \code
+            sl_protocol_WlanSetInfoElement_t    infoele;
+            infoele.index     = Index;                  // Index of the info element. range: 0 - MAX_PRIVATE_INFO_ELEMENTS_SUPPROTED
+            infoele.role      = Role;                   // INFO_ELEMENT_AP_ROLE (0) or INFO_ELEMENT_P2P_GO_ROLE (1)
+            infoele.ie.id     =  Id;                    // Info element ID. if INFO_ELEMENT_DEFAULT_ID (0) is set, ID will be set to 221.
+            // Organization unique ID. If all 3 bytes are zero - it will be replaced with 08,00,28.
+            infoele.ie.oui[0] =  Oui0;                  // Organization unique ID first Byte
+            infoele.ie.oui[1] =  Oui1;                  // Organization unique ID second Byte
+            infoele.ie.oui[2] =  Oui2;                  // Organization unique ID third Byte
+            infoele.ie.length = Len;                    // Length of the info element. must be smaller than 253 bytes
+            memset(infoele.ie.data, 0, INFO_ELEMENT_MAX_SIZE);
+            if ( Len <= INFO_ELEMENT_MAX_SIZE )
+            {
+                memcpy(infoele.ie.data, IE, Len);           // Info element. length of the info element is [0-252]
+                sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID,WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT,sizeof(sl_protocol_WlanSetInfoElement_t),(uint8_t* ) &infoele);
+            }
+            sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID,WLAN_GENERAL_PARAM_OPT_INFO_ELEMENT,sizeof(sl_protocol_WlanSetInfoElement_t),(uint8_t* ) &infoele);
+        \endcode
+
+    */
+#if _SL_INCLUDE_FUNC(sl_WlanSet)
+    int16_t sl_WlanSet(uint16_t ConfigId ,uint16_t ConfigOpt,uint16_t ConfigLen, uint8_t *pValues);
+#endif
+
+    /*!
+        \brief     Internal function for getting WLAN configurations
+
+        \return    On success, zero is returned. On error, -1 is
+                   returned
+
+        \param[in] ConfigId -  configuration id
+                              - <b>SL_WLAN_CFG_AP_ID</b>
+                              - <b>SL_WLAN_CFG_GENERAL_PARAM_ID</b>
+                              - <b>SL_WLAN_CFG_P2P_PARAM_ID</b>
+
+        \param[out] pConfigOpt - get configurations option
+                              - <b>SL_WLAN_CFG_AP_ID</b>
+                                  - <b>WLAN_AP_OPT_SSID</b> \n
+                                          Get SSID for AP mode. \n
+                                          Get up to 32 characters of SSID \n
+                                          This options takes <b>uint8_t</b> as parameter
+                                  - <b>WLAN_AP_OPT_CHANNEL</b> \n
+                                          Get channel for AP mode. \n
+                                          This option takes <b>uint8_t</b> as a parameter
+                                  - <b>WLAN_AP_OPT_HIDDEN_SSID</b> \n
+                                          Get Hidden SSID Mode for AP mode.Hidden options: \n
+                                             0: disabled \n
+                                             1: Send empty (length=0) SSID in beacon and ignore probe request for broadcast SSID \n
+                                             2: Clear SSID (ASCII 0), but keep the original length (this may be required with some \n
+                                                clients that do not support empty SSID) and ignore probe requests for broadcast SSID \n
+                                          This option takes <b>uint8_t</b> as a parameter
+                                  - <b>WLAN_AP_OPT_SECURITY_TYPE</b> \n
+                                          Get Security type for AP mode. Security options are:
+                                          - Open security: SL_SEC_TYPE_OPEN
+                                          - WEP security:  SL_SEC_TYPE_WEP
+                                          - WPA security:  SL_SEC_TYPE_WPA_WPA2  \n
+                                          This option takes <b>uint8_t</b> as a parameter
+                                  - <b>WLAN_AP_OPT_PASSWORD</b> \n
+                                          Get Password for for AP mode (for WEP or for WPA): \n
+                                          Returns password - string, fills up to 64 characters. \n
+                                          This options takes <b>uint8_t</b> buffer as parameter
+                              - <b>SL_WLAN_CFG_GENERAL_PARAM_ID</b>
+                                  - <b> WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS </b> \n
+                                          Get scan parameters.
+                                          This option uses slWlanScanParamCommand_t as parameter
+                                  - <b>WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE</b> \n
+                                          Get Country Code for AP mode \n
+                                          This options takes <b>uint8_t</b> buffer as parameter
+                                  - <b>WLAN_GENERAL_PARAM_OPT_STA_TX_POWER</b> \n
+                                          Get STA mode Tx power level \n
+                                          Number between 0-15, as dB offset from max power (0 indicates MAX power) \n
+                                          This options takes <b>uint8_t</b> as parameter
+                                  - <b>WLAN_GENERAL_PARAM_OPT_AP_TX_POWER</b>
+                                          Get AP mode Tx power level \n
+                                          Number between 0-15, as dB offset from max power (0 indicates MAX power) \n
+                                          This options takes <b>uint8_t</b> as parameter
+                              - <b>SL_WLAN_CFG_P2P_PARAM_ID</b>
+                                  - <b>WLAN_P2P_OPT_CHANNEL_N_REGS</b> \n
+                                         Get P2P Channels. \n
+                                         listen channel (either 1/6/11 for 2.4GHz) \n
+                                         listen regulatory class (81 for 2.4GHz)   \n
+                                         oper channel (either 1/6/11 for 2.4GHz)   \n
+                                         oper regulatory class (81 for 2.4GHz)     \n
+                                         listen channel and regulatory class will determine the device listen channel during p2p find listen phase \n
+                                         oper channel and regulatory class will determine the operating channel preferred by this device (in case it is group owner this will be the operating channel) \n
+                                         channels should be one of the social channels (1/6/11). In case no listen/oper channel selected, a random 1/6/11 will be selected. \n
+                                         This option takes pointer to <b>uint8_t[4]</b> as parameter
+
+        \param[out] pConfigLen - The length of the allocated memory as input, when the
+                                            function complete, the value of this parameter would be
+                                            the len that actually read from the device.
+                                            If the device return length that is longer from the input
+                                            value, the function will cut the end of the returned structure
+                                            and will return SL_ESMALLBUF.
+
+
+        \param[out] pValues - get configurations values
+
+        \sa   sl_WlanSet
+
+        \note
+
+        \warning
+
+        \par    Examples:
+        \par
+              <b> WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS: </b>
+        \code
+              slWlanScanParamCommand_t ScanParamConfig;
+              uint16_t Option = WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS;
+              uint16_t OptionLen = sizeof(slWlanScanParamCommand_t);
+              sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID ,&Option,&OptionLen,(uint8_t *)&ScanParamConfig);
+        \endcode
+        \par
+               <b> WLAN_GENERAL_PARAM_OPT_AP_TX_POWER: </b>
+        \code
+               int16_t TXPower = 0;
+               uint16_t Option = WLAN_GENERAL_PARAM_OPT_AP_TX_POWER;
+               uint16_t OptionLen = sizeof(int16_t);
+               sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID ,&Option,&OptionLen,(uint8_t *)&TXPower);
+        \endcode
+        \par
+               <b> WLAN_GENERAL_PARAM_OPT_STA_TX_POWER: </b>
+        \code
+               int16_t TXPower = 0;
+               uint16_t Option = WLAN_GENERAL_PARAM_OPT_STA_TX_POWER;
+               uint16_t OptionLen = sizeof(int16_t);
+
+               sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID ,&Option,&OptionLen,(uint8_t *)&TXPower);
+        \endcode
+        \par
+               <b> WLAN_P2P_OPT_DEV_TYPE: </b>
+        \code
+               int8_t device_type[18];
+               uint16_t len = 18;
+               uint16_t config_opt = WLAN_P2P_OPT_DEV_TYPE;
+               sl_WlanGet(SL_WLAN_CFG_P2P_PARAM_ID, &config_opt , &len, (uint8_t* )device_type);
+        \endcode
+        \par
+               <b> WLAN_AP_OPT_SSID: </b>
+        \code
+               int8_t ssid[32];
+               uint16_t len = 32;
+               uint16_t  config_opt = WLAN_AP_OPT_SSID;
+               sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt , &len, (uint8_t* )ssid);
+        \endcode
+        \par
+               <b> WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE: </b>
+        \code
+               int8_t country[3];
+               uint16_t len = 3;
+               uint16_t  config_opt = WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE;
+               sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID, &config_opt, &len, (uint8_t* )country);
+        \endcode
+        \par
+               <b> WLAN_AP_OPT_CHANNEL: </b>
+        \code
+               int8_t channel;
+               uint16_t len = 1;
+               uint16_t  config_opt = WLAN_AP_OPT_CHANNEL;
+               sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (uint8_t* )&channel);
+        \endcode
+        \par
+               <b> WLAN_AP_OPT_HIDDEN_SSID: </b>
+        \code
+              uint8_t hidden;
+              uint16_t len = 1;
+              uint16_t  config_opt = WLAN_AP_OPT_HIDDEN_SSID;
+              sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (uint8_t* )&hidden);
+        \endcode
+        \par
+               <b> WLAN_AP_OPT_SECURITY_TYPE: </b>
+        \code
+             uint8_t sec_type;
+             uint16_t len = 1;
+             uint16_t  config_opt = WLAN_AP_OPT_SECURITY_TYPE;
+             sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (uint8_t* )&sec_type);
+        \endcode
+        \par
+               <b> WLAN_AP_OPT_PASSWORD: </b>
+        \code
+             uint8_t password[64];
+             uint16_t len = 64;
+             memset(password,0,64);
+             uint16_t config_opt = WLAN_AP_OPT_PASSWORD;
+             sl_WlanGet(SL_WLAN_CFG_AP_ID, &config_opt, &len, (uint8_t* )password);
+
+        \endcode
+        \par
+               <b> WLAN_P2P_OPT_CHANNEL_N_REGS: </b>
+        \code
+           uint16_t listen_channel,listen_reg,oper_channel,oper_reg;
+           uint16_t len = 4;
+           uint16_t  config_opt = WLAN_P2P_OPT_CHANNEL_N_REGS;
+           uint8_t channel_n_regs[4];
+           sl_WlanGet(SL_WLAN_CFG_P2P_PARAM_ID, &config_opt, &len, (uint8_t* )channel_n_regs);
+           listen_channel = channel_n_regs[0];
+           listen_reg = channel_n_regs[1];
+           oper_channel = channel_n_regs[2];
+           oper_reg = channel_n_regs[3];
+        \endcode
+    */
+
+#if _SL_INCLUDE_FUNC(sl_WlanGet)
+    int16_t sl_WlanGet(uint16_t ConfigId, uint16_t *pConfigOpt,uint16_t *pConfigLen, uint8_t *pValues);
+#endif
+
+private:
+
+    cc3100_driver           &_driver;
+    cc3100_wlan_rx_filters  &_wlan_filters;
+
+    /*!
+
+     Close the Doxygen group.
+     @}
+
+     */
+
+};//class
+
+}//namespace mbed_cc3100
+
+#endif    /*  __WLAN_H__ */
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simplelink/cc3100_wlan_rx_filters.h	Tue Feb 10 12:09:29 2015 +0000
@@ -0,0 +1,1011 @@
+/*
+ * wlan_rx_filters.h - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+#ifndef RX_FILTERS_PREPROCESSOR_CLI_IF_H_
+#define RX_FILTERS_PREPROCESSOR_CLI_IF_H_
+
+
+/*****************************************************************************/
+/* Include files                                                             */
+/*****************************************************************************/
+#include "cc3100_simplelink.h"
+#include "cc3100_driver.h"
+
+/*****************************************************************************/
+/* Macro declarations                                                                        */
+/*****************************************************************************/
+
+/*!
+ * \def SL_RX_FILTER_MAX_FILTERS
+ *  The Max number of filters for 64 filters
+ */
+#define SL_RX_FILTER_MAX_FILTERS 64
+
+/*!
+ * \def SL_RX_FILTER_MAX_PRE_PREPARED_FILTERS_SETS
+ * The Max number of software filters
+ */
+#define SL_RX_FILTER_MAX_PRE_PREPARED_FILTERS_SETS      (32)
+/*!
+ * \def SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS
+ *
+ */
+#define SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS          (2)
+/*!
+ * \def SL_RX_FILTER_NUM_OF_FILTER_PAYLOAD_ARGS
+ *
+ */
+#define SL_RX_FILTER_NUM_OF_FILTER_PAYLOAD_ARGS         (2)
+/*!
+ * \def SL_RX_FILTER_NUM_OF_FILTER_PAYLOAD_ARGS
+ *
+ */
+#define SL_RX_FILTER_NUM_OF_COMBINATION_TYPE_ARGS       (2)
+/*!
+ * \def SL_RX_FILTER_LENGTH_OF_REGX_PATTERN_LENGTH
+ *
+ */
+#define SL_RX_FILTER_LENGTH_OF_REGX_PATTERN_LENGTH      (32)
+
+
+/*  List of possible error numbers */
+#define RXFL_OK                                                (0) /*  O.K */
+#define RXFL_OUTPUT_OR_INPUT_BUFFER_LENGTH_TOO_SMALL           (76) /* ! The output buffer length is smaller than required for that operation */
+#define RXFL_DEPENDENT_FILTER_SOFTWARE_FILTER_NOT_FIT          (75) /* Node filter can't be child of software filter and vice_versa */
+#define RXFL_DEPENDENCY_IS_NOT_PERSISTENT                      (74) /*  Dependency filter is not persistent */
+#define RXFL_SYSTEM_STATE_NOT_SUPPORTED_FOR_THIS_FILTER        (72) /*  System state is not supported */
+#define RXFL_TRIGGER_USE_REG5_TO_REG8                          (71) /*  Only counters 5 - 8 are allowed, for Tigger */
+#define RXFL_TRIGGER_USE_REG1_TO_REG4                          (70) /*  Only counters 1 - 4 are allowed, for trigger */
+#define RXFL_ACTION_USE_REG5_TO_REG8                           (69) /*  Only counters 5 - 8 are allowed, for action */
+#define RXFL_ACTION_USE_REG1_TO_REG4                           (68) /*  Only counters 1 - 4 are allowed, for action */
+#define RXFL_FIELD_SUPPORT_ONLY_EQUAL_AND_NOTEQUAL             (67) /*  Rule compare function Id is out of range */
+#define RXFL_WRONG_MULTICAST_BROADCAST_ADDRESS                 (66) /*  The address should be of type mutlicast or broadcast */
+#define RXFL_THE_FILTER_IS_NOT_OF_HEADER_TYPE                  (65) /*  The filter should be of header type */
+#define RXFL_WRONG_COMPARE_FUNC_FOR_BROADCAST_ADDRESS          (64) /*  The compare funcion is not suitable for broadcast address */
+#define RXFL_WRONG_MULTICAST_ADDRESS                           (63) /*  The address should be of muticast type */
+#define RXFL_DEPENDENT_FILTER_IS_NOT_PERSISTENT                (62) /*  The dependency filter is not persistent */
+#define RXFL_DEPENDENT_FILTER_IS_NOT_ENABLED                   (61) /*  The dependency filter is not enabled */
+#define RXFL_FILTER_HAS_CHILDS                                 (60) /*  The filter has childs and can't be removed */
+#define RXFL_CHILD_IS_ENABLED                                  (59) /*  Can't disable filter while the child is enabled */
+#define RXFL_DEPENDENCY_IS_DISABLED                            (58) /*  Can't enable filetr in case its depndency filter is disabled */
+#define RXFL_NUMBER_OF_CONNECTION_POINTS_EXCEEDED              (52) /*  Number of connection points exceeded */
+#define RXFL_DEPENDENT_FILTER_DEPENDENCY_ACTION_IS_DROP        (51) /*  The dependent filter has Drop action, thus the filter can't be created */
+#define RXFL_FILTER_DO_NOT_EXISTS                              (50) /*  The filter doesn't exists */
+#define RXFL_DEPEDENCY_NOT_ON_THE_SAME_LAYER                   (49) /*  The filter and its dependency must be on the same layer */
+#define RXFL_NUMBER_OF_ARGS_EXCEEDED                           (48) /*  Number of arguments excceded */
+#define RXFL_ACTION_NO_REG_NUMBER                              (47) /*  Action require counter number */
+#define RXFL_DEPENDENT_FILTER_LAYER_DO_NOT_FIT                 (46) /*  the filter and its dependency should be from the same layer */
+#define RXFL_DEPENDENT_FILTER_SYSTEM_STATE_DO_NOT_FIT          (45) /*  The filter and its dependency system state don't fit  */
+#define RXFL_DEPENDENT_FILTER_DO_NOT_EXIST_2                   (44) /*  The parent filter don't exist  */
+#define RXFL_DEPENDENT_FILTER_DO_NOT_EXIST_1                   (43) /*  The parent filter is null */
+#define RXFL_RULE_HEADER_ACTION_TYPE_NOT_SUPPORTED             (42) /*  The action type is not supported */
+#define RXFL_RULE_HEADER_TRIGGER_COMPARE_FUNC_OUT_OF_RANGE     (41) /*  The Trigger comparision function is out of range */
+#define RXFL_RULE_HEADER_TRIGGER_OUT_OF_RANGE                  (40) /*  The Trigger is out of range */
+#define RXFL_RULE_HEADER_COMPARE_FUNC_OUT_OF_RANGE             (39) /*  The rule compare function is out of range */
+#define RXFL_FRAME_TYPE_NOT_SUPPORTED                          (38) /*  ASCII frame type string is illegal */
+#define RXFL_RULE_FIELD_ID_NOT_SUPPORTED                       (37) /*  Rule field ID is out of range */
+#define RXFL_RULE_HEADER_FIELD_ID_ASCII_NOT_SUPPORTED          (36) /*  This ASCII field ID is not supported */
+#define RXFL_RULE_HEADER_NOT_SUPPORTED                         (35) /*  The header rule is not supported on current release */
+#define RXFL_RULE_HEADER_OUT_OF_RANGE                          (34) /*  The header rule is out of range */
+#define RXFL_RULE_HEADER_COMBINATION_OPERATOR_OUT_OF_RANGE     (33) /*  Combination function Id is out of ramge */
+#define RXFL_RULE_HEADER_FIELD_ID_OUT_OF_RANGE                 (32) /*  rule field Id is out of range */
+#define RXFL_UPDATE_NOT_SUPPORTED                              (31) /*  Update not supported */
+#define RXFL_NO_FILTERS_ARE_DEFINED                            (24) /*  No filters are defined in the system */
+#define RXFL_NUMBER_OF_FILTER_EXCEEDED                         (23) /*  Number of max filters excceded */
+
+
+/******************************************************************************/
+/* Type declarations                                                                         */
+/******************************************************************************/
+
+/*!
+
+
+ * \typedef SlrxFilterID_t
+ * Unique filter ID which is allocated by the system , negative number means error
+ */
+typedef  int8_t    SlrxFilterID_t;
+
+
+/*!
+ * \typedef SlrxFilterCompareMask_t
+ * The mask is used for the rule comparison function
+ */
+typedef uint8_t   SlrxFilterCompareMask_t;
+
+/*!
+ * \typedef SlrxFilterIdMask_t
+ *  Representation of filters Id as a bit field
+ *  The bit field is used to declare which filters are involved
+ *  in operation. Number of filter can be up to 128 filters. i.e. 128 bits are needed.
+ *  On the current release, up to 64 filters can be defined.
+ */
+typedef uint8_t   SlrxFilterIdMask_t[128/8];
+
+/*!
+ * \typedef SlrxFilterPrePreparedFilters_t
+ *  Describes the supported software filter sets,
+ */
+typedef uint8_t  SlrxFilterPrePreparedFilters_t;
+#define SL_ARP_AUTO_REPLY_PRE_PREPARED_FILTERS       (0)
+#define SL_MULTICASTSIPV4_DROP_PREPREPARED_FILTERS   (1)
+#define SL_MULTICASTSIPV6_DROP_PREPREPARED_FILTERS   (2)
+#define SL_MULTICASTSWIFI_DROP_PREPREPARED_FILTERS   (3)
+
+
+
+/*!
+ * \typedef SlrxFilterPrePreparedFiltersMask_t
+ *  Describes the supported software filter sets,
+ *  each bit represents different software filter set
+ *  The filter sets are defined at SlrxFilterPrePreparedFilters_t
+ */
+typedef uint8_t   SlrxFilterPrePreparedFiltersMask_t[SL_RX_FILTER_MAX_PRE_PREPARED_FILTERS_SETS/8];
+
+
+/*! \typedef SlrxFilterRegxPattern_t
+ * The struct contains the regular expression pattern which is used in case of payload rule.
+ * Not supported in the current release
+ */
+typedef struct SlrxFilterRegxPattern_t {
+    uint8_t x[SL_RX_FILTER_LENGTH_OF_REGX_PATTERN_LENGTH];
+} SlrxFilterRegxPattern_t;
+
+
+/*! \typedef SlrxFilterAsciiArg_t
+ * The buffer is used to provide container for ASCII argument, which may be used in case of HEADER rule.
+ * example for ASCII argument can be : IP = 256.0.67.1
+ */
+typedef uint8_t SlrxFilterAsciiArg_t;
+
+
+/*! \typedef SlrxFilterBinaryArg_t
+ * The buffer provides container for binary argument, which  may be used in case of HEADER rule
+ */
+typedef uint8_t   SlrxFilterBinaryArg_t ;
+
+
+/*! \typedef SlrxFilterActionArg_t
+ *  Provides container for the filter action argument.
+ *  for example: in case action is to send automatic response , the argument is the template to be used for the automatic response.
+ *
+ *
+ */
+typedef  uint8_t SlrxFilterActionArg_t ;
+
+
+
+/*! \typedef SlrxFilterOffset_t
+ * The offset relative to the packet payload start location.
+ * Not supported on current release
+ */
+typedef uint32_t   SlrxFilterOffset_t;
+
+
+
+/*! \typedef SlrxFilterRuleType_t
+ * Enumerates the different filter types.
+ * On the current release only HEADER and COMBINATION are supported.
+ */
+typedef uint8_t SlrxFilterRuleType_t;
+/* possible values for SlrxFilterRuleType_t */
+#define HEADER                    (0)
+#define COMBINATION               (1)
+#define EXACT_PATTERN             (2)
+#define LIKELIHOOD_PATTERN        (3)
+#define ALWAYS_TRUE               (4)
+#define NUM_OF_FILTER_TYPES       (5)
+
+
+/*! \typedef SlrxFilterFlags_t
+ * Bit field which sets the behaviour of the RX filter
+ *
+ */
+
+#define RX_FILTER_BINARY          (0x1)
+#define RX_FILTER_PERSISTENT      (0x8)
+#define RX_FILTER_ENABLE          (0x10)
+
+typedef union SlrxFilterFlags_t {
+
+    /* struct
+    { */
+    /*!
+     *  The filter argument can be set as binary argument or ASCII arguments.
+     *  When the bit is on the argument are binary.
+     */
+    /* uint8_t Binary: 1; */
+    /*!
+     *
+     */
+    /* uint8_t AutoSort : 1; */
+    /*!
+     *
+     */
+    /* uint8_t AutoFaultDetect : 1; */
+    /*!
+     *  When the bit is on it means the the node is enabled .
+    */
+    /* uint8_t Enabled : 1; */
+    /* uint8_t padding : 3; */
+    /*
+    };*/
+
+    uint8_t IntRepresentation;
+
+} SlrxFilterFlags_t;
+
+/*! \typedef SlrxFilterCompareFunction_t
+ * Used as comparison function for the header type arguments
+ *
+ */
+typedef uint8_t SlrxFilterCompareFunction_t;
+/* Possible values for SlrxFilterCompareFunction_t */
+#define COMPARE_FUNC_IN_BETWEEN                 (0)
+#define COMPARE_FUNC_EQUAL                      (1)
+#define COMPARE_FUNC_NOT_EQUAL_TO               (2)
+#define COMPARE_FUNC_NOT_IN_BETWEEN             (3)
+#define COMPARE_FUNC_NUM_OF_FILTER_COMPARE_FUNC (4)
+
+/*! \typedef SlrxFilterCompareFunction_t
+ * Used as comparison function for the header type arguments
+ *
+ */
+typedef uint8_t SlrxTriggerCompareFunction_t;
+/* Possible values for SlrxTriggerCompareFunction_t */
+#define TRIGGER_COMPARE_FUNC_EQUAL              (0)
+/*   arg1 == protocolVal ,not supported in current release */
+#define TRIGGER_COMPARE_FUNC_NOT_EQUAL_TO       (1)
+/*   arg1 == protocolVal */
+#define TRIGGER_COMPARE_FUNC_SMALLER_THAN       (2)
+/*   arg1 == protocolVal */
+#define TRIGGER_COMPARE_FUNC_BIGGER_THAN        (3)
+/* definition */
+#define TRIGGER_COMPARE_FUNC_NUM_OF_FILTER_COMPARE_FUNC (4)
+
+
+/*! \typedef SlrxFilterHdrField_t
+ * Provides list of possible header types which may be defined as part of the rule
+ *
+ */
+typedef uint8_t SlrxFilterHdrField_t;
+/* Possible values for SlrxFilterHdrField_t */
+#define NULL_FIELD_ID_TYPE           (0)
+/* 802.11 control\data\management */
+#define FRAME_TYPE_FIELD             (1)
+/*  802.11 beacon\probe\.. */
+#define FRAME_SUBTYPE_FIELD          (2)
+/*  802.11 bssid type */
+#define BSSID_FIELD                  (3)
+/* */
+#define MAC_SRC_ADDRESS_FIELD        (4)
+/* */
+#define MAC_DST_ADDRESS_FIELD        (5)
+/* */
+#define FRAME_LENGTH_FIELD           (6)
+/* */
+#define PROTOCOL_TYPE_FIELD          (7)
+/* */
+#define IP_VERSION_FIELD             (8)
+/* TCP / UDP */
+#define IP_PROTOCOL_FIELD            (9)
+/* */
+#define IPV4_SRC_ADRRESS_FIELD       (10)
+/* */
+#define IPV4_DST_ADDRESS_FIELD       (11)
+/* */
+#define IPV6_SRC_ADRRESS_FIELD       (12)
+/* */
+#define IPV6_DST_ADDRESS_FIELD       (13)
+/* */
+#define SRC_PORT_FIELD               (14)
+/* */
+#define DST_PORT_FIELD               (15)
+/* Definition */
+#define NUM_OF_FIELD_NAME_FIELD      (16)
+
+/*! \union SlrxFilterHeaderArg_t
+ * The structure holds the header ARGS which are used in case of HDR rule.
+ */
+/* -- 36 bytes */
+typedef union SlrxFilterHeaderArg_t {
+    /*----------------------------- Large size ---------------------------------*/
+    /*! buffer for binary arguments, number of argument may be up to SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS
+     * example : IPV6 16 bytes, 39 characters
+     * ipv6 Ascii address: 2001:0db8:3c4d:0015:0000:0000:abcd:ef12
+     */
+
+    SlrxFilterBinaryArg_t RxFilterDB16BytesRuleArgs[SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][16 ]; /*  Binary Values for comparition */
+    /*! buffer for ASCII arguments, number of argument may be up to SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS
+     * example : IPV6 16 bytes, 39 characters
+     * ipv6 Ascii address: 2001:0db8:3c4d:0015:0000:0000:abcd:ef12
+     * Ascii format for ipV6 is not supported
+     */
+    /*----------------------------- Medium size ---------------------------------*/
+    /*! buffer for binary arguments, number of argument may be up to SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS
+     * MAC address: 6 bytes, 17 chars
+     */
+    SlrxFilterBinaryArg_t RxFilterDB6BytesRuleArgs[SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][6]; /*  Binary Values for comparition */
+    /*!
+     * ! buffer for ASCII arguments, number of argument may be up to SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS
+     *  IP address: 4 bytes, 15 chars
+     *  2 bytes are added for padding
+     */
+    SlrxFilterAsciiArg_t RxFilterDB18BytesAsciiRuleArgs[SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][18]; /* Ascii Values for comparison */
+    /*----------------------------- Small size ---------------------------------*/
+    /*! buffer for binary arguments, number of argument may be up to SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS
+     *  IP address: 4 bytes, 15 chars
+     *  Port: 2 bytes, chars: 5 chars
+     */
+    SlrxFilterBinaryArg_t RxFilterDB4BytesRuleArgs[SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][4]; /*  Binary Values for comparison */
+    /*! buffer for ASCII arguments, number of argument may be up to SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS
+     * Port: 2 bytes, chars: 5 chars
+     */
+    SlrxFilterAsciiArg_t RxFilterDB5BytesRuleAsciiArgs[SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][5]; /* Ascii Values for comparison */
+    /*----------------------------- 1 byte size ---------------------------------*/
+    /*! buffer for binary arguments, number of argument may be up to SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS
+     */
+    SlrxFilterBinaryArg_t RxFilterDB1BytesRuleArgs[SL_RX_FILTER_NUM_OF_FILTER_HEADER_ARGS][1]; /*  Binary Values for comparison */
+} SlrxFilterHeaderArg_t;
+
+
+
+/*! \typedef SlrxFilterRuleHeaderArgsAndMask_t
+ * Structure which defines the Header Args and mask
+ */
+/* -- 52 bytes */
+typedef struct SlrxFilterRuleHeaderArgsAndMask_t {
+    /*! Argument for the comparison function */
+    /* -- 36 byte */
+    SlrxFilterHeaderArg_t RuleHeaderArgs;
+
+    /*! the mask is used in order to enable partial comparison,
+     *  Use the 0xFFFFFFFF in case you don't want to use mask
+     */
+    /* -- 16 bytes */
+    SlrxFilterCompareMask_t RuleHeaderArgsMask[16];
+
+} SlrxFilterRuleHeaderArgsAndMask_t;
+
+/*! \typedef SlrxFilterHeaderType_t
+ * Structure which defines the Header rule
+ * The header rule defines compare function on the protocol header
+ * For example destMacAddre is between ( 12:6::78:77,  12:6::78:90 )
+ *
+ */
+/* -- 56 byte */
+typedef struct SlrxFilterHeaderType_t {
+    /*! see :: SlrxFilterRuleHeaderArgsAndMask_t */
+    /* -- 52 bytes */
+    SlrxFilterRuleHeaderArgsAndMask_t RuleHeaderArgsAndMask;
+
+    /*! Packet HDR field which will be compared to the argument */
+    /* -- 1 byte */
+    SlrxFilterHdrField_t RuleHeaderfield;
+
+    /* -- 1 byte */
+    /*! type of the comparison function
+     * see :: SlrxFilterCompareFunction_t
+     */
+    SlrxFilterCompareFunction_t RuleCompareFunc;
+
+    /*! padding */
+    /* -- 2 bytes */
+    uint8_t RulePadding[2];
+
+} SlrxFilterHeaderType_t;
+
+/*! \typedef SlrxFilterPayloadType_t
+ *  Structure which defines payload rule.
+ *  Not supported on current release.
+ */
+/* -- 40 byte  */
+typedef struct SlrxFilterPayloadType_t {
+    /*! Not supported on current release */
+    /* -- 32 byte */
+    SlrxFilterRegxPattern_t RegxPattern;
+    /*! Not supported on current release */
+    /* -- 4 byte */
+    SlrxFilterOffset_t LowerOffset;
+    /*! Not supported on current release */
+    /* -- 4 byte */
+    SlrxFilterOffset_t UpperOffset;
+} SlrxFilterPayloadType_t;
+
+/*! \typedef SlrxFilterCombinationTypeOperator_t
+ * Enumerate the optional operators for the combination type
+ * filterID1 is located in  the first arg , filterId2 is the second arg,see ::SlrxFilterCombinationType_t.CombinationFilterId
+ */
+typedef uint8_t SlrxFilterCombinationTypeOperator_t;
+/* Possible values for SlrxFilterCombinationTypeOperator_t */
+/*! !filterID1 */
+#define COMBINED_FUNC_NOT     (0)
+/*! filterID1 && filterID2 */
+#define COMBINED_FUNC_AND     (1)
+/*! filterID1 && filterID2 */
+#define COMBINED_FUNC_OR      (2)
+
+/*! \typedef SlrxFilterCombinationType_t
+ * Defines the structure which define the combination type filter
+ * The combined filter enable to make operation on one or two filter,
+ * for example !filterId1 or and(filterId2,filterId3).
+ *
+ */
+/* -- 4  byte */
+typedef struct SlrxFilterCombinationType_t {
+    /* ! combination operator */
+    /*  -- 1 byte */
+    SlrxFilterCombinationTypeOperator_t CombinationTypeOperator;
+    /* ! filterID, may be one or two depends on the combination operator type */
+    /*  -- 2  byte */
+    SlrxFilterID_t CombinationFilterId[SL_RX_FILTER_NUM_OF_COMBINATION_TYPE_ARGS];
+    /* ! Padding */
+    /*  -- 1  byte */
+    uint8_t Padding;
+} SlrxFilterCombinationType_t;
+
+
+/*! \typedef SlrxFilterRule_t
+ * Rule structure composed of behavioral flags and the filter rule definitions
+ *
+ */
+/*  -- 56  byte */
+typedef union SlrxFilterRule_t {
+    /* ! Header type rule , see explanation on the ::SlrxFilterHeaderType_t structure */
+    /*  -- 56 byte */
+    SlrxFilterHeaderType_t HeaderType;
+    /* ! Payload rule, not supported in current release */
+    /*  -- 40 byte */
+    SlrxFilterPayloadType_t PayLoadHeaderType; /* future for exact pattern or like hood pattern */
+    /* ! Combined type rule , see explanation in ::SlrxFilterCombinationType_t structure */
+    /*  -- 4  byte */
+    SlrxFilterCombinationType_t CombinationType;
+} SlrxFilterRule_t;
+
+/*! \typedef SlrxFilterTriggerRoles_t
+ * Bit field which represents the roleId possible values
+ * In the current release only Station/AP roles are supported.
+ */
+#define RX_FILTER_ROLE_AP                            (1)
+#define RX_FILTER_ROLE_STA                           (2)
+#define RX_FILTER_ROLE_PROMISCUOUS                   (4)
+#define RX_FILTER_ROLE_NULL                          (0)
+
+typedef union SlrxFilterTriggerRoles_t {
+    /*     struct                                                            */
+    /*     {                                                                 */
+    /*         uint8_t RoleAP :1;                                      */
+    /*         uint8_t RoleStation :1;                                 */
+    /* The filter is activated only in Promiscuous mode          */
+    /*         uint8_t PromiscuousMode :1;                             */
+    /*         uint8_t RoleReserved :5;                                */
+    /*     };                                                                */
+    /* ! Bit fiels of the Filter role    */
+    uint8_t IntRepresentation;
+
+} SlrxFilterTriggerRoles_t;
+
+/*! \typedef SlrxFilterTriggerConnectionStates_t
+ * Bit field representing the possible values of the When section of the rule
+ *
+ */
+#define RX_FILTER_CONNECTION_STATE_STA_CONNECTED     (1)
+#define RX_FILTER_CONNECTION_STATE_STA_NOT_CONNECTED (2)
+#define RX_FILTER_CONNECTION_STATE_STA_HAS_IP        (4)
+#define RX_FILTER_CONNECTION_STATE_STA_HAS_NO_IP     (8)
+
+typedef union SlrxFilterTriggerConnectionStates_t {
+    /*     struct */
+    /*     {      */
+    /*         uint8_t RoleStationWiFiConnected :1;  */
+    /*         uint8_t RoleStationWiFiDisconneted:1; */
+    /*         uint8_t RoleStationWiFiHasIp:1;       */
+    /*         uint8_t RoleStationWiFiHasNoIp:1;     */
+    /*         uint8_t RoleStationWiFiSocketOpened:1; */
+    /*         uint8_t RoleStationWiFiSocketclosed:1; */
+    /*     }; */
+    /*  */
+    /* ! */
+    uint8_t IntRepresentation;
+
+} SlrxFilterTriggerConnectionStates_t;
+
+/*! \typedef SlrxFilterDBTriggerArg_t
+ * Provides container for entering the filter 'when' argument.
+ * The current release support 'When rules' which has no arguments.
+ * For example :
+ *  When connect to specific AP -- the AP bssid is the argument.
+ *
+ */
+typedef uint32_t  SlrxFilterDBTriggerArg_t;
+
+
+
+/*! \typedef  SlrxFilterCounterId_t
+ * the counter ID we have 4 counters
+ */
+typedef uint8_t SlrxFilterCounterId_t;
+/* Possible values for SlrxFilterCounterId_t */
+#define NO_TRIGGER                                  (0)
+#define RX_FILTER_COUNTER1                          (1)
+#define RX_FILTER_COUNTER2                          (2)
+#define RX_FILTER_COUNTER3                          (3)
+#define RX_FILTER_COUNTER4                          (4)
+#define RX_FILTER_COUNTER5                          (5)
+#define RX_FILTER_COUNTER6                          (6)
+#define RX_FILTER_COUNTER7                          (7)
+#define RX_FILTER_COUNTER8                          (8)
+#define MAX_RX_FILTER_COUNTER                       (9)
+
+
+
+/*! \typedef SlrxFilterActionArgs_t
+ * Possible value for filter action args
+ *
+ */
+
+typedef uint8_t  SlrxFilterActionArgs_t;
+/* Possible values for SlrxFilterActionArgs_t */
+#define ACTION_ARG_REG_1_4                          (0)
+/* ! Can be use as counter */
+#define ACTION_ARG_TEMPLATE                         (1)
+/* ! Can be use as counter */
+#define ACTION_ARG_EVENT                            (2)
+
+/* ! GPIO number */
+#define ACTION_ARG_GPIO                             (4)
+/*!
+ * \def SL_RX_FILTER_NUM_OF_BYTES_FOR_ACTIONS_ARGS
+ *
+ */
+#define SL_RX_FILTER_NUM_OF_BYTES_FOR_ACTIONS_ARGS  (5)
+
+
+
+
+/*! \typedef SlrxFilterTrigger_t
+ * The filter trigger, determine when the filter is triggered,
+ * The filter is triggered in the following condition :\n
+ * 1. The filter parent is triggered\n
+ * 2. The requested connection type exists, i.e. wlan_connect\n
+ * 3. The filter role is the same as the system role\n
+ *
+ */
+/*  --  12 byte */
+typedef struct SlrxFilterTrigger_t {
+    /*! The parent filter ID, this is the way to build filter tree. */
+    /*  NULL           value means  tree root.
+    */
+    /*  --  1 byte */
+    SlrxFilterID_t ParentFilterID;
+    /* ! See ::SlrxFilterCounterId_t explanation */
+    /*  -- 1 byte */
+    SlrxFilterCounterId_t Trigger;
+    /* ! See :: SlrxFilterTriggerConnectionStates_t */
+    /*  -- 1 byte */
+    SlrxFilterTriggerConnectionStates_t TriggerArgConnectionState;
+    /* ! See ::SlrxFilterTriggerRoles_t */
+    /*  -- 1 byte */
+    SlrxFilterTriggerRoles_t TriggerArgRoleStatus;
+    /* ! The Trigger arguments are in the same order as the Trigger bit field order. */
+    /*  --  4 byte */
+    SlrxFilterDBTriggerArg_t TriggerArg;
+    /** The compare function which will be operate for each bit that is turned on in the ::SlrxFilterTrigger_t.Trigger field,
+     * for example , in case the second bit in the Trigger function is on the second function in the list will be executed.
+     *
+    */
+    /*  --  1 byte */
+    SlrxTriggerCompareFunction_t TriggerCompareFunction;
+
+    /* ! padding */
+    /*  --  3 byte */
+    uint8_t Padding[3];
+} SlrxFilterTrigger_t;
+
+/*! \typedef SlrxFilterActionType_t
+ *  The actions are executed only if the filter is matched,\n
+ *  In case of false match the packet is transfered to the HOST. \n
+ *  The action is composed of bit field structure,
+ *  up to 2 actions can be defined per filter.
+ *
+ */
+#define RX_FILTER_ACTION_NULL               (0x0)
+#define RX_FILTER_ACTION_DROP               (0x1)
+#define RX_FILTER_ACTION_GPIO               (0x2)
+#define RX_FILTER_ACTION_ON_REG_INCREASE    (0x4)
+#define RX_FILTER_ACTION_ON_REG_DECREASE    (0x8)
+#define RX_FILTER_ACTION_ON_REG_RESET       (0x10)
+#define RX_FILTER_ACTION_SEND_TEMPLATE      (0x20) /* unsupported */
+#define RX_FILTER_ACTION_EVENT_TO_HOST      (0x40) /* unsupported */
+
+typedef union SlrxFilterActionType_t {
+    /*     struct */
+    /*     { */
+    /* ! No action to execute the packet is dropped,drop is always on leaf. */
+    /* ! If not dropped ,The packet is passed to the next filter or in case it is the last filter to the host */
+    /*         uint8_t ActionDrop : 1; */
+    /* ! Not Supported in the current release */
+    /*         uint8_t ActionGpio : 1; */
+    /*! action can increase counter registers.
+     *  1 = Increase
+     *  2 = decrease
+     *  3 = reset
+     */
+    /*         uint8_t ActionOnREGIncrease : 1; */
+    /*         uint8_t ActionOnREGDecrease : 1; */
+    /*         uint8_t ActionOnREGReset : 1;    */
+
+    /* ! Not Supported in the current release */
+    /*         uint8_t ActionSendTemplate : 1; */
+    /* ! Not Supported in the current release */
+    /*         uint8_t ActionEventToHost: 1;   */
+    /*         uint8_t padding: 1;             */
+    /*     }; */
+
+    uint8_t IntRepresentation;
+
+} SlrxFilterActionType_t;
+
+/*! \typedef SlrxFilterAction_t
+ * Several actions can be defined,\n
+ * The action is executed in case the filter rule is matched.
+ */
+/*  -- 8 byte   */
+typedef struct SlrxFilterAction_t {
+    /*  -- 1 byte */
+    /* ! Determine which actions are supported */
+    SlrxFilterActionType_t ActionType;
+    /* ! Buffer for the action arguments */
+    /**
+     * <b>location 0</b> - The counter to increase
+     *     In case the action is of type "increase" the arg will contain the counter number,
+     *     The counter number values are as in  ::SlrxFilterCounterId_t.\n
+     * <b>location 1</b> - The template arg.\n
+     * <b>location 2</b> - The event arg.\n
+     *
+     */
+    /*  -- 5 byte */
+    SlrxFilterActionArg_t ActionArg[SL_RX_FILTER_NUM_OF_BYTES_FOR_ACTIONS_ARGS];
+
+    /* ! Padding */
+    /* - 2 Bytes */
+    uint8_t Padding[2];
+
+} SlrxFilterAction_t;
+
+
+/*! \struct _WlanRxFilterOperationCommandBuff_t
+ *  The structure is used for the interface HOST NWP.\n
+ *  The supported operation : \n
+ *   ::ENABLE_DISABLE_RX_FILTER,\n
+ *   ::REMOVE_RX_FILTER,\n
+ *
+ */
+/*  20 bytes */
+typedef struct _WlanRxFilterOperationCommandBuff_t {
+    /*  -- 16 bytes */
+    SlrxFilterIdMask_t FilterIdMask;
+    /*  4 bytes */
+    uint8_t Padding[4];
+} _WlanRxFilterOperationCommandBuff_t;
+
+
+
+/* -- 56 bytes */
+typedef struct _WlanRxFilterUpdateArgsCommandBuff_t {
+    /*  -- 1 bytes */
+    uint8_t  FilterId;
+
+    /*  -- 1 bytes */
+    /* ! the args representation */
+    uint8_t BinaryRepresentation;
+
+    /*  -- 52 byte */
+    SlrxFilterRuleHeaderArgsAndMask_t FilterRuleHeaderArgsAndMask;
+
+    /* -- 2 bytes */
+    uint8_t Padding[2];
+} _WlanRxFilterUpdateArgsCommandBuff_t;
+
+
+/*! \typedef _WlanRxFilterRetrieveEnableStatusCommandResponseBuff_t
+ *  The structure is used for the interface HOST NWP.\n
+ *
+ */
+/* -- 16 bytes */
+typedef struct _WlanRxFilterRetrieveEnableStatusCommandResponseBuff_t {
+
+    /* ! the filter set bit map */
+    /*  -- 16 bytes             */
+    SlrxFilterIdMask_t FilterIdMask;
+
+} _WlanRxFilterRetrieveEnableStatusCommandResponseBuff_t;
+
+
+/*! \struct _WlanRxFilterPrePreparedFiltersCommandBuff_t
+ *  The function enables to perform operations on pre-prepared filters
+ *
+ */
+typedef struct _WlanRxFilterPrePreparedFiltersCommandBuff_t {
+    /* ! the filter set bit map */
+    /*  -- 4 bytes */
+    SlrxFilterPrePreparedFiltersMask_t  FilterPrePreparedFiltersMask;
+
+} _WlanRxFilterPrePreparedFiltersCommandBuff_t;
+
+
+/*! \typedef sl_protocol_WlanRxFilterPrePreparedFiltersCommandResponseBuff_t
+ *
+ */
+/*-- 4 bytes  */
+typedef struct _WlanRxFilterPrePreparedFiltersCommandResponseBuff_t {
+    /* -- 4 bytes */
+    /* ! the filter set bit map */
+    SlrxFilterPrePreparedFiltersMask_t  FilterPrePreparedFiltersMask;
+
+} _WlanRxFilterPrePreparedFiltersCommandResponseBuff_t;
+
+
+
+typedef uint8_t SLrxFilterOperation_t;
+#define SL_ENABLE_DISABLE_RX_FILTER                         (0)
+#define SL_REMOVE_RX_FILTER                                 (1)
+#define SL_STORE_RX_FILTERS                                 (2)
+#define SL_UPDATE_RX_FILTER_ARGS                            (3)
+#define SL_FILTER_RETRIEVE_ENABLE_STATE                     (4)
+#define SL_FILTER_PRE_PREPARED_RETRIEVE_CREATE_REMOVE_STATE (5)
+#define SL_FILTER_PRE_PREPARED_SET_CREATE_REMOVE_STATE      (6)
+
+
+/*  Bit manipulation for 8 bit */
+#define ISBITSET8(x,i) ((x[i>>3] & (0x80>>(i&7)))!=0) /* < Is bit set, 8 bit unsigned numbers = x , location = i */
+#define SETBIT8(x,i) x[i>>3]|=(0x80>>(i&7)); /* < Set bit,8 bit unsigned numbers = x , location = i */
+#define CLEARBIT8(x,i) x[i>>3]&=(0x80>>(i&7))^0xFF; /* < Clear bit,8 bit unsigned numbers = x , location = i */
+
+namespace mbed_cc3100 {
+
+/* ******************************************************************************/
+/*     RX filters - Start  */
+/* ******************************************************************************/
+/*  -- 80 bytes */
+typedef struct _WlanRxFilterAddCommand_t {
+    /*  -- 1 byte */
+    SlrxFilterRuleType_t RuleType;
+    /*  -- 1 byte */
+    SlrxFilterFlags_t FilterFlags;
+    /*  --  1 byte */
+    SlrxFilterID_t FilterId;
+    /*  --  1 byte */
+    uint8_t Padding;
+    /*  -- 56 byte */
+    SlrxFilterRule_t Rule;
+    /*  --  12 byte ( 3 padding ) */
+    SlrxFilterTrigger_t Trigger;
+    /*  --  8 byte */
+    SlrxFilterAction_t Action;
+} _WlanRxFilterAddCommand_t;
+
+
+
+/* -- 4 bytes */
+typedef struct l_WlanRxFilterAddCommandReponse_t {
+    /*  -- 1 byte */
+    SlrxFilterID_t FilterId;
+    /* -- 1 Byte */
+    uint8_t          Status;
+    /*  -- 2 byte */
+    uint8_t  Padding[2];
+
+} _WlanRxFilterAddCommandReponse_t;
+
+
+
+/*
+ * \struct _WlanRxFilterSetCommand_t
+ */
+typedef struct _WlanRxFilterSetCommand_t {
+    uint16_t InputBufferLength;
+    /* 1 byte */
+    SLrxFilterOperation_t RxFilterOperation;
+    uint8_t Padding[1];
+} _WlanRxFilterSetCommand_t;
+
+/**
+ * \struct _WlanRxFilterSetCommandReponse_t
+ */
+typedef struct _WlanRxFilterSetCommandReponse_t {
+    /* 1 byte */
+    uint8_t  Status;
+    /* 3 bytes  */
+    uint8_t Padding[3];
+
+} _WlanRxFilterSetCommandReponse_t;
+
+/**
+ * \struct _WlanRxFilterGetCommand_t
+ */
+typedef struct _WlanRxFilterGetCommand_t {
+    uint16_t OutputBufferLength;
+    /* 1 byte  */
+    SLrxFilterOperation_t RxFilterOperation;
+    uint8_t Padding[1];
+} _WlanRxFilterGetCommand_t;
+
+/**
+ * \struct _WlanRxFilterGetCommandReponse_t
+ */
+typedef struct _WlanRxFilterGetCommandReponse_t {
+    /* 1 byte  */
+    uint8_t  Status;
+    /* 1 bytes  */
+    uint8_t Padding;
+    /* 2 byte  */
+    uint16_t OutputBufferLength;
+
+} _WlanRxFilterGetCommandReponse_t;
+
+
+
+/* ******************************************************************************/
+/*     RX filters -- End  */
+/* ******************************************************************************/
+
+class cc3100_driver;
+
+class cc3100_wlan_rx_filters
+{
+
+public:
+
+    cc3100_wlan_rx_filters(cc3100_driver &driver);
+
+    ~cc3100_wlan_rx_filters();
+
+
+    /*********************************************************************************************/
+    /* Function prototypes                                                                       */
+    /*********************************************************************************************/
+
+    /*!
+
+        \addtogroup wlan
+        @{
+
+    */
+
+
+    /*!
+      \brief Adds new filter rule to the system
+
+      \param[in]    RuleType     The rule type
+      \param[in]    FilterFlags  Flags which set the type of header rule Args and sets the persistent flag
+      \param[in]    pRule        Determine the filter rule logic
+      \param[in]    pTrigger     Determine when the rule is triggered also sets rule parent.
+      \param[in]    pAction      Sets the action to be executed in case the match functions pass
+      \param[out]   pFilterId    The filterId which was created
+
+      \return       On success, zero is returned. Otherwise error code is returned
+     */
+#if _SL_INCLUDE_FUNC(sl_WlanRxFilterAdd)
+    SlrxFilterID_t sl_WlanRxFilterAdd(    SlrxFilterRuleType_t                 RuleType,
+                                          SlrxFilterFlags_t                     FilterFlags,
+                                          const SlrxFilterRule_t* const         Rule,
+                                          const SlrxFilterTrigger_t* const     Trigger,
+                                          const SlrxFilterAction_t* const     Action,
+                                          SlrxFilterID_t*                     pFilterId);
+
+#endif
+
+
+
+
+
+    /*!
+      \brief   Sets parameters to Rx filters
+
+     \param[in] RxFilterOperation
+     possible operations :
+        - SL_ENABLE_DISABLE_RX_FILTER - Enables\disables filter in a filter list
+        - SL_REMOVE_RX_FILTER - Removes filter from memory ( to remove from flash call SL_STORE_RX_FILTERS after this command)
+        - SL_STORE_RX_FILTERS - Save the filters for persistent
+        - SL_UPDATE_RX_FILTER_ARGS - Update the arguments of existing filter
+        - SL_FILTER_PRE_PREPARED_SET_CREATE_REMOVE_STATE - Change the default creation of the pre-prepared filters
+
+      \param[in] pInputBuffer options:
+       The buffer input is _WlanRxFilterOperationCommandBuff_t:
+         - SL_ENABLE_DISABLE_RX_FILTER
+        - SL_REMOVE_RX_FILTER
+        - SL_STORE_RX_FILTERS
+        The buffer input is _WlanRxFilterUpdateArgsCommandBuff_t:
+         - SL_UPDATE_RX_FILTER_ARGS
+       The buffer input is _WlanRxFilterPrePreparedFiltersCommandBuff_t:
+         - SL_FILTER_PRE_PREPARED_SET_CREATE_REMOVE_STATE
+
+      \param[in] InputbufferLength The length in byte of the input buffer
+
+      \return    On success, zero is returned. Otherwise error code is returned
+     */
+
+#if _SL_INCLUDE_FUNC(sl_WlanRxFilterSet)
+    int16_t sl_WlanRxFilterSet(  const SLrxFilterOperation_t RxFilterOperation,
+                                 const uint8_t*  const pInputBuffer,
+                                 uint16_t InputbufferLength);
+#endif
+
+    /*!
+      \brief    Gets parameters of Rx filters
+
+     \param[in] RxFilterOperation
+     possible operations :
+        - SL_FILTER_RETRIEVE_ENABLE_STATE - Retrieves the enable disable status
+        - SL_FILTER_PRE_PREPARED_RETRIEVE_CREATE_REMOVE_STATE - Retrieves the pre-prepared filters creation status
+
+     \param[in] pOutputBuffer
+       The buffer input is _WlanRxFilterRetrieveEnableStatusCommandResponseBuff_t:
+         - SL_FILTER_RETRIEVE_ENABLE_STATE
+       The buffer input is _WlanRxFilterPrePreparedFiltersCommandResponseBuff_t:
+         - SL_FILTER_PRE_PREPARED_RETRIEVE_CREATE_REMOVE_STATE
+
+      \param[in] OutputbufferLength   The length in byte of the output buffer
+
+       \return   On success, zero is returned. Otherwise error code is returned
+    */
+
+#if _SL_INCLUDE_FUNC(sl_WlanRxFilterGet)
+    int16_t sl_WlanRxFilterGet(const SLrxFilterOperation_t RxFilterOperation,
+                               uint8_t*  pOutputBuffer,
+                               uint16_t  OutputbufferLength);
+#endif
+
+private:
+
+    cc3100_driver           &_driver;
+
+
+    /*!
+
+     Close the Doxygen group.
+     @}
+
+     */
+};//class
+
+}//namespace mbed_cc3100
+
+#endif /* RX_FILTERS_PREPROCESSOR_CLI_IF_H_ */
+
+
+