ext: simplelink: dos2unix EOL conversion on wifi/porting files

Convert some files in the Linux SimpleLink SDK installation
which had DOS line endings.

Signed-off-by: Gil Pitney <gil.pitney@linaro.org>
diff --git a/ext/hal/ti/simplelink/source/ti/drivers/net/wifi/porting/cc_pal.c b/ext/hal/ti/simplelink/source/ti/drivers/net/wifi/porting/cc_pal.c
index e715cbd..89d97bc 100644
--- a/ext/hal/ti/simplelink/source/ti/drivers/net/wifi/porting/cc_pal.c
+++ b/ext/hal/ti/simplelink/source/ti/drivers/net/wifi/porting/cc_pal.c
@@ -1,484 +1,484 @@
-/*

- * cc_pal.c - CC32xx Host Driver Implementation

- *

- * Copyright (C) 2017 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.

- *

-*/

-/******************************************************************************

-* 	cc_pal.c

-*

-*   SimpleLink Wi-Fi abstraction file for CC3220

-******************************************************************************/

-

-/* Board includes */

-#include <ti/drivers/net/wifi/simplelink.h>

-#include <ti/drivers/net/wifi/porting/cc_pal.h>

-#include <ti/drivers/dpl/HwiP.h>

-#include <ti/drivers/SPI.h>

-

-#include <ti/devices/cc32xx/inc/hw_ints.h>

-#include <ti/devices/cc32xx/inc/hw_udma.h>

-#include <ti/devices/cc32xx/inc/hw_types.h>

-#include <ti/devices/cc32xx/inc/hw_memmap.h>

-#include <ti/devices/cc32xx/inc/hw_mcspi.h>

-#include <ti/devices/cc32xx/inc/hw_common_reg.h>

-#include <ti/devices/cc32xx/inc/hw_ocp_shared.h>

-#include <ti/devices/cc32xx/inc/hw_apps_rcm.h>

-#include <ti/devices/cc32xx/inc/hw_gprcm.h>

-#include <ti/devices/cc32xx/inc/hw_hib1p2.h>

-#include "ti/devices/cc32xx/driverlib/rom.h"

-#include "ti/devices/cc32xx/driverlib/rom_map.h"

-#include <ti/devices/cc32xx/driverlib/interrupt.h>

-#include <ti/devices/cc32xx/driverlib/prcm.h>

-#include <ti/devices/cc32xx/driverlib/timer.h>

-#include <ti/drivers/net/wifi/source/driver.h>

-

-/* NWP_SPARE_REG_5 - (OCP_SHARED_BASE + OCP_SHARED_O_SPARE_REG_5)

-	- Bits 31:02 - Reserved

-	- Bits 01	 - SLSTOP1 - NWP in Reset, Power Domain Down

-	- Bits 00    - Reserved

-*/

-#define NWP_SPARE_REG_5	                (OCP_SHARED_BASE + OCP_SHARED_O_SPARE_REG_5)

-#define NWP_SPARE_REG_5_SLSTOP          (0x00000002)

-

-/* ANA_DCDC_PARAMS0 - (HIB1P2_BASE + HIB1P2_O_ANA_DCDC_PARAMETERS0)

-	- Bits 31:28 - Reserved

-	- Bits 27    - Override PWM mode (==> PFM) 

-	- Bits 26:00 - Reserved

-*/

-#define ANA_DCDC_PARAMS0                (HIB1P2_BASE + HIB1P2_O_ANA_DCDC_PARAMETERS0)

-#define ANA_DCDC_PARAMS0_PWMOVERRIDE    (0x08000000)

-

-/* WAKENWP - (ARCM_BASE + APPS_RCM_O_APPS_TO_NWP_WAKE_REQUEST)

-	- Bits 31:01 - Reserved

-	- Bits 00    - Wake Request to NWP

-*/

-#define WAKENWP                         (ARCM_BASE + APPS_RCM_O_APPS_TO_NWP_WAKE_REQUEST)

-#define WAKENWP_WAKEREQ                 (APPS_RCM_APPS_TO_NWP_WAKE_REQUEST_APPS_TO_NWP_WAKEUP_REQUEST)

-

-/* NWP_PWR_STATE - (GPRCM_BASE + GPRCM_O_NWP_PWR_STATE)

-	- Bits 31:12 - Reserved

-	- Bits 11:08 - Active (0x3)

-	- Bits 07:00 - Reserved

-*/

-#define NWP_PWR_STATE                   (GPRCM_BASE + GPRCM_O_NWP_PWR_STATE)

-#define NWP_PWR_STATE_PWRMASK           (0x00000F00)

-#define NWP_PWR_STATE_PWRACTIVE         (0x00000300)

-

-/* NWP_LPDS_WAKEUPCFG - (GPRCM_BASE + GPRCM_O_NWP_LPDS_WAKEUP_CFG)

-	- Bits 31:08 - Reserved

-	- Bits 07:00 - WakeUp Config AppsToNwp Wake (0x20) - reset condition

-*/

-#define NWP_LPDS_WAKEUPCFG              (GPRCM_BASE + GPRCM_O_NWP_LPDS_WAKEUP_CFG)

-#define NWP_LPDS_WAKEUPCFG_APPS2NWP     (0x00000020)

-#define NWP_LPDS_WAKEUPCFG_TIMEOUT_MSEC (600)

-

-/* N2A_INT_MASK_SET -                   (COMMON_REG_BASE + COMMON_REG_O_NW_INT_MASK_SET)  */

-#define N2A_INT_MASK_SET                (COMMON_REG_BASE + COMMON_REG_O_NW_INT_MASK_SET)

-/* N2A_INT_MASK_CLR -                   (COMMON_REG_BASE + COMMON_REG_O_NW_INT_MASK_CLR)  */

-#define N2A_INT_MASK_CLR                (COMMON_REG_BASE + COMMON_REG_O_NW_INT_MASK_CLR)

-/* N2A_INT_ACK -                        (COMMON_REG_BASE + COMMON_REG_O_NW_INT_ACK)       */

-#define N2A_INT_ACK                     (COMMON_REG_BASE + COMMON_REG_O_NW_INT_ACK)

-#define NWP_N2A_INT_ACK_TIMEOUT_MSEC    (3000)

-

-/* A2N_INT_STS_CLR -                    (COMMON_REG_BASE + COMMON_REG_O_APPS_INT_STS_CLR)  */

-#define A2N_INT_STS_CLR                 (COMMON_REG_BASE + COMMON_REG_O_APPS_INT_STS_CLR)

-/* A2N_INT_TRIG -                       (COMMON_REG_BASE + COMMON_REG_O_APPS_INT_TRIG)     */

-#define A2N_INT_TRIG                    (COMMON_REG_BASE + COMMON_REG_O_APPS_INT_TRIG)

-/* A2N_INT_STS_RAW -                    (COMMON_REG_BASE + COMMON_REG_O_APPS_INT_STS_RAW)  */

-#define A2N_INT_STS_RAW                 (COMMON_REG_BASE + COMMON_REG_O_APPS_INT_STS_RAW)

-

-#define uSEC_DELAY(x)                   (ROM_UtilsDelayDirect(x*80/3))

-#define MAX_DMA_RECV_TRANSACTION_SIZE   (4096)

-#define SPI_RATE_20M                    (20000000)

-

-HwiP_Handle g_intHandle = 0;

-

-//****************************************************************************

-//                          LOCAL FUNCTIONS

-//****************************************************************************

-

-Fd_t spi_Open(char *ifName, unsigned long flags)

-{

-	void *lspi_hndl;

-	unsigned int lspi_index;

-	SPI_Params SPI_Config;

-	SPI_Params_init(&SPI_Config);

-

-	/* configure the SPI settings */

-	SPI_Config.transferMode = SPI_MODE_BLOCKING;

-	SPI_Config.mode = SPI_MASTER;

-	SPI_Config.bitRate = SPI_RATE_20M;

-	SPI_Config.dataSize = 32;

-	SPI_Config.frameFormat = SPI_POL0_PHA0;

-

-	/* index of the link SPI initialization configuration in the SPI_Config table */

-	lspi_index = 0;

-	lspi_hndl = SPI_open(lspi_index, &SPI_Config);

-	if(NULL == lspi_hndl)

-	{

-        return -1;

-	}

-	else

-	{

-        return (Fd_t)lspi_hndl;

-	}

-}

-

-

-int spi_Close(Fd_t fd)

-{

-	SPI_close((void *)fd);

-    return 0;

-}

-

-

-int spi_Read(Fd_t fd, unsigned char *pBuff, int len)

-{    

-    SPI_Transaction transact_details;

-    int read_size = 0;

-    

-    /* check if the link SPI has been initialized successfully */

-    if(fd < 0)

-    {

-        return -1;

-    }

-    

-	transact_details.txBuf = NULL;

-	transact_details.arg = NULL;

-	while(len > 0)

-	{

-		/* DMA can transfer upto a maximum of 1024 words in one go. So, if

-		   the data to be read is more than 1024 words, it will be done in

-		   parts */

-		/* length is received in bytes, should be specified in words for the

-		 * SPI driver.

-		 */

-		if(len > MAX_DMA_RECV_TRANSACTION_SIZE)

-		{

-			transact_details.count = (MAX_DMA_RECV_TRANSACTION_SIZE +3)>>2;

-			transact_details.rxBuf = (void*)(pBuff + read_size);

-			if(SPI_transfer((SPI_Handle)fd, &transact_details))

-			{

-				read_size += MAX_DMA_RECV_TRANSACTION_SIZE;

-				len = len - MAX_DMA_RECV_TRANSACTION_SIZE;

-			}

-			else

-			{

-				return -1;

-			}

-

-		}

-		else

-		{

-			transact_details.count = (len+3)>>2;

-			transact_details.rxBuf = (void*)(pBuff + read_size);

-			if(SPI_transfer((SPI_Handle)fd, &transact_details))

-			{

-				read_size += len;

-				len = 0;

-				return read_size;

-			}

-			else

-			{

-				 return -1;

-			}

-		}

-	}

-

-    return(read_size);

-}

-

-

-int spi_Write(Fd_t fd, unsigned char *pBuff, int len)

-{

-    SPI_Transaction transact_details;

-    int write_size = 0;

-    

-    /* check if the link SPI has been initialized successfully */

-    if(fd < 0)

-    {

-    	return -1;

-    }

-

-	transact_details.rxBuf = NULL;

-	transact_details.arg = NULL;

-	while(len > 0)

-	{

-		/* configure the transaction details.

-		 * length is received in bytes, should be specified in words for the SPI

-		 * driver.

-		 */

-		if(len > MAX_DMA_RECV_TRANSACTION_SIZE)

-		{

-			transact_details.count = (MAX_DMA_RECV_TRANSACTION_SIZE +3)>>2;

-			transact_details.txBuf = (void*)(pBuff + write_size);

-			if(SPI_transfer((SPI_Handle)fd, &transact_details))

-			{

-				write_size += MAX_DMA_RECV_TRANSACTION_SIZE;

-				len = len - MAX_DMA_RECV_TRANSACTION_SIZE;

-			}

-			else

-			{

-				return -1;

-			}

-		}

-		else

-		{

-			transact_details.count = (len+3)>>2;

-			transact_details.txBuf = (void*)(pBuff + write_size);

-			if(SPI_transfer((SPI_Handle)fd, &transact_details))

-			{

-				write_size += len;

-				len = 0;

-				return write_size;

-			}

-			else

-			{

-				 return -1;

-			}

-		}

-	}

-

-    return(write_size);

-}

