aboutsummaryrefslogtreecommitdiff
path: root/cc3200/simplelink
diff options
context:
space:
mode:
authorDamien George2017-09-06 13:40:51 +1000
committerDamien George2017-09-06 13:40:51 +1000
commit01dd7804b87d60b2deab16712eccb3b97351a9b7 (patch)
tree1aa21f38a872b8e62a3d4e4f74f68033c6f827e4 /cc3200/simplelink
parenta9862b30068fc9df1022f08019fb35aaa5085f64 (diff)
ports: Make new ports/ sub-directory and move all ports there.
This is to keep the top-level directory clean, to make it clear what is core and what is a port, and to allow the repository to grow with new ports in a sustainable way.
Diffstat (limited to 'cc3200/simplelink')
-rw-r--r--cc3200/simplelink/cc_pal.c517
-rw-r--r--cc3200/simplelink/cc_pal.h202
-rw-r--r--cc3200/simplelink/oslib/osi.h580
-rw-r--r--cc3200/simplelink/oslib/osi_freertos.c747
-rw-r--r--cc3200/simplelink/user.h1063
5 files changed, 0 insertions, 3109 deletions
diff --git a/cc3200/simplelink/cc_pal.c b/cc3200/simplelink/cc_pal.c
deleted file mode 100644
index 7b0be5d13..000000000
--- a/cc3200/simplelink/cc_pal.c
+++ /dev/null
@@ -1,517 +0,0 @@
-//*****************************************************************************
-// cc_pal.c
-//
-// simplelink abstraction file for CC3200
-//
-// Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
-//
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the
-// distribution.
-//
-// Neither the name of Texas Instruments Incorporated nor the names of
-// its contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//*****************************************************************************
-
-//Simplelink includes
-#include <simplelink.h>
-#include <cc_pal.h>
-
-//Driverlib includes
-#include <hw_ints.h>
-#include <hw_types.h>
-#include <pin.h>
-#include <hw_memmap.h>
-#include <hw_mcspi.h>
-#include <hw_common_reg.h>
-#include <rom.h>
-#include <rom_map.h>
-#include <spi.h>
-#include <prcm.h>
-#include <rom.h>
-#include <rom_map.h>
-#include <hw_ints.h>
-#include <interrupt.h>
-#include <utils.h>
-
-
-#define REG_INT_MASK_SET 0x400F7088
-#define REG_INT_MASK_CLR 0x400F708C
-#define APPS_SOFT_RESET_REG 0x4402D000
-#define OCP_SHARED_MAC_RESET_REG 0x4402E168
-
-#define SPI_RATE_20M 20000000
-
-#define UNUSED(x) (x = x)
-
-//
-// GLOBAL VARIABLES -- Start
-//
-volatile Fd_t g_SpiFd =0;
-P_EVENT_HANDLER g_pHostIntHdl = NULL;
-
-//
-// GLOBAL VARIABLES -- End
-//
-
-
-//****************************************************************************
-// LOCAL FUNCTION PROTOTYPES
-//****************************************************************************
-static int spi_Read_CPU(unsigned char *pBuff, int len);
-static int spi_Write_CPU(unsigned char *pBuff, int len);
-
-//****************************************************************************
-// LOCAL FUNCTION DEFINITIONS
-//****************************************************************************
-
-/*!
- \brief attempts to read up to len bytes from SPI channel into a buffer starting at pBuff.
-
- \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 Read Size.
- Otherwise, -1 shall be returned
-
- \sa spi_Read_CPU , spi_Write_CPU
- \note
- \warning
-*/
-int spi_Read_CPU(unsigned char *pBuff, int len)
-{
- unsigned long ulCnt;
- unsigned long ulStatusReg;
- unsigned long *ulDataIn;
- unsigned long ulTxReg;
- unsigned long ulRxReg;
-
- MAP_SPICSEnable(LSPI_BASE);
-
- //
- // Initialize local variable.
- //
- ulDataIn = (unsigned long *)pBuff;
- ulCnt = (len + 3) >> 2;
- ulStatusReg = LSPI_BASE+MCSPI_O_CH0STAT;
- ulTxReg = LSPI_BASE + MCSPI_O_TX0;
- ulRxReg = LSPI_BASE + MCSPI_O_RX0;
-
- //
- // Reading loop
- //
- while(ulCnt--)
- {
- while(!( HWREG(ulStatusReg)& MCSPI_CH0STAT_TXS ));
- HWREG(ulTxReg) = 0xFFFFFFFF;
- while(!( HWREG(ulStatusReg)& MCSPI_CH0STAT_RXS ));
- *ulDataIn = HWREG(ulRxReg);
- ulDataIn++;
- }
-
- MAP_SPICSDisable(LSPI_BASE);
-
- return len;
-}
-
-/*!
- \brief attempts to write up to len bytes to the 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 write size.
- Otherwise, -1 shall be returned
-
- \sa spi_Read_CPU , spi_Write_CPU
- \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_CPU(unsigned char *pBuff, int len)
-{
- unsigned long ulCnt;
- unsigned long ulStatusReg;
- unsigned long *ulDataOut;
- unsigned long ulDataIn;
- unsigned long ulTxReg;
- unsigned long ulRxReg;
-
-
- MAP_SPICSEnable(LSPI_BASE);
-
- //
- // Initialize local variable.
- //
- ulDataOut = (unsigned long *)pBuff;
- ulCnt = (len +3 ) >> 2;
- ulStatusReg = LSPI_BASE+MCSPI_O_CH0STAT;
- ulTxReg = LSPI_BASE + MCSPI_O_TX0;
- ulRxReg = LSPI_BASE + MCSPI_O_RX0;
-
- //
- // Writing Loop
- //
- while(ulCnt--)
- {
- while(!( HWREG(ulStatusReg)& MCSPI_CH0STAT_TXS ));
- HWREG(ulTxReg) = *ulDataOut;
- while(!( HWREG(ulStatusReg)& MCSPI_CH0STAT_RXS ));
- ulDataIn = HWREG(ulRxReg);
- ulDataOut++;
- }
-
- MAP_SPICSDisable(LSPI_BASE);
-
- UNUSED(ulDataIn);
- return len;
-}
-
-/*!
- \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 simple link driver receives
- on opening the device. in systems that the spi channel is
- not implemented as part of the os device drivers, this
- parameter could be NULL.
- \param 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)
-{
- unsigned long ulBase;
- unsigned long ulSpiBitRate = SPI_RATE_20M;
-
- //NWP master interface
- ulBase = LSPI_BASE;
-
- //Enable MCSPIA2
- MAP_PRCMPeripheralClkEnable(PRCM_LSPI,PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK);
-
- //Disable Chip Select
- MAP_SPICSDisable(ulBase);
-
- //Disable SPI Channel
- MAP_SPIDisable(ulBase);
-
- // Reset SPI
- MAP_SPIReset(ulBase);
-
- //
- // Configure SPI interface
- //
-
- MAP_SPIConfigSetExpClk(ulBase,MAP_PRCMPeripheralClockGet(PRCM_LSPI),
- ulSpiBitRate,SPI_MODE_MASTER,SPI_SUB_MODE_0,
- (SPI_SW_CTRL_CS |
- SPI_4PIN_MODE |
- SPI_TURBO_OFF |
- SPI_CS_ACTIVEHIGH |
- SPI_WL_32));
-
- MAP_SPIEnable(ulBase);
-
- g_SpiFd = 1;
- return g_SpiFd;
-}
-/*!
- \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)
-{
- unsigned long ulBase = LSPI_BASE;
-
- g_SpiFd = 0;
-
- //Disable Chip Select
- MAP_SPICSDisable(LSPI_BASE);
-
-
- //Disable SPI Channel
- MAP_SPIDisable(ulBase);
-
- // Reset SPI
- MAP_SPIReset(ulBase);
-
- // Disable SPI Peripheral
- MAP_PRCMPeripheralClkDisable(PRCM_LSPI,PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK);
-
- return 0;
-}
-
-/*!
- \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_Read(Fd_t fd, unsigned char *pBuff, int len)
-{
- if (fd != 1 || g_SpiFd != 1) {
- return -1;
- }
-
- return spi_Read_CPU(pBuff, 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)
-{
- if (fd != 1 || g_SpiFd != 1) {
- return -1;
- }
-
- return spi_Write_CPU(pBuff,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)
-{
-
- if(InterruptHdl == NULL)
- {
- //De-register Interprocessor communication interrupt between App and NWP
- #ifdef SL_PLATFORM_MULTI_THREADED
- osi_InterruptDeRegister(INT_NWPIC);
- #else
- MAP_IntDisable(INT_NWPIC);
- MAP_IntUnregister(INT_NWPIC);
- MAP_IntPendClear(INT_NWPIC);
- #endif
- }
- else
- {
- #ifdef SL_PLATFORM_MULTI_THREADED
- MAP_IntPendClear(INT_NWPIC);
- osi_InterruptRegister(INT_NWPIC, (P_OSI_INTR_ENTRY)InterruptHdl,INT_PRIORITY_LVL_1);
- #else
- MAP_IntRegister(INT_NWPIC, InterruptHdl);
- MAP_IntPrioritySet(INT_NWPIC, INT_PRIORITY_LVL_1);
- MAP_IntPendClear(INT_NWPIC);
- MAP_IntEnable(INT_NWPIC);
- #endif
- }
-
- return 0;
-}
-
-
-/*!
- \brief Masks host IRQ
-
-
- \sa NwpUnMaskInterrupt
-
- \warning
-*/
-void NwpMaskInterrupt()
-{
- (*(unsigned long *)REG_INT_MASK_SET) = 0x1;
-}
-
-
-/*!
- \brief Unmasks host IRQ
-
-
- \sa NwpMaskInterrupt
-
- \warning
-*/
-void NwpUnMaskInterrupt()
-{
- (*(unsigned long *)REG_INT_MASK_CLR) = 0x1;
-}
-
-#ifdef DEBUG
-/*!
- \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)
-{
- #define MAX_RETRY_COUNT 1000
-
- unsigned int sl_stop_ind, apps_int_sts_raw, nwp_lpds_wake_cfg;
- unsigned int retry_count;
- /* Perform the sl_stop equivalent to ensure network services
- are turned off if active */
- HWREG(0x400F70B8) = 1; /* APPs to NWP interrupt */
- UtilsDelay(800000/5);
-
- retry_count = 0;
- nwp_lpds_wake_cfg = HWREG(0x4402D404);
- sl_stop_ind = HWREG(0x4402E16C);
-
- if((nwp_lpds_wake_cfg != 0x20) && /* Check for NWP POR condition */
- !(sl_stop_ind & 0x2)) /* Check if sl_stop was executed */
- {
- /* Loop until APPs->NWP interrupt is cleared or timeout */
- while(retry_count < MAX_RETRY_COUNT)
- {
- apps_int_sts_raw = HWREG(0x400F70C0);
- if(apps_int_sts_raw & 0x1)
- {
- UtilsDelay(800000/5);
- retry_count++;
- }
- else
- {
- break;
- }
- }
- }
- HWREG(0x400F70B0) = 1; /* Clear APPs to NWP interrupt */
- UtilsDelay(800000/5);
-
- /* Stop the networking services */
- NwpPowerOff();
-}
-#endif
-
-/*!
- \brief Enable the Network Processor
-
- \sa sl_DeviceDisable
-
- \note belongs to \ref ported_sec
-
-*/
-void NwpPowerOn(void)
-{
- //bring the 1.32 eco out of reset
- HWREG(0x4402E16C) &= 0xFFFFFFFD;
-
- //NWP Wakeup
- HWREG(0x44025118) = 1;
-#ifdef DEBUG
- UtilsDelay(8000000);
-#endif
-
- //UnMask Host Interrupt
- NwpUnMaskInterrupt();
-}
-
-
-/*!
- \brief Disable the Network Processor
-
- \sa sl_DeviceEnable
-
- \note belongs to \ref ported_sec
-*/
-void NwpPowerOff(void)
-{
- //Must delay 300 usec to enable the NWP to finish all sl_stop activities
- UtilsDelay(300*80/3);
-
- //Mask Host Interrupt
- NwpMaskInterrupt();
-
- //Switch to PFM Mode
- HWREG(0x4402F024) &= 0xF7FFFFFF;
-
- //sl_stop eco for PG1.32 devices
- HWREG(0x4402E16C) |= 0x2;
-
- UtilsDelay(800000);
-}
diff --git a/cc3200/simplelink/cc_pal.h b/cc3200/simplelink/cc_pal.h
deleted file mode 100644
index 1cf83e771..000000000
--- a/cc3200/simplelink/cc_pal.h
+++ /dev/null
@@ -1,202 +0,0 @@
-//*****************************************************************************
-// cc_pal.h
-//
-// Simplelink abstraction header file for CC3200
-//
-// Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
-//
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the
-// distribution.
-//
-// Neither the name of Texas Instruments Incorporated nor the names of
-// its contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//*****************************************************************************
-
-#ifndef __CC31xx_PAL_H__
-#define __CC31xx_PAL_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-
-
-/*!
- \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 givven on
- registration of a new interrupt handler
-
- \note
-*/
-
-typedef void (*SL_P_EVENT_HANDLER)(void);
-
-#define P_EVENT_HANDLER SL_P_EVENT_HANDLER
-
-/*!
- \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 simple link driver receives
- on opening the device. in systems that the spi channel is
- not implemented as part of the os device drivers, this
- parameter could be NULL.
- \param 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();
-
-void NwpPowerOnPreamble(void);
-
-void NwpPowerOff(void);
-
-void NwpPowerOn(void);
-
-
-#ifdef __cplusplus
-}
-#endif // __cplusplus
-
-
-#endif
-
diff --git a/cc3200/simplelink/oslib/osi.h b/cc3200/simplelink/oslib/osi.h
deleted file mode 100644
index 11fe61bb6..000000000
--- a/cc3200/simplelink/oslib/osi.h
+++ /dev/null
@@ -1,580 +0,0 @@
-//*****************************************************************************
-// osi.h
-//
-// MACRO and Function prototypes for TI-RTOS and Free-RTOS API calls
-//
-// Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
-//
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list zof conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the
-// distribution.
-//
-// Neither the name of Texas Instruments Incorporated nor the names of
-// its contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//*****************************************************************************
-
-#ifndef __OSI_H__
-#define __OSI_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define OSI_WAIT_FOREVER (0xFFFFFFFF)
-
-#define OSI_NO_WAIT (0)
-
-typedef enum
-{
- OSI_OK = 0,
- OSI_FAILURE = -1,
- OSI_OPERATION_FAILED = -2,
- OSI_ABORTED = -3,
- OSI_INVALID_PARAMS = -4,
- OSI_MEMORY_ALLOCATION_FAILURE = -5,
- OSI_TIMEOUT = -6,
- OSI_EVENTS_IN_USE = -7,
- OSI_EVENT_OPEARTION_FAILURE = -8
-}OsiReturnVal_e;
-
-
-//#define ENTER_CRITICAL_SECTION osi_EnterCritical()
-//#define EXIT_CRITICAL_SECTION osi_ExitCritical()
-
-typedef void* OsiMsgQ_t;
-
- /*!
- \brief type definition for a time value
-
- \note On each porting or platform the type could be whatever is needed - integer, pointer to structure etc.
-*/
-//typedef unsigned int OsiTime_t;
-typedef unsigned int OsiTime_t;
-/*!
- \brief type definition for a sync object container
-
- Sync object is object used to synchronize between two threads or thread and interrupt handler.
- One thread is waiting on the object and the other thread send a signal, which then
- release the waiting thread.
- The signal must be able to be sent from interrupt context.
- This object is generally implemented by binary semaphore or events.
-
- \note On each porting or platform the type could be whatever is needed - integer, structure etc.
-*/
-//typedef unsigned int OsiSyncObj_t;
-typedef void * OsiSyncObj_t;
-
-/*!
- \brief type definition for a locking object container
-
- Locking object are used to protect a resource from mutual accesses of two or more threads.
- The locking object should support re-entrant locks by a signal thread.
- This object is generally implemented by mutex semaphore
-
- \note On each porting or platform the type could be whatever is needed - integer, structure etc.
-*/
-//typedef unsigned int OsiLockObj_t;
-typedef void * OsiLockObj_t;
-
-/*!
- \brief type definition for a spawn entry callback
-
- the spawn mechanism enable to run a function on different context.
- This mechanism allow to transfer the execution context from interrupt context to thread context
- or changing the context from an unknown user thread to general context.
- The implementation of the spawn mechanism depends on the user's system requirements and could varies
- from implementation of serialized execution using single thread to creating thread per call
-
- \note The stack size of the execution thread must be at least of TBD bytes!
-*/
-typedef void (*P_OSI_SPAWN_ENTRY)(void* pValue);
-
-typedef void (*P_OSI_EVENT_HANDLER)(void* pValue);
-
-typedef void (*P_OSI_TASK_ENTRY)(void* pValue);
-
-typedef void (*P_OSI_INTR_ENTRY)(void);
-
-typedef void* OsiTaskHandle;
-
-/*!
- \brief This function registers an interrupt in NVIC table
-
- The sync object is used for synchronization between different thread or ISR and
- a thread.
-
- \param iIntrNum - Interrupt number to register
- \param pEntry - Pointer to the interrupt handler
-
- \return upon successful creation the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note
- \warning
-*/
-OsiReturnVal_e osi_InterruptRegister(int iIntrNum,P_OSI_INTR_ENTRY pEntry,unsigned char ucPriority);
-
-/*!
- \brief This function De-registers an interrupt in NVIC table
-
- \param iIntrNum - Interrupt number to register
- \param pEntry - Pointer to the interrupt handler
-
- \return upon successful creation the function should return Positive number
- Otherwise, a negative value indicating the error code shall be returned
- \note
- \warning
-*/
-void osi_InterruptDeRegister(int iIntrNum);
-
-
-/*!
- \brief This function creates a sync object
-
- The sync object is used for synchronization between different thread or ISR and
- a thread.
-
- \param pSyncObj - pointer to the sync object control block
-
- \return upon successful creation the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note
- \warning
-*/
-OsiReturnVal_e osi_SyncObjCreate(OsiSyncObj_t* 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
- \warning
-*/
-OsiReturnVal_e osi_SyncObjDelete(OsiSyncObj_t* pSyncObj);
-
-/*!
- \brief This function generates a sync signal for the object.
-
- All suspended threads waiting on this sync object are resumed
-
- \param pSyncObj - pointer to the sync object control block
-
- \return upon successful signalling the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note the function could be called from ISR context
- \warning
-*/
-OsiReturnVal_e osi_SyncObjSignal(OsiSyncObj_t* pSyncObj);
-
-/*!
- \brief This function generates a sync signal for the object.
- from ISR context.
-
- All suspended threads waiting on this sync object are resumed
-
- \param pSyncObj - pointer to the sync object control block
-
- \return upon successful signalling the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note the function is called from ISR context
- \warning
-*/
-OsiReturnVal_e osi_SyncObjSignalFromISR(OsiSyncObj_t* pSyncObj);
-
-/*!
- \brief This function waits for a sync signal of the specific sync object
-
- \param pSyncObj - pointer to the sync object control block
- \param Timeout - numeric value specifies the maximum number of mSec to
- stay suspended while waiting for the sync signal
- Currently, the simple link driver uses only two values:
- - OSI_WAIT_FOREVER
- - OSI_NO_WAIT
-
- \return upon successful reception of the signal within the timeout window return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note
- \warning
-*/
-OsiReturnVal_e osi_SyncObjWait(OsiSyncObj_t* pSyncObj , OsiTime_t Timeout);
-
-/*!
- \brief This function clears a sync object
-
- \param pSyncObj - pointer to the sync object control block
-
- \return upon successful clearing the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note
- \warning
-*/
-OsiReturnVal_e osi_SyncObjClear(OsiSyncObj_t* pSyncObj);
-
-/*!
- \brief This function creates a locking object.
-
- The locking object is used for protecting a shared resources between different
- threads.
-
- \param pLockObj - pointer to the locking object control block
-
- \return upon successful creation the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note
- \warning
-*/
-OsiReturnVal_e osi_LockObjCreate(OsiLockObj_t* 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
- \warning
-*/
-#define osi_LockObjDelete osi_SyncObjDelete
-
-/*!
- \brief This function locks a locking object.
-
- All other threads that call this function before this thread calls
- the osi_LockObjUnlock would be suspended
-
- \param pLockObj - pointer to the locking object control block
- \param Timeout - numeric value specifies the maximum number of mSec to
- stay suspended while waiting for the locking object
- Currently, the simple link driver uses only two values:
- - OSI_WAIT_FOREVER
- - OSI_NO_WAIT
-
-
- \return upon successful reception of the locking object the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note
- \warning
-*/
-#define osi_LockObjLock osi_SyncObjWait
-
-/*!
- \brief This function unlock a locking object.
-
- \param pLockObj - pointer to the locking object control block
-
- \return upon successful unlocking the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note
- \warning
-*/
-#define osi_LockObjUnlock osi_SyncObjSignal
-
-
-/*!
- \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
- \warning
-*/
-/*!
- \brief This function creates a Task.
-
- Creates a new Task and add it to the last of tasks that are ready to run
-
- \param pEntry - pointer to the Task Function
- \param pcName - Task Name String
- \param usStackDepth - Stack Size Stack Size in 32-bit long words
- \param pvParameters - pointer to structure to be passed to the Task Function
- \param uxPriority - Task Priority
-
- \return upon successful unlocking the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note
- \warning
-*/
-OsiReturnVal_e osi_TaskCreate(P_OSI_TASK_ENTRY pEntry,const signed char * const pcName,unsigned short usStackDepth,void *pvParameters,unsigned long uxPriority,OsiTaskHandle *pTaskHandle);
-
-/*!
- \brief This function Deletes a Task.
-
- Deletes a Task and remove it from list of running task
-
- \param pTaskHandle - Task Handle
-
- \note
- \warning
-*/
-void osi_TaskDelete(OsiTaskHandle* pTaskHandle);
-
-/*!
- \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
- \warning
-*/
-OsiReturnVal_e osi_Spawn(P_OSI_SPAWN_ENTRY pEntry , void* pValue , unsigned long flags);
-
-
-/*******************************************************************************
-
-This function creates a message queue that is typically used for inter thread
-communication.
-
-Parameters:
-
- pMsgQ - pointer to the message queue control block
- pMsgQName - pointer to the name of the message queue
- MsgSize - the size of the message.
-
- NOTICE: THE MESSGAE SIZE MUST BE SMALLER THAN 16
-
- MaxMsgs - maximum number of messages.
-
-Please note that this function allocates the entire memory required
-for the maximum number of messages (MsgSize * MaxMsgs).
-
-********************************************************************************/
-OsiReturnVal_e osi_MsgQCreate(OsiMsgQ_t* pMsgQ ,
- char* pMsgQName,
- unsigned long MsgSize,
- unsigned long MaxMsgs);
-
-/*******************************************************************************
-
-This function deletes a specific message queue.
-All threads suspended waiting for a message from this queue are resumed with
-an error return value.
-
-Parameters:
-
- pMsgQ - pointer to the message queue control block
-
-********************************************************************************/
-OsiReturnVal_e osi_MsgQDelete(OsiMsgQ_t* pMsgQ);
-
-
-/*******************************************************************************
-
-This function writes a message to a specific message queue.
-
-Notice that the message is copied to the queue from the memory area specified
-by pMsg pointer.
-
---------------------------------------------------------------------------------
-THIS FUNCTION COULD BE CALLED FROM ISR AS LONG AS THE TIMEOUT PARAMETER IS
-SET TO "OSI_NO_WAIT"
---------------------------------------------------------------------------------
-
-Parameters:
-
- pMsgQ - pointer to the message queue control block
- pMsg - pointer to the message
- Timeout - numeric value specifies the maximum number of mSec to stay
- suspended while waiting for available space for the message
-
-********************************************************************************/
-OsiReturnVal_e osi_MsgQWrite(OsiMsgQ_t* pMsgQ, void* pMsg , OsiTime_t Timeout);
-
-
-/*******************************************************************************
-
-This function retrieves a message from the specified message queue. The
-retrieved message is copied from the queue into the memory area specified by
-the pMsg pointer
-
-Parameters:
-
- pMsgQ - pointer to the message queue control block
- pMsg - pointer that specify the location where to copy the message
- Timeout - numeric value specifies the maximum number of mSec to stay
- suspended while waiting for a message to be available
-
-********************************************************************************/
-OsiReturnVal_e osi_MsgQRead(OsiMsgQ_t* pMsgQ, void* pMsg , OsiTime_t Timeout);
-
-/*!
- \brief This function starts the OS Scheduler
- \param - void
- \return - void
- \note
- \warning
-*/
-void osi_start();
-
-/*!
- \brief Allocates Memory on Heap
- \param Size - Size of the Buffer to be allocated
- \sa
- \note
- \warning
-*/
-void * mem_Malloc(unsigned long Size);
-
-
-/*!
- \brief Deallocates Memory
- \param pMem - Pointer to the Buffer to be freed
- \return void
- \sa
- \note
- \warning
-*/
-void mem_Free(void *pMem);
-
-
-/*!
- \brief Set Memory
- \param pBuf - Pointer to the Buffer
- \param Val - Value to be set
- \param Size - Size of the memory to be set
- \sa
- \note
- \warning
-*/
-void mem_set(void *pBuf,int Val,size_t Size);
-
-/*!
- \brief Copy Memory
- \param pDst - Pointer to the Destination Buffer
- \param pSrc - Pointer to the Source Buffer
- \param Size - Size of the memory to be copied
- \return void
- \note
- \warning
-*/
-void mem_copy(void *pDst, void *pSrc,size_t Size);
-
-/*!
- \brief Enter Critical Section
- \sa
- \note
- \warning
-*/
-void osi_EnterCritical(void);
-
-/*!
- \brief Exit Critical Section
- \sa
- \note
- \warning
-*/
-void osi_ExitCritical(void);
-
-/*!
- \brief This function used to save the os context before sleep
- \param void
- \return void
- \note
- \warning
-*/
-void osi_ContextSave();
-/*!
- \brief This function used to retrieve the context after sleep
- \param void
- \return void
- \note
- \warning
-*/
-void osi_ContextRestore();
-
-/*!
- \brief This function used to suspend the task for the specified number of milli secs
- \param MilliSecs - Time in millisecs to suspend the task
- \return void
- \note
- \warning
-*/
-void osi_Sleep(unsigned int MilliSecs);
-
-/*!
- \brief This function used to disable the tasks
- \param - void
- \return - void
- \note
- \warning
-*/
-void osi_TaskDisable(void);
-
-/*!
- \brief This function used to enable all tasks
- \param - void
- \return - void
- \note
- \warning
-*/
-void osi_TaskEnable(void);
-
-/*!
- \brief structure definition for simple link spawn message
-
- \note On each porting or platform the type could be whatever is needed - integer, pointer to structure etc.
-*/
-typedef struct
-{
- P_OSI_SPAWN_ENTRY pEntry;
- void* pValue;
-}tSimpleLinkSpawnMsg;
-
-/* The queue used to send message to simple link spawn task. */
-extern void* xSimpleLinkSpawnQueue;
-
-/* API for SL Task*/
-OsiReturnVal_e VStartSimpleLinkSpawnTask(unsigned long uxPriority);
-void VDeleteSimpleLinkSpawnTask( void );
-
-
-
-#ifdef __cplusplus
-}
-#endif // __cplusplus
-
-#endif
diff --git a/cc3200/simplelink/oslib/osi_freertos.c b/cc3200/simplelink/oslib/osi_freertos.c
deleted file mode 100644
index 53822add7..000000000
--- a/cc3200/simplelink/oslib/osi_freertos.c
+++ /dev/null
@@ -1,747 +0,0 @@
-//*****************************************************************************
-// osi_freertos.c
-//
-// Interface APIs for free-rtos function calls
-//
-// Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
-//
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions
-// are met:
-//
-// Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the
-// distribution.
-//
-// Neither the name of Texas Instruments Incorporated nor the names of
-// its contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-//*****************************************************************************
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "FreeRTOS.h"
-#include "task.h"
-#include "semphr.h"
-#include "portmacro.h"
-#include "osi.h"
-#include "rom_map.h"
-#include "inc/hw_types.h"
-#include "interrupt.h"
-#include "pybwdt.h"
-#include "debug.h"
-
-portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
-//Local function definition
-static void vSimpleLinkSpawnTask( void *pvParameters );
-//Queue Handler
-QueueHandle_t xSimpleLinkSpawnQueue = NULL;
-TaskHandle_t xSimpleLinkSpawnTaskHndl = NULL;
-// Queue size
-#define slQUEUE_SIZE ( 3 )
-#define SL_SPAWN_MAX_WAIT_MS ( 200 )
-
-// This is the static memory (TCB and stack) for the SL spawn task
-static StaticTask_t spawnTaskTCB __attribute__ ((section (".rtos_heap")));
-static portSTACK_TYPE spawnTaskStack[896 / sizeof(portSTACK_TYPE)] __attribute__ ((section (".rtos_heap"))) __attribute__((aligned (8)));
-
-/*!
- \brief This function registers an interrupt in NVIC table
-
- The sync object is used for synchronization between different thread or ISR and
- a thread.
-
- \param iIntrNum - Interrupt number to register
- \param pEntry - Pointer to the interrupt handler
- \param ucPriority - priority of the interrupt
-
- \return upon successful creation the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note
- \warning
-*/
-OsiReturnVal_e osi_InterruptRegister(int iIntrNum,P_OSI_INTR_ENTRY pEntry,unsigned char ucPriority)
-{
- MAP_IntRegister(iIntrNum,(void(*)(void))pEntry);
- MAP_IntPrioritySet(iIntrNum, ucPriority);
- MAP_IntEnable(iIntrNum);
- return OSI_OK;
-}
-
-/*!
- \brief This function De registers an interrupt in NVIC table
-
-
- \param iIntrNum - Interrupt number to De register
-
- \return none
- \note
- \warning
-*/
-
-void osi_InterruptDeRegister(int iIntrNum)
-{
- MAP_IntDisable(iIntrNum);
- MAP_IntUnregister(iIntrNum);
-}
-
-/*!
- \brief This function creates a sync object
-
- The sync object is used for synchronization between different thread or ISR and
- a thread.
-
- \param pSyncObj - pointer to the sync object control block
-
- \return upon successful creation the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note
- \warning
-*/
-OsiReturnVal_e osi_SyncObjCreate(OsiSyncObj_t* pSyncObj)
-{
- SemaphoreHandle_t *pl_SyncObj = (SemaphoreHandle_t *)pSyncObj;
-
- *pl_SyncObj = xSemaphoreCreateBinary();
-
- ASSERT (*pSyncObj != NULL);
-
- return OSI_OK;
-}
-
-/*!
- \brief This function deletes a sync object
-
- \param pSyncObj - pointer to the sync object control block
-
- \return upon successful deletion the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note
- \warning
-*/
-OsiReturnVal_e osi_SyncObjDelete(OsiSyncObj_t* pSyncObj)
-{
- vSemaphoreDelete(*pSyncObj );
- return OSI_OK;
-}
-
-/*!
- \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
-*/
-OsiReturnVal_e osi_SyncObjSignal(OsiSyncObj_t* pSyncObj)
-{
- xSemaphoreGive( *pSyncObj );
- return OSI_OK;
-}
-/*!
- \brief This function generates a sync signal for the object
- from ISR context.
-
- All suspended threads waiting on this sync object are resumed
-
- \param pSyncObj - pointer to the sync object control block
-
- \return upon successful signalling the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note the function is called from ISR context
- \warning
-*/
-OsiReturnVal_e osi_SyncObjSignalFromISR(OsiSyncObj_t* pSyncObj)
-{
- xHigherPriorityTaskWoken = pdFALSE;
- if(pdTRUE == xSemaphoreGiveFromISR( *pSyncObj, &xHigherPriorityTaskWoken ))
- {
- if( xHigherPriorityTaskWoken )
- {
- taskYIELD ();
- }
- }
- return OSI_OK;
-}
-
-/*!
- \brief This function waits for a sync signal of the specific sync object
-
- \param pSyncObj - pointer to the sync object control block
- \param Timeout - numeric value specifies the maximum number of mSec to
- stay suspended while waiting for the sync signal
- Currently, the simple link driver uses only two values:
- - OSI_WAIT_FOREVER
- - OSI_NO_WAIT
-
- \return upon successful reception of the signal within the timeout window return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note
- \warning
-*/
-OsiReturnVal_e osi_SyncObjWait(OsiSyncObj_t* pSyncObj , OsiTime_t Timeout)
-{
- if(pdTRUE == xSemaphoreTake( (SemaphoreHandle_t)*pSyncObj, ( TickType_t )Timeout))
- {
- return OSI_OK;
- }
- else
- {
- return OSI_OPERATION_FAILED;
- }
-}
-
-/*!
- \brief This function clears a sync object
-
- \param pSyncObj - pointer to the sync object control block
-
- \return upon successful clearing the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note
- \warning
-*/
-OsiReturnVal_e osi_SyncObjClear(OsiSyncObj_t* pSyncObj)
-{
- if (OSI_OK == osi_SyncObjWait(pSyncObj,0) )
- {
- return OSI_OK;
- }
- else
- {
- return OSI_OPERATION_FAILED;
- }
-}
-
-/*!
- \brief This function creates a locking object.
-
- The locking object is used for protecting a shared resources between different
- threads.
-
- \param pLockObj - pointer to the locking object control block
-
- \return upon successful creation the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note
- \warning
-*/
-OsiReturnVal_e osi_LockObjCreate(OsiLockObj_t* pLockObj)
-{
- SemaphoreHandle_t *pl_LockObj = (SemaphoreHandle_t *)pLockObj;
-
- vSemaphoreCreateBinary(*pl_LockObj);
-
- ASSERT (*pLockObj != NULL);
-
- return OSI_OK;
-}
-
-/*!
- \brief This function creates a Task.
-
- Creates a new Task and add it to the last of tasks that are ready to run
-
- \param pEntry - pointer to the Task Function
- \param pcName - Task Name String
- \param usStackDepth - Stack Size in bytes
- \param pvParameters - pointer to structure to be passed to the Task Function
- \param uxPriority - Task Priority
-
- \return upon successful creation the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note
- \warning
-*/
-OsiReturnVal_e osi_TaskCreate(P_OSI_TASK_ENTRY pEntry,const signed char * const pcName,
- unsigned short usStackDepth, void *pvParameters,
- unsigned long uxPriority,OsiTaskHandle* pTaskHandle)
-{
- ASSERT (pdPASS == xTaskCreate( pEntry, (char const*)pcName,
- (usStackDepth/(sizeof( portSTACK_TYPE ))),
- pvParameters,(unsigned portBASE_TYPE)uxPriority,
- (TaskHandle_t*)pTaskHandle ));
- return OSI_OK;
-}
-
-
-/*!
- \brief This function Deletes a Task.
-
- Deletes a Task and remove it from list of running task
-
- \param pTaskHandle - Task Handle
-
- \note
- \warning
-*/
-void osi_TaskDelete(OsiTaskHandle* pTaskHandle)
-{
- vTaskDelete((TaskHandle_t)*pTaskHandle);
-}
-
-
-
-/*!
- \brief This function deletes a locking object.
-
- \param pLockObj - pointer to the locking object control block
-
- \return upon successful deletion the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note
- \warning
-*/
-OsiReturnVal_e _osi_LockObjDelete(OsiLockObj_t* pLockObj)
-{
- vSemaphoreDelete((SemaphoreHandle_t)*pLockObj );
- return OSI_OK;
-}
-
-/*!
- \brief This function locks a locking object.
-
- All other threads that call this function before this thread calls
- the osi_LockObjUnlock would be suspended
-
- \param pLockObj - pointer to the locking object control block
- \param Timeout - numeric value specifies the maximum number of mSec to
- stay suspended while waiting for the locking object
- Currently, the simple link driver uses only two values:
- - OSI_WAIT_FOREVER
- - OSI_NO_WAIT
-
-
- \return upon successful reception of the locking object the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note
- \warning
-*/
-OsiReturnVal_e _osi_LockObjLock(OsiLockObj_t* pLockObj , OsiTime_t Timeout)
-{
- //Take Semaphore
- if(pdTRUE == xSemaphoreTake( *pLockObj, ( TickType_t ) Timeout ))
- {
- return OSI_OK;
- }
- else
- {
- return OSI_OPERATION_FAILED;
- }
-}
-
-/*!
- \brief This function unlock a locking object.
-
- \param pLockObj - pointer to the locking object control block
-
- \return upon successful unlocking the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note
- \warning
-*/
-OsiReturnVal_e _osi_LockObjUnlock(OsiLockObj_t* pLockObj)
-{
- //Release Semaphore
- if(pdTRUE == xSemaphoreGive( *pLockObj ))
- {
- return OSI_OK;
- }
- else
- {
- return OSI_OPERATION_FAILED;
- }
-}
-
-
-/*!
- \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
- \warning
-*/
-
-OsiReturnVal_e osi_Spawn(P_OSI_SPAWN_ENTRY pEntry , void* pValue , unsigned long flags)
-{
-
- tSimpleLinkSpawnMsg Msg;
- Msg.pEntry = pEntry;
- Msg.pValue = pValue;
- xHigherPriorityTaskWoken = pdFALSE;
-
- if(pdTRUE == xQueueSendFromISR( xSimpleLinkSpawnQueue, &Msg, &xHigherPriorityTaskWoken ))
- {
- if( xHigherPriorityTaskWoken )
- {
- taskYIELD ();
- }
- return OSI_OK;
- }
- return OSI_OPERATION_FAILED;
-}
-
-
-/*!
- \brief This is the simplelink spawn task to call SL callback from a different context
-
- \param pvParameters - pointer to the task parameter
-
- \return void
- \note
- \warning
-*/
-void vSimpleLinkSpawnTask(void *pvParameters)
-{
- tSimpleLinkSpawnMsg Msg;
- portBASE_TYPE ret;
-
- for(;;)
- {
- ret = xQueueReceive( xSimpleLinkSpawnQueue, &Msg, SL_SPAWN_MAX_WAIT_MS);
- if(ret == pdPASS)
- {
- Msg.pEntry(Msg.pValue);
- }
- // set the alive flag for the wdt
- pybwdt_sl_alive();
- }
-}
-
-/*!
- \brief This is the API to create SL spawn task and create the SL queue
-
- \param uxPriority - task priority
-
- \return void
- \note
- \warning
-*/
-__attribute__ ((section (".boot")))
-OsiReturnVal_e VStartSimpleLinkSpawnTask(unsigned portBASE_TYPE uxPriority)
-{
- xSimpleLinkSpawnQueue = xQueueCreate( slQUEUE_SIZE, sizeof( tSimpleLinkSpawnMsg ) );
- ASSERT (xSimpleLinkSpawnQueue != NULL);
-
- /*
- // This is the original code to create a task dynamically
- ASSERT (pdPASS == xTaskCreate( vSimpleLinkSpawnTask, ( portCHAR * ) "SLSPAWN",\
- 896 / sizeof(portSTACK_TYPE), NULL, uxPriority, &xSimpleLinkSpawnTaskHndl ));
- */
-
- // This code creates the task using static memory for the TCB and stack
- xSimpleLinkSpawnTaskHndl = xTaskCreateStatic(
- vSimpleLinkSpawnTask, ( portCHAR * ) "SLSPAWN",
- 896 / sizeof(portSTACK_TYPE), NULL, uxPriority,
- spawnTaskStack, &spawnTaskTCB);
-
- ASSERT(xSimpleLinkSpawnTaskHndl != NULL);
-
- return OSI_OK;
-}
-
-/*!
- \brief This is the API to delete SL spawn task and delete the SL queue
-
- \param none
-
- \return void
- \note
- \warning
-*/
-void VDeleteSimpleLinkSpawnTask( void )
-{
- if(xSimpleLinkSpawnTaskHndl)
- {
- vTaskDelete( xSimpleLinkSpawnTaskHndl );
- xSimpleLinkSpawnTaskHndl = 0;
- }
-
- if(xSimpleLinkSpawnQueue)
- {
- vQueueDelete( xSimpleLinkSpawnQueue );
- xSimpleLinkSpawnQueue = 0;
- }
-}
-
-/*!
- \brief This function is used to create the MsgQ
-
- \param pMsgQ - pointer to the message queue
- \param pMsgQName - msg queue name
- \param MsgSize - size of message on the queue
- \param MaxMsgs - max. number of msgs that the queue can hold
-
- \return - OsiReturnVal_e
- \note
- \warning
-*/
-OsiReturnVal_e osi_MsgQCreate(OsiMsgQ_t* pMsgQ ,
- char* pMsgQName,
- unsigned long MsgSize,
- unsigned long MaxMsgs)
-{
- QueueHandle_t handle;
-
- //Create Queue
- handle = xQueueCreate( MaxMsgs, MsgSize );
- ASSERT (handle != NULL);
-
- *pMsgQ = (OsiMsgQ_t)handle;
- return OSI_OK;
-}
-/*!
- \brief This function is used to delete the MsgQ
-
- \param pMsgQ - pointer to the message queue
-
- \return - OsiReturnVal_e
- \note
- \warning
-*/
-OsiReturnVal_e osi_MsgQDelete(OsiMsgQ_t* pMsgQ)
-{
- vQueueDelete((QueueHandle_t) *pMsgQ );
- return OSI_OK;
-}
-/*!
- \brief This function is used to write data to the MsgQ
-
- \param pMsgQ - pointer to the message queue
- \param pMsg - pointer to the Msg strut to read into
- \param Timeout - timeout to wait for the Msg to be available
-
- \return - OsiReturnVal_e
- \note
- \warning
-*/
-
-OsiReturnVal_e osi_MsgQWrite(OsiMsgQ_t* pMsgQ, void* pMsg , OsiTime_t Timeout)
-{
- xHigherPriorityTaskWoken = pdFALSE;
- if(pdPASS == xQueueSendFromISR((QueueHandle_t) *pMsgQ, pMsg, &xHigherPriorityTaskWoken ))
- {
- taskYIELD ();
- return OSI_OK;
- }
- else
- {
- return OSI_OPERATION_FAILED;
- }
-}
-/*!
- \brief This function is used to read data from the MsgQ
-
- \param pMsgQ - pointer to the message queue
- \param pMsg - pointer to the Msg strut to read into
- \param Timeout - timeout to wait for the Msg to be available
-
- \return - OsiReturnVal_e
- \note
- \warning
-*/
-
-OsiReturnVal_e osi_MsgQRead(OsiMsgQ_t* pMsgQ, void* pMsg , OsiTime_t Timeout)
-{
- //Receive Item from Queue
- if( pdTRUE == xQueueReceive((QueueHandle_t)*pMsgQ,pMsg,Timeout) )
- {
- return OSI_OK;
- }
- else
- {
- return OSI_OPERATION_FAILED;
- }
-}
-
-/*!
- \brief This function to call the memory de-allocation function of the FREERTOS
-
- \param Size - size of memory to alloc in bytes
-
- \return - void *
- \note
- \warning
-*/
-
-void * mem_Malloc(unsigned long Size)
-{
- return ( void * ) pvPortMalloc( (size_t)Size );
-}
-
-/*!
- \brief This function to call the memory de-allocation function of the FREERTOS
-
- \param pMem - pointer to the memory which needs to be freed
-
- \return - void
- \note
- \warning
-*/
-void mem_Free(void *pMem)
-{
- vPortFree( pMem );
-}
-
-/*!
- \brief This function call the memset function
- \param pBuf - pointer to the memory to be fill
- \param Val - Value to be fill
- \param Size - Size of the memory which needs to be fill
- \return - void
- \note
- \warning
-*/
-
-void mem_set(void *pBuf,int Val,size_t Size)
-{
- memset( pBuf,Val,Size);
-}
-
-/*!
- \brief This function call the memcopy function
- \param pDst - pointer to the destination
- \param pSrc - pointer to the source
- \param Size - Size of the memory which needs to be copy
-
- \return - void
- \note
- \warning
-*/
-void mem_copy(void *pDst, void *pSrc,size_t Size)
-{
- memcpy(pDst,pSrc,Size);
-}
-
-
-/*!
- \brief This function use to entering into critical section
- \param void
- \return - void
- \note
- \warning
-*/
-
-void osi_EnterCritical(void)
-{
- vPortEnterCritical();
-}
-
-/*!
- \brief This function use to exit critical section
- \param void
- \return - void
- \note
- \warning
-*/
-
-void osi_ExitCritical(void)
-{
- vPortExitCritical();
-}
-/*!
- \brief This function used to start the scheduler
- \param void
- \return - void
- \note
- \warning
-*/
-__attribute__ ((section (".boot")))
-void osi_start()
-{
- vTaskStartScheduler();
-}
-/*!
- \brief This function used to suspend the task for the specified number of milli secs
- \param MilliSecs - Time in millisecs to suspend the task
- \return - void
- \note
- \warning
-*/
-void osi_Sleep(unsigned int MilliSecs)
-{
- vTaskDelay(MilliSecs);
-}
-
-
-/*!
- \brief This function used to disable the tasks
- \param - void
- \return - Key with the suspended tasks
- \note
- \warning
-*/
-void osi_TaskDisable(void)
-{
- vTaskSuspendAll();
-}
-
-
-/*!
- \brief This function used to resume all the tasks
- \param key - returned from suspend tasks
- \return - void
- \note
- \warning
-*/
-void osi_TaskEnable(void)
-{
- xTaskResumeAll();
-}
-
-/*!
- \brief This function used to save the OS context before sleep
- \param void
- \return - void
- \note
- \warning
-*/
-void osi_ContextSave()
-{
-
-}
-/*!
- \brief This function used to restore the OS context after sleep
- \param void
- \return - void
- \note
- \warning
-*/
-void osi_ContextRestore()
-{
-
-}
diff --git a/cc3200/simplelink/user.h b/cc3200/simplelink/user.h
deleted file mode 100644
index d3f6d4adf..000000000
--- a/cc3200/simplelink/user.h
+++ /dev/null
@@ -1,1063 +0,0 @@
-/*
- * user.h - CC31xx/CC32xx Host Driver Implementation
- *
- * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
- *
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
-*/
-
-
-
-#ifndef __USER_H__
-#define __USER_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-
-
-
-/*!
- ******************************************************************************
-
- \defgroup porting_user_include Porting - User Include Files
-
- This section IS NOT REQUIRED in case user provided primitives are handled
- in makefiles or project configurations (IDE)
-
- PORTING ACTION:
- - Include all required header files for the definition of:
- -# Transport layer library API (e.g. SPI, UART)
- -# OS primitives definitions (e.g. Task spawn, Semaphores)
- -# Memory management primitives (e.g. alloc, free)
-
- ******************************************************************************
- */
-
-#include <string.h>
-#include "cc_pal.h"
-#include "debug.h"
-
-/*!
- \def MAX_CONCURRENT_ACTIONS
-
- \brief Defines the maximum number of concurrent action in the system
- Min:1 , Max: 32
-
- Actions which has async events as return, can be
-
- \sa
-
- \note In case there are not enough resources for the actions needed in the system,
- error is received: POOL_IS_EMPTY
- one option is to increase MAX_CONCURRENT_ACTIONS
- (improves performance but results in memory consumption)
- Other option is to call the API later (decrease performance)
-
- \warning In case of setting to one, recommend to use non-blocking recv\recvfrom to allow
- multiple socket recv
-*/
-#define MAX_CONCURRENT_ACTIONS 10
-/*!
- \def CPU_FREQ_IN_MHZ
- \brief Defines CPU frequency for Host side, for better accuracy of busy loops, if any
- \sa
- \note
-
- \warning If not set the default CPU frequency is set to 200MHz
- This option will be deprecated in future release
-*/
-
-#define CPU_FREQ_IN_MHZ 80
-
-
-/*!
- ******************************************************************************
-
- \defgroup porting_capabilities Porting - 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_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 proting_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_STD_BSD_API_NAMING
-
- \brief Defines whether SimpleLink driver should expose standard BSD
- APIs or not
-
- When defined, the SimpleLink driver in addtion to its alternative
- BSD APIs expose also standard BSD APIs.
- Stadrad BSD API includs the following functions:
- socket , close , accept , bind , listen , connect , select ,
- setsockopt , getsockopt , recv , recvfrom , write , send , sendto ,
- gethostbyname
-
- \sa
-
- \note belongs to \ref porting_sec
-
- \warning
-*/
-/* #define SL_INC_STD_BSD_API_NAMING */
-
-
-/*!
- \brief Defines whether to include extended API in SimpleLink driver
- or not
-
- When defined, the SimpleLink driver will include also all
- exteded API of the included packages
-
- \sa ext_api
-
- \note belongs to \ref porting_sec
-
- \warning
-*/
-#define SL_INC_EXT_API
-
-/*!
- \brief Defines whether to include WLAN package in SimpleLink driver
- or not
-
- When defined, the SimpleLink driver will include also
- the WLAN package
-
- \sa
-
- \note belongs to \ref porting_sec
-
- \warning
-*/
-#define SL_INC_WLAN_PKG
-
-/*!
- \brief Defines whether to include SOCKET package in SimpleLink
- driver or not
-
- When defined, the SimpleLink driver will include also
- the SOCKET package
-
- \sa
-
- \note belongs to \ref porting_sec
-
- \warning
-*/
-#define SL_INC_SOCKET_PKG
-
-/*!
- \brief Defines whether to include NET_APP package in SimpleLink
- driver or not
-
- When defined, the SimpleLink driver will include also the
- NET_APP package
-
- \sa
-
- \note belongs to \ref porting_sec
-
- \warning
-*/
-#define SL_INC_NET_APP_PKG
-
-/*!
- \brief Defines whether to include NET_CFG package in SimpleLink
- driver or not
-
- When defined, the SimpleLink driver will include also
- the NET_CFG package
-
- \sa
-
- \note belongs to \ref porting_sec
-
- \warning
-*/
-#define SL_INC_NET_CFG_PKG
-
-/*!
- \brief Defines whether to include NVMEM package in SimpleLink
- driver or not
-
- When defined, the SimpleLink driver will include also the
- NVMEM package
-
- \sa
-
- \note belongs to \ref porting_sec
-
- \warning
-*/
-#define SL_INC_NVMEM_PKG
-
-/*!
- \brief Defines whether to include socket server side APIs
- in SimpleLink driver or not
-
- When defined, the SimpleLink driver will include also socket
- server side APIs
-
- \sa server_side
-
- \note
-
- \warning
-*/
-#define SL_INC_SOCK_SERVER_SIDE_API
-
-/*!
- \brief Defines whether to include socket client side APIs in SimpleLink
- driver or not
-
- When defined, the SimpleLink driver will include also socket
- client side APIs
-
- \sa client_side
-
- \note belongs to \ref porting_sec
-
- \warning
-*/
-#define SL_INC_SOCK_CLIENT_SIDE_API
-
-/*!
- \brief Defines whether to include socket receive APIs in SimpleLink
- driver or not
-
- When defined, the SimpleLink driver will include also socket
- receive side APIs
-
- \sa recv_api
-
- \note belongs to \ref porting_sec
-
- \warning
-*/
-#define SL_INC_SOCK_RECV_API
-
-/*!
- \brief Defines whether to include socket send APIs in SimpleLink
- driver or not
-
- When defined, the SimpleLink driver will include also socket
- send side APIs
-
- \sa send_api
-
- \note belongs to \ref porting_sec
-
- \warning
-*/
-#define SL_INC_SOCK_SEND_API
-
-/*!
-
- Close the Doxygen group.
- @}
-
- */
-
-
-/*!
- ******************************************************************************
-
- \defgroup ported_enable_device Ported on CC32XX - 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 ported_sec
-
-*/
-#ifdef DEBUG
-#define sl_DeviceEnablePreamble() NwpPowerOnPreamble()
-#else
-#define sl_DeviceEnablePreamble()
-#endif
-
-/*!
- \brief Enable the Network Processor
-
- \sa sl_DeviceDisable
-
- \note belongs to \ref ported_sec
-
-*/
-#define sl_DeviceEnable() NwpPowerOn()
-
-/*!
- \brief Disable the Network Processor
-
- \sa sl_DeviceEnable
-
- \note belongs to \ref ported_sec
-*/
-#define sl_DeviceDisable() NwpPowerOff()
-
-/*!
-
- Close the Doxygen group.
- @}
-
- */
-
-/*!
- ******************************************************************************
-
- \defgroup ported_interface Ported on CC32XX - Communication Interface
-
- The simple link device can work with different communication
- channels (e.g. spi/uart). Texas Instruments provides single driver
- that can work with all these types. This section bind between the
- physical communication interface channel and the SimpleLink driver
-
-
- \note Correct and efficient implementation of this driver is critical
- for the performances of the SimpleLink device on this platform.
-
-
- PORTING ACTION:
- - None
-
- @{
-
- ******************************************************************************
-*/
-
-#define _SlFd_t 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 simple link driver receives
- on opening the driver (sl_Start).
- In systems that the spi channel is not implemented as
- part of the os device drivers, this parameter could be NULL.
-
- \param flags - optional flags parameters for future use
-
- \return upon successful completion, the function shall open the channel
- and return a non-negative integer representing the file descriptor.
- Otherwise, -1 shall be returned
-
- \sa sl_IfClose , sl_IfRead , sl_IfWrite
-
- \note The prototype of the function is as follow:
- Fd_t xxx_IfOpen(char* pIfName , unsigned long flags);
-
- \note belongs to \ref ported_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 ported_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 ported_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 ported_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 ported_sec
-
- \warning
-*/
-#define sl_IfRegIntHdlr(InterruptHdl , pValue) NwpRegisterInterruptHandler(InterruptHdl , pValue)
-
-/*!
- \brief Masks the Host IRQ
-
- \sa sl_IfUnMaskIntHdlr
-
-
-
- \note belongs to \ref ported_sec
-
- \warning
-*/
-
-
-#define sl_IfMaskIntHdlr() NwpMaskInterrupt()
-
-/*!
- \brief Unmasks the Host IRQ
-
- \sa sl_IfMaskIntHdlr
-
-
-
- \note belongs to \ref ported_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 ported_sec
-
- \warning
-*/
-/* #define SL_START_WRITE_STAT */
-
-
-/*!
-
- Close the Doxygen group.
- @}
-
-*/
-
-/*!
- ******************************************************************************
-
- \defgroup ported_os Ported on CC32XX - Operating System
-
- The simple link driver can run on multi-threaded environment as well
- as non-os environment (mail loop)
-
- This section IS NOT REQUIRED in case you are working on non-os environment.
-
- If you choose to work in multi-threaded environment under any operating system
- you will have to provide some basic adaptation routines to allow the driver
- to protect access to resources from different threads (locking object) and
- to allow synchronization between threads (sync objects).
-
- PORTING ACTION:
- -# Uncomment SL_PLATFORM_MULTI_THREADED define
- -# Bind locking object routines
- -# Bind synchronization object routines
- -# Optional - Bind spawn thread routine
-
- @{
-
- ******************************************************************************
-*/
-
-#define SL_PLATFORM_MULTI_THREADED
-
-
-#ifdef SL_PLATFORM_MULTI_THREADED
-#include "osi.h"
-
-
-/*!
- \brief
- \sa
- \note belongs to \ref ported_sec
- \warning
-*/
-#define SL_OS_RET_CODE_OK ((int)OSI_OK)
-
-/*!
- \brief
- \sa
- \note belongs to \ref ported_sec
- \warning
-*/
-#define SL_OS_WAIT_FOREVER ((OsiTime_t)OSI_WAIT_FOREVER)
-
-/*!
- \brief
- \sa
- \note belongs to \ref ported_sec
- \warning
-*/
-#define SL_OS_NO_WAIT ((OsiTime_t)OSI_NO_WAIT)
-
-/*!
- \brief type definition for a time value
-
- \note On each porting or platform the type could be whatever is needed - integer, pointer to structure etc.
-
- \note belongs to \ref ported_sec
-*/
-#define _SlTime_t OsiTime_t
-
-/*!
- \brief type definition for a sync object container
-
- Sync object is object used to synchronize between two threads or thread and interrupt handler.
- One thread is waiting on the object and the other thread send a signal, which then
- release the waiting thread.
- The signal must be able to be sent from interrupt context.
- This object is generally implemented by binary semaphore or events.
-
- \note On each porting or platform the type could be whatever is needed - integer, structure etc.
-
- \note belongs to \ref ported_sec
-*/
-typedef OsiSyncObj_t _SlSyncObj_t;
-
-
-/*!
- \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 ported_sec
- \warning
-*/
-#define sl_SyncObjCreate(pSyncObj,pName) osi_SyncObjCreate(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 ported_sec
- \warning
-*/
-#define sl_SyncObjDelete(pSyncObj) osi_SyncObjDelete(pSyncObj)
-
-
-/*!
- \brief This function generates a sync signal for the object.
-
- All suspended threads waiting on this sync object are resumed
-
- \param pSyncObj - pointer to the sync object control block
-
- \return upon successful 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) osi_SyncObjSignal(pSyncObj)
-
-/*!
- \brief This function generates a sync signal for the object from Interrupt
-
- This is for RTOS that should signal from IRQ using a dedicated API
-
- \param pSyncObj - pointer to the sync object control block
-
- \return upon successful 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) osi_SyncObjSignalFromISR(pSyncObj)
-
-/*!
- \brief This function waits for a sync signal of the specific sync object
-
- \param pSyncObj - pointer to the sync object control block
- \param Timeout - numeric value specifies the maximum number of mSec to
- stay suspended while waiting for the sync signal
- Currently, the simple link driver uses only two values:
- - OSI_WAIT_FOREVER
- - OSI_NO_WAIT
-
- \return upon successful reception of the signal within the timeout window return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note belongs to \ref ported_sec
- \warning
-*/
-#define sl_SyncObjWait(pSyncObj,Timeout) osi_SyncObjWait(pSyncObj,Timeout)
-
-/*!
- \brief type definition for a locking object container
-
- Locking object are used to protect a resource from mutual accesses of two or more threads.
- The locking object should suppurt reentrant locks by a signal thread.
- This object is generally implemented by mutex semaphore
-
- \note On each porting or platform the type could be whatever is needed - integer, structure etc.
- \note belongs to \ref ported_sec
-*/
-typedef OsiLockObj_t _SlLockObj_t;
-
-/*!
- \brief This function creates a locking object.
-
- The locking object is used for protecting a shared resources between different
- threads.
-
- \param pLockObj - pointer to the locking object control block
-
- \return upon successful creation the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note belongs to \ref ported_sec
- \warning
-*/
-#define sl_LockObjCreate(pLockObj,pName) osi_LockObjCreate(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 ported_sec
- \warning
-*/
-#define sl_LockObjDelete(pLockObj) osi_LockObjDelete(pLockObj)
-
-/*!
- \brief This function locks a locking object.
-
- All other threads that call this function before this thread calls
- the osi_LockObjUnlock would be suspended
-
- \param pLockObj - pointer to the locking object control block
- \param Timeout - numeric value specifies the maximum number of mSec to
- stay suspended while waiting for the locking object
- Currently, the simple link driver uses only two values:
- - OSI_WAIT_FOREVER
- - OSI_NO_WAIT
-
-
- \return upon successful reception of the locking object the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note belongs to \ref ported_sec
- \warning
-*/
-#define sl_LockObjLock(pLockObj,Timeout) osi_LockObjLock(pLockObj,Timeout)
-
-/*!
- \brief This function unlock a locking object.
-
- \param pLockObj - pointer to the locking object control block
-
- \return upon successful unlocking the function should return 0
- Otherwise, a negative value indicating the error code shall be returned
- \note belongs to \ref ported_sec
- \warning
-*/
-#define sl_LockObjUnlock(pLockObj) osi_LockObjUnlock(pLockObj)
-
-#endif
-/*!
- \brief This function call the pEntry callback from a different context
-
- \param pEntry - pointer to the entry callback function
-
- \param pValue - pointer to any type of memory structure that would be
- passed to pEntry callback from the execution thread.
-
- \param flags - execution flags - reserved for future usage
-
- \return upon successful registration of the spawn the function should return 0
- (the function is not blocked till the end of the execution of the function
- and could be returned before the execution is actually completed)
- Otherwise, a negative value indicating the error code shall be returned
- \note belongs to \ref ported_sec
- \warning
-*/
-#define SL_PLATFORM_EXTERNAL_SPAWN
-
-#ifdef SL_PLATFORM_EXTERNAL_SPAWN
-#define sl_Spawn(pEntry,pValue,flags) osi_Spawn(pEntry,pValue,flags)
-#endif
-
-/*!
-
- Close the Doxygen group.
- @}
-
- */
-/*!
- ******************************************************************************
-
- \defgroup porting_mem_mgm Porting - Memory Management
-
- This section declare in which memory management model the SimpleLink driver
- will run:
- -# Static
- -# Dynamic
-
- This section IS NOT REQUIRED in case Static model is selected.
-
- The default memory model is Static
-
- PORTING ACTION:
- - If dynamic model is selected, define the alloc and free functions.
-
- @{
-
- *****************************************************************************
-*/
-
-/*!
- \brief Defines whether the SimpleLink driver is working in dynamic
- memory model or not
-
- When defined, the SimpleLink driver use dynamic allocations
- if dynamic allocation is selected malloc and free functions
- must be retrieved
-
- \sa
-
- \note belongs to \ref porting_sec
-
- \warning
-*/
-
-#define SL_MEMORY_MGMT_DYNAMIC 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 ported_sec
- \warning
-*/
-#define sl_Malloc(Size) mem_Malloc(Size)
-
-/*!
- \brief
- \sa
- \note belongs to \ref ported_sec
- \warning
-*/
-#define sl_Free(pMem) mem_Free(pMem)
-#else
-#include <stdlib.h>
-/*!
- \brief
- \sa
- \note belongs to \ref ported_sec
- \warning
-*/
-#define sl_Malloc(Size) malloc(Size)
-
-/*!
- \brief
- \sa
- \note belongs to \ref ported_sec
- \warning
-*/
-#define sl_Free(pMem) free(pMem)
-#endif
-#endif
-/*!
-
- Close the Doxygen group.
- @}
-
- */
-
-
-/*!
- ******************************************************************************
-
- \defgroup porting_events Porting - Event Handlers
-
- This section includes the asynchronous event handlers routines
-
- PORTING ACTION:
- -Uncomment the required handler and define your routine as the value
- of this handler
-
- @{
-
- ******************************************************************************
- */
-
-/*!
- \brief
-
- \sa
-
- \note belongs to \ref porting_sec
-
- \warning
-*/
-
-#define sl_GeneralEvtHdlr SimpleLinkGeneralEventHandler
-
-
-/*!
- \brief An event handler for WLAN connection or disconnection indication
- This event handles async WLAN events.
- Possible events are:
- SL_WLAN_CONNECT_EVENT - indicates WLAN is connected
- SL_WLAN_DISCONNECT_EVENT - indicates WLAN is disconnected
- \sa
-
- \note belongs to \ref porting_sec
-
- \warning
-*/
-
-#define sl_WlanEvtHdlr SimpleLinkWlanEventHandler
-
-
-/*!
- \brief An event handler for IP address asynchronous event. Usually accepted after new WLAN connection.
- This event handles networking events.
- Possible events are:
- SL_NETAPP_IPV4_ACQUIRED - IP address was acquired (DHCP or Static)
-
- \sa
-
- \note belongs to \ref porting_sec
-
- \warning
-*/
-
-#define sl_NetAppEvtHdlr SimpleLinkNetAppEventHandler
-
-/*!
- \brief A callback for HTTP server events.
- Possible events are:
- SL_NETAPP_HTTPGETTOKENVALUE - NWP requests to get the value of a specific token
- SL_NETAPP_HTTPPOSTTOKENVALUE - NWP post to the host a new value for a specific token
-
- \param pServerEvent - Contains the relevant event information (SL_NETAPP_HTTPGETTOKENVALUE or SL_NETAPP_HTTPPOSTTOKENVALUE)
-
- \param pServerResponse - Should be filled by the user with the relevant response information (i.e SL_NETAPP_HTTPSETTOKENVALUE as a response to SL_NETAPP_HTTPGETTOKENVALUE event)
-
- \sa
-
- \note belongs to \ref porting_sec
-
- \warning
-*/
-
-#define sl_HttpServerCallback SimpleLinkHttpServerCallback
-/*!
- \brief
-
- \sa
-
- \note belongs to \ref porting_sec
-
- \warning
-*/
-
-#define sl_SockEvtHdlr SimpleLinkSockEventHandler
-
-
-
-#define _SL_USER_TYPES
-#define _u8 unsigned char
-#define _i8 signed char
-
-#define _u16 unsigned short
-#define _i16 signed short
-
-#define _u32 unsigned int
-#define _i32 signed int
-#define _volatile volatile
-#define _const const
-
-
-
-/*!
-
- Close the Doxygen group.
- @}
-
- */
-
-
-#ifdef __cplusplus
-}
-#endif // __cplusplus
-
-#endif // __USER_H__