-

-

-int NwpRegisterInterruptHandler(P_EVENT_HANDLER InterruptHdl , void* pValue)

-{

-

-	HwiP_Params nwp_iParams;

-

-	HwiP_Params_init(&nwp_iParams);

-

-	HwiP_clearInterrupt(INT_NWPIC);

-

-	if(!InterruptHdl)

-	{

-		HwiP_delete(g_intHandle);

-		return OS_OK;

-	}

-	else

-	{

-		nwp_iParams.priority = INT_PRIORITY_LVL_1 ;

-

-	}

-		g_intHandle = HwiP_create(INT_NWPIC , (HwiP_Fxn)(InterruptHdl) , &nwp_iParams);

-

-	if(!g_intHandle)

-	{

-		return -1;

-	}

-	else

-	{

-		return OS_OK ;

-	}

-}

-

-

-void NwpMaskInterrupt()

-{

-	(*(unsigned long *)N2A_INT_MASK_SET) = 0x1;

-}

-

-

-void NwpUnMaskInterrupt()

-{

-	(*(unsigned long *)N2A_INT_MASK_CLR) = 0x1;

-}

-

-

-void NwpPowerOn(void)

-{

-    /* bring the 1.32 eco out of reset */

-    HWREG(NWP_SPARE_REG_5) &= ~NWP_SPARE_REG_5_SLSTOP;

-

-    /* Clear host IRQ indication */

-    HWREG(N2A_INT_ACK) = 1;

-

-    /* NWP Wake-up */

-    HWREG(WAKENWP) = WAKENWP_WAKEREQ;

-

-    //UnMask Host Interrupt

-    NwpUnMaskInterrupt();

-}

-

-

-void NwpPowerOff(void)

-{

-

-    volatile unsigned long apps_int_sts_raw;

-    volatile unsigned long sl_stop_ind       = HWREG(NWP_SPARE_REG_5);

-    volatile unsigned long nwp_lpds_wake_cfg = HWREG(NWP_LPDS_WAKEUPCFG);

-    _SlTimeoutParams_t SlTimeoutInfo         = {0};

-

-    if((nwp_lpds_wake_cfg != NWP_LPDS_WAKEUPCFG_APPS2NWP) &&     /* Check for NWP POR condition - APPS2NWP is reset condition */

-                !(sl_stop_ind & NWP_SPARE_REG_5_SLSTOP))         /* Check if sl_stop was executed */

-    {

-    	HWREG(0xE000E104) = 0x200;               /* Enable the out of band interrupt, this is not a wake-up source*/

-    	HWREG(A2N_INT_TRIG) = 0x1;               /* Trigger out of band interrupt  */

-    	HWREG(WAKENWP) = WAKENWP_WAKEREQ;        /* Wake-up the NWP */

-

-	    _SlDrvStartMeasureTimeout(&SlTimeoutInfo, NWP_N2A_INT_ACK_TIMEOUT_MSEC);

-

-	   /* Wait for the A2N_INT_TRIG to be cleared by the NWP to indicate it's awake and ready for shutdown.

-		* poll until APPs->NWP interrupt is cleared or timeout :

-		* for service pack 3.1.99.1 or higher, this condition is fulfilled in less than 1 mSec.

-		* Otherwise, in some cases it may require up to 3000 mSec of waiting.  */

-

-    	apps_int_sts_raw = HWREG(A2N_INT_STS_RAW);

-    	while(!(apps_int_sts_raw & 0x1))

-    	{

-        	if(_SlDrvIsTimeoutExpired(&SlTimeoutInfo))

-        	{

-        		break;

-        	}

-    		apps_int_sts_raw = HWREG(A2N_INT_STS_RAW);

-    	}

-

-    	WAIT_NWP_SHUTDOWN_READY;

-   }

-

-   /* Clear Out of band interrupt, Acked by the NWP */

-   HWREG(A2N_INT_STS_CLR) = 0x1;

-

-   /* Mask Host Interrupt */

-   NwpMaskInterrupt();

-

-   /* Switch to PFM Mode */

-   HWREG(ANA_DCDC_PARAMS0) &= ~ANA_DCDC_PARAMS0_PWMOVERRIDE;

-

-   /* sl_stop ECO for PG1.32 devices */

-   HWREG(NWP_SPARE_REG_5) |= NWP_SPARE_REG_5_SLSTOP;

-

-   /* Wait for 20 uSec, which is the minimal time between on-off cycle */

-   uSEC_DELAY(20);

-}

-

-

-int Semaphore_create_handle(SemaphoreP_Handle* pSemHandle)

-{

-    SemaphoreP_Params params;

-

-    SemaphoreP_Params_init(&params);

-

-    params.mode = SemaphoreP_Mode_BINARY;

-

-#ifndef SL_PLATFORM_MULTI_THREADED

-    params.callback = tiDriverSpawnCallback;

-#endif    

-	(*(pSemHandle)) = SemaphoreP_create(1, &params);

-

-	if(!(*(pSemHandle)))

-	{

-		return SemaphoreP_FAILURE ;

-	}

-

-	return SemaphoreP_OK;

-}

-

-int SemaphoreP_delete_handle(SemaphoreP_Handle* pSemHandle)

-{

-    SemaphoreP_delete(*(pSemHandle));

-    return SemaphoreP_OK;

-}

-

-int SemaphoreP_post_handle(SemaphoreP_Handle* pSemHandle)

-{

-    SemaphoreP_post(*(pSemHandle));

-    return SemaphoreP_OK;

-}

-

-

-int Mutex_create_handle(MutexP_Handle* pMutexHandle)

-{

-    MutexP_Params params;

-

-    MutexP_Params_init(&params);

-#ifndef SL_PLATFORM_MULTI_THREADED

-    params.callback = tiDriverSpawnCallback;

-#endif    

-

-	(*(pMutexHandle)) = MutexP_create(&params);

-

-	if(!(*(pMutexHandle)))

-	{

-		return MutexP_FAILURE ;

-	}

-

-	return MutexP_OK;

-}

-

-int  MutexP_delete_handle(MutexP_Handle* pMutexHandle)

-{

-    MutexP_delete(*(pMutexHandle));

-    return(MutexP_OK);

-}

-

-int Mutex_unlock(MutexP_Handle pMutexHandle)

-{

-	MutexP_unlock(pMutexHandle, 0);

-	return(MutexP_OK);

-}

-

-

-int Mutex_lock(MutexP_Handle pMutexHandle)

-{

-	MutexP_lock(pMutexHandle);

-	return(MutexP_OK);

-}

-

-

-unsigned long TimerGetCurrentTimestamp()

-{

-    return (ClockP_getSystemTicks());

-}

-

-

-void NwpWaitForShutDownInd()

-{

-	volatile unsigned long nwp_wakup_ind = HWREG(NWP_LPDS_WAKEUPCFG);

-	_SlTimeoutParams_t SlTimeoutInfo = {0};

-

-	_SlDrvStartMeasureTimeout(&SlTimeoutInfo, NWP_LPDS_WAKEUPCFG_TIMEOUT_MSEC);

-

-    while(nwp_wakup_ind != NWP_LPDS_WAKEUPCFG_APPS2NWP)

-    {

-    	if(_SlDrvIsTimeoutExpired(&SlTimeoutInfo))

-    	{

-    		return;

-    	}

-    	nwp_wakup_ind = HWREG(NWP_LPDS_WAKEUPCFG);

-    }

-

-    return ;

-}

+/*
+ * cc_pal.c - CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2017 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.
+ *
+*/
+/******************************************************************************
+* 	cc_pal.c
+*
+*   SimpleLink Wi-Fi abstraction file for CC3220
+******************************************************************************/
+
+/* Board includes */
+#include <ti/drivers/net/wifi/simplelink.h>
+#include <ti/drivers/net/wifi/porting/cc_pal.h>
+#include <ti/drivers/dpl/HwiP.h>
+#include <ti/drivers/SPI.h>
+
+#include <ti/devices/cc32xx/inc/hw_ints.h>
+#include <ti/devices/cc32xx/inc/hw_udma.h>
+#include <ti/devices/cc32xx/inc/hw_types.h>
+#include <ti/devices/cc32xx/inc/hw_memmap.h>
+#include <ti/devices/cc32xx/inc/hw_mcspi.h>
+#include <ti/devices/cc32xx/inc/hw_common_reg.h>
+#include <ti/devices/cc32xx/inc/hw_ocp_shared.h>
+#include <ti/devices/cc32xx/inc/hw_apps_rcm.h>
+#include <ti/devices/cc32xx/inc/hw_gprcm.h>
+#include <ti/devices/cc32xx/inc/hw_hib1p2.h>
+#include "ti/devices/cc32xx/driverlib/rom.h"
+#include "ti/devices/cc32xx/driverlib/rom_map.h"
+#include <ti/devices/cc32xx/driverlib/interrupt.h>
+#include <ti/devices/cc32xx/driverlib/prcm.h>
+#include <ti/devices/cc32xx/driverlib/timer.h>
+#include <ti/drivers/net/wifi/source/driver.h>
+
+/* NWP_SPARE_REG_5 - (OCP_SHARED_BASE + OCP_SHARED_O_SPARE_REG_5)
+	- Bits 31:02 - Reserved
+	- Bits 01	 - SLSTOP1 - NWP in Reset, Power Domain Down
+	- Bits 00    - Reserved
+*/
+#define NWP_SPARE_REG_5	                (OCP_SHARED_BASE + OCP_SHARED_O_SPARE_REG_5)
+#define NWP_SPARE_REG_5_SLSTOP          (0x00000002)
+
+/* ANA_DCDC_PARAMS0 - (HIB1P2_BASE + HIB1P2_O_ANA_DCDC_PARAMETERS0)
+	- Bits 31:28 - Reserved
+	- Bits 27    - Override PWM mode (==> PFM) 
+	- Bits 26:00 - Reserved
+*/
+#define ANA_DCDC_PARAMS0                (HIB1P2_BASE + HIB1P2_O_ANA_DCDC_PARAMETERS0)
+#define ANA_DCDC_PARAMS0_PWMOVERRIDE    (0x08000000)
+
+/* WAKENWP - (ARCM_BASE + APPS_RCM_O_APPS_TO_NWP_WAKE_REQUEST)
+	- Bits 31:01 - Reserved
+	- Bits 00    - Wake Request to NWP
+*/
+#define WAKENWP                         (ARCM_BASE + APPS_RCM_O_APPS_TO_NWP_WAKE_REQUEST)
+#define WAKENWP_WAKEREQ                 (APPS_RCM_APPS_TO_NWP_WAKE_REQUEST_APPS_TO_NWP_WAKEUP_REQUEST)
+
+/* NWP_PWR_STATE - (GPRCM_BASE + GPRCM_O_NWP_PWR_STATE)
+	- Bits 31:12 - Reserved
+	- Bits 11:08 - Active (0x3)
+	- Bits 07:00 - Reserved
+*/
+#define NWP_PWR_STATE                   (GPRCM_BASE + GPRCM_O_NWP_PWR_STATE)
+#define NWP_PWR_STATE_PWRMASK           (0x00000F00)
+#define NWP_PWR_STATE_PWRACTIVE         (0x00000300)
+
+/* NWP_LPDS_WAKEUPCFG - (GPRCM_BASE + GPRCM_O_NWP_LPDS_WAKEUP_CFG)
+	- Bits 31:08 - Reserved
+	- Bits 07:00 - WakeUp Config AppsToNwp Wake (0x20) - reset condition
+*/
+#define NWP_LPDS_WAKEUPCFG              (GPRCM_BASE + GPRCM_O_NWP_LPDS_WAKEUP_CFG)
+#define NWP_LPDS_WAKEUPCFG_APPS2NWP     (0x00000020)
+#define NWP_LPDS_WAKEUPCFG_TIMEOUT_MSEC (600)
+
+/* N2A_INT_MASK_SET -                   (COMMON_REG_BASE + COMMON_REG_O_NW_INT_MASK_SET)  */
+#define N2A_INT_MASK_SET                (COMMON_REG_BASE + COMMON_REG_O_NW_INT_MASK_SET)
+/* N2A_INT_MASK_CLR -                   (COMMON_REG_BASE + COMMON_REG_O_NW_INT_MASK_CLR)  */
+#define N2A_INT_MASK_CLR                (COMMON_REG_BASE + COMMON_REG_O_NW_INT_MASK_CLR)
+/* N2A_INT_ACK -                        (COMMON_REG_BASE + COMMON_REG_O_NW_INT_ACK)       */
+#define N2A_INT_ACK                     (COMMON_REG_BASE + COMMON_REG_O_NW_INT_ACK)
+#define NWP_N2A_INT_ACK_TIMEOUT_MSEC    (3000)
+
+/* A2N_INT_STS_CLR -                    (COMMON_REG_BASE + COMMON_REG_O_APPS_INT_STS_CLR)  */
+#define A2N_INT_STS_CLR                 (COMMON_REG_BASE + COMMON_REG_O_APPS_INT_STS_CLR)
+/* A2N_INT_TRIG -                       (COMMON_REG_BASE + COMMON_REG_O_APPS_INT_TRIG)     */
+#define A2N_INT_TRIG                    (COMMON_REG_BASE + COMMON_REG_O_APPS_INT_TRIG)
+/* A2N_INT_STS_RAW -                    (COMMON_REG_BASE + COMMON_REG_O_APPS_INT_STS_RAW)  */
+#define A2N_INT_STS_RAW                 (COMMON_REG_BASE + COMMON_REG_O_APPS_INT_STS_RAW)
+
+#define uSEC_DELAY(x)                   (ROM_UtilsDelayDirect(x*80/3))
+#define MAX_DMA_RECV_TRANSACTION_SIZE   (4096)
+#define SPI_RATE_20M                    (20000000)
+
+HwiP_Handle g_intHandle = 0;
+
+//****************************************************************************
+//                          LOCAL FUNCTIONS
+//****************************************************************************
+
+Fd_t spi_Open(char *ifName, unsigned long flags)
+{
+	void *lspi_hndl;
+	unsigned int lspi_index;
+	SPI_Params SPI_Config;
+	SPI_Params_init(&SPI_Config);
+
+	/* configure the SPI settings */
+	SPI_Config.transferMode = SPI_MODE_BLOCKING;
+	SPI_Config.mode = SPI_MASTER;
+	SPI_Config.bitRate = SPI_RATE_20M;
+	SPI_Config.dataSize = 32;
+	SPI_Config.frameFormat = SPI_POL0_PHA0;
+
+	/* index of the link SPI initialization configuration in the SPI_Config table */
+	lspi_index = 0;
+	lspi_hndl = SPI_open(lspi_index, &SPI_Config);
+	if(NULL == lspi_hndl)
+	{
+        return -1;
+	}
+	else
+	{
+        return (Fd_t)lspi_hndl;
+	}
+}
+
+
+int spi_Close(Fd_t fd)
+{
+	SPI_close((void *)fd);
+    return 0;
+}
+
+
+int spi_Read(Fd_t fd, unsigned char *pBuff, int len)
+{    
+    SPI_Transaction transact_details;
+    int read_size = 0;
+    
+    /* check if the link SPI has been initialized successfully */
+    if(fd < 0)
+    {
+        return -1;
+    }
+    
+	transact_details.txBuf = NULL;
+	transact_details.arg = NULL;
+	while(len > 0)
+	{
+		/* DMA can transfer upto a maximum of 1024 words in one go. So, if
+		   the data to be read is more than 1024 words, it will be done in
+		   parts */
+		/* length is received in bytes, should be specified in words for the
+		 * SPI driver.
+		 */
+		if(len > MAX_DMA_RECV_TRANSACTION_SIZE)
+		{
+			transact_details.count = (MAX_DMA_RECV_TRANSACTION_SIZE +3)>>2;
+			transact_details.rxBuf = (void*)(pBuff + read_size);
+			if(SPI_transfer((SPI_Handle)fd, &transact_details))
+			{
+				read_size += MAX_DMA_RECV_TRANSACTION_SIZE;
+				len = len - MAX_DMA_RECV_TRANSACTION_SIZE;
+			}
+			else
+			{
+				return -1;
+			}
+
+		}
+		else
+		{
+			transact_details.count = (len+3)>>2;
+			transact_details.rxBuf = (void*)(pBuff + read_size);
+			if(SPI_transfer((SPI_Handle)fd, &transact_details))
+			{
+				read_size += len;
+				len = 0;
+				return read_size;
+			}
+			else
+			{
+				 return -1;
+			}
+		}
+	}
+
+    return(read_size);
+}
+
+
+int spi_Write(Fd_t fd, unsigned char *pBuff, int len)
+{
+    SPI_Transaction transact_details;
+    int write_size = 0;
+    
+    /* check if the link SPI has been initialized successfully */
+    if(fd < 0)
+    {
+    	return -1;
+    }
+
+	transact_details.rxBuf = NULL;
+	transact_details.arg = NULL;
+	while(len > 0)
+	{
+		/* configure the transaction details.
+		 * length is received in bytes, should be specified in words for the SPI
+		 * driver.
+		 */
+		if(len > MAX_DMA_RECV_TRANSACTION_SIZE)
+		{
+			transact_details.count = (MAX_DMA_RECV_TRANSACTION_SIZE +3)>>2;
+			transact_details.txBuf = (void*)(pBuff + write_size);
+			if(SPI_transfer((SPI_Handle)fd, &transact_details))
+			{
+				write_size += MAX_DMA_RECV_TRANSACTION_SIZE;
+				len = len - MAX_DMA_RECV_TRANSACTION_SIZE;
+			}
+			else
+			{
+				return -1;
+			}
+		}
+		else
+		{
+			transact_details.count = (len+3)>>2;
+			transact_details.txBuf = (void*)(pBuff + write_size);
+			if(SPI_transfer((SPI_Handle)fd, &transact_details))
+			{
+				write_size += len;
+				len = 0;
+				return write_size;
+			}
+			else
+			{
+				 return -1;
+			}
+		}
+	}
+
+    return(write_size);
+}
+
+
+int NwpRegisterInterruptHandler(P_EVENT_HANDLER InterruptHdl , void* pValue)
+{
+
+	HwiP_Params nwp_iParams;
+
+	HwiP_Params_init(&nwp_iParams);
+
+	HwiP_clearInterrupt(INT_NWPIC);
+
+	if(!InterruptHdl)
+	{
+		HwiP_delete(g_intHandle);
+		return OS_OK;
+	}
+	else
+	{
+		nwp_iParams.priority = INT_PRIORITY_LVL_1 ;
+
+	}
+		g_intHandle = HwiP_create(INT_NWPIC , (HwiP_Fxn)(InterruptHdl) , &nwp_iParams);
+
+	if(!g_intHandle)
+	{
+		return -1;
+	}
+	else
+	{
+		return OS_OK ;
+	}
+}
+
+
+void NwpMaskInterrupt()
+{
+	(*(unsigned long *)N2A_INT_MASK_SET) = 0x1;
+}
+
+
+void NwpUnMaskInterrupt()
+{
+	(*(unsigned long *)N2A_INT_MASK_CLR) = 0x1;
+}
+
+
+void NwpPowerOn(void)
+{
+    /* bring the 1.32 eco out of reset */
+    HWREG(NWP_SPARE_REG_5) &= ~NWP_SPARE_REG_5_SLSTOP;
+
+    /* Clear host IRQ indication */
+    HWREG(N2A_INT_ACK) = 1;
+
+    /* NWP Wake-up */
+    HWREG(WAKENWP) = WAKENWP_WAKEREQ;
+
+    //UnMask Host Interrupt
+    NwpUnMaskInterrupt();
+}
+
+
+void NwpPowerOff(void)
+{
+
+    volatile unsigned long apps_int_sts_raw;
+    volatile unsigned long sl_stop_ind       = HWREG(NWP_SPARE_REG_5);
+    volatile unsigned long nwp_lpds_wake_cfg = HWREG(NWP_LPDS_WAKEUPCFG);
+    _SlTimeoutParams_t SlTimeoutInfo         = {0};
+
+    if((nwp_lpds_wake_cfg != NWP_LPDS_WAKEUPCFG_APPS2NWP) &&     /* Check for NWP POR condition - APPS2NWP is reset condition */
+                !(sl_stop_ind & NWP_SPARE_REG_5_SLSTOP))         /* Check if sl_stop was executed */
+    {
+    	HWREG(0xE000E104) = 0x200;               /* Enable the out of band interrupt, this is not a wake-up source*/
+    	HWREG(A2N_INT_TRIG) = 0x1;               /* Trigger out of band interrupt  */
+    	HWREG(WAKENWP) = WAKENWP_WAKEREQ;        /* Wake-up the NWP */
+
+	    _SlDrvStartMeasureTimeout(&SlTimeoutInfo, NWP_N2A_INT_ACK_TIMEOUT_MSEC);
+
+	   /* Wait for the A2N_INT_TRIG to be cleared by the NWP to indicate it's awake and ready for shutdown.
+		* poll until APPs->NWP interrupt is cleared or timeout :
+		* for service pack 3.1.99.1 or higher, this condition is fulfilled in less than 1 mSec.
+		* Otherwise, in some cases it may require up to 3000 mSec of waiting.  */
+
+    	apps_int_sts_raw = HWREG(A2N_INT_STS_RAW);
+    	while(!(apps_int_sts_raw & 0x1))
+    	{
+        	if(_SlDrvIsTimeoutExpired(&SlTimeoutInfo))
+        	{
+        		break;
+        	}
+    		apps_int_sts_raw = HWREG(A2N_INT_STS_RAW);
+    	}
+
+    	WAIT_NWP_SHUTDOWN_READY;
+   }
+
+   /* Clear Out of band interrupt, Acked by the NWP */
+   HWREG(A2N_INT_STS_CLR) = 0x1;
+
+   /* Mask Host Interrupt */
+   NwpMaskInterrupt();
+
+   /* Switch to PFM Mode */
+   HWREG(ANA_DCDC_PARAMS0) &= ~ANA_DCDC_PARAMS0_PWMOVERRIDE;
+
+   /* sl_stop ECO for PG1.32 devices */
+   HWREG(NWP_SPARE_REG_5) |= NWP_SPARE_REG_5_SLSTOP;
+
+   /* Wait for 20 uSec, which is the minimal time between on-off cycle */
+   uSEC_DELAY(20);
+}
+
+
+int Semaphore_create_handle(SemaphoreP_Handle* pSemHandle)
+{
+    SemaphoreP_Params params;
+
+    SemaphoreP_Params_init(&params);
+
+    params.mode = SemaphoreP_Mode_BINARY;
+
+#ifndef SL_PLATFORM_MULTI_THREADED
+    params.callback = tiDriverSpawnCallback;
+#endif    
+	(*(pSemHandle)) = SemaphoreP_create(1, &params);
+
+	if(!(*(pSemHandle)))
+	{
+		return SemaphoreP_FAILURE ;
+	}
+
+	return SemaphoreP_OK;
+}
+
+int SemaphoreP_delete_handle(SemaphoreP_Handle* pSemHandle)
+{
+    SemaphoreP_delete(*(pSemHandle));
+    return SemaphoreP_OK;
+}
+
+int SemaphoreP_post_handle(SemaphoreP_Handle* pSemHandle)
+{
+    SemaphoreP_post(*(pSemHandle));
+    return SemaphoreP_OK;
+}
+
+
+int Mutex_create_handle(MutexP_Handle* pMutexHandle)
+{
+    MutexP_Params params;
+
+    MutexP_Params_init(&params);
+#ifndef SL_PLATFORM_MULTI_THREADED
+    params.callback = tiDriverSpawnCallback;
+#endif    
+
+	(*(pMutexHandle)) = MutexP_create(&params);
+
+	if(!(*(pMutexHandle)))
+	{
+		return MutexP_FAILURE ;
+	}
+
+	return MutexP_OK;
+}
+
+int  MutexP_delete_handle(MutexP_Handle* pMutexHandle)
+{
+    MutexP_delete(*(pMutexHandle));
+    return(MutexP_OK);
+}
+
+int Mutex_unlock(MutexP_Handle pMutexHandle)
+{
+	MutexP_unlock(pMutexHandle, 0);
+	return(MutexP_OK);
+}
+
+
+int Mutex_lock(MutexP_Handle pMutexHandle)
+{
+	MutexP_lock(pMutexHandle);
+	return(MutexP_OK);
+}
+
+
+unsigned long TimerGetCurrentTimestamp()
+{
+    return (ClockP_getSystemTicks());
+}
+
+
+void NwpWaitForShutDownInd()
+{
+	volatile unsigned long nwp_wakup_ind = HWREG(NWP_LPDS_WAKEUPCFG);
+	_SlTimeoutParams_t SlTimeoutInfo = {0};
+
+	_SlDrvStartMeasureTimeout(&SlTimeoutInfo, NWP_LPDS_WAKEUPCFG_TIMEOUT_MSEC);
+
+    while(nwp_wakup_ind != NWP_LPDS_WAKEUPCFG_APPS2NWP)
+    {
+    	if(_SlDrvIsTimeoutExpired(&SlTimeoutInfo))
+    	{
+    		return;
+    	}
+    	nwp_wakup_ind = HWREG(NWP_LPDS_WAKEUPCFG);
+    }
+
+    return ;
+}
diff --git a/ext/hal/ti/simplelink/source/ti/drivers/net/wifi/porting/cc_pal.h b/ext/hal/ti/simplelink/source/ti/drivers/net/wifi/porting/cc_pal.h
index 70930e3..6ab72a6 100644
--- a/ext/hal/ti/simplelink/source/ti/drivers/net/wifi/porting/cc_pal.h
+++ b/ext/hal/ti/simplelink/source/ti/drivers/net/wifi/porting/cc_pal.h
@@ -1,369 +1,369 @@
-/*

- * cc_pal.h - CC32xx Host Driver Implementation

- *

- * Copyright (C) 2017 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.

- *

-*/

-/******************************************************************************

-*   cc_pal.h

-*

-*   SimpleLink Wi-Fi abstraction file for CC3220

-******************************************************************************/

-

-#ifndef __CC31xx_PAL_H__

-#define	__CC31xx_PAL_H__

-

-#ifdef	__cplusplus

-extern "C" {

-#endif

-

-#include <ti/drivers/dpl/SemaphoreP.h>

-#include <ti/drivers/dpl/MutexP.h>

-#include <ti/drivers/dpl/ClockP.h>

-

-

-#define MAX_QUEUE_SIZE					(4)

-#define OS_WAIT_FOREVER   				(0xFFFFFFFF)

-#define OS_NO_WAIT        				(0)

-#define OS_OK 	 						(0)

-

-

-/*!

-	\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 int Fd_t;

-

-

-/*!

-	\brief 	type definition for the host interrupt handler

-

-	\param 	pValue	-	pointer to any memory strcuture. The value of this pointer is given on

-						registration of a new interrupt handler

-

-	\note

-*/

-

-typedef void (*SL_P_EVENT_HANDLER)(void);

-

-#define P_EVENT_HANDLER SL_P_EVENT_HANDLER

-

-/*!

-	\brief 	type definition for the host spawn function

-

-	\param 	pValue	-	pointer to any memory strcuture. The value of this pointer is given on

-						invoking the spawn function.

-

-	\note

-*/

-

-typedef signed short (*P_OS_SPAWN_ENTRY)(void* pValue);

-

-typedef struct

-{

-	P_OS_SPAWN_ENTRY pEntry;

-    void* pValue;

-}tSimpleLinkSpawnMsg;

-

-/*!

-    \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	 		ifName		-	points to the interface name/path. The interface name is an

-									optional attributes that the SimpleLink 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			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(char *ifName, unsigned long flags);

-

-/*!

-    \brief closes an opened SPI communication port

-

-	\param	 		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	 		fd			-	file descriptor of an opened SPI channel

-

-	\param			pBuff		- 	points to first location to start writing the data

-

-	\param			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, unsigned char *pBuff, int len);

-

-/*!

-    \brief attempts to write up to len bytes to the SPI channel

-

-	\param	 		fd			-	file descriptor of an opened SPI channel

-

-	\param			pBuff		- 	points to first location to start getting the data from

-

-	\param			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, unsigned char *pBuff, int len);

-

-/*!

-    \brief register an interrupt handler for the host IRQ

-

-	\param	 		InterruptHdl	-	pointer to interrupt handler function

-

-	\param 			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 NwpRegisterInterruptHandler(P_EVENT_HANDLER InterruptHdl , void* pValue);

-

-

-/*!

-    \brief 				Masks host IRQ

-

-

-    \sa             	NwpUnMaskInterrupt

-

-    \warning

-*/

-void NwpMaskInterrupt();

-

-

-/*!

-    \brief 				Unmasks host IRQ

-

-

-    \sa             	NwpMaskInterrupt

-

-    \warning

-*/

-void NwpUnMaskInterrupt();

-

-

-/*!

-    \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

-

-*/

-

-void NwpPowerOnPreamble(void);

-

-

-

-/*!

-    \brief		Disable the Network Processor

-

-    \sa			sl_DeviceEnable

-

-    \note       belongs to \ref ported_sec

-*/

-void NwpPowerOff(void);

-

-

-/*!

-    \brief		Enable the Network Processor

-

-    \sa			sl_DeviceDisable

-

-    \note       belongs to \ref ported_sec

-

-*/

-void NwpPowerOn(void);

-

-

-/*!

-    \brief Creates a semaphore handle, using the driver porting layer of the core SDK. 

-

-	\param	 		pSemHandle      -	pointer to a memory structure that would contain the handle.

-

-	\return			upon successful creation, the function shall return 0.

-					Otherwise, -1 shall be returned

-

-	\note           belongs to \ref ported_sec		

-*/

-int Semaphore_create_handle(SemaphoreP_Handle* pSemHandle);

-

-

-/*!

-    \brief Deletes a semaphore handle, using the driver porting layer of the core SDK.

-

-    \param          pSemHandle      -   pointer to a memory structure that would contain the handle.

-

-    \return         The function shall return 0.

-

-    \note           belongs to \ref ported_sec

-*/

-int SemaphoreP_delete_handle(SemaphoreP_Handle* pSemHandle);

-

-

-/*!

-    \brief Post (signal) a semaphore handle, using the driver porting layer of the core SDK.

-

-    \param          pSemHandle      -   pointer to a memory structure that would contain the handle.

-

-    \return         The function shall return 0.

-

-    \note           belongs to \ref ported_sec

-*/

-int SemaphoreP_post_handle(SemaphoreP_Handle* pSemHandle);

-

-

-/*!

-    \brief Creates a mutex object handle, using the driver porting layer of the core SDK. 

-

-	\param	 		pMutexHandle    -	pointer to a memory structure that would contain the handle.

-

-	\return			upon successful creation, the function shall return 0.

-					Otherwise, -1 shall be returned

-

-	\note           belongs to \ref ported_sec	

-*/

-int Mutex_create_handle(MutexP_Handle* pMutexHandle);

-

-

-/*!

-    \brief Deletes a mutex object handle, using the driver porting layer of the core SDK.

-

-    \param          pMutexHandle    -   pointer to a memory structure that would contain the handle.

-

-    \return         the function shall return 0.

-

-    \note           belongs to \ref ported_sec

-*/

-int  MutexP_delete_handle(MutexP_Handle* pMutexHandle);

-

-/*!

-    \brief Unlocks a mutex object.

-

-	\param	 		pMutexHandle    -	pointer to a memory structure that contains the object.

-

-	\return			upon successful unlocking, the function shall return 0.

-

-	\note           belongs to \ref ported_sec	

-*/

-int Mutex_unlock(MutexP_Handle pMutexHandle);

-

-

-/*!

-    \brief Locks a mutex object.

-

-	\param	 		pMutexHandle    -	pointer to a memory structure that contains the object.

-

-	\return			upon successful locking, the function shall return 0.

-

-	\note           belongs to \ref ported_sec	

-	

-	\warning        The lock will block until the mutex is available.

-*/

-int Mutex_lock(MutexP_Handle pMutexHandle);

-

-

-/*!

-    \brief Take a time stamp value.

-

-	\return			32-bit value of the systick counter.

-

-	\sa

-	

-	\warning

-*/

-unsigned long TimerGetCurrentTimestamp();

-

-/*!

-    \brief

-

-	\return

-

-	\sa

-

-	\warning

-*/

-void NwpWaitForShutDownInd();

-

-

-#ifdef  __cplusplus

-}

-#endif // __cplusplus

-

-#endif

-

+/*
+ * cc_pal.h - CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2017 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.
+ *
+*/
+/******************************************************************************
+*   cc_pal.h
+*
+*   SimpleLink Wi-Fi abstraction file for CC3220
+******************************************************************************/
+
+#ifndef __CC31xx_PAL_H__
+#define	__CC31xx_PAL_H__
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+#include <ti/drivers/dpl/SemaphoreP.h>
+#include <ti/drivers/dpl/MutexP.h>
+#include <ti/drivers/dpl/ClockP.h>
+
+
+#define MAX_QUEUE_SIZE					(4)
+#define OS_WAIT_FOREVER   				(0xFFFFFFFF)
+#define OS_NO_WAIT        				(0)
+#define OS_OK 	 						(0)
+
+
+/*!
+	\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 int Fd_t;
+
+
+/*!
+	\brief 	type definition for the host interrupt handler
+
+	\param 	pValue	-	pointer to any memory strcuture. The value of this pointer is given on
+						registration of a new interrupt handler
+
+	\note
+*/
+
+typedef void (*SL_P_EVENT_HANDLER)(void);
+
+#define P_EVENT_HANDLER SL_P_EVENT_HANDLER
+
+/*!
+	\brief 	type definition for the host spawn function
+
+	\param 	pValue	-	pointer to any memory strcuture. The value of this pointer is given on
+						invoking the spawn function.
+
+	\note
+*/
+
+typedef signed short (*P_OS_SPAWN_ENTRY)(void* pValue);
+
+typedef struct
+{
+	P_OS_SPAWN_ENTRY pEntry;
+    void* pValue;
+}tSimpleLinkSpawnMsg;
+
+/*!
+    \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	 		ifName		-	points to the interface name/path. The interface name is an
+									optional attributes that the SimpleLink 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			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(char *ifName, unsigned long flags);
+
+/*!
+    \brief closes an opened SPI communication port
+
+	\param	 		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	 		fd			-	file descriptor of an opened SPI channel
+
+	\param			pBuff		- 	points to first location to start writing the data
+
+	\param			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, unsigned char *pBuff, int len);
+
+/*!
+    \brief attempts to write up to len bytes to the SPI channel
+
+	\param	 		fd			-	file descriptor of an opened SPI channel
+
+	\param			pBuff		- 	points to first location to start getting the data from
+
+	\param			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, unsigned char *pBuff, int len);
+
+/*!
+    \brief register an interrupt handler for the host IRQ
+
+	\param	 		InterruptHdl	-	pointer to interrupt handler function
+
+	\param 			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 NwpRegisterInterruptHandler(P_EVENT_HANDLER InterruptHdl , void* pValue);
+
+
+/*!
+    \brief 				Masks host IRQ
+
+
+    \sa             	NwpUnMaskInterrupt
+
+    \warning
+*/
+void NwpMaskInterrupt();
+
+
+/*!
+    \brief 				Unmasks host IRQ
+
+
+    \sa             	NwpMaskInterrupt
+
+    \warning
+*/
+void NwpUnMaskInterrupt();
+
+
+/*!
+    \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
+
+*/
+
+void NwpPowerOnPreamble(void);
+
+
+
+/*!
+    \brief		Disable the Network Processor
+
+    \sa			sl_DeviceEnable
+
+    \note       belongs to \ref ported_sec
+*/
+void NwpPowerOff(void);
+
+
+/*!
+    \brief		Enable the Network Processor
+
+    \sa			sl_DeviceDisable
+
+    \note       belongs to \ref ported_sec
+
+*/
+void NwpPowerOn(void);
+
+
+/*!
+    \brief Creates a semaphore handle, using the driver porting layer of the core SDK. 
+
+	\param	 		pSemHandle      -	pointer to a memory structure that would contain the handle.
+
+	\return			upon successful creation, the function shall return 0.
+					Otherwise, -1 shall be returned
+
+	\note           belongs to \ref ported_sec		
+*/
+int Semaphore_create_handle(SemaphoreP_Handle* pSemHandle);
+
+
+/*!
+    \brief Deletes a semaphore handle, using the driver porting layer of the core SDK.
+
+    \param          pSemHandle      -   pointer to a memory structure that would contain the handle.
+
+    \return         The function shall return 0.
+
+    \note           belongs to \ref ported_sec
+*/
+int SemaphoreP_delete_handle(SemaphoreP_Handle* pSemHandle);
+
+
+/*!
+    \brief Post (signal) a semaphore handle, using the driver porting layer of the core SDK.
+
+    \param          pSemHandle      -   pointer to a memory structure that would contain the handle.
+
+    \return         The function shall return 0.
+
+    \note           belongs to \ref ported_sec
+*/
+int SemaphoreP_post_handle(SemaphoreP_Handle* pSemHandle);
+
+
+/*!
+    \brief Creates a mutex object handle, using the driver porting layer of the core SDK. 
+
+	\param	 		pMutexHandle    -	pointer to a memory structure that would contain the handle.
+
+	\return			upon successful creation, the function shall return 0.
+					Otherwise, -1 shall be returned
+
+	\note           belongs to \ref ported_sec	
+*/
+int Mutex_create_handle(MutexP_Handle* pMutexHandle);
+
+
+/*!
+    \brief Deletes a mutex object handle, using the driver porting layer of the core SDK.
+
+    \param          pMutexHandle    -   pointer to a memory structure that would contain the handle.
+
+    \return         the function shall return 0.
+
+    \note           belongs to \ref ported_sec
+*/
+int  MutexP_delete_handle(MutexP_Handle* pMutexHandle);
+
+/*!
+    \brief Unlocks a mutex object.
+
+	\param	 		pMutexHandle    -	pointer to a memory structure that contains the object.
+
+	\return			upon successful unlocking, the function shall return 0.
+
+	\note           belongs to \ref ported_sec	
+*/
+int Mutex_unlock(MutexP_Handle pMutexHandle);
+
+
+/*!
+    \brief Locks a mutex object.
+
+	\param	 		pMutexHandle    -	pointer to a memory structure that contains the object.
+
+	\return			upon successful locking, the function shall return 0.
+
+	\note           belongs to \ref ported_sec	
+	
+	\warning        The lock will block until the mutex is available.
+*/
+int Mutex_lock(MutexP_Handle pMutexHandle);
+
+
+/*!
+    \brief Take a time stamp value.
+
+	\return			32-bit value of the systick counter.
+
+	\sa
+	
+	\warning
+*/
+unsigned long TimerGetCurrentTimestamp();
+
+/*!
+    \brief
+
+	\return
+
+	\sa
+
+	\warning
+*/
+void NwpWaitForShutDownInd();
+
+
+#ifdef  __cplusplus
+}
+#endif // __cplusplus
+
+#endif
+
diff --git a/ext/hal/ti/simplelink/source/ti/drivers/net/wifi/porting/user.h b/ext/hal/ti/simplelink/source/ti/drivers/net/wifi/porting/user.h
index b343cbe..0ffddd5 100644
--- a/ext/hal/ti/simplelink/source/ti/drivers/net/wifi/porting/user.h
+++ b/ext/hal/ti/simplelink/source/ti/drivers/net/wifi/porting/user.h
@@ -1,1370 +1,1370 @@
-/*

- * user.h - CC31xx/CC32xx Host Driver Implementation

- *

- * Copyright (C) 2017 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.

- *

-*/

-

-/******************************************************************************

-*	user.h - CC31xx/CC32xx Host Driver Implementation

-******************************************************************************/

-

-#ifndef __USER_H__

-#define __USER_H__

-

-#ifdef  __cplusplus

-extern "C" {

-#endif

-

-  

-#include <string.h>

-#include <ti/drivers/net/wifi/porting/cc_pal.h>

-

-typedef signed int _SlFd_t;

-

-#define SL_TIMESTAMP_TICKS_IN_10_MILLISECONDS     (_u32)(10)

-#define SL_TIMESTAMP_MAX_VALUE                    (_u32)(0xFFFFFFFF)

-

-/*!

-	\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

-*/

-#ifndef SL_TINY_EXT

-#define MAX_CONCURRENT_ACTIONS 10

-#else

-#define MAX_CONCURRENT_ACTIONS 1

-#endif

-

-/*!

-	\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        80 */

-

-

-/*!

- ******************************************************************************

-

-    \defgroup       configuration_capabilities        Configuration - Capabilities Set

-

-    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

-

-    @{

-

- *******************************************************************************

-*/

-/*!

-    \def        SL_RUNTIME_EVENT_REGISTERATION

-

-    \brief      Defines whether the SimpleLink driver uses dynamic event registration

-                or static precompiled event mechanism

-    \sa

-

-    \note       belongs to \ref configuration_sec

-

-*/

-#define SL_RUNTIME_EVENT_REGISTERATION

-

-

-/*!

-	\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 behavior in case of invalid arguments

-

-    \sa             

-

-    \note       belongs to \ref configuration_sec

-

-    \warning    Removing argument check may cause unpredictable behavior 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_INTERNAL_ERRNO

-

-    \brief      Defines whether SimpleLink driver should employ it's internal errno

-                setter and getter to comply with BSD.

-                (Usually, this kind of mechanism should be handled by the OS).

-

-                When defined, the SimpleLink driver would set and manage the errno variable

-                per thread, to the various returned errors by the standard BSD API.

-                The BSD API includes the following functions:

-                socket, close, accept, bind, listen, connect, select,

-                setsockopt, getsockopt, recv, recvfrom, send, sendto,

-                gethostbyname. Furthermore, the user's application can read errno's value.

-                When not defined, user must provide an errno setter, such that the SimpleLink driver

-                would use the users's external errno meachnism to set an error code.

-

-    \sa         slcb_SetErrno

-

-    \note       belongs to \ref configuration_sec

-

-    \warning    Query errno in the user's application is by simply invoking the macro 'errno'

-                which returns a dereferenced pointer to the allocated calling thread's errno value.

-                If the user choose to change, write to or modifiy the value of errno in any way,

-                It might overwrite the errno value allocated to any other thread at the point in time.

-                (Once errno has been read, the driver assumes it can be allocated to another thread).

-*/

-

-#define SL_INC_INTERNAL_ERRNO

-

-/*!

-    \brief      Defines whether to include extended API in SimpleLink driver

-                or not

-    

-                When defined, the SimpleLink driver will include also all 

-                exteded API of the included packages

-

-    \sa         ext_api

-

-    \note       belongs to \ref configuration_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 configuration_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 configuration_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 configuration_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 configuration_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 configuration_sec

-

-    \warning        

-*/ 

-#define SL_INC_NVMEM_PKG

-

-

-/*!

-    \brief      Defines whether to include NVMEM extended package in SimpleLink

-                driver or not

-

-                When defined, the SimpleLink driver will include also the

-                NVMEM extended package

-

-    \sa

-

-    \note       belongs to \ref nvmem_ext

-

-    \warning

-*/

-#define SL_INC_NVMEM_EXT_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 configuration_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 configuration_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 configuration_sec

-

-    \warning        

-*/

-#define SL_INC_SOCK_SEND_API

-

-

-/*!

-

- Close the Doxygen group.

- @}

-

- */

-

-

-/*!

- ******************************************************************************

-

-    \defgroup   configuration_enable_device       Configuration - Device Enable/Disable

-

-    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 configuration_sec

-

-*/

-#define sl_DeviceEnablePreamble()

-

-

-

-/*!

-    \brief		Enable the Network Processor

-

-    \sa			sl_DeviceDisable

-

-    \note       belongs to \ref configuration_sec

-

-*/

-#define sl_DeviceEnable()			NwpPowerOn()

-

-

-/*!

-    \brief		Disable the Network Processor

-

-    \sa			sl_DeviceEnable

-

-    \note       belongs to \ref configuration_sec

-*/

-#define sl_DeviceDisable() 			NwpPowerOff()

-

-

-/*!

-

- Close the Doxygen group.

- @}

-

- */

-

-/*!

- ******************************************************************************

-

-    \defgroup   configuration_interface         Configuration - Communication Interface

-

-	The SimpleLink device supports several standard communication protocol among SPI and

-	UART. CC32XX Host Driver implements SPI Communication Interface

-

-

-    \note       	In CC32XX, SPI implementation uses DMA in order to increase the utilization

- 			of the communication channel. If user prefers to user UART, these interfaces 

- 			need to be redefined

-

-

-    porting ACTION:	

-        - None

-

-    @{

-

- ******************************************************************************

-*/

-

-#define _SlFd_t					Fd_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 SimpleLink 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 configuration_sec

-

-    \warning

-*/

-#define sl_IfOpen                           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 configuration_sec

-

-    \warning

-*/

-#define sl_IfClose                          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 configuration_sec

-

-    \warning

-*/

-#define sl_IfRead                           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. 

-				therwise, 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 configuration_sec

-

-    \warning

-*/

-#define sl_IfWrite                          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 configuration_sec

-

-    \warning

-*/

-#define sl_IfRegIntHdlr(InterruptHdl , pValue)          NwpRegisterInterruptHandler(InterruptHdl , pValue)   

-

-

-/*!

-    \brief 		Masks the Host IRQ

-

-    \sa		sl_IfUnMaskIntHdlr

-

-

-

-    \note       belongs to \ref configuration_sec

-

-    \warning

-*/

-#define sl_IfMaskIntHdlr()								NwpMaskInterrupt()

-

-

-/*!

-    \brief 		Unmasks the Host IRQ

-

-    \sa		sl_IfMaskIntHdlr

-

-

-

-    \note       belongs to \ref configuration_sec

-

-    \warning

-*/

-#define sl_IfUnMaskIntHdlr()							NwpUnMaskInterrupt()

-

-

-/*!

-    \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 configuration_sec

-

-    \warning        

-*/

-/* #define SL_START_WRITE_STAT */

-

-#ifdef SL_START_WRITE_STAT

-#define sl_IfStartWriteSequence

-#define sl_IfEndWriteSequence

-#endif

-

-

-/*!

-    \brief 		Get the timer counter value (timestamp).

-				The timer must count from zero to its MAX value.

-

-	\param	 	None.

-

-

-	\return		Returns 32-bit timer counter value (ticks unit) 

-

-    \sa

-

-	\note		 

-

-    \note       belongs to \ref porting_sec

-

-    \warning        

-*/

-#ifndef SL_TINY_EXT

-#undef slcb_GetTimestamp

-/* A timer must be started before using this function */ 

-#define slcb_GetTimestamp           TimerGetCurrentTimestamp

-#endif

-

-

-/*!

-    \brief 		This macro wait for the NWP to raise a ready for shutdown indication.

-

-	\param	 	None.

-

-	\note       This function is unique for the CC32XX family

-

-    \warning

-*/

-

-#define WAIT_NWP_SHUTDOWN_READY          NwpWaitForShutDownInd()

-

-/*!

-    \brief      User's errno setter function. User must provide an errno setter

-                in order to let the SimpleLink Wi-Fi driver to support BSD API

-                alongside the user's errno mechanism.

-

-    \param      None.

-

-    \sa         SL_INC_INTERNAL_ERRNO

-

-    \note

-

-    \note       belongs to \ref porting_sec

-

-    \warning

-*/

-#ifndef SL_INC_INTERNAL_ERRNO

-#define slcb_SetErrno

-#endif

-

-/*!

- Close the Doxygen group.

- @}

-

-*/

-

-/*!

- ******************************************************************************

-

-    \defgroup   configuration_os          Configuration - Operating System

-

-	The SimpleLink driver could run on two kind of platforms:

-	   -# Non-Os / Single Threaded (default)

-	   -# Multi-Threaded

-	

-	CC32XX SimpleLink Host Driver is ported on both Non-Os and Multi Threaded OS enviroment. 

-	The Host driver is made OS independent by implementing an OS Abstraction layer. 

-	Reference implementation for OS Abstraction is available for FreeRTOS and TI-RTOS. 

-	

-	

-	If you choose to work in multi-threaded environment under different 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 SimpleLink 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.

-

-	\note - This Macro is defined in the IDE to generate Driver for both OS and Non-OS 

-	

-	 porting ACTION: 

-		 - None

-	 

-	 @{

-

- ******************************************************************************

-*/

-

-/*

-#define SL_PLATFORM_MULTI_THREADED

-*/

-

-#ifdef SL_PLATFORM_MULTI_THREADED

-

-/*!

-    \brief

-    \sa

-    \note           belongs to \ref configuration_sec

-    \warning

-*/

-#define SL_OS_RET_CODE_OK                       ((int)OS_OK)

-

-/*!

-    \brief

-    \sa

-    \note           belongs to \ref configuration_sec

-    \warning

-*/

-#define SL_OS_WAIT_FOREVER                      ((uint32_t)OS_WAIT_FOREVER)

-

-/*!

-    \brief

-    \sa

-    \note           belongs to \ref configuration_sec

-    \warning

-*/

-#define SL_OS_NO_WAIT	                        ((uint32_t)OS_NO_WAIT)

-

-/*!

-	\brief type definition for a time value

-

-	\note	On each configuration or platform the type could be whatever is needed - integer, pointer to structure etc.

-

-    \note       belongs to \ref configuration_sec

-*/

-#define _SlTime_t				uint32_t

-

-

-#endif //SL_PLATFORM_MULTI_THREADED

-

-/*!

-	\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 configuration or platform the type could be whatever is needed - integer, structure etc.

-

-    \note       belongs to \ref configuration_sec

-*/

-#define _SlSyncObj_t			    SemaphoreP_Handle

-

-    

-/*!

-	\brief 	This function creates a sync object

-

-	The sync object is used for synchronization between diffrent 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 configuration_sec

-    \warning

-*/

-#define sl_SyncObjCreate(pSyncObj,pName)            Semaphore_create_handle(pSyncObj)

-

-

-/*!

-	\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 configuration_sec

-    \warning

-*/

-#define sl_SyncObjDelete(pSyncObj)                  SemaphoreP_delete_handle(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 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 sl_SyncObjSignal(pSyncObj)                SemaphoreP_post_handle(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 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 sl_SyncObjSignalFromIRQ(pSyncObj)           SemaphoreP_post_handle(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 SimpleLink 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 configuration_sec

-    \warning

-*/

-#define sl_SyncObjWait(pSyncObj,Timeout)            SemaphoreP_pend((*(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 suppurt reentrant locks by a signal thread.

-	This object is generally implemented by mutex semaphore

-

-	\note	On each configuration or platform the type could be whatever is needed - integer, structure etc.

-    \note       belongs to \ref configuration_sec

-*/

-#define _SlLockObj_t 			             MutexP_Handle

-

-/*!

-	\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 configuration_sec

-    \warning

-*/

-#define sl_LockObjCreate(pLockObj, pName)     Mutex_create_handle(pLockObj)

-

-

-/*!

-	\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 configuration_sec

-    \warning

-*/

-#define sl_LockObjDelete(pLockObj)                  MutexP_delete_handle(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 SimpleLink 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 configuration_sec

-    \warning

-*/

-#define sl_LockObjLock(pLockObj,Timeout)          Mutex_lock(*(pLockObj))

-

-

-/*!

-	\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 configuration_sec

-    \warning

-*/

-#define sl_LockObjUnlock(pLockObj)                   Mutex_unlock(*(pLockObj))

-

-

-/*!

-	\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 configuration_sec

-    

-    \warning                User must implement it's own 'os_Spawn' function.

-*/

-//#define SL_PLATFORM_EXTERNAL_SPAWN

-

-#ifdef SL_PLATFORM_EXTERNAL_SPAWN

-#define sl_Spawn(pEntry,pValue,flags)       os_Spawn(pEntry,pValue,flags)        

-#endif

-

-/*!

- *

- Close the Doxygen group.

- @}

-

- */

-/*!

- ******************************************************************************

-

-    \defgroup   configuration_mem_mgm             Configuration - 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

-

-

-    @{

-

- *****************************************************************************

-*/

-

-/*!

-    \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 configuration_sec

-

-    \warning

-*/

-/*

-#define SL_MEMORY_MGMT_DYNAMIC 	1

-#define SL_MEMORY_MGMT_STATIC  0

-

-#define SL_MEMORY_MGMT  SL_MEMORY_MGMT_DYNAMIC

-*/

-#ifdef SL_MEMORY_MGMT_DYNAMIC

-

-#ifdef SL_PLATFORM_MULTI_THREADED

-

-/*!

-    \brief

-    \sa

-    \note           belongs to \ref configuration_sec

-    \warning

-*/

-#define sl_Malloc(Size)                                 mem_Malloc(Size)

-

-/*!

-    \brief

-    \sa

-    \note           belongs to \ref configuration_sec

-    \warning

-*/

-#define sl_Free(pMem)                                   mem_Free(pMem)

-

-#else

-#include <stdlib.h>

-/*!

-    \brief

-    \sa

-    \note           belongs to \ref configuration_sec

-    \warning        

-*/

-#define sl_Malloc(Size)                                 malloc(Size)

-

-/*!

-    \brief

-    \sa

-    \note           belongs to \ref configuration_sec

-    \warning        

-*/

-#define sl_Free(pMem)                                   free(pMem)

-#endif

-                        

-#endif

-

-/*!

-

- Close the Doxygen group.

- @}

-

-*/

-

-/*!

- ******************************************************************************

-

-    \defgroup       configuration_events      Configuration - Event Handlers

-

-    This section includes the asynchronous event handlers routines

-

-    porting ACTION:

-        -define your routine as the value of this handler

-

-    @{

-

- ******************************************************************************

- */

-

-

-

-/*!

-    \brief      Fatal Error async event for inspecting fatal error events.

-				This event handles events/errors reported from the device/host driver

-	

-	\param[out]	pSlFatalErrorEvent

-	

-	\par

-             Parameters:

-			 

-			 - <b> slFatalErrorEvent->Id = SL_DEVICE_EVENT_FATAL_DEVICE_ABORT </b>,

-			 

-			 - <b> slFatalErrorEvent->Id = SL_DEVICE_EVENT_FATAL_DRIVER_ABORT </b>,

-			 

-			 - <b> slFatalErrorEvent->Id = SL_DEVICE_EVENT_FATAL_NO_CMD_ACK </b>,

-			

-			 - <b> slFatalErrorEvent->Id = SL_DEVICE_EVENT_FATAL_SYNC_LOSS </b>,

-			

-			 - <b> slFatalErrorEvent->Id = SL_DEVICE_EVENT_FATAL_CMD_TIMEOUT </b>,

-			

-

-    \note       belongs to \ref configuration_sec

-

-    \warning

-*/

-

-#define slcb_DeviceFatalErrorEvtHdlr      SimpleLinkFatalErrorEventHandler

-

-/*!

-    \brief      General async event for inspecting general events.

-				This event handles events/errors reported from the device/host driver

-    \sa

-

-    \note       belongs to \ref configuration_sec

-

-    \warning

-*/

-

-#define slcb_DeviceGeneralEvtHdlr		  SimpleLinkGeneralEventHandler

-

-/*!

-    \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   

-

-    \sa

-

-    \note           belongs to \ref configuration_sec

-

-    \warning

-*/

-

-#define slcb_WlanEvtHdlr                     SimpleLinkWlanEventHandler         

-

-

-/*!

-    \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

-

-

-    \sa

-

-    \note           belongs to \ref configuration_sec

-

-    \warning

-*/

-

-#define slcb_NetAppEvtHdlr              		SimpleLinkNetAppEventHandler              

-

-/*!

-    \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  

-

-

-    \sa

-

-    \note           belongs to \ref configuration_sec

-

-    \warning

-*/

-

-#define slcb_NetAppHttpServerHdlr   SimpleLinkHttpServerEventHandler

-

-

-

-/*!

-    \brief          A handler for handling Netapp requests.

-                    Netapp request types:

-                    For HTTP server: GET / POST (future: PUT / DELETE)

-

-	\param

-

-	\param

-

-    \sa

-

-    \note           belongs to \ref porting_sec

-

-    \warning

-*/

-

-#define slcb_NetAppRequestHdlr  SimpleLinkNetAppRequestEventHandler

-

-

-

-/*!

-    \brief          A handler for freeing the memory of the NetApp response.

-

-	\param

-

-	\param

-

-    \sa

-

-    \note           belongs to \ref porting_sec

-

-    \warning

-*/

-

-#define slcb_NetAppRequestMemFree  SimpleLinkNetAppRequestMemFreeEventHandler

-

-

-

-/*!

-    \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

-

-    \sa

-

-    \note           belongs to \ref configuration_sec

-

-    \warning

-*/

-

-#define slcb_SockEvtHdlr         SimpleLinkSockEventHandler

-

-

-/*!

-    \brief Trigger Async event handler. If define, sl_Select operates only in trigger mode.

-                           To disable trigger mode, handler should not be defined.

-

-    \param[out]      pSlTriggerEvent   pointer to SlSockTriggerEvent_t data

-

-    \par

-             Parameters:\n

-             - <b>pSlTriggerEvent->Event = SL_SOCKET_TRIGGER_EVENT_SELECT</b>

-             - pSlTriggerEvent->EventData: Not in use

-

-

-    \sa

-

-    \note           belongs to \ref configuration_sec

-

-    \warning

-*/

-#ifndef SL_PLATFORM_MULTI_THREADED

-#define slcb_SocketTriggerEventHandler SimpleLinkSocketTriggerEventHandler

-#endif

-/*!

-

- Close the Doxygen group.

- @}

-

- */

-

-

-#ifdef  __cplusplus

-}

-#endif // __cplusplus

-

-#endif // __USER_H__

+/*
+ * user.h - CC31xx/CC32xx Host Driver Implementation
+ *
+ * Copyright (C) 2017 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.
+ *
+*/
+
+/******************************************************************************
+*	user.h - CC31xx/CC32xx Host Driver Implementation
+******************************************************************************/
+
+#ifndef __USER_H__
+#define __USER_H__
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+  
+#include <string.h>
+#include <ti/drivers/net/wifi/porting/cc_pal.h>
+
+typedef signed int _SlFd_t;
+
+#define SL_TIMESTAMP_TICKS_IN_10_MILLISECONDS     (_u32)(10)
+#define SL_TIMESTAMP_MAX_VALUE                    (_u32)(0xFFFFFFFF)
+
+/*!
+	\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
+*/
+#ifndef SL_TINY_EXT
+#define MAX_CONCURRENT_ACTIONS 10
+#else
+#define MAX_CONCURRENT_ACTIONS 1
+#endif
+
+/*!
+	\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        80 */
+
+
+/*!
+ ******************************************************************************
+
+    \defgroup       configuration_capabilities        Configuration - Capabilities Set
+
+    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
+
+    @{
+
+ *******************************************************************************
+*/
+/*!
+    \def        SL_RUNTIME_EVENT_REGISTERATION
+
+    \brief      Defines whether the SimpleLink driver uses dynamic event registration
+                or static precompiled event mechanism
+    \sa
+
+    \note       belongs to \ref configuration_sec
+
+*/
+#define SL_RUNTIME_EVENT_REGISTERATION
+
+
+/*!
+	\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 behavior in case of invalid arguments
+
+    \sa             
+
+    \note       belongs to \ref configuration_sec
+
+    \warning    Removing argument check may cause unpredictable behavior 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_INTERNAL_ERRNO
+
+    \brief      Defines whether SimpleLink driver should employ it's internal errno
+                setter and getter to comply with BSD.
+                (Usually, this kind of mechanism should be handled by the OS).
+
+                When defined, the SimpleLink driver would set and manage the errno variable
+                per thread, to the various returned errors by the standard BSD API.
+                The BSD API includes the following functions:
+                socket, close, accept, bind, listen, connect, select,
+                setsockopt, getsockopt, recv, recvfrom, send, sendto,
+                gethostbyname. Furthermore, the user's application can read errno's value.
+                When not defined, user must provide an errno setter, such that the SimpleLink driver
+                would use the users's external errno meachnism to set an error code.
+
+    \sa         slcb_SetErrno
+
+    \note       belongs to \ref configuration_sec
+
+    \warning    Query errno in the user's application is by simply invoking the macro 'errno'
+                which returns a dereferenced pointer to the allocated calling thread's errno value.
+                If the user choose to change, write to or modifiy the value of errno in any way,
+                It might overwrite the errno value allocated to any other thread at the point in time.
+                (Once errno has been read, the driver assumes it can be allocated to another thread).
+*/
+
+#define SL_INC_INTERNAL_ERRNO
+
+/*!
+    \brief      Defines whether to include extended API in SimpleLink driver
+                or not
+    
+                When defined, the SimpleLink driver will include also all 
+                exteded API of the included packages
+
+    \sa         ext_api
+
+    \note       belongs to \ref configuration_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 configuration_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 configuration_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 configuration_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 configuration_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 configuration_sec
+
+    \warning        
+*/ 
+#define SL_INC_NVMEM_PKG
+
+
+/*!
+    \brief      Defines whether to include NVMEM extended package in SimpleLink
+                driver or not
+
+                When defined, the SimpleLink driver will include also the
+                NVMEM extended package
+
+    \sa
+
+    \note       belongs to \ref nvmem_ext
+
+    \warning
+*/
+#define SL_INC_NVMEM_EXT_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 configuration_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 configuration_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 configuration_sec
+
+    \warning        
+*/
+#define SL_INC_SOCK_SEND_API
+
+
+/*!
+
+ Close the Doxygen group.
+ @}
+
+ */
+
+
+/*!
+ ******************************************************************************
+
+    \defgroup   configuration_enable_device       Configuration - Device Enable/Disable
+
+    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 configuration_sec
+
+*/
+#define sl_DeviceEnablePreamble()
+
+
+
+/*!
+    \brief		Enable the Network Processor
+
+    \sa			sl_DeviceDisable
+
+    \note       belongs to \ref configuration_sec
+
+*/
+#define sl_DeviceEnable()			NwpPowerOn()
+
+
+/*!
+    \brief		Disable the Network Processor
+
+    \sa			sl_DeviceEnable
+
+    \note       belongs to \ref configuration_sec
+*/
+#define sl_DeviceDisable() 			NwpPowerOff()
+
+
+/*!
+
+ Close the Doxygen group.
+ @}
+
+ */
+
+/*!
+ ******************************************************************************
+
+    \defgroup   configuration_interface         Configuration - Communication Interface
+
+	The SimpleLink device supports several standard communication protocol among SPI and
+	UART. CC32XX Host Driver implements SPI Communication Interface
+
+
+    \note       	In CC32XX, SPI implementation uses DMA in order to increase the utilization
+ 			of the communication channel. If user prefers to user UART, these interfaces 
+ 			need to be redefined
+
+
+    porting ACTION:	
+        - None
+
+    @{
+
+ ******************************************************************************
+*/
+
+#define _SlFd_t					Fd_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 SimpleLink 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 configuration_sec
+
+    \warning
+*/
+#define sl_IfOpen                           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 configuration_sec
+
+    \warning
+*/
+#define sl_IfClose                          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 configuration_sec
+
+    \warning
+*/
+#define sl_IfRead                           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. 
+				therwise, 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 configuration_sec
+
+    \warning
+*/
+#define sl_IfWrite                          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 configuration_sec
+
+    \warning
+*/
+#define sl_IfRegIntHdlr(InterruptHdl , pValue)          NwpRegisterInterruptHandler(InterruptHdl , pValue)   
+
+
+/*!
+    \brief 		Masks the Host IRQ
+
+    \sa		sl_IfUnMaskIntHdlr
+
+
+
+    \note       belongs to \ref configuration_sec
+
+    \warning
+*/
+#define sl_IfMaskIntHdlr()								NwpMaskInterrupt()
+
+
+/*!
+    \brief 		Unmasks the Host IRQ
+
+    \sa		sl_IfMaskIntHdlr
+
+
+
+    \note       belongs to \ref configuration_sec
+
+    \warning
+*/
+#define sl_IfUnMaskIntHdlr()							NwpUnMaskInterrupt()
+
+
+/*!
+    \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 configuration_sec
+
+    \warning        
+*/
+/* #define SL_START_WRITE_STAT */
+
+#ifdef SL_START_WRITE_STAT
+#define sl_IfStartWriteSequence
+#define sl_IfEndWriteSequence
+#endif
+
+
+/*!
+    \brief 		Get the timer counter value (timestamp).
+				The timer must count from zero to its MAX value.
+
+	\param	 	None.
+
+
+	\return		Returns 32-bit timer counter value (ticks unit) 
+
+    \sa
+
+	\note		 
+
+    \note       belongs to \ref porting_sec
+
+    \warning        
+*/
+#ifndef SL_TINY_EXT
+#undef slcb_GetTimestamp
+/* A timer must be started before using this function */ 
+#define slcb_GetTimestamp           TimerGetCurrentTimestamp
+#endif
+
+
+/*!
+    \brief 		This macro wait for the NWP to raise a ready for shutdown indication.
+
+	\param	 	None.
+
+	\note       This function is unique for the CC32XX family
+
+    \warning
+*/
+
+#define WAIT_NWP_SHUTDOWN_READY          NwpWaitForShutDownInd()
+
+/*!
+    \brief      User's errno setter function. User must provide an errno setter
+                in order to let the SimpleLink Wi-Fi driver to support BSD API
+                alongside the user's errno mechanism.
+
+    \param      None.
+
+    \sa         SL_INC_INTERNAL_ERRNO
+
+    \note
+
+    \note       belongs to \ref porting_sec
+
+    \warning
+*/
+#ifndef SL_INC_INTERNAL_ERRNO
+#define slcb_SetErrno
+#endif
+
+/*!
+ Close the Doxygen group.
+ @}
+
+*/
+
+/*!
+ ******************************************************************************
+
+    \defgroup   configuration_os          Configuration - Operating System
+
+	The SimpleLink driver could run on two kind of platforms:
+	   -# Non-Os / Single Threaded (default)
+	   -# Multi-Threaded
+	
+	CC32XX SimpleLink Host Driver is ported on both Non-Os and Multi Threaded OS enviroment. 
+	The Host driver is made OS independent by implementing an OS Abstraction layer. 
+	Reference implementation for OS Abstraction is available for FreeRTOS and TI-RTOS. 
+	
+	
+	If you choose to work in multi-threaded environment under different 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 SimpleLink 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.
+
+	\note - This Macro is defined in the IDE to generate Driver for both OS and Non-OS 
+	
+	 porting ACTION: 
+		 - None
+	 
+	 @{
+
+ ******************************************************************************
+*/
+
+/*
+#define SL_PLATFORM_MULTI_THREADED
+*/
+
+#ifdef SL_PLATFORM_MULTI_THREADED
+
+/*!
+    \brief
+    \sa
+    \note           belongs to \ref configuration_sec
+    \warning
+*/
+#define SL_OS_RET_CODE_OK                       ((int)OS_OK)
+
+/*!
+    \brief
+    \sa
+    \note           belongs to \ref configuration_sec
+    \warning
+*/
+#define SL_OS_WAIT_FOREVER                      ((uint32_t)OS_WAIT_FOREVER)
+
+/*!
+    \brief
+    \sa
+    \note           belongs to \ref configuration_sec
+    \warning
+*/
+#define SL_OS_NO_WAIT	                        ((uint32_t)OS_NO_WAIT)
+
+/*!
+	\brief type definition for a time value
+
+	\note	On each configuration or platform the type could be whatever is needed - integer, pointer to structure etc.
+
+    \note       belongs to \ref configuration_sec
+*/
+#define _SlTime_t				uint32_t
+
+
+#endif //SL_PLATFORM_MULTI_THREADED
+
+/*!
+	\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 configuration or platform the type could be whatever is needed - integer, structure etc.
+
+    \note       belongs to \ref configuration_sec
+*/
+#define _SlSyncObj_t			    SemaphoreP_Handle
+
+    
+/*!
+	\brief 	This function creates a sync object
+
+	The sync object is used for synchronization between diffrent 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 configuration_sec
+    \warning
+*/
+#define sl_SyncObjCreate(pSyncObj,pName)            Semaphore_create_handle(pSyncObj)
+
+
+/*!
+	\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 configuration_sec
+    \warning
+*/
+#define sl_SyncObjDelete(pSyncObj)                  SemaphoreP_delete_handle(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 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 sl_SyncObjSignal(pSyncObj)                SemaphoreP_post_handle(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 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 sl_SyncObjSignalFromIRQ(pSyncObj)           SemaphoreP_post_handle(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 SimpleLink 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 configuration_sec
+    \warning
+*/
+#define sl_SyncObjWait(pSyncObj,Timeout)            SemaphoreP_pend((*(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 suppurt reentrant locks by a signal thread.
+	This object is generally implemented by mutex semaphore
+
+	\note	On each configuration or platform the type could be whatever is needed - integer, structure etc.
+    \note       belongs to \ref configuration_sec
+*/
+#define _SlLockObj_t 			             MutexP_Handle
+
+/*!
+	\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 configuration_sec
+    \warning
+*/
+#define sl_LockObjCreate(pLockObj, pName)     Mutex_create_handle(pLockObj)
+
+
+/*!
+	\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 configuration_sec
+    \warning
+*/
+#define sl_LockObjDelete(pLockObj)                  MutexP_delete_handle(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 SimpleLink 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 configuration_sec
+    \warning
+*/
+#define sl_LockObjLock(pLockObj,Timeout)          Mutex_lock(*(pLockObj))
+
+
+/*!
+	\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 configuration_sec
+    \warning
+*/
+#define sl_LockObjUnlock(pLockObj)                   Mutex_unlock(*(pLockObj))
+
+
+/*!
+	\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 configuration_sec
+    
+    \warning                User must implement it's own 'os_Spawn' function.
+*/
+//#define SL_PLATFORM_EXTERNAL_SPAWN
+
+#ifdef SL_PLATFORM_EXTERNAL_SPAWN
+#define sl_Spawn(pEntry,pValue,flags)       os_Spawn(pEntry,pValue,flags)        
+#endif
+
+/*!
+ *
+ Close the Doxygen group.
+ @}
+
+ */
+/*!
+ ******************************************************************************
+
+    \defgroup   configuration_mem_mgm             Configuration - 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
+
+
+    @{
+
+ *****************************************************************************
+*/
+
+/*!
+    \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 configuration_sec
+
+    \warning
+*/
+/*
+#define SL_MEMORY_MGMT_DYNAMIC 	1
+#define SL_MEMORY_MGMT_STATIC  0
+
+#define SL_MEMORY_MGMT  SL_MEMORY_MGMT_DYNAMIC
+*/
+#ifdef SL_MEMORY_MGMT_DYNAMIC
+
+#ifdef SL_PLATFORM_MULTI_THREADED
+
+/*!
+    \brief
+    \sa
+    \note           belongs to \ref configuration_sec
+    \warning
+*/
+#define sl_Malloc(Size)                                 mem_Malloc(Size)
+
+/*!
+    \brief
+    \sa
+    \note           belongs to \ref configuration_sec
+    \warning
+*/
+#define sl_Free(pMem)                                   mem_Free(pMem)
+
+#else
+#include <stdlib.h>
+/*!
+    \brief
+    \sa
+    \note           belongs to \ref configuration_sec
+    \warning        
+*/
+#define sl_Malloc(Size)                                 malloc(Size)
+
+/*!
+    \brief
+    \sa
+    \note           belongs to \ref configuration_sec
+    \warning        
+*/
+#define sl_Free(pMem)                                   free(pMem)
+#endif
+                        
+#endif
+
+/*!
+
+ Close the Doxygen group.
+ @}
+
+*/
+
+/*!
+ ******************************************************************************
+
+    \defgroup       configuration_events      Configuration - Event Handlers
+
+    This section includes the asynchronous event handlers routines
+
+    porting ACTION:
+        -define your routine as the value of this handler
+
+    @{
+
+ ******************************************************************************
+ */
+
+
+
+/*!
+    \brief      Fatal Error async event for inspecting fatal error events.
+				This event handles events/errors reported from the device/host driver
+	
+	\param[out]	pSlFatalErrorEvent
+	
+	\par
+             Parameters:
+			 
+			 - <b> slFatalErrorEvent->Id = SL_DEVICE_EVENT_FATAL_DEVICE_ABORT </b>,
+			 
+			 - <b> slFatalErrorEvent->Id = SL_DEVICE_EVENT_FATAL_DRIVER_ABORT </b>,
+			 
+			 - <b> slFatalErrorEvent->Id = SL_DEVICE_EVENT_FATAL_NO_CMD_ACK </b>,
+			
+			 - <b> slFatalErrorEvent->Id = SL_DEVICE_EVENT_FATAL_SYNC_LOSS </b>,
+			
+			 - <b> slFatalErrorEvent->Id = SL_DEVICE_EVENT_FATAL_CMD_TIMEOUT </b>,
+			
+
+    \note       belongs to \ref configuration_sec
+
+    \warning
+*/
+
+#define slcb_DeviceFatalErrorEvtHdlr      SimpleLinkFatalErrorEventHandler
+
+/*!
+    \brief      General async event for inspecting general events.
+				This event handles events/errors reported from the device/host driver
+    \sa
+
+    \note       belongs to \ref configuration_sec
+
+    \warning
+*/
+
+#define slcb_DeviceGeneralEvtHdlr		  SimpleLinkGeneralEventHandler
+
+/*!
+    \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   
+
+    \sa
+
+    \note           belongs to \ref configuration_sec
+
+    \warning
+*/
+
+#define slcb_WlanEvtHdlr                     SimpleLinkWlanEventHandler         
+
+
+/*!
+    \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
+
+
+    \sa
+
+    \note           belongs to \ref configuration_sec
+
+    \warning
+*/
+
+#define slcb_NetAppEvtHdlr              		SimpleLinkNetAppEventHandler              
+
+/*!
+    \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  
+
+
+    \sa
+
+    \note           belongs to \ref configuration_sec
+
+    \warning
+*/
+
+#define slcb_NetAppHttpServerHdlr   SimpleLinkHttpServerEventHandler
+
+
+
+/*!
+    \brief          A handler for handling Netapp requests.
+                    Netapp request types:
+                    For HTTP server: GET / POST (future: PUT / DELETE)
+
+	\param
+
+	\param
+
+    \sa
+
+    \note           belongs to \ref porting_sec
+
+    \warning
+*/
+
+#define slcb_NetAppRequestHdlr  SimpleLinkNetAppRequestEventHandler
+
+
+
+/*!
+    \brief          A handler for freeing the memory of the NetApp response.
+
+	\param
+
+	\param
+
+    \sa
+
+    \note           belongs to \ref porting_sec
+
+    \warning
+*/
+
+#define slcb_NetAppRequestMemFree  SimpleLinkNetAppRequestMemFreeEventHandler
+
+
+
+/*!
+    \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
+
+    \sa
+
+    \note           belongs to \ref configuration_sec
+
+    \warning
+*/
+
+#define slcb_SockEvtHdlr         SimpleLinkSockEventHandler
+
+
+/*!
+    \brief Trigger Async event handler. If define, sl_Select operates only in trigger mode.
+                           To disable trigger mode, handler should not be defined.
+
+    \param[out]      pSlTriggerEvent   pointer to SlSockTriggerEvent_t data
+
+    \par
+             Parameters:\n
+             - <b>pSlTriggerEvent->Event = SL_SOCKET_TRIGGER_EVENT_SELECT</b>
+             - pSlTriggerEvent->EventData: Not in use
+
+
+    \sa
+
+    \note           belongs to \ref configuration_sec
+
+    \warning
+*/
+#ifndef SL_PLATFORM_MULTI_THREADED
+#define slcb_SocketTriggerEventHandler SimpleLinkSocketTriggerEventHandler
+#endif
+/*!
+
+ Close the Doxygen group.
+ @}
+
+ */
+
+
+#ifdef  __cplusplus
+}
+#endif // __cplusplus
+
+#endif // __USER_H__