drivers: Update CC3100 driver library to SDK release version 1.1.0.

This commit is contained in:
danicampora 2015-03-15 11:45:01 +01:00
parent c292632b59
commit 2b8a718d73
21 changed files with 2317 additions and 1360 deletions

View File

@ -34,14 +34,16 @@
*
*/
#ifndef __DEVICE_H__
#define __DEVICE_H__
/*****************************************************************************/
/* Include files */
/*****************************************************************************/
#include "simplelink.h"
#ifndef __DEVICE_H__
#define __DEVICE_H__
#ifdef __cplusplus
extern "C" {
#endif
@ -79,6 +81,10 @@ extern "C" {
/* User supplied invalid parameter */
#define SL_INVALPARAM (-2003)
/* Failed to open interface */
#define SL_BAD_INTERFACE (-2004)
/* End of SL internal Error codes */
@ -171,6 +177,8 @@ typedef enum
#define SL_WLAN_CONNECTION_FAILED_EVENT (9)
/* SL_EVENT_CLASS_DEVICE user events */
#define SL_DEVICE_FATAL_ERROR_EVENT (1)
#define SL_DEVICE_ABORT_ERROR_EVENT (2)
/* SL_EVENT_CLASS_BSD user events */
#define SL_SOCKET_TX_FAILED_EVENT (1)
#define SL_SOCKET_ASYNC_EVENT (2)
@ -228,6 +236,8 @@ typedef enum
/* Structure/Enum declarations */
/*****************************************************************************/
#define ROLE_UNKNOWN_ERR (-1)
#ifdef SL_IF_TYPE_UART
typedef struct
{
@ -252,6 +262,14 @@ typedef struct
_u16 Padding;
}SlVersionFull;
typedef struct
{
_u32 AbortType;
_u32 AbortData;
}sl_DeviceReportAbort;
typedef struct
{
_i8 status;
@ -261,6 +279,7 @@ typedef struct
typedef union
{
sl_DeviceReport deviceEvent;
sl_DeviceReportAbort deviceReport;
} _SlDeviceEventData_u;
typedef struct
@ -376,7 +395,7 @@ _i16 sl_Start(const void* pIfHdl, _i8* pDevName, const P_INIT_CALLBACK pInitCal
\warning
*/
#if _SL_INCLUDE_FUNC(sl_Stop)
_i16 sl_Stop(_u16 timeout);
_i16 sl_Stop(const _u16 timeout);
#endif
@ -399,7 +418,7 @@ _i16 sl_Stop(_u16 timeout);
Setting device time and date example:
SlDateTime_t dateTime= {0};
dateTime.sl_tm_day = (_u32)23; // Day of month (DD format) range 1-13
dateTime.sl_tm_day = (_u32)23; // Day of month (DD format) range 1-31
dateTime.sl_tm_mon = (_u32)6; // Month (MM format) in the range of 1-12
dateTime.sl_tm_year = (_u32)2014; // Year (YYYY format)
dateTime.sl_tm_hour = (_u32)17; // Hours in the range of 0-23
@ -413,7 +432,7 @@ _i16 sl_Stop(_u16 timeout);
\endcode
*/
#if _SL_INCLUDE_FUNC(sl_DevSet)
_i32 sl_DevSet(_u8 DeviceSetId ,_u8 Option,_u8 ConfigLen, _u8 *pValues);
_i32 sl_DevSet(const _u8 DeviceSetId ,const _u8 Option,const _u8 ConfigLen,const _u8 *pValues);
#endif
/*!
@ -446,9 +465,11 @@ _i32 sl_DevSet(_u8 DeviceSetId ,_u8 Option,_u8 ConfigLen, _u8 *pValues);
_u8 pConfigOpt;
_u8 pConfigLen;
pConfigOpt = SL_EVENT_CLASS_WLAN;
pConfigLen = sizeof(_u32);
sl_DevGet(SL_DEVICE_STATUS,&pConfigOpt,&pConfigLen,(_u8 *)(&statusWlan));
Example for getting version:
SlVersionFull ver;
pConfigLen = sizeof(ver);
pConfigOpt = SL_DEVICE_GENERAL_VERSION;
sl_DevGet(SL_DEVICE_GENERAL_CONFIGURATION,&pConfigOpt,&pConfigLen,(_u8 *)(&ver));
printf("CHIP %d\nMAC 31.%d.%d.%d.%d\nPHY %d.%d.%d.%d\nNWP %d.%d.%d.%d\nROM %d\nHOST %d.%d.%d.%d\n",
@ -475,7 +496,7 @@ _i32 sl_DevSet(_u8 DeviceSetId ,_u8 Option,_u8 ConfigLen, _u8 *pValues);
\endcode
*/
#if _SL_INCLUDE_FUNC(sl_DevGet)
_i32 sl_DevGet(_u8 DeviceGetId, _u8 *pOption,_u8 *pConfigLen, _u8 *pValues);
_i32 sl_DevGet(const _u8 DeviceGetId,_u8 *pOption,_u8 *pConfigLen, _u8 *pValues);
#endif
@ -527,7 +548,7 @@ _i32 sl_DevGet(_u8 DeviceGetId, _u8 *pOption,_u8 *pConfigLen, _u8 *pValues);
\endcode
*/
#if _SL_INCLUDE_FUNC(sl_EventMaskSet)
_i16 sl_EventMaskSet(_u8 EventClass , _u32 Mask);
_i16 sl_EventMaskSet(const _u8 EventClass ,const _u32 Mask);
#endif
/*!
@ -567,7 +588,7 @@ _i16 sl_EventMaskSet(_u8 EventClass , _u32 Mask);
\endcode
*/
#if _SL_INCLUDE_FUNC(sl_EventMaskGet)
_i16 sl_EventMaskGet(_u8 EventClass, _u32 *pMask);
_i16 sl_EventMaskGet(const _u8 EventClass,_u32 *pMask);
#endif

View File

@ -61,8 +61,8 @@ typedef struct
typedef struct
{
_u16 TxPayloadLen;
_u16 RxPayloadLen;
_u16 ActualRxPayloadLen;
_i16 RxPayloadLen;
_i16 ActualRxPayloadLen;
_u8 *pTxPayload;
_u8 *pRxPayload;
}_SlCmdExt_t;
@ -97,12 +97,20 @@ typedef enum
SOCKET_6,
SOCKET_7,
MAX_SOCKET_ENUM_IDX,
#ifndef SL_TINY_EXT
ACCEPT_ID = MAX_SOCKET_ENUM_IDX,
CONNECT_ID,
#else
CONNECT_ID = MAX_SOCKET_ENUM_IDX,
#endif
#ifndef SL_TINY_EXT
SELECT_ID,
#endif
GETHOSYBYNAME_ID,
#ifndef SL_TINY_EXT
GETHOSYBYSERVICE_ID,
PING_ID,
#endif
START_STOP_ID,
RECV_ID
}_SlActionID_e;
@ -166,21 +174,18 @@ typedef struct
_SlSyncObj_t CmdSyncObj;
_u8 IsCmdRespWaited;
_SlFlowContCB_t FlowContCB;
_SlFlowContCB_t FlowContCB;
_u8 TxSeqNum;
_volatile _u8 RxIrqCnt;
_u8 RxDoneCnt;
_u8 SocketNonBlocking;
_u8 SocketTXFailure;
_u8 RelayFlagsViaRxPayload;
/* for stack reduction the parameters are globals */
_SlFunctionParams_t FunctionParams;
_u8 ActionIndex;
}_SlDriverCb_t;
extern _volatile _u8 RxIrqCnt;
extern _SlDriverCb_t* g_pCB;
extern P_SL_DEV_PING_CALLBACK pPingCallBackFunc;
@ -195,25 +200,47 @@ extern _SlReturnVal_t _SlDrvCmdOp(_SlCmdCtrl_t *pCmdCtrl , void* pTxRxDescBuff
extern _SlReturnVal_t _SlDrvCmdSend(_SlCmdCtrl_t *pCmdCtrl , void* pTxRxDescBuff , _SlCmdExt_t* pCmdExt);
extern _SlReturnVal_t _SlDrvDataReadOp(_SlSd_t Sd, _SlCmdCtrl_t *pCmdCtrl , void* pTxRxDescBuff , _SlCmdExt_t* pCmdExt);
extern _SlReturnVal_t _SlDrvDataWriteOp(_SlSd_t Sd, _SlCmdCtrl_t *pCmdCtrl , void* pTxRxDescBuff , _SlCmdExt_t* pCmdExt);
extern _i16 _SlDrvBasicCmd(_SlOpcode_t Opcode);
extern void _sl_HandleAsync_InitComplete(void *pVoidBuf);
extern void _sl_HandleAsync_Connect(void *pVoidBuf);
#ifndef SL_TINY_EXT
extern _i16 _SlDrvBasicCmd(_SlOpcode_t Opcode);
extern void _sl_HandleAsync_Accept(void *pVoidBuf);
extern void _sl_HandleAsync_Select(void *pVoidBuf);
extern void _sl_HandleAsync_DnsGetHostByName(void *pVoidBuf);
extern void _sl_HandleAsync_DnsGetHostByService(void *pVoidBuf);
extern void _sl_HandleAsync_Select(void *pVoidBuf);
#endif
extern void _sl_HandleAsync_DnsGetHostByName(void *pVoidBuf);
extern void _sl_HandleAsync_DnsGetHostByAddr(void *pVoidBuf);
extern void _sl_HandleAsync_PingResponse(void *pVoidBuf);
extern void _SlDrvNetAppEventHandler(void *pArgs);
extern void _SlDrvDeviceEventHandler(void *pArgs);
extern void _SlDrvNetAppEventHandler(void* pArgs);
extern void _SlDrvDeviceEventHandler(void* pArgs);
extern void _sl_HandleAsync_Stop(void *pVoidBuf);
extern _i16 _SlDrvWaitForPoolObj(_u32 ActionID, _u8 SocketID);
extern _u8 _SlDrvWaitForPoolObj(_u8 ActionID, _u8 SocketID);
extern void _SlDrvReleasePoolObj(_u8 pObj);
extern void _SlDrvObjInit(void);
extern _u16 _SlDrvAlignSize(_u16 msgLen);
extern _u8 _SlDrvProtectAsyncRespSetting(_u8 *pAsyncRsp, _u8 ActionID, _u8 SocketID);
extern void _SlDrvSyncObjWaitForever(_SlSyncObj_t *pSyncObj);
extern void _SlDrvSyncObjSignal(_SlSyncObj_t *pSyncObj);
extern void _SlDrvObjLock(_SlLockObj_t *pLockObj, _SlTime_t Timeout);
extern void _SlDrvObjLockWaitForever(_SlLockObj_t *pLockObj);
extern void _SlDrvProtectionObjLockWaitForever();
extern void _SlDrvObjUnLock(_SlLockObj_t *pLockObj);
extern void _SlDrvProtectionObjUnLock();
extern void _SlDrvMemZero(void* Addr, _u16 size);
extern void _SlDrvResetCmdExt(_SlCmdExt_t* pCmdExt);
#define _SL_PROTOCOL_ALIGN_SIZE(msgLen) (((msgLen)+3) & (~3))
#define _SL_IS_PROTOCOL_ALIGNED_SIZE(msgLen) (!((msgLen) & 3))
#define _SL_PROTOCOL_CALC_LEN(pCmdCtrl,pCmdExt) ((pCmdExt) ? \
(_SL_PROTOCOL_ALIGN_SIZE(pCmdCtrl->TxDescLen) + _SL_PROTOCOL_ALIGN_SIZE(pCmdExt->TxPayloadLen)) : \
(_SL_PROTOCOL_ALIGN_SIZE(pCmdCtrl->TxDescLen)))

View File

@ -33,15 +33,17 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __FS_H__
#define __FS_H__
/*****************************************************************************/
/* Include files */
/*****************************************************************************/
#include "simplelink.h"
#ifndef __FS_H__
#define __FS_H__
#ifdef __cplusplus
extern "C" {
@ -180,7 +182,7 @@ typedef enum
_FS_FILE_OPEN_FLAG_NO_SIGNATURE_TEST = 0x4, /* Relevant to secure file only */
_FS_FILE_OPEN_FLAG_STATIC = 0x8, /* Relevant to secure file only */
_FS_FILE_OPEN_FLAG_VENDOR = 0x10, /* Relevant to secure file only */
_FS_FILE_PUBLIC_WRITE = 0x20, /* Relevant to secure file only, the file can be opened for write without Token */
_FS_FILE_PUBLIC_WRITE= 0x20, /* Relevant to secure file only, the file can be opened for write without Token */
_FS_FILE_PUBLIC_READ = 0x40 /* Relevant to secure file only, the file can be opened for read without Token */
}SlFileOpenFlags_e;
@ -256,7 +258,7 @@ _u32 _sl_GetCreateFsMode(_u32 maxSizeInBytes,_u32 accessFlags);
\endcode
*/
#if _SL_INCLUDE_FUNC(sl_FsOpen)
_i32 sl_FsOpen(_u8 *pFileName,_u32 AccessModeAndMaxSize,_u32 *pToken,_i32 *pFileHandle);
_i32 sl_FsOpen(const _u8 *pFileName,const _u32 AccessModeAndMaxSize,_u32 *pToken,_i32 *pFileHandle);
#endif
/*!
@ -279,7 +281,7 @@ _i32 sl_FsOpen(_u8 *pFileName,_u32 AccessModeAndMaxSize,_u32 *pToken,_i32 *pFile
\endcode
*/
#if _SL_INCLUDE_FUNC(sl_FsClose)
_i16 sl_FsClose(_i32 FileHdl,_u8* pCeritificateFileName,_u8* pSignature,_u32 SignatureLen);
_i16 sl_FsClose(const _i32 FileHdl,const _u8* pCeritificateFileName,const _u8* pSignature,const _u32 SignatureLen);
#endif
/*!
@ -301,7 +303,7 @@ _i16 sl_FsClose(_i32 FileHdl,_u8* pCeritificateFileName,_u8* pSignature,_u32 Sig
\endcode
*/
#if _SL_INCLUDE_FUNC(sl_FsRead)
_i32 sl_FsRead(_i32 FileHdl,_u32 Offset ,_u8* pData,_u32 Len);
_i32 sl_FsRead(const _i32 FileHdl,_u32 Offset ,_u8* pData,_u32 Len);
#endif
/*!
@ -323,7 +325,7 @@ _i32 sl_FsRead(_i32 FileHdl,_u32 Offset ,_u8* pData,_u32 Len);
\endcode
*/
#if _SL_INCLUDE_FUNC(sl_FsWrite)
_i32 sl_FsWrite(_i32 FileHdl,_u32 Offset,_u8* pData,_u32 Len);
_i32 sl_FsWrite(const _i32 FileHdl,_u32 Offset,_u8* pData,_u32 Len);
#endif
/*!
@ -344,7 +346,7 @@ _i32 sl_FsWrite(_i32 FileHdl,_u32 Offset,_u8* pData,_u32 Len);
\endcode
*/
#if _SL_INCLUDE_FUNC(sl_FsGetInfo)
_i16 sl_FsGetInfo(_u8 *pFileName,_u32 Token,SlFsFileInfo_t* pFsFileInfo);
_i16 sl_FsGetInfo(const _u8 *pFileName,const _u32 Token,SlFsFileInfo_t* pFsFileInfo);
#endif
/*!
@ -363,7 +365,7 @@ _i16 sl_FsGetInfo(_u8 *pFileName,_u32 Token,SlFsFileInfo_t* pFsFileInfo);
\endcode
*/
#if _SL_INCLUDE_FUNC(sl_FsDel)
_i16 sl_FsDel(_u8 *pFileName,_u32 Token);
_i16 sl_FsDel(const _u8 *pFileName,const _u32 Token);
#endif
/*!

View File

@ -34,15 +34,17 @@
*
*/
#ifndef __NETAPP_H__
#define __NETAPP_H__
/*****************************************************************************/
/* Include files */
/*****************************************************************************/
#include "simplelink.h"
#ifndef __NETAPP_H__
#define __NETAPP_H__
#ifdef __cplusplus
extern "C" {
@ -356,7 +358,7 @@ typedef void (*P_SL_DEV_PING_CALLBACK)(SlPingReport_t*);
\endcode
*/
#if _SL_INCLUDE_FUNC(sl_NetAppStart)
_i16 sl_NetAppStart(_u32 AppBitMap);
_i16 sl_NetAppStart(const _u32 AppBitMap);
#endif
/*!
\brief Stops a network application
@ -382,7 +384,7 @@ _i16 sl_NetAppStart(_u32 AppBitMap);
\endcode
*/
#if _SL_INCLUDE_FUNC(sl_NetAppStop)
_i16 sl_NetAppStop(_u32 AppBitMap);
_i16 sl_NetAppStop(const _u32 AppBitMap);
#endif
/*!
@ -417,6 +419,8 @@ _i16 sl_NetAppStop(_u32 AppBitMap);
In this case, MAX_CONCURRENT_ACTIONS can be increased (result in memory increase) or try
again later to issue the command.
\warning
In case an IP address in a string format is set as input, without any prefix (e.g. "1.2.3.4") the device will not
try to access the DNS and it will return the input address on the 'out_ip_addr' field
\par Example:
\code
_u32 DestinationIP;
@ -430,7 +434,7 @@ _i16 sl_NetAppStop(_u32 AppBitMap);
\endcode
*/
#if _SL_INCLUDE_FUNC(sl_NetAppDnsGetHostByName)
_i16 sl_NetAppDnsGetHostByName(_i8 * hostname, _u16 usNameLen, _u32* out_ip_addr,_u8 family );
_i16 sl_NetAppDnsGetHostByName(_i8 * hostname,const _u16 usNameLen, _u32* out_ip_addr,const _u8 family );
#endif
/*!
@ -490,8 +494,8 @@ _i16 sl_NetAppDnsGetHostByName(_i8 * hostname, _u16 usNameLen, _u32* out_ip_add
*/
#if _SL_INCLUDE_FUNC(sl_NetAppDnsGetHostByService)
_i32 sl_NetAppDnsGetHostByService(_i8 *pServiceName, /* string containing all (or only part): name + subtype + service */
_u8 ServiceLen,
_u8 Family, /* 4-IPv4 , 16-IPv6 */
const _u8 ServiceLen,
const _u8 Family, /* 4-IPv4 , 16-IPv6 */
_u32 pAddr[],
_u32 *pPort,
_u16 *pTextLen, /* in: max len , out: actual len */
@ -549,11 +553,11 @@ _i32 sl_NetAppDnsGetHostByService(_i8 *pServiceName, /* string containing all
*/
#if _SL_INCLUDE_FUNC(sl_NetAppGetServiceList)
_i16 sl_NetAppGetServiceList(_u8 IndexOffest,
_u8 MaxServiceCount,
_u8 Flags,
_i8 *pBuffer,
_u32 RxBufferLength
_i16 sl_NetAppGetServiceList(const _u8 IndexOffest,
const _u8 MaxServiceCount,
const _u8 Flags,
_i8 *pBuffer,
const _u32 RxBufferLength
);
#endif
@ -582,7 +586,7 @@ _i16 sl_NetAppGetServiceList(_u8 IndexOffest,
The size of the service length should be smaller than 255.
*/
#if _SL_INCLUDE_FUNC(sl_NetAppMDNSUnRegisterService)
_i16 sl_NetAppMDNSUnRegisterService(const _i8 *pServiceName,_u8 ServiceNameLen);
_i16 sl_NetAppMDNSUnRegisterService(const _i8 *pServiceName,const _u8 ServiceNameLen);
#endif
/*!
@ -651,12 +655,12 @@ _i16 sl_NetAppMDNSUnRegisterService(const _i8 *pServiceName,_u8 ServiceNameLen);
*/
#if _SL_INCLUDE_FUNC(sl_NetAppMDNSRegisterService)
_i16 sl_NetAppMDNSRegisterService( const _i8* pServiceName,
_u8 ServiceNameLen,
const _u8 ServiceNameLen,
const _i8* pText,
_u8 TextLen,
_u16 Port,
_u32 TTL,
_u32 Options);
const _u8 TextLen,
const _u16 Port,
const _u32 TTL,
_u32 Options);
#endif
/*!
@ -720,7 +724,7 @@ _i16 sl_NetAppMDNSRegisterService( const _i8* pServiceName,
\endcode
*/
#if _SL_INCLUDE_FUNC(sl_NetAppPingStart)
_i16 sl_NetAppPingStart(SlPingStartCommand_t* pPingParams,_u8 family,SlPingReport_t *pReport,const P_SL_DEV_PING_CALLBACK pPingCallback);
_i16 sl_NetAppPingStart(const SlPingStartCommand_t* pPingParams,const _u8 family,SlPingReport_t *pReport,const P_SL_DEV_PING_CALLBACK pPingCallback);
#endif
/*!
@ -732,10 +736,27 @@ _i16 sl_NetAppPingStart(SlPingStartCommand_t* pPingParams,_u8 family,SlPingRepor
\param[in] AppId Application id, could be one of the following: \n
- SL_NET_APP_HTTP_SERVER_ID
- SL_NET_APP_DHCP_SERVER_ID
- SL_NET_APP_DHCP_SERVER_ID
- SL_NET_APP_MDNS_ID
- SL_NET_APP_DEVICE_CONFIG_ID
\param[in] SetOptions set option, could be one of the following: \n
NETAPP_SET_BASIC_OPT
- SL_NET_APP_DHCP_SERVER_ID
- NETAPP_SET_DHCP_SRV_BASIC_OPT
- SL_NET_APP_HTTP_SERVER_ID
- NETAPP_SET_GET_HTTP_OPT_PORT_NUMBER
- NETAPP_SET_GET_HTTP_OPT_AUTH_CHECK
- NETAPP_SET_GET_HTTP_OPT_AUTH_NAME
- NETAPP_SET_GET_HTTP_OPT_AUTH_PASSWORD
- NETAPP_SET_GET_HTTP_OPT_AUTH_REALM
- NETAPP_SET_GET_HTTP_OPT_ROM_PAGES_ACCESS
- SL_NET_APP_MDNS_ID
- NETAPP_SET_GET_MDNS_CONT_QUERY_OPT
- NETAPP_SET_GET_MDNS_QEVETN_MASK_OPT
- NETAPP_SET_GET_MDNS_TIMING_PARAMS_OPT
- SL_NET_APP_DEVICE_CONFIG_ID
- NETAPP_SET_GET_DEV_CONF_OPT_DEVICE_URN
- NETAPP_SET_GET_DEV_CONF_OPT_DOMAIN_NAME
\param[in] OptionLen option structure length
@ -770,7 +791,7 @@ _i16 sl_NetAppPingStart(SlPingStartCommand_t* pPingParams,_u8 family,SlPingRepor
*/
#if _SL_INCLUDE_FUNC(sl_NetAppSet)
_i32 sl_NetAppSet(_u8 AppId ,_u8 Option,_u8 OptionLen, _u8 *pOptionValue);
_i32 sl_NetAppSet(const _u8 AppId ,const _u8 Option,const _u8 OptionLen,const _u8 *pOptionValue);
#endif
/*!
@ -782,9 +803,27 @@ _i32 sl_NetAppSet(_u8 AppId ,_u8 Option,_u8 OptionLen, _u8 *pOptionValue);
\param[in] AppId Application id, could be one of the following: \n
- SL_NET_APP_HTTP_SERVER_ID
- SL_NET_APP_DHCP_SERVER_ID
- SL_NET_APP_MDNS_ID
- SL_NET_APP_DEVICE_CONFIG_ID
\param[in] SetOptions set option, could be one of the following: \n
- SL_NET_APP_DHCP_SERVER_ID
- NETAPP_SET_DHCP_SRV_BASIC_OPT
- SL_NET_APP_HTTP_SERVER_ID
- NETAPP_SET_GET_HTTP_OPT_PORT_NUMBER
- NETAPP_SET_GET_HTTP_OPT_AUTH_CHECK
- NETAPP_SET_GET_HTTP_OPT_AUTH_NAME
- NETAPP_SET_GET_HTTP_OPT_AUTH_PASSWORD
- NETAPP_SET_GET_HTTP_OPT_AUTH_REALM
- NETAPP_SET_GET_HTTP_OPT_ROM_PAGES_ACCESS
- SL_NET_APP_MDNS_ID
- NETAPP_SET_GET_MDNS_CONT_QUERY_OPT
- NETAPP_SET_GET_MDNS_QEVETN_MASK_OPT
- NETAPP_SET_GET_MDNS_TIMING_PARAMS_OPT
- SL_NET_APP_DEVICE_CONFIG_ID
- NETAPP_SET_GET_DEV_CONF_OPT_DEVICE_URN
- NETAPP_SET_GET_DEV_CONF_OPT_DOMAIN_NAME
\param[in] Options Get option, could be one of the following: \n
NETAPP_SET_BASIC_OPT
\param[in] OptionLen The length of the allocated memory as input, when the
function complete, the value of this parameter would be
@ -824,7 +863,7 @@ _i32 sl_NetAppSet(_u8 AppId ,_u8 Option,_u8 OptionLen, _u8 *pOptionValue);
\endcode
*/
#if _SL_INCLUDE_FUNC(sl_NetAppGet)
_i32 sl_NetAppGet(_u8 AppId, _u8 Option,_u8 *pOptionLen, _u8 *pOptionValue);
_i32 sl_NetAppGet(const _u8 AppId,const _u8 Option,_u8 *pOptionLen, _u8 *pOptionValue);
#endif

View File

@ -33,15 +33,17 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __NETCFG_H__
#define __NETCFG_H__
/*****************************************************************************/
/* Include files */
/*****************************************************************************/
#include "simplelink.h"
#ifndef __NETCFG_H__
#define __NETCFG_H__
#ifdef __cplusplus
extern "C" {
#endif
@ -182,7 +184,7 @@ typedef struct
*/
#if _SL_INCLUDE_FUNC(sl_NetCfgSet)
_i32 sl_NetCfgSet(_u8 ConfigId ,_u8 ConfigOpt, _u8 ConfigLen, _u8 *pValues);
_i32 sl_NetCfgSet(const _u8 ConfigId,const _u8 ConfigOpt,const _u8 ConfigLen,const _u8 *pValues);
#endif
@ -262,7 +264,7 @@ _i32 sl_NetCfgSet(_u8 ConfigId ,_u8 ConfigOpt, _u8 ConfigLen, _u8 *pValues);
*/
#if _SL_INCLUDE_FUNC(sl_NetCfgGet)
_i32 sl_NetCfgGet(_u8 ConfigId ,_u8 *pConfigOpt, _u8 *pConfigLen, _u8 *pValues);
_i32 sl_NetCfgGet(const _u8 ConfigId ,_u8 *pConfigOpt, _u8 *pConfigLen, _u8 *pValues);
#endif
/*!

View File

@ -55,7 +55,7 @@ extern "C" {
#define NONOS_WAIT_FOREVER 0xFF
#define NONOS_NO_WAIT 0x01
#define NONOS_NO_WAIT 0x00
#define NONOS_RET_OK (0)
#define NONOS_RET_ERR (0xFF)

View File

@ -168,25 +168,25 @@ extern "C" {
#define _SL_INCLUDE_FUNC(Name) (_SL_INC_##Name)
/* Driver */
#define _SL_INC_sl_NetAppStart __nap
#define _SL_INC_sl_NetAppStart __nap__ext
#define _SL_INC_sl_NetAppStop __nap__ext
#define _SL_INC_sl_NetAppStop __nap
#define _SL_INC_sl_NetAppDnsGetHostByName __nap__clt
#define _SL_INC_sl_NetAppDnsGetHostByName __nap__clt
#define _SL_INC_sl_NetAppDnsGetHostByService __nap__clt
#define _SL_INC_sl_NetAppMDNSRegisterService __nap__clt
#define _SL_INC_sl_NetAppMDNSUnRegisterService __nap__clt
#define _SL_INC_sl_NetAppMDNSRegisterUnregisterService __nap__clt
#define _SL_INC_sl_NetAppGetServiceList __nap__clt
#define _SL_INC_sl_NetAppDnsGetHostByService __nap__ext
#define _SL_INC_sl_NetAppMDNSRegisterService __nap__ext
#define _SL_INC_sl_NetAppMDNSUnRegisterService __nap__ext
#define _SL_INC_sl_NetAppMDNSRegisterUnregisterService __nap__ext
#define _SL_INC_sl_NetAppGetServiceList __nap__ext
#define _SL_INC_sl_DnsGetHostByAddr __nap__ext
#define _SL_INC_sl_NetAppPingStart __nap__ext
#define _SL_INC_sl_NetAppPingReport __nap__ext
#define _SL_INC_sl_NetAppSet __nap__ext
#define _SL_INC_sl_NetAppGet __nap__ext
#define _SL_INC_sl_NetAppPingStart __nap
#define _SL_INC_sl_NetAppPingReport __nap
/* FS */
#define _SL_INC_sl_FsOpen __nvm
@ -210,14 +210,11 @@ extern "C" {
#define _SL_INC_sl_NetCfgSet __ncg
#define _SL_INC_sl_NetAppSet __nap
#define _SL_INC_sl_NetAppGet __nap
/* socket */
#define _SL_INC_sl_Socket __sck
#define _SL_INC_sl_Close __sck__ext
#define _SL_INC_sl_Close __sck
#define _SL_INC_sl_Accept __sck__srv
@ -306,7 +303,7 @@ extern "C" {
#define _SL_INC_sl_StatusGet __dev
#ifdef SL_IF_TYPE_UART
#define _SL_INC_sl_UartSetMode __dev
#define _SL_INC_sl_UartSetMode __dev__ext
#endif
#define _SL_INC_sl_EventMaskGet __dev__ext

View File

@ -149,6 +149,7 @@ typedef struct
#define SL_FLAGS_MASK (0xF)
#define SL_OPCODE_DEVICE_INITCOMPLETE 0x0008
#define SL_OPCODE_DEVICE_ABORT 0x000C
#define SL_OPCODE_DEVICE_STOP_COMMAND 0x8473
#define SL_OPCODE_DEVICE_STOP_RESPONSE 0x0473
#define SL_OPCODE_DEVICE_STOP_ASYNC_RESPONSE 0x0073
@ -351,9 +352,6 @@ typedef struct
#define SL_OPCODE_WLAN_SMARTCONFIGOPTGET 0x8C8E
#define SL_OPCODE_WLAN_SMARTCONFIGOPTGETRESPONSE 0x0C8E
#define SL_OPCODE_FREE_BSD_RECV_BUFFER 0xCCCB
#define SL_OPCODE_FREE_NON_BSD_READ_BUFFER 0xCCCD
/* Rx Filters opcodes */
#define SL_OPCODE_WLAN_WLANRXFILTERADDCOMMAND 0x8C6C
@ -1032,6 +1030,7 @@ typedef struct
_u16 rxKbitsSec;
_u32 outOfOrderPackets;
_u32 missedPackets;
_i16 token;
}_CtestAsyncResponse_t;
typedef struct
@ -1162,8 +1161,15 @@ typedef _BasicResponse_t _FsWriteResponse_t;
/* Set Max Async Payload length depending on flavor (Tiny, Small, etc.) */
#define SL_ASYNC_MAX_PAYLOAD_LEN 160 /* size must be aligned to 4 */
/* TODO: Set MAx Async Payload length depending on flavor (Tiny, Small, etc.) */
#ifdef SL_TINY_EXT
#define SL_ASYNC_MAX_PAYLOAD_LEN 120 /* size must be aligned to 4 */
#else
#define SL_ASYNC_MAX_PAYLOAD_LEN 160 /* size must be aligned to 4 */
#endif
#define SL_ASYNC_MAX_MSG_LEN (_SL_RESP_HDR_SIZE + SL_ASYNC_MAX_PAYLOAD_LEN)
#define RECV_ARGS_SIZE (sizeof(_SocketResponse_t))

View File

@ -58,7 +58,7 @@
Listed below are the various modules in the SimpleLink CC31xx/CC32xx driver:
-# \ref device - controls the behaviour of the CC31xx/CC32xx device (start/stop, events masking and obtaining specific device status)
-# \ref wlan - controls the use of the WiFi WLAN module including:
- Connection features, such as: profiles, policies, SmartConfig
- Connection features, such as: profiles, policies, SmartConfig<EFBFBD>
- Advanced WLAN features, such as: scans, rx filters and rx statistics collection
-# \ref socket - controls standard client/server sockets programming options and capabilities
-# \ref netapp - activates networking applications, such as: HTTP Server, DHCP Server, Ping, DNS and mDNS.
@ -250,11 +250,11 @@ extern "C"
/*****************************************************************************/
/* Macro declarations for Host Driver version */
/*****************************************************************************/
#define SL_DRIVER_VERSION "1.0.0.1"
#define SL_DRIVER_VERSION "1.0.0.10"
#define SL_MAJOR_VERSION_NUM 1L
#define SL_MINOR_VERSION_NUM 0L
#define SL_VERSION_NUM 0L
#define SL_SUB_VERSION_NUM 1L
#define SL_SUB_VERSION_NUM 10L
/*****************************************************************************/
@ -264,15 +264,17 @@ extern "C"
#ifdef SL_TINY
#undef SL_INC_ARG_CHECK
#undef SL_INC_EXT_API
#undef SL_INC_SOCK_CLIENT_SIDE_API
#undef SL_INC_SOCK_SEND_API
#undef SL_INC_SOCK_SERVER_SIDE_API
#undef SL_INC_WLAN_PKG
#undef SL_INC_NET_APP_PKG
#undef SL_INC_NET_CFG_PKG
#undef SL_INC_FS_PKG
#define SL_INC_SOCK_SERVER_SIDE_API
#define SL_INC_SOCK_RECV_API
#define SL_INC_SOCKET_PKG
#undef SL_INC_SET_UART_MODE
#undef SL_INC_STD_BSD_API_NAMING
#undef SL_INC_SOCK_CLIENT_SIDE_API
#undef SL_INC_NET_APP_PKG
#undef SL_INC_SOCK_RECV_API
#undef SL_INC_SOCK_SEND_API
#undef SL_INC_SOCKET_PKG
#endif
#ifdef SL_SMALL
@ -287,6 +289,7 @@ extern "C"
#define SL_INC_SOCK_SERVER_SIDE_API
#define SL_INC_SOCK_RECV_API
#define SL_INC_SOCK_SEND_API
#define SL_INC_SET_UART_MODE
#endif
#ifdef SL_FULL
@ -301,6 +304,7 @@ extern "C"
#define SL_INC_SOCK_SERVER_SIDE_API
#define SL_INC_SOCK_RECV_API
#define SL_INC_SOCK_SEND_API
#define SL_INC_SET_UART_MODE
#endif
#define SL_RET_CODE_OK (0)
@ -314,7 +318,11 @@ extern "C"
#define sl_SyncObjClear(pObj) sl_SyncObjWait(pObj,SL_OS_NO_WAIT)
#ifndef SL_TINY_EXT
#define SL_MAX_SOCKETS (8)
#else
#define SL_MAX_SOCKETS (2)
#endif
/*****************************************************************************/
@ -339,14 +347,14 @@ typedef void (*_SlSpawnEntryFunc_t)(void* pValue);
#endif
#ifndef _SL_USER_TYPES
#define _u8 unsigned char
#define _i8 signed char
typedef unsigned char _u8;
typedef signed char _i8;
#define _u16 unsigned short
#define _i16 signed short
typedef unsigned short _u16;
typedef signed short _i16;
#define _u32 unsigned long
#define _i32 signed long
typedef unsigned long _u32;
typedef signed long _i32;
#define _volatile volatile
#define _const const
#endif
@ -362,6 +370,23 @@ typedef _i16 _SlReturnVal_t;
/*
* This event status used to block or continue the event propagation
* through all the registered external libs/user application
*
*/
typedef enum {
EVENT_PROPAGATION_BLOCK = 0,
EVENT_PROPAGATION_CONTINUE
} _SlEventPropogationStatus_e;
/*****************************************************************************/
/* Include files */
/*****************************************************************************/
@ -389,6 +414,323 @@ typedef _i16 _SlReturnVal_t;
#include "wlan_rx_filters.h"
/* The general events dispatcher which is
* initialized to the user handler */
#ifdef sl_GeneralEvtHdlr
#define _SlDrvHandleGeneralEvents sl_GeneralEvtHdlr
#endif
/* The wlan events dispatcher which is
* initialized to the user handler */
#ifdef sl_WlanEvtHdlr
#define _SlDrvHandleWlanEvents sl_WlanEvtHdlr
#endif
/* The NetApp events dispatcher which is
* initialized to the user handler */
#ifdef sl_NetAppEvtHdlr
#define _SlDrvHandleNetAppEvents sl_NetAppEvtHdlr
#endif
/* The http server events dispatcher which is
* initialized to the user handler if exists */
#ifdef sl_HttpServerCallback
#define _SlDrvHandleHttpServerEvents sl_HttpServerCallback
#endif
/* The socket events dispatcher which is
* initialized to the user handler */
#ifdef sl_SockEvtHdlr
#define _SlDrvHandleSockEvents sl_SockEvtHdlr
#endif
#ifndef __CONCAT
#define __CONCAT(x,y) x ## y
#endif
#define __CONCAT2(x,y) __CONCAT(x,y)
/*
* The section below handles the external lib event registration
* according to the desired events it specified in its API header file.
* The external lib should be first installed by the user (see user.h)
*/
#ifdef SL_EXT_LIB_1
/* General Event Registration */
#if __CONCAT2(SL_EXT_LIB_1, _NOTIFY_GENERAL_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_1, _GeneralEventHdl) (SlDeviceEvent_t *);
#define SlExtLib1GeneralEventHandler __CONCAT2(SL_EXT_LIB_1, _GeneralEventHdl)
#undef EXT_LIB_REGISTERED_GENERAL_EVENTS
#define EXT_LIB_REGISTERED_GENERAL_EVENTS
#endif
/* Wlan Event Registration */
#if __CONCAT2(SL_EXT_LIB_1, _NOTIFY_WLAN_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_1, _WlanEventHdl) (SlWlanEvent_t *);
#define SlExtLib1WlanEventHandler __CONCAT2(SL_EXT_LIB_1, _WlanEventHdl)
#undef EXT_LIB_REGISTERED_WLAN_EVENTS
#define EXT_LIB_REGISTERED_WLAN_EVENTS
#endif
/* NetApp Event Registration */
#if __CONCAT2(SL_EXT_LIB_1, _NOTIFY_NETAPP_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_1, _NetAppEventHdl) (SlNetAppEvent_t *);
#define SlExtLib1NetAppEventHandler __CONCAT2(SL_EXT_LIB_1, _NetAppEventHdl)
#undef EXT_LIB_REGISTERED_NETAPP_EVENTS
#define EXT_LIB_REGISTERED_NETAPP_EVENTS
#endif
/* Http Server Event Registration */
#if __CONCAT2(SL_EXT_LIB_1, _NOTIFY_HTTP_SERVER_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_1, _HttpServerEventHdl) (SlHttpServerEvent_t* , SlHttpServerResponse_t*);
#define SlExtLib1HttpServerEventHandler __CONCAT2(SL_EXT_LIB_1, _HttpServerEventHdl)
#undef EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS
#define EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS
#endif
/* Socket Event Registration */
#if __CONCAT2(SL_EXT_LIB_1, _NOTIFY_SOCK_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_1, _SockEventHdl) (SlSockEvent_t *);
#define SlExtLib1SockEventHandler __CONCAT2(SL_EXT_LIB_1, _SockEventHdl)
#undef EXT_LIB_REGISTERED_SOCK_EVENTS
#define EXT_LIB_REGISTERED_SOCK_EVENTS
#endif
#endif
#ifdef SL_EXT_LIB_2
/* General Event Registration */
#if __CONCAT2(SL_EXT_LIB_2, _NOTIFY_GENERAL_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_2, _GeneralEventHdl) (SlDeviceEvent_t *);
#define SlExtLib2GeneralEventHandler __CONCAT2(SL_EXT_LIB_2, _GeneralEventHdl)
#undef EXT_LIB_REGISTERED_GENERAL_EVENTS
#define EXT_LIB_REGISTERED_GENERAL_EVENTS
#endif
/* Wlan Event Registration */
#if __CONCAT2(SL_EXT_LIB_2, _NOTIFY_WLAN_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_2, _WlanEventHdl) (SlWlanEvent_t *);
#define SlExtLib2WlanEventHandler __CONCAT2(SL_EXT_LIB_2, _WlanEventHdl)
#undef EXT_LIB_REGISTERED_WLAN_EVENTS
#define EXT_LIB_REGISTERED_WLAN_EVENTS
#endif
/* NetApp Event Registration */
#if __CONCAT2(SL_EXT_LIB_2, _NOTIFY_NETAPP_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_2, _NetAppEventHdl) (SlNetAppEvent_t *);
#define SlExtLib2NetAppEventHandler __CONCAT2(SL_EXT_LIB_2, _NetAppEventHdl)
#undef EXT_LIB_REGISTERED_NETAPP_EVENTS
#define EXT_LIB_REGISTERED_NETAPP_EVENTS
#endif
/* Http Server Event Registration */
#if __CONCAT2(SL_EXT_LIB_2, _NOTIFY_HTTP_SERVER_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_2, _HttpServerEventHdl) (SlHttpServerEvent_t* , SlHttpServerResponse_t*);
#define SlExtLib2HttpServerEventHandler __CONCAT2(SL_EXT_LIB_2, _HttpServerEventHdl)
#undef EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS
#define EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS
#endif
/* Socket Event Registration */
#if __CONCAT2(SL_EXT_LIB_2, _NOTIFY_SOCK_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_2, _SockEventHdl) (SlSockEvent_t *);
#define SlExtLib2SockEventHandler __CONCAT2(SL_EXT_LIB_2, _SockEventHdl)
#undef EXT_LIB_REGISTERED_SOCK_EVENTS
#define EXT_LIB_REGISTERED_SOCK_EVENTS
#endif
#endif
#ifdef SL_EXT_LIB_3
/* General Event Registration */
#if __CONCAT2(SL_EXT_LIB_3, _NOTIFY_GENERAL_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_3, _GeneralEventHdl) (SlDeviceEvent_t *);
#define SlExtLib3GeneralEventHandler __CONCAT2(SL_EXT_LIB_3, _GeneralEventHdl)
#undef EXT_LIB_REGISTERED_GENERAL_EVENTS
#define EXT_LIB_REGISTERED_GENERAL_EVENTS
#endif
/* Wlan Event Registration */
#if __CONCAT2(SL_EXT_LIB_3, _NOTIFY_WLAN_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_3, _WlanEventHdl) (SlWlanEvent_t *);
#define SlExtLib3WlanEventHandler __CONCAT2(SL_EXT_LIB_3, _WlanEventHdl)
#undef EXT_LIB_REGISTERED_WLAN_EVENTS
#define EXT_LIB_REGISTERED_WLAN_EVENTS
#endif
/* NetApp Event Registration */
#if __CONCAT2(SL_EXT_LIB_3, _NOTIFY_NETAPP_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_3, _NetAppEventHdl) (SlNetAppEvent_t *);
#define SlExtLib3NetAppEventHandler __CONCAT2(SL_EXT_LIB_3, _NetAppEventHdl)
#undef EXT_LIB_REGISTERED_NETAPP_EVENTS
#define EXT_LIB_REGISTERED_NETAPP_EVENTS
#endif
/* Http Server Event Registration */
#if __CONCAT2(SL_EXT_LIB_3, _NOTIFY_HTTP_SERVER_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_3, _HttpServerEventHdl) (SlHttpServerEvent_t* , SlHttpServerResponse_t*);
#define SlExtLib3HttpServerEventHandler __CONCAT2(SL_EXT_LIB_3, _HttpServerEventHdl)
#undef EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS
#define EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS
#endif
/* Socket Event Registration */
#if __CONCAT2(SL_EXT_LIB_3, _NOTIFY_SOCK_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_3, _SockEventHdl) (SlSockEvent_t *);
#define SlExtLib3SockEventHandler __CONCAT2(SL_EXT_LIB_3, _SockEventHdl)
#undef EXT_LIB_REGISTERED_SOCK_EVENTS
#define EXT_LIB_REGISTERED_SOCK_EVENTS
#endif
#endif
#ifdef SL_EXT_LIB_4
/* General Event Registration */
#if __CONCAT2(SL_EXT_LIB_4, _NOTIFY_GENERAL_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_4, _GeneralEventHdl) (SlDeviceEvent_t *);
#define SlExtLib4GeneralEventHandler __CONCAT2(SL_EXT_LIB_4, _GeneralEventHdl)
#undef EXT_LIB_REGISTERED_GENERAL_EVENTS
#define EXT_LIB_REGISTERED_GENERAL_EVENTS
#endif
/* Wlan Event Registration */
#if __CONCAT2(SL_EXT_LIB_4, _NOTIFY_WLAN_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_4, _WlanEventHdl) (SlWlanEvent_t *);
#define SlExtLib4WlanEventHandler __CONCAT2(SL_EXT_LIB_4, _WlanEventHdl)
#undef EXT_LIB_REGISTERED_WLAN_EVENTS
#define EXT_LIB_REGISTERED_WLAN_EVENTS
#endif
/* NetApp Event Registration */
#if __CONCAT2(SL_EXT_LIB_4, _NOTIFY_NETAPP_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_4, _NetAppEventHdl) (SlNetAppEvent_t *);
#define SlExtLib4NetAppEventHandler __CONCAT2(SL_EXT_LIB_4, _NetAppEventHdl)
#undef EXT_LIB_REGISTERED_NETAPP_EVENTS
#define EXT_LIB_REGISTERED_NETAPP_EVENTS
#endif
/* Http Server Event Registration */
#if __CONCAT2(SL_EXT_LIB_4, _NOTIFY_HTTP_SERVER_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_4, _HttpServerEventHdl) (SlHttpServerEvent_t* , SlHttpServerResponse_t*);
#define SlExtLib4HttpServerEventHandler __CONCAT2(SL_EXT_LIB_4, _HttpServerEventHdl)
#undef EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS
#define EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS
#endif
/* Socket Event Registration */
#if __CONCAT2(SL_EXT_LIB_4, _NOTIFY_SOCK_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_4, _SockEventHdl) (SlSockEvent_t *);
#define SlExtLib4SockEventHandler __CONCAT2(SL_EXT_LIB_4, _SockEventHdl)
#undef EXT_LIB_REGISTERED_SOCK_EVENTS
#define EXT_LIB_REGISTERED_SOCK_EVENTS
#endif
#endif
#ifdef SL_EXT_LIB_5
/* General Event Registration */
#if __CONCAT2(SL_EXT_LIB_5, _NOTIFY_GENERAL_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_5, _GeneralEventHdl) (SlDeviceEvent_t *);
#define SlExtLib5GeneralEventHandler __CONCAT2(SL_EXT_LIB_5, _GeneralEventHdl)
#undef EXT_LIB_REGISTERED_GENERAL_EVENTS
#define EXT_LIB_REGISTERED_GENERAL_EVENTS
#endif
/* Wlan Event Registration */
#if __CONCAT2(SL_EXT_LIB_5, _NOTIFY_WLAN_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_5, _WlanEventHdl) (SlWlanEvent_t *);
#define SlExtLib5WlanEventHandler __CONCAT2(SL_EXT_LIB_5, _WlanEventHdl)
#undef EXT_LIB_REGISTERED_WLAN_EVENTS
#define EXT_LIB_REGISTERED_WLAN_EVENTS
#endif
/* NetApp Event Registration */
#if __CONCAT2(SL_EXT_LIB_5, _NOTIFY_NETAPP_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_5, _NetAppEventHdl) (SlNetAppEvent_t *);
#define SlExtLib5NetAppEventHandler __CONCAT2(SL_EXT_LIB_5, _NetAppEventHdl)
#undef EXT_LIB_REGISTERED_NETAPP_EVENTS
#define EXT_LIB_REGISTERED_NETAPP_EVENTS
#endif
/* Http Server Event Registration */
#if __CONCAT2(SL_EXT_LIB_5, _NOTIFY_HTTP_SERVER_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_5, _HttpServerEventHdl) (SlHttpServerEvent_t* , SlHttpServerResponse_t*);
#define SlExtLib5HttpServerEventHandler __CONCAT2(SL_EXT_LIB_5, _HttpServerEventHdl)
#undef EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS
#define EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS
#endif
/* Socket Event Registration */
#if __CONCAT2(SL_EXT_LIB_5, _NOTIFY_SOCK_EVENT)
extern _SlEventPropogationStatus_e __CONCAT2(SL_EXT_LIB_5, _SockEventHdl) (SlSockEvent_t *);
#define SlExtLib5SockEventHandler __CONCAT2(SL_EXT_LIB_5, _SockEventHdl)
#undef EXT_LIB_REGISTERED_SOCK_EVENTS
#define EXT_LIB_REGISTERED_SOCK_EVENTS
#endif
#endif
#if defined(EXT_LIB_REGISTERED_GENERAL_EVENTS)
extern void _SlDrvHandleGeneralEvents(SlDeviceEvent_t *slGeneralEvent);
#endif
#if defined(EXT_LIB_REGISTERED_WLAN_EVENTS)
extern void _SlDrvHandleWlanEvents(SlWlanEvent_t *slWlanEvent);
#endif
#if defined (EXT_LIB_REGISTERED_NETAPP_EVENTS)
extern void _SlDrvHandleNetAppEvents(SlNetAppEvent_t *slNetAppEvent);
#endif
#if defined(EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS)
extern void _SlDrvHandleHttpServerEvents(SlHttpServerEvent_t *slHttpServerEvent, SlHttpServerResponse_t *slHttpServerResponse);
#endif
#if defined(EXT_LIB_REGISTERED_SOCK_EVENTS)
extern void _SlDrvHandleSockEvents(SlSockEvent_t *slSockEvent);
#endif
typedef void (*_SlSpawnEntryFunc_t)(void* pValue);
/* Async functions description*/
@ -399,17 +741,31 @@ typedef _i16 _SlReturnVal_t;
\par
Parameters: \n
<b>pSlDeviceEvent->Event = SL_DEVICE_FATAL_ERROR_EVENT </b>
- <b>pSlDeviceEvent->Event = SL_DEVICE_FATAL_ERROR_EVENT </b>
- pSlDeviceEvent->EventData.deviceEvent fields:
- status: An error code indication from the device
- sender: The sender originator which is based on SlErrorSender_e enum
\par Example:
- sender: The sender originator which is based on SlErrorSender_e enum
- <b>pSlDeviceEvent->Event = SL_DEVICE_ABORT_ERROR_EVENT </b>
Indicates a severe error occured and the device stopped
- pSlDeviceEvent->EventData.deviceReport fields:
- AbortType: An idication of the event type
- AbortData: Additional info about the data error
\par Example for fatal error:
\code
printf(General Event Handler - ID=%d Sender=%d\n\n",
pSlDeviceEvent->EventData.deviceEvent.status, // status of the general event
pSlDeviceEvent->EventData.deviceEvent.sender); // sender type
\endcode
\par Example for abort request:
\code
printf(Abort type =%d Abort Data=%d\n\n",
pSlDeviceEvent->EventData.deviceReport.AbortType,
pSlDeviceEvent->EventData.deviceReport.AbortData);
\endcode
*/
#if (defined(sl_GeneralEvtHdlr))
extern void sl_GeneralEvtHdlr(SlDeviceEvent_t *pSlDeviceEvent);
@ -490,7 +846,7 @@ extern void sl_GeneralEvtHdlr(SlDeviceEvent_t *pSlDeviceEvent);
- status
*/
#if (defined(sl_WlanEvtHdlr))
extern void sl_WlanEvtHdlr(SlWlanEvent_t *pSlWlanEvent);
extern void sl_WlanEvtHdlr(SlWlanEvent_t* pSlWlanEvent);
#endif
@ -501,27 +857,27 @@ extern void sl_WlanEvtHdlr(SlWlanEvent_t *pSlWlanEvent);
\par
Parameters:
- <b>pSlWlanEvent->Event = SL_NETAPP_IPV4_IPACQUIRED_EVENT</b>, IPV4 acquired event
- pSlWlanEvent->EventData.ipAcquiredV4 fields:
- <b>pSlNetApp->Event = SL_NETAPP_IPV4_IPACQUIRED_EVENT</b>, IPV4 acquired event
- pSlNetApp->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:
- <b>pSlNetApp->Event = SL_NETAPP_IP_LEASED_EVENT</b>, AP or P2P go dhcp lease event
- pSlNetApp->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
- <b>pSlNetApp->Event = SL_NETAPP_IP_RELEASED_EVENT</b>, AP or P2P go dhcp ip release event
- pSlNetApp->EventData.ipReleased fields
- ip_address
- mac
- reason
*/
#if (defined(sl_NetAppEvtHdlr))
extern void sl_NetAppEvtHdlr(SlNetAppEvent_t *pSlNetApp);
extern void sl_NetAppEvtHdlr(SlNetAppEvent_t* pSlNetApp);
#endif
/*!
@ -532,18 +888,18 @@ extern void sl_NetAppEvtHdlr(SlNetAppEvent_t *pSlNetApp);
\par
Parameters:\n
- <b>pSlSockEvent->Event = SL_SOCKET_TX_FAILED_EVENT</b>
- pSlSockEvent->EventData fields:
- pSlSockEvent->SockTxFailData fields:
- sd
- status
- <b>pSlSockEvent->Event = SL_SOCKET_ASYNC_EVENT</b>
- pSlSockEvent->EventData fields:
- pSlSockEvent->SockAsyncData fields:
- sd
- type: SSL_ACCEPT or RX_FRAGMENTATION_TOO_BIG or OTHER_SIDE_CLOSE_SSL_DATA_NOT_ENCRYPTED
- val
*/
#if (defined(sl_SockEvtHdlr))
extern void sl_SockEvtHdlr(SlSockEvent_t *pSlSockEvent);
extern void sl_SockEvtHdlr(SlSockEvent_t* pSlSockEvent);
#endif
/*!

View File

@ -34,14 +34,16 @@
*
*/
#ifndef __SL_SOCKET_H__
#define __SL_SOCKET_H__
/*****************************************************************************/
/* Include files */
/*****************************************************************************/
#include "simplelink.h"
#ifndef __SL_SOCKET_H__
#define __SL_SOCKET_H__
#ifdef __cplusplus
extern "C" {
@ -155,6 +157,60 @@ extern "C" {
#define SL_ESEC_ALT_NAME_E (-177) /* alt name size problem, too big */
#define SL_ESEC_AES_GCM_AUTH_E (-180) /* AES-GCM Authentication check failure */
#define SL_ESEC_AES_CCM_AUTH_E (-181) /* AES-CCM Authentication check failure */
#define SL_SOCKET_ERROR_E (-208) /* Error state on socket */
#define SL_ESEC_MEMORY_ERROR (-203) /* out of memory */
#define SL_ESEC_VERIFY_FINISHED_ERROR (-204) /* verify problem on finished */
#define SL_ESEC_VERIFY_MAC_ERROR (-205) /* verify mac problem */
#define SL_ESEC_UNKNOWN_HANDSHAKE_TYPE (-207) /* weird handshake type */
#define SL_ESEC_SOCKET_ERROR_E (-208) /* error state on socket */
#define SL_ESEC_SOCKET_NODATA (-209) /* expected data, not there */
#define SL_ESEC_INCOMPLETE_DATA (-210) /* don't have enough data to complete task */
#define SL_ESEC_UNKNOWN_RECORD_TYPE (-211) /* unknown type in record hdr */
#define SL_ESEC_FATAL_ERROR (-213) /* recvd alert fatal error */
#define SL_ESEC_ENCRYPT_ERROR (-214) /* error during encryption */
#define SL_ESEC_NO_PEER_KEY (-216) /* need peer's key */
#define SL_ESEC_NO_PRIVATE_KEY (-217) /* need the private key */
#define SL_ESEC_RSA_PRIVATE_ERROR (-218) /* error during rsa priv op */
#define SL_ESEC_NO_DH_PARAMS (-219) /* server missing DH params */
#define SL_ESEC_BUILD_MSG_ERROR (-220) /* build message failure */
#define SL_ESEC_BAD_HELLO (-221) /* client hello malformed */
#define SL_ESEC_DOMAIN_NAME_MISMATCH (-222) /* peer subject name mismatch */
#define SL_ESEC_WANT_READ (-223) /* want read, call again */
#define SL_ESEC_NOT_READY_ERROR (-224) /* handshake layer not ready */
#define SL_ESEC_PMS_VERSION_ERROR (-225) /* pre m secret version error */
#define SL_ESEC_VERSION_ERROR (-226) /* record layer version error */
#define SL_ESEC_WANT_WRITE (-227) /* want write, call again */
#define SL_ESEC_BUFFER_ERROR (-228) /* malformed buffer input */
#define SL_ESEC_VERIFY_CERT_ERROR (-229) /* verify cert error */
#define SL_ESEC_VERIFY_SIGN_ERROR (-230) /* verify sign error */
#define SL_ESEC_LENGTH_ERROR (-241) /* record layer length error */
#define SL_ESEC_PEER_KEY_ERROR (-242) /* can't decode peer key */
#define SL_ESEC_ZERO_RETURN (-243) /* peer sent close notify */
#define SL_ESEC_SIDE_ERROR (-244) /* wrong client/server type */
#define SL_ESEC_NO_PEER_CERT (-245) /* peer didn't send key */
#define SL_ESEC_ECC_CURVETYPE_ERROR (-250) /* Bad ECC Curve Type */
#define SL_ESEC_ECC_CURVE_ERROR (-251) /* Bad ECC Curve */
#define SL_ESEC_ECC_PEERKEY_ERROR (-252) /* Bad Peer ECC Key */
#define SL_ESEC_ECC_MAKEKEY_ERROR (-253) /* Bad Make ECC Key */
#define SL_ESEC_ECC_EXPORT_ERROR (-254) /* Bad ECC Export Key */
#define SL_ESEC_ECC_SHARED_ERROR (-255) /* Bad ECC Shared Secret */
#define SL_ESEC_NOT_CA_ERROR (-257) /* Not a CA cert error */
#define SL_ESEC_BAD_PATH_ERROR (-258) /* Bad path for opendir */
#define SL_ESEC_BAD_CERT_MANAGER_ERROR (-259) /* Bad Cert Manager */
#define SL_ESEC_MAX_CHAIN_ERROR (-268) /* max chain depth exceeded */
#define SL_ESEC_SUITES_ERROR (-271) /* suites pointer error */
#define SL_ESEC_SSL_NO_PEM_HEADER (-272) /* no PEM header found */
#define SL_ESEC_OUT_OF_ORDER_E (-273) /* out of order message */
#define SL_ESEC_SANITY_CIPHER_E (-275) /* sanity check on cipher error */
#define SL_ESEC_GEN_COOKIE_E (-277) /* Generate Cookie Error */
#define SL_ESEC_NO_PEER_VERIFY (-278) /* Need peer cert verify Error */
#define SL_ESEC_UNKNOWN_SNI_HOST_NAME_E (-281) /* Unrecognized host name Error */
/* begin negotiation parameter errors */
#define SL_ESEC_UNSUPPORTED_SUITE (-290) /* unsupported cipher suite */
#define SL_ESEC_MATCH_SUITE_ERROR (-291 ) /* can't match cipher suite */
/* ssl tls security start with -300 offset */
#define SL_ESEC_CLOSE_NOTIFY (-300) /* ssl/tls alerts */
#define SL_ESEC_UNEXPECTED_MESSAGE (-310) /* ssl/tls alerts */
@ -262,7 +318,13 @@ extern "C" {
#define SL_SEC_MASK_TLS_DHE_RSA_WITH_AES_256_CBC_SHA (1 << 3)
#define SL_SEC_MASK_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (1 << 4)
#define SL_SEC_MASK_TLS_ECDHE_RSA_WITH_RC4_128_SHA (1 << 5)
#define SL_SEC_MASK_SECURE_DEFAULT ((SEC_MASK_TLS_ECDHE_RSA_WITH_RC4_128_SHA << 1) - 1)
#define SL_SEC_MASK_TLS_RSA_WITH_AES_128_CBC_SHA256 (1 << 6)
#define SL_SEC_MASK_TLS_RSA_WITH_AES_256_CBC_SHA256 (1 << 7)
#define SL_SEC_MASK_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 (1 << 8)
#define SL_SEC_MASK_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 (1 << 9)
#define SL_SEC_MASK_SECURE_DEFAULT ((SL_SEC_MASK_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 << 1) - 1)
#define SL_MSG_DONTWAIT (0x00000008) /* Nonblocking IO */
@ -415,28 +477,41 @@ typedef struct
_u32 NonblockingEnabled;/* 0 = disabled;1 = enabled;default = 1*/
}SlSockNonblocking_t;
typedef struct
{
_u8 sd;
_u8 type;
_u16 val;
_u8 sd;
_u8 type;
_i16 val;
_u8* pExtraInfo;
} SlSocketAsyncEvent_t;
typedef struct
{
_i16 status;
_u16 sd;
SlSocketAsyncEvent_t socketAsyncEvent;
} SlSockEventData_t;
_i16 status;
_u8 sd;
_u8 padding;
} SlSockTxFailEventData_t;
typedef union
{
SlSockTxFailEventData_t SockTxFailData;
SlSocketAsyncEvent_t SockAsyncData;
} SlSockEventData_u;
typedef struct
{
_u32 Event;
SlSockEventData_t EventData;
SlSockEventData_u socketAsyncEvent;
} SlSockEvent_t;
typedef struct
{
_u32 secureMask;
@ -819,7 +894,7 @@ _i16 sl_Connect(_i16 sd, const SlSockAddr_t *addr, _i16 addrlen);
\param[in] nfds the highest-numbered file descriptor in any of the
three sets, plus 1.
\param[out] readsds socket descriptors list for read monitoring and accept monitoring
\param[out] writesds socket descriptors list for connect monitoring only, write monitoring is not supported
\param[out] writesds socket descriptors list for connect monitoring only, write monitoring is not supported, non blocking connect is supported
\param[out] exceptsds socket descriptors list for exception monitoring, not supported.
\param[in] timeout is an upper bound on the amount of time elapsed
before select() returns. Null or above 0xffff seconds means

View File

@ -33,14 +33,16 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __WLAN_H__
#define __WLAN_H__
/*****************************************************************************/
/* Include files */
/*****************************************************************************/
#include "simplelink.h"
#ifndef __WLAN_H__
#define __WLAN_H__
#ifdef __cplusplus
@ -98,32 +100,6 @@ extern "C" {
#define SL_DISCONNECT_RESERVED_6 (29)
#define SL_DISCONNECT_RESERVED_7 (30)
#define SL_DISCONNECT_RESERVED_8 (31)
#define SL_DISASSOCIATED_FOR_UNSPECIFIED_QOS_RELATED_REASON (32)
#define SL_DISASSOCIATED_BECAUSE_QAP_LACKS_SUFFICIENT_BANDWIDTH_FOR_THIS_QSTA (33)
#define SL_DISASSOCIATED_BECAUSE_EXCESSIVE_NUMBER_OF_FRAMES_NEED_TO_BE_ACKNOWLEDGED (34)
#define SL_DISASSOCIATED_BECAUSE_QSTA_IS_TRANSMITTING_OUTSIDE_THE_LIMITS_OF_ITS_TXOPS (35)
#define SL_REQUESTED_FROM_PEER_QSTA_AS_THE_QSTA_IS_LEAVING_THE_QBSS (36)
#define SL_REQUESTED_FROM_PEER_QSTA_AS_IT_DOES_NO_WANT_TO_USE_THE_MECHANISM (37)
#define SL_REQUESTED_FROM_PEER_QSTA_AS_THE_QSTA_RECEIVED_FRAMES_SETUP_IS_REQUIRED (38)
#define SL_REQUESTED_FROM_PEER_QSTA_DUE_TO_TIMEOUT (39)
#define SL_PEER_QSTA_DOES_NOT_SUPPORT_THE_REQUESTED_CIPHER_SUITE (40)
#define SL_CISCO_DEFINED (98)
#define SL_CISCO_DEFINED_1 (99)
#define SL_ROAMING_TRIGGER_NONE (100)
#define SL_ROAMING_TRIGGER_LOW_QUALITY_FOR_BG_SCAN (101)
#define SL_ROAMING_TRIGGER_HIGH_QUALITY_FOR_BG_SCAN (102)
#define SL_ROAMING_TRIGGER_NORMAL_QUALITY_FOR_BG_SCAN (103)
#define SL_ROAMING_TRIGGER_LOW_TX_RATE (104)
#define SL_ROAMING_TRIGGER_LOW_SNR (105)
#define SL_ROAMING_TRIGGER_LOW_QUALITY (106)
#define SL_ROAMING_TRIGGER_TSPEC_REJECTED (107)
#define SL_ROAMING_TRIGGER_MAX_TX_RETRIES (108)
#define SL_ROAMING_TRIGGER_BSS_LOSS (109)
#define SL_ROAMING_TRIGGER_BSS_LOSS_DUE_TO_MAX_TX_RETRY (110)
#define SL_ROAMING_TRIGGER_SWITCH_CHANNEL (111)
#define SL_ROAMING_TRIGGER_AP_DISCONNECT (112)
#define SL_ROAMING_TRIGGER_SECURITY_ATTACK (113)
#define SL_ROAMING_TRIGGER_MAX (114)
#define SL_USER_INITIATED_DISCONNECTION (200)
/* Wlan error codes */
@ -155,8 +131,8 @@ extern "C" {
#define SL_SEC_TYPE_WPS_PIN (4)
#define SL_SEC_TYPE_WPA_ENT (5)
#define SL_SEC_TYPE_P2P_PBC (6)
#define SL_SEC_TYPE_P2P_PIN_KEYPAD (7)
#define SL_SEC_TYPE_P2P_PIN_DISPLAY (8)
#define SL_SEC_TYPE_P2P_PIN_KEYPAD (7)
#define SL_SEC_TYPE_P2P_PIN_DISPLAY (8)
#define SL_SEC_TYPE_P2P_PIN_AUTO (9) /* NOT Supported yet */
@ -417,7 +393,7 @@ typedef struct
{
_u32 ReceivedValidPacketsNumber; /* sum of the packets that been received OK (include filtered) */
_u32 ReceivedFcsErrorPacketsNumber; /* sum of the packets that been dropped due to FCS error */
_u32 ReceivedPlcpErrorPacketsNumber; /* sum of the packets that been dropped due to PLCP error */
_u32 ReceivedAddressMismatchPacketsNumber; /* sum of the packets that been received but filtered out by one of the HW filters */
_i16 AvarageDataCtrlRssi; /* average RSSI for all valid data packets received */
_i16 AvarageMgMntRssi; /* average RSSI for all valid management packets received */
_u16 RateHistogram[NUM_OF_RATE_INDEXES]; /* rate histogram for all valid packets received */
@ -461,7 +437,7 @@ typedef struct
_u8 UserLen;
_i8 AnonUser[32];
_u8 AnonUserLen;
_u8 CertIndex; //not supported
_u8 CertIndex; /* not supported */
_u32 EapMethod;
}SlGetSecParamsExt_t;
@ -505,19 +481,19 @@ typedef struct
/*!
\brief Connect to wlan network as a station
\param[in] sec_type security types options: \n
- SL_SEC_TYPE_OPEN
- SL_SEC_TYPE_WEP
- SL_SEC_TYPE_WPA_WPA2
- SL_SEC_TYPE_WPA_ENT
- SL_SEC_TYPE_WPS_PBC
- SL_SEC_TYPE_WPS_PIN
\param[in] pName up to 32 bytes in case of STA the name is the SSID of the Access Point
\param[in] NameLen name length
\param[in] pMacAddr 6 bytes for MAC address
\param[in] pSecParams Security parameters (use NULL key for SL_SEC_TYPE_OPEN)
Security types options: \n
- SL_SEC_TYPE_OPEN
- SL_SEC_TYPE_WEP
- SL_SEC_TYPE_WPA_WPA2
- SL_SEC_TYPE_WPA_ENT
- SL_SEC_TYPE_WPS_PBC
- SL_SEC_TYPE_WPS_PIN
\param[in] pSecExtParams Enterprise parameters (set NULL in case Enterprise parameters is not in use)
\return On success, zero is returned. On error, negative is returned
@ -529,7 +505,7 @@ typedef struct
SL_SEC_TYPE_WPA is a deprecated definition, the new definition is SL_SEC_TYPE_WPA_WPA2
*/
#if _SL_INCLUDE_FUNC(sl_WlanConnect)
_i16 sl_WlanConnect(_i8* pName, _i16 NameLen, _u8 *pMacAddr, SlSecParams_t* pSecParams , SlSecParamsExt_t* pSecExtParams);
_i16 sl_WlanConnect(const _i8* pName,const _i16 NameLen,const _u8 *pMacAddr,const SlSecParams_t* pSecParams ,const SlSecParamsExt_t* pSecExtParams);
#endif
/*!
@ -586,7 +562,7 @@ _i16 sl_WlanDisconnect(void);
*/
#if _SL_INCLUDE_FUNC(sl_WlanProfileAdd)
_i16 sl_WlanProfileAdd(_i8* pName, _i16 NameLen, _u8 *pMacAddr, SlSecParams_t* pSecParams , SlSecParamsExt_t* pSecExtParams, _u32 Priority, _u32 Options);
_i16 sl_WlanProfileAdd(const _i8* pName,const _i16 NameLen,const _u8 *pMacAddr,const SlSecParams_t* pSecParams ,const SlSecParamsExt_t* pSecExtParams,const _u32 Priority,const _u32 Options);
#endif
/*!
@ -601,8 +577,8 @@ _i16 sl_WlanProfileAdd(_i8* pName, _i16 NameLen, _u8 *pMacAddr, SlSecParams_t*
\param[out] pNameLen name length
\param[out] pMacAddr 6 bytes for MAC address
\param[out] pSecParams security parameters - security type
(LAN_SEC_UNSEC, WLAN_SEC_WEP, WLAN_SEC_WPA or
WLAN_SEC_WPA2, WLAN_SEC_P2P_PBC, WLAN_SEC_P2P_PIN_KEYPAD or WLAN_SEC_P2P_DISPLAY), key and key length are not
(SL_SEC_TYPE_OPEN, SL_SEC_TYPE_WEP, SL_SEC_TYPE_WPA_WPA2 or
SL_SEC_TYPE_WPS_PBC, SL_SEC_TYPE_WPS_PIN, SL_SEC_TYPE_WPA_ENT,SL_SEC_TYPE_P2P_PBC,SL_SEC_TYPE_P2P_PIN_KEYPAD or SL_SEC_TYPE_P2P_PIN_DISPLAY), key and key length are not
in case of p2p security type pin the key refers to pin code
return due to security reasons.
\param[out] pSecExtParams enterprise parameters - identity, identity
@ -618,7 +594,7 @@ _i16 sl_WlanProfileAdd(_i8* pName, _i16 NameLen, _u8 *pMacAddr, SlSecParams_t*
\warning
*/
#if _SL_INCLUDE_FUNC(sl_WlanProfileGet)
_i16 sl_WlanProfileGet(_i16 Index,_i8* pName, _i16 *pNameLen, _u8 *pMacAddr, SlSecParams_t* pSecParams, SlGetSecParamsExt_t* pSecExtParams, _u32 *pPriority);
_i16 sl_WlanProfileGet(const _i16 Index,_i8* pName, _i16 *pNameLen, _u8 *pMacAddr, SlSecParams_t* pSecParams, SlGetSecParamsExt_t* pSecExtParams, _u32 *pPriority);
#endif
/*!
@ -637,7 +613,7 @@ _i16 sl_WlanProfileGet(_i16 Index,_i8* pName, _i16 *pNameLen, _u8 *pMacAddr, Sl
\warning
*/
#if _SL_INCLUDE_FUNC(sl_WlanProfileDel)
_i16 sl_WlanProfileDel(_i16 Index);
_i16 sl_WlanProfileDel(const _i16 Index);
#endif
/*!
@ -672,7 +648,7 @@ _i16 sl_WlanProfileDel(_i16 Index);
<b> sl_WlanPolicySet(SL_POLICY_CONNECTION,SL_CONNECTION_POLICY(0,0,0,0,1),NULL,0) </b> \n
The options above could be combined to a single action, if more than one action is required. \n
\par
SL_POLICY_SCAN defines system scan time interval in case there is no connection. Default interval is 10 minutes. \n
SL_POLICY_SCAN defines system scan time interval.Default interval is 10 minutes. \n
After settings scan interval, an immediate scan is activated. The next scan will be based on the interval settings. \n
- For example, setting scan interval to 1 minute interval use: \n
_u32 intervalInSeconds = 60; \n
@ -706,7 +682,7 @@ _i16 sl_WlanProfileDel(_i16 Index);
*/
#if _SL_INCLUDE_FUNC(sl_WlanPolicySet)
_i16 sl_WlanPolicySet(_u8 Type , const _u8 Policy, _u8 *pVal,_u8 ValLen);
_i16 sl_WlanPolicySet(const _u8 Type , const _u8 Policy, _u8 *pVal,const _u8 ValLen);
#endif
/*!
\brief get policy values
@ -729,7 +705,7 @@ _i16 sl_WlanPolicySet(_u8 Type , const _u8 Policy, _u8 *pVal,_u8 ValLen);
*/
#if _SL_INCLUDE_FUNC(sl_WlanPolicyGet)
_i16 sl_WlanPolicyGet(_u8 Type , _u8 Policy,_u8 *pVal,_u8 *pValLen);
_i16 sl_WlanPolicyGet(const _u8 Type , _u8 Policy,_u8 *pVal,_u8 *pValLen);
#endif
/*!
\brief Gets the WLAN scan operation results
@ -760,7 +736,7 @@ _i16 sl_WlanPolicyGet(_u8 Type , _u8 Policy,_u8 *pVal,_u8 *pValLen);
\endcode
*/
#if _SL_INCLUDE_FUNC(sl_WlanGetNetworkList)
_i16 sl_WlanGetNetworkList(_u8 Index, _u8 Count, Sl_WlanNetworkEntry_t *pEntries);
_i16 sl_WlanGetNetworkList(const _u8 Index,const _u8 Count, Sl_WlanNetworkEntry_t *pEntries);
#endif
/*!
@ -770,7 +746,7 @@ _i16 sl_WlanGetNetworkList(_u8 Index, _u8 Count, Sl_WlanNetworkEntry_t *pEntries
\sa sl_WlanRxStatStop sl_WlanRxStatGet
\note belongs to \ref ext_api
\warning This API is deprecated and should be removed for next release
\warning
\par Example:
\code Getting wlan RX statistics:
@ -810,7 +786,7 @@ _i16 sl_WlanRxStatStart(void);
\sa sl_WlanRxStatStart sl_WlanRxStatGet
\note belongs to \ref ext_api
\warning This API is deprecated and should be removed for next release
\warning
*/
#if _SL_INCLUDE_FUNC(sl_WlanRxStatStop)
_i16 sl_WlanRxStatStop(void);
@ -829,7 +805,7 @@ _i16 sl_WlanRxStatStop(void);
\warning
*/
#if _SL_INCLUDE_FUNC(sl_WlanRxStatGet)
_i16 sl_WlanRxStatGet(SlGetRxStatResponse_t *pRxStat,_u32 Flags);
_i16 sl_WlanRxStatGet(SlGetRxStatResponse_t *pRxStat,const _u32 Flags);
#endif
@ -844,7 +820,7 @@ _i16 sl_WlanRxStatGet(SlGetRxStatResponse_t *pRxStat,_u32 Flags);
\sa sl_WlanSmartConfigStart
\note belongs to \ref ext_api
\warning This API is deprecated and should be removed for next release
\warning
*/
#if _SL_INCLUDE_FUNC(sl_WlanSmartConfigStop)
@ -980,6 +956,9 @@ _i16 sl_WlanSetMode(const _u8 mode);
for WEP: 5 / 13 characters (ascii) \n
This options takes <b>_u8</b> buffer as parameter
- <b>SL_WLAN_CFG_GENERAL_PARAM_ID</b>
- <b> WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS </b> \n
Set scan parameters.
This option uses slWlanScanParamCommand_t as parameter
- <b>WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE</b> \n
Set Country Code for AP mode \n
This options takes <b>_u8</b> 2 bytes buffer as parameter
@ -1065,6 +1044,15 @@ _i16 sl_WlanSetMode(const _u8 mode);
_u8 stapower=(_u8)power;
sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, WLAN_GENERAL_PARAM_OPT_STA_TX_POWER,1,(_u8 *)&stapower);
\endcode
\par
<b> WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS: </b>
\code
slWlanScanParamCommand_t ScanParamConfig;
ScanParamConfig.G_Channels_mask = 0x01; // bit mask for channels:1 means channel 1 is enabled, 3 means channels 1 + 2 are enabled
ScanParamConfig.rssiThershold = -70; // only for RSSI level which is higher than -70
sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID ,WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS,sizeof(slWlanScanParamCommand_t),(_u8*)&ScanParamConfig);
\endcode
\par
<b> WLAN_GENERAL_PARAM_OPT_COUNTRY_CODE: </b>
\code
@ -1119,7 +1107,7 @@ _i16 sl_WlanSetMode(const _u8 mode);
*/
#if _SL_INCLUDE_FUNC(sl_WlanSet)
_i16 sl_WlanSet(_u16 ConfigId ,_u16 ConfigOpt,_u16 ConfigLen, _u8 *pValues);
_i16 sl_WlanSet(const _u16 ConfigId ,const _u16 ConfigOpt,const _u16 ConfigLen,const _u8 *pValues);
#endif
/*!
@ -1214,17 +1202,17 @@ _i16 sl_WlanSet(_u16 ConfigId ,_u16 ConfigOpt,_u16 ConfigLen, _u8 *pValues);
\par
<b> WLAN_GENERAL_PARAM_OPT_AP_TX_POWER: </b>
\code
_i16 TXPower = 0;
_i8 TXPower = 0;
_u16 Option = WLAN_GENERAL_PARAM_OPT_AP_TX_POWER;
_u16 OptionLen = sizeof(_i16);
_u16 OptionLen = sizeof(_i8);
sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID ,&Option,&OptionLen,(_u8 *)&TXPower);
\endcode
\par
<b> WLAN_GENERAL_PARAM_OPT_STA_TX_POWER: </b>
\code
_i16 TXPower = 0;
_i8 TXPower = 0;
_u16 Option = WLAN_GENERAL_PARAM_OPT_STA_TX_POWER;
_u16 OptionLen = sizeof(_i16);
_u16 OptionLen = sizeof(_i8);
sl_WlanGet(SL_WLAN_CFG_GENERAL_PARAM_ID ,&Option,&OptionLen,(_u8 *)&TXPower);
\endcode
@ -1302,7 +1290,7 @@ _i16 sl_WlanSet(_u16 ConfigId ,_u16 ConfigOpt,_u16 ConfigLen, _u8 *pValues);
*/
#if _SL_INCLUDE_FUNC(sl_WlanGet)
_i16 sl_WlanGet(_u16 ConfigId, _u16 *pConfigOpt,_u16 *pConfigLen, _u8 *pValues);
_i16 sl_WlanGet(const _u16 ConfigId, _u16 *pConfigOpt,_u16 *pConfigLen, _u8 *pValues);
#endif
/*!

View File

@ -34,15 +34,17 @@
*
*/
#ifndef RX_FILTERS_PREPROCESSOR_CLI_IF_H_
#define RX_FILTERS_PREPROCESSOR_CLI_IF_H_
/*****************************************************************************/
/* Include files */
/*****************************************************************************/
#include "simplelink.h"
#ifndef RX_FILTERS_PREPROCESSOR_CLI_IF_H_
#define RX_FILTERS_PREPROCESSOR_CLI_IF_H_
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -49,25 +49,23 @@
/* Internal functions */
/*****************************************************************************/
const _i8 StartResponseLUT[8] =
{
ROLE_UNKNOWN_ERR,
ROLE_STA,
ROLE_STA_ERR,
ROLE_AP,
ROLE_AP_ERR,
ROLE_P2P,
ROLE_P2P_ERR,
ROLE_UNKNOWN_ERR
};
_i16 _sl_GetStartResponseConvert(_u32 Status)
{
switch(Status)
{
case INIT_STA_OK:
return ROLE_STA;
case INIT_STA_ERR:
return ROLE_STA_ERR;
case INIT_AP_OK:
return ROLE_AP;
case INIT_AP_ERR:
return ROLE_AP_ERR;
case INIT_P2P_OK:
return ROLE_P2P;
case INIT_P2P_ERR:
return ROLE_P2P_ERR;
default:
return (_i16)Status;
}
return (_i16)StartResponseLUT[Status & 0x7];
}
/*****************************************************************************/
@ -112,39 +110,37 @@ _i16 sl_Start(const void* pIfHdl, _i8* pDevName, const P_INIT_CALLBACK pInitCal
{
g_pCB->FD = (_SlFd_t)pIfHdl;
}
/* Use Obj to issue the command, if not available try later */
ObjIdx = _SlDrvWaitForPoolObj(START_STOP_ID,SL_MAX_SOCKETS);
ObjIdx = _SlDrvProtectAsyncRespSetting((_u8 *)&AsyncRsp, START_STOP_ID, SL_MAX_SOCKETS);
if (MAX_CONCURRENT_ACTIONS == ObjIdx)
{
return SL_POOL_IS_EMPTY;
}
OSI_RET_OK_CHECK(sl_LockObjLock(&g_pCB->ProtectionLockObj, SL_OS_WAIT_FOREVER));
g_pCB->ObjPool[ObjIdx].pRespArgs = (_u8 *)&AsyncRsp;
OSI_RET_OK_CHECK(sl_LockObjUnlock(&g_pCB->ProtectionLockObj));
if( g_pCB->FD >= 0)
if( g_pCB->FD >= (_SlFd_t)0)
{
sl_DeviceDisable();
sl_IfRegIntHdlr((SL_P_EVENT_HANDLER)_SlDrvRxIrqHandler, NULL);
if(NULL != pInitCallBack)
{
g_pCB->pInitCallback = pInitCallBack;
}
g_pCB->pInitCallback = pInitCallBack;
sl_DeviceEnable();
if (NULL == pInitCallBack)
{
OSI_RET_OK_CHECK(sl_SyncObjWait(&g_pCB->ObjPool[ObjIdx].SyncObj, SL_OS_WAIT_FOREVER));
/*release Pool Object*/
_SlDrvSyncObjWaitForever(&g_pCB->ObjPool[ObjIdx].SyncObj);
/* release Pool Object */
_SlDrvReleasePoolObj(g_pCB->FunctionParams.AsyncExt.ActionIndex);
return _sl_GetStartResponseConvert(AsyncRsp.Status);
return _sl_GetStartResponseConvert(AsyncRsp.Status);
}
else
{
return SL_RET_CODE_OK;
}
}
return (_i16)g_pCB->FD;
return SL_BAD_INTERFACE;
}
#endif
@ -156,7 +152,7 @@ void _sl_HandleAsync_InitComplete(void *pVoidBuf)
{
InitComplete_t *pMsgArgs = (InitComplete_t *)_SL_RESP_ARGS_START(pVoidBuf);
OSI_RET_OK_CHECK(sl_LockObjLock(&g_pCB->ProtectionLockObj, SL_OS_WAIT_FOREVER));
_SlDrvProtectionObjLockWaitForever();
if(g_pCB->pInitCallback)
{
@ -165,10 +161,11 @@ void _sl_HandleAsync_InitComplete(void *pVoidBuf)
else
{
sl_Memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(InitComplete_t));
OSI_RET_OK_CHECK(sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj));
_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
}
OSI_RET_OK_CHECK(sl_LockObjUnlock(&g_pCB->ProtectionLockObj));
_SlDrvProtectionObjUnLock();
if(g_pCB->pInitCallback)
{
_SlDrvReleasePoolObj(g_pCB->FunctionParams.AsyncExt.ActionIndex);
@ -186,11 +183,13 @@ void _sl_HandleAsync_Stop(void *pVoidBuf)
VERIFY_SOCKET_CB(NULL != g_pCB->StopCB.pAsyncRsp);
OSI_RET_OK_CHECK(sl_LockObjLock(&g_pCB->ProtectionLockObj, SL_OS_WAIT_FOREVER));
_SlDrvProtectionObjLockWaitForever();
sl_Memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_BasicResponse_t));
OSI_RET_OK_CHECK(sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj));
OSI_RET_OK_CHECK(sl_LockObjUnlock(&g_pCB->ProtectionLockObj));
_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
_SlDrvProtectionObjUnLock();
return;
}
@ -212,12 +211,12 @@ const _SlCmdCtrl_t _SlStopCmdCtrl =
};
#if _SL_INCLUDE_FUNC(sl_Stop)
_i16 sl_Stop(_u16 timeout)
_i16 sl_Stop(const _u16 timeout)
{
_i16 RetVal=0;
_SlStopMsg_u Msg;
_BasicResponse_t AsyncRsp;
_i16 ObjIdx = MAX_CONCURRENT_ACTIONS;
_i8 ObjIdx = MAX_CONCURRENT_ACTIONS;
/* if timeout is 0 the shutdown is forced immediately */
if( 0 == timeout )
{
@ -230,32 +229,26 @@ _i16 sl_Stop(_u16 timeout)
{
/* let the device make the shutdown using the defined timeout */
Msg.Cmd.Timeout = timeout;
/* Use Obj to issue the command, if not available try later */
ObjIdx = _SlDrvWaitForPoolObj(START_STOP_ID,SL_MAX_SOCKETS);
if (MAX_CONCURRENT_ACTIONS == ObjIdx)
{
return SL_POOL_IS_EMPTY;
}
OSI_RET_OK_CHECK(sl_LockObjLock(&g_pCB->ProtectionLockObj, SL_OS_WAIT_FOREVER));
g_pCB->ObjPool[ObjIdx].pRespArgs = (_u8 *)&AsyncRsp;
ObjIdx = _SlDrvProtectAsyncRespSetting((_u8 *)&AsyncRsp, START_STOP_ID, SL_MAX_SOCKETS);
if (MAX_CONCURRENT_ACTIONS == ObjIdx)
{
return SL_POOL_IS_EMPTY;
}
OSI_RET_OK_CHECK(sl_LockObjUnlock(&g_pCB->ProtectionLockObj));
VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlStopCmdCtrl, &Msg, NULL));
VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlStopCmdCtrl, &Msg, NULL));
if(SL_OS_RET_CODE_OK == (_i16)Msg.Rsp.status)
{
_SlDrvSyncObjWaitForever(&g_pCB->ObjPool[ObjIdx].SyncObj);
Msg.Rsp.status = AsyncRsp.status;
RetVal = Msg.Rsp.status;
}
if(SL_OS_RET_CODE_OK == (_i16)Msg.Rsp.status)
{
OSI_RET_OK_CHECK(sl_SyncObjWait(&g_pCB->ObjPool[ObjIdx].SyncObj, SL_OS_WAIT_FOREVER));
Msg.Rsp.status = AsyncRsp.status;
RetVal = Msg.Rsp.status;
}
_SlDrvReleasePoolObj((_u8)ObjIdx);
sl_IfRegIntHdlr(NULL, NULL);
sl_DeviceDisable();
sl_IfClose(g_pCB->FD);
_SlDrvReleasePoolObj(ObjIdx);
sl_IfRegIntHdlr(NULL, NULL);
sl_DeviceDisable();
sl_IfClose(g_pCB->FD);
}
_SlDrvDriverCBDeinit();
@ -269,10 +262,15 @@ sl_EventMaskSet
*****************************************************************************/
typedef union
{
_DevMaskEventSetCommand_t Cmd;
_BasicResponse_t Rsp;
_DevMaskEventSetCommand_t Cmd;
_BasicResponse_t Rsp;
}_SlEventMaskSetMsg_u;
#if _SL_INCLUDE_FUNC(sl_EventMaskSet)
const _SlCmdCtrl_t _SlEventMaskSetCmdCtrl =
{
SL_OPCODE_DEVICE_EVENTMASKSET,
@ -280,8 +278,8 @@ const _SlCmdCtrl_t _SlEventMaskSetCmdCtrl =
sizeof(_BasicResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_EventMaskSet)
_i16 sl_EventMaskSet(_u8 EventClass , _u32 Mask)
_i16 sl_EventMaskSet(const _u8 EventClass ,const _u32 Mask)
{
_SlEventMaskSetMsg_u Msg;
@ -299,10 +297,14 @@ sl_EventMaskGet
******************************************************************************/
typedef union
{
_DevMaskEventGetCommand_t Cmd;
_DevMaskEventGetCommand_t Cmd;
_DevMaskEventGetResponse_t Rsp;
}_SlEventMaskGetMsg_u;
#if _SL_INCLUDE_FUNC(sl_EventMaskGet)
const _SlCmdCtrl_t _SlEventMaskGetCmdCtrl =
{
SL_OPCODE_DEVICE_EVENTMASKGET,
@ -310,8 +312,8 @@ const _SlCmdCtrl_t _SlEventMaskGetCmdCtrl =
sizeof(_DevMaskEventGetResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_EventMaskGet)
_i16 sl_EventMaskGet(_u8 EventClass, _u32 *pMask)
_i16 sl_EventMaskGet(const _u8 EventClass,_u32 *pMask)
{
_SlEventMaskGetMsg_u Msg;
@ -332,10 +334,14 @@ sl_DevGet
typedef union
{
_DeviceSetGet_t Cmd;
_DeviceSetGet_t Rsp;
_DeviceSetGet_t Cmd;
_DeviceSetGet_t Rsp;
}_SlDeviceMsgGet_u;
#if _SL_INCLUDE_FUNC(sl_DevGet)
const _SlCmdCtrl_t _SlDeviceGetCmdCtrl =
{
SL_OPCODE_DEVICE_DEVICEGET,
@ -343,8 +349,7 @@ const _SlCmdCtrl_t _SlDeviceGetCmdCtrl =
sizeof(_DeviceSetGet_t)
};
#if _SL_INCLUDE_FUNC(sl_DevGet)
_i32 sl_DevGet(_u8 DeviceGetId, _u8 *pOption,_u8 *pConfigLen, _u8 *pValues)
_i32 sl_DevGet(const _u8 DeviceGetId,_u8 *pOption,_u8 *pConfigLen, _u8 *pValues)
{
_SlDeviceMsgGet_u Msg;
_SlCmdExt_t CmdExt;
@ -356,11 +361,10 @@ _i32 sl_DevGet(_u8 DeviceGetId, _u8 *pOption,_u8 *pConfigLen, _u8 *pValues)
if( pOption )
{
CmdExt.TxPayloadLen = 0;
_SlDrvResetCmdExt(&CmdExt);
CmdExt.RxPayloadLen = *pConfigLen;
CmdExt.pTxPayload = NULL;
CmdExt.pRxPayload = (_u8 *)pValues;
CmdExt.ActualRxPayloadLen = 0;
Msg.Cmd.DeviceSetId = DeviceGetId;
@ -401,6 +405,10 @@ typedef union
_BasicResponse_t Rsp;
}_SlDeviceMsgSet_u;
#if _SL_INCLUDE_FUNC(sl_DevSet)
const _SlCmdCtrl_t _SlDeviceSetCmdCtrl =
{
SL_OPCODE_DEVICE_DEVICESET,
@ -408,17 +416,16 @@ const _SlCmdCtrl_t _SlDeviceSetCmdCtrl =
sizeof(_BasicResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_DevSet)
_i32 sl_DevSet(_u8 DeviceSetId ,_u8 Option,_u8 ConfigLen, _u8 *pValues)
_i32 sl_DevSet(const _u8 DeviceSetId ,const _u8 Option,const _u8 ConfigLen,const _u8 *pValues)
{
_SlDeviceMsgSet_u Msg;
_SlCmdExt_t CmdExt;
CmdExt.TxPayloadLen = (ConfigLen+3) & (~3);
CmdExt.RxPayloadLen = 0;
CmdExt.pTxPayload = (_u8 *)pValues;
CmdExt.pRxPayload = NULL;
_SlDrvResetCmdExt(&CmdExt);
CmdExt.TxPayloadLen = (ConfigLen+3) & (~3);
CmdExt.pTxPayload = (_u8 *)pValues;
Msg.Cmd.DeviceSetId = DeviceSetId;
Msg.Cmd.ConfigLen = ConfigLen;
@ -434,7 +441,7 @@ _i32 sl_DevSet(_u8 DeviceSetId ,_u8 Option,_u8 ConfigLen, _u8 *pValues)
/******************************************************************************
_SlDrvDeviceEventHandler - handles internally device async events
******************************************************************************/
void _SlDrvDeviceEventHandler(void *pArgs)
void _SlDrvDeviceEventHandler(void* pArgs)
{
_SlResponseHeader_t *pHdr = (_SlResponseHeader_t *)pArgs;
@ -446,21 +453,34 @@ void _SlDrvDeviceEventHandler(void *pArgs)
case SL_OPCODE_DEVICE_STOP_ASYNC_RESPONSE:
_sl_HandleAsync_Stop(pHdr);
break;
case SL_OPCODE_DEVICE_ABORT:
{
#if defined (sl_GeneralEvtHdlr) || defined(EXT_LIB_REGISTERED_GENERAL_EVENTS)
SlDeviceEvent_t devHandler;
devHandler.Event = SL_DEVICE_ABORT_ERROR_EVENT;
devHandler.EventData.deviceReport.AbortType = *((_u32*)pArgs + 2);
devHandler.EventData.deviceReport.AbortData = *((_u32*)pArgs + 3);
_SlDrvHandleGeneralEvents(&devHandler);
#endif
}
break;
case SL_OPCODE_DEVICE_DEVICEASYNCFATALERROR:
#ifdef sl_GeneralEvtHdlr
#if defined (sl_GeneralEvtHdlr) || defined(EXT_LIB_REGISTERED_GENERAL_EVENTS)
{
_BasicResponse_t *pMsgArgs = (_BasicResponse_t *)_SL_RESP_ARGS_START(pHdr);
SlDeviceEvent_t devHandler;
devHandler.Event = SL_DEVICE_FATAL_ERROR_EVENT;
devHandler.EventData.deviceEvent.status = pMsgArgs->status & 0xFF;
devHandler.EventData.deviceEvent.sender = (SlErrorSender_e)((pMsgArgs->status >> 8) & 0xFF);
sl_GeneralEvtHdlr(&devHandler);
_SlDrvHandleGeneralEvents(&devHandler);
}
#endif
break;
default:
SL_ERROR_TRACE1(MSG_306, "ASSERT: _SlDrvDeviceEventHandler : invalid opcode = 0x%x", pHdr->GenHeader.Opcode);
VERIFY_PROTOCOL(0);
SL_ERROR_TRACE2(MSG_306, "ASSERT: _SlDrvDeviceEventHandler : invalid opcode = 0x%x = %1", pHdr->GenHeader.Opcode, pHdr->GenHeader.Opcode);
}
}
@ -471,10 +491,14 @@ sl_UartSetMode
#ifdef SL_IF_TYPE_UART
typedef union
{
_DevUartSetModeCommand_t Cmd;
_DevUartSetModeCommand_t Cmd;
_DevUartSetModeResponse_t Rsp;
}_SlUartSetModeMsg_u;
#if _SL_INCLUDE_FUNC(sl_UartSetMode)
const _SlCmdCtrl_t _SlUartSetModeCmdCtrl =
{
SL_OPCODE_DEVICE_SETUARTMODECOMMAND,
@ -482,8 +506,6 @@ const _SlCmdCtrl_t _SlUartSetModeCmdCtrl =
sizeof(_DevUartSetModeResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_UartSetMode)
_i16 sl_UartSetMode(const SlUartIfParams_t* pUartParams)
{
_SlUartSetModeMsg_u Msg;

File diff suppressed because it is too large Load Diff

View File

@ -53,7 +53,6 @@
/* Internal functions */
/*****************************************************************************/
/*****************************************************************************/
/* _sl_Strlen */
/*****************************************************************************/
@ -87,7 +86,6 @@ _u32 _sl_GetCreateFsMode(_u32 maxSizeInBytes,_u32 accessFlags)
return _FS_MODE(_FS_MODE_OPEN_WRITE_CREATE_IF_NOT_EXIST, granIdx, granNum, accessFlags);
}
/*****************************************************************************/
/* API functions */
/*****************************************************************************/
@ -97,10 +95,13 @@ _u32 _sl_GetCreateFsMode(_u32 maxSizeInBytes,_u32 accessFlags)
/*****************************************************************************/
typedef union
{
_FsOpenCommand_t Cmd;
_FsOpenResponse_t Rsp;
_FsOpenCommand_t Cmd;
_FsOpenResponse_t Rsp;
}_SlFsOpenMsg_u;
#if _SL_INCLUDE_FUNC(sl_FsOpen)
const _SlCmdCtrl_t _SlFsOpenCmdCtrl =
{
SL_OPCODE_NVMEM_FILEOPEN,
@ -108,41 +109,40 @@ const _SlCmdCtrl_t _SlFsOpenCmdCtrl =
sizeof(_FsOpenResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_FsOpen)
_i32 sl_FsOpen(_u8 *pFileName,_u32 AccessModeAndMaxSize, _u32 *pToken,_i32 *pFileHandle)
_i32 sl_FsOpen(const _u8 *pFileName,const _u32 AccessModeAndMaxSize, _u32 *pToken,_i32 *pFileHandle)
{
_SlReturnVal_t RetVal;
_SlFsOpenMsg_u Msg;
_SlCmdExt_t CmdExt;
CmdExt.TxPayloadLen = (_sl_Strlen(pFileName)+4) & (~3); // add 4: 1 for NULL and the 3 for align
CmdExt.TxPayloadLen = (_sl_Strlen(pFileName)+4) & (~3); /* add 4: 1 for NULL and the 3 for align */
CmdExt.RxPayloadLen = 0;
CmdExt.pTxPayload = pFileName;
CmdExt.pTxPayload = (_u8*)pFileName;
CmdExt.pRxPayload = NULL;
Msg.Cmd.Mode = AccessModeAndMaxSize;
if(pToken != NULL)
{
if(pToken != NULL)
{
Msg.Cmd.Token = *pToken;
}
}
else
{
{
Msg.Cmd.Token = 0;
}
}
RetVal = _SlDrvCmdOp((_SlCmdCtrl_t *)&_SlFsOpenCmdCtrl, &Msg, &CmdExt);
*pFileHandle = Msg.Rsp.FileHandle;
if (pToken != NULL)
{
if (pToken != NULL)
{
*pToken = Msg.Rsp.Token;
}
}
/* in case of an error, return the erros file handler as an error code */
if( *pFileHandle < 0 )
{
return *pFileHandle;
}
/* in case of an error, return the erros file handler as an error code */
if( *pFileHandle < 0 )
{
return *pFileHandle;
}
return (_i32)RetVal;
}
#endif
@ -152,10 +152,13 @@ _i32 sl_FsOpen(_u8 *pFileName,_u32 AccessModeAndMaxSize, _u32 *pToken,_i32 *pFil
/*****************************************************************************/
typedef union
{
_FsCloseCommand_t Cmd;
_BasicResponse_t Rsp;
_FsCloseCommand_t Cmd;
_BasicResponse_t Rsp;
}_SlFsCloseMsg_u;
#if _SL_INCLUDE_FUNC(sl_FsClose)
const _SlCmdCtrl_t _SlFsCloseCmdCtrl =
{
SL_OPCODE_NVMEM_FILECLOSE,
@ -163,10 +166,9 @@ const _SlCmdCtrl_t _SlFsCloseCmdCtrl =
sizeof(_FsCloseResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_FsClose)
_i16 sl_FsClose(_i32 FileHdl, _u8* pCeritificateFileName,_u8* pSignature ,_u32 SignatureLen)
_i16 sl_FsClose(const _i32 FileHdl, const _u8* pCeritificateFileName,const _u8* pSignature ,const _u32 SignatureLen)
{
_SlFsCloseMsg_u Msg = {.Cmd = {0, 0, 0}, .Rsp = {0, 0}};
_SlFsCloseMsg_u Msg = {{0, 0}};
_SlCmdExt_t ExtCtrl;
Msg.Cmd.FileHandle = FileHdl;
@ -177,13 +179,13 @@ _i16 sl_FsClose(_i32 FileHdl, _u8* pCeritificateFileName,_u8* pSignature ,_u32
Msg.Cmd.SignatureLen = SignatureLen;
ExtCtrl.TxPayloadLen = ((SignatureLen+3) & (~3)); /* align */
ExtCtrl.pTxPayload = pSignature;
ExtCtrl.RxPayloadLen = (_u16)Msg.Cmd.CertificFileNameLength;
ExtCtrl.pRxPayload = pCeritificateFileName; /* Add signature */
ExtCtrl.pTxPayload = (_u8*)pSignature;
ExtCtrl.RxPayloadLen = (_i16)Msg.Cmd.CertificFileNameLength;
ExtCtrl.pRxPayload = (_u8*)pCeritificateFileName; /* Add signature */
if(ExtCtrl.pRxPayload != NULL && ExtCtrl.RxPayloadLen != 0)
{
g_pCB->RelayFlagsViaRxPayload = TRUE;
ExtCtrl.RxPayloadLen = ExtCtrl.RxPayloadLen * (-1);
}
VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlFsCloseCmdCtrl, &Msg, &ExtCtrl));
@ -198,20 +200,21 @@ _i16 sl_FsClose(_i32 FileHdl, _u8* pCeritificateFileName,_u8* pSignature ,_u32
/*****************************************************************************/
typedef union
{
_FsReadCommand_t Cmd;
_FsReadResponse_t Rsp;
_FsReadCommand_t Cmd;
_FsReadResponse_t Rsp;
}_SlFsReadMsg_u;
#if _SL_INCLUDE_FUNC(sl_FsRead)
const _SlCmdCtrl_t _SlFsReadCmdCtrl =
{
SL_OPCODE_NVMEM_FILEREADCOMMAND,
sizeof(_FsReadCommand_t),
sizeof(_FsReadResponse_t)
};
};
#if _SL_INCLUDE_FUNC(sl_FsRead)
_i32 sl_FsRead(_i32 FileHdl, _u32 Offset, _u8* pData, _u32 Len)
_i32 sl_FsRead(const _i32 FileHdl,_u32 Offset, _u8* pData,_u32 Len)
{
_SlFsReadMsg_u Msg;
_SlCmdExt_t ExtCtrl;
@ -269,10 +272,13 @@ _i32 sl_FsRead(_i32 FileHdl, _u32 Offset, _u8* pData, _u32 Len)
/*****************************************************************************/
typedef union
{
_FsWriteCommand_t Cmd;
_FsWriteResponse_t Rsp;
_FsWriteCommand_t Cmd;
_FsWriteResponse_t Rsp;
}_SlFsWriteMsg_u;
#if _SL_INCLUDE_FUNC(sl_FsWrite)
const _SlCmdCtrl_t _SlFsWriteCmdCtrl =
{
SL_OPCODE_NVMEM_FILEWRITECOMMAND,
@ -280,9 +286,7 @@ const _SlCmdCtrl_t _SlFsWriteCmdCtrl =
sizeof(_FsWriteResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_FsWrite)
_i32 sl_FsWrite(_i32 FileHdl, _u32 Offset, _u8* pData, _u32 Len)
_i32 sl_FsWrite(const _i32 FileHdl,_u32 Offset, _u8* pData,_u32 Len)
{
_SlFsWriteMsg_u Msg;
_SlCmdExt_t ExtCtrl;
@ -343,10 +347,14 @@ _i32 sl_FsWrite(_i32 FileHdl, _u32 Offset, _u8* pData, _u32 Len)
/*****************************************************************************/
typedef union
{
_FsGetInfoCommand_t Cmd;
_FsGetInfoResponse_t Rsp;
_FsGetInfoCommand_t Cmd;
_FsGetInfoResponse_t Rsp;
}_SlFsGetInfoMsg_u;
#if _SL_INCLUDE_FUNC(sl_FsGetInfo)
const _SlCmdCtrl_t _SlFsGetInfoCmdCtrl =
{
SL_OPCODE_NVMEM_FILEGETINFOCOMMAND,
@ -354,15 +362,14 @@ const _SlCmdCtrl_t _SlFsGetInfoCmdCtrl =
sizeof(_FsGetInfoResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_FsGetInfo)
_i16 sl_FsGetInfo(_u8 *pFileName,_u32 Token,SlFsFileInfo_t* pFsFileInfo)
_i16 sl_FsGetInfo(const _u8 *pFileName,const _u32 Token,SlFsFileInfo_t* pFsFileInfo)
{
_SlFsGetInfoMsg_u Msg;
_SlCmdExt_t CmdExt;
CmdExt.TxPayloadLen = (_sl_Strlen(pFileName)+4) & (~3); /* add 4: 1 for NULL and the 3 for align */
CmdExt.RxPayloadLen = 0;
CmdExt.pTxPayload = pFileName;
CmdExt.pTxPayload = (_u8*)pFileName;
CmdExt.pRxPayload = NULL;
Msg.Cmd.Token = Token;
@ -384,10 +391,13 @@ _i16 sl_FsGetInfo(_u8 *pFileName,_u32 Token,SlFsFileInfo_t* pFsFileInfo)
/*****************************************************************************/
typedef union
{
_FsDeleteCommand_t Cmd;
_FsDeleteResponse_t Rsp;
_FsDeleteCommand_t Cmd;
_FsDeleteResponse_t Rsp;
}_SlFsDeleteMsg_u;
#if _SL_INCLUDE_FUNC(sl_FsDel)
const _SlCmdCtrl_t _SlFsDeleteCmdCtrl =
{
SL_OPCODE_NVMEM_FILEDELCOMMAND,
@ -395,15 +405,14 @@ const _SlCmdCtrl_t _SlFsDeleteCmdCtrl =
sizeof(_FsDeleteResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_FsDel)
_i16 sl_FsDel(_u8 *pFileName,_u32 Token)
_i16 sl_FsDel(const _u8 *pFileName,const _u32 Token)
{
_SlFsDeleteMsg_u Msg;
_SlCmdExt_t CmdExt;
CmdExt.TxPayloadLen = (_sl_Strlen(pFileName)+4) & (~3); /* add 4: 1 for NULL and the 3 for align */
CmdExt.RxPayloadLen = 0;
CmdExt.pTxPayload = pFileName;
CmdExt.pTxPayload = (_u8*)pFileName;
CmdExt.pRxPayload = NULL;
Msg.Cmd.Token = Token;

View File

@ -59,32 +59,33 @@
/* Functions prototypes */
/*****************************************************************************/
void _sl_HandleAsync_DnsGetHostByName(void *pVoidBuf);
#ifndef SL_TINY_EXT
void _sl_HandleAsync_DnsGetHostByService(void *pVoidBuf);
void _sl_HandleAsync_PingResponse(void *pVoidBuf);
#endif
void CopyPingResultsToReport(_PingReportResponse_t *pResults,SlPingReport_t *pReport);
_u16 sl_NetAppSendTokenValue(slHttpServerData_t * Token);
_i16 sl_NetAppMDNSRegisterUnregisterService(const _i8* pServiceName,
_u8 ServiceNameLen,
const _u8 ServiceNameLen,
const _i8* pText,
_u8 TextLen,
_u16 Port,
_u32 TTL,
_u32 Options);
const _u8 TextLen,
const _u16 Port,
const _u32 TTL,
const _u32 Options);
/*****************************************************************************/
/* API functions */
/*****************************************************************************/
/*****************************************************************************
sl_NetAppStart
*****************************************************************************/
#if defined(sl_HttpServerCallback) || defined(EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS)
_u16 _sl_NetAppSendTokenValue(slHttpServerData_t * Token);
#endif
typedef union
{
_NetAppStartStopCommand_t Cmd;
_NetAppStartStopResponse_t Rsp;
}_SlNetAppStartStopMsg_u;
#if _SL_INCLUDE_FUNC(sl_NetAppStart)
const _SlCmdCtrl_t _SlNetAppStartCtrl =
{
SL_OPCODE_NETAPP_START_COMMAND,
@ -92,15 +93,7 @@ const _SlCmdCtrl_t _SlNetAppStartCtrl =
sizeof(_NetAppStartStopResponse_t)
};
const _SlCmdCtrl_t _SlNetAppStopCtrl =
{
SL_OPCODE_NETAPP_STOP_COMMAND,
sizeof(_NetAppStartStopCommand_t),
sizeof(_NetAppStartStopResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_NetAppStart)
_i16 sl_NetAppStart(_u32 AppBitMap)
_i16 sl_NetAppStart(const _u32 AppBitMap)
{
_SlNetAppStartStopMsg_u Msg;
Msg.Cmd.appId = AppBitMap;
@ -114,7 +107,18 @@ _i16 sl_NetAppStart(_u32 AppBitMap)
sl_NetAppStop
*****************************************************************************/
#if _SL_INCLUDE_FUNC(sl_NetAppStop)
_i16 sl_NetAppStop(_u32 AppBitMap)
const _SlCmdCtrl_t _SlNetAppStopCtrl =
{
SL_OPCODE_NETAPP_STOP_COMMAND,
sizeof(_NetAppStartStopCommand_t),
sizeof(_NetAppStartStopResponse_t)
};
_i16 sl_NetAppStop(const _u32 AppBitMap)
{
_SlNetAppStartStopMsg_u Msg;
Msg.Cmd.appId = AppBitMap;
@ -142,6 +146,9 @@ typedef union
_BasicResponse_t Rsp;
}_SlNetappGetServiceListMsg_u;
#if _SL_INCLUDE_FUNC(sl_NetAppGetServiceList)
const _SlCmdCtrl_t _SlGetServiceListeCtrl =
{
SL_OPCODE_NETAPP_NETAPP_MDNS_LOOKUP_SERVICE,
@ -149,13 +156,11 @@ const _SlCmdCtrl_t _SlGetServiceListeCtrl =
sizeof(_BasicResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_NetAppGetServiceList)
_i16 sl_NetAppGetServiceList(_u8 IndexOffest,
_u8 MaxServiceCount,
_u8 Flags,
_i8 *pBuffer,
_u32 RxBufferLength
_i16 sl_NetAppGetServiceList(const _u8 IndexOffest,
const _u8 MaxServiceCount,
const _u8 Flags,
_i8 *pBuffer,
const _u32 RxBufferLength
)
{
@ -201,9 +206,8 @@ _i16 sl_NetAppGetServiceList(_u8 IndexOffest,
return SL_ERROR_NETAPP_RX_BUFFER_LENGTH_ERROR;
}
CmdExt.TxPayloadLen = 0;
_SlDrvResetCmdExt(&CmdExt);
CmdExt.RxPayloadLen = BufferSize;
CmdExt.pTxPayload = NULL;
CmdExt.pRxPayload = (_u8 *)pBuffer;
Msg.Cmd.IndexOffest = IndexOffest;
@ -257,6 +261,9 @@ typedef union
_BasicResponse_t Rsp;
}_SlNetappMdnsRegisterServiceMsg_u;
#if _SL_INCLUDE_FUNC(sl_NetAppMDNSRegisterUnregisterService)
const _SlCmdCtrl_t _SlRegisterServiceCtrl =
{
SL_OPCODE_NETAPP_MDNSREGISTERSERVICE,
@ -264,7 +271,6 @@ const _SlCmdCtrl_t _SlRegisterServiceCtrl =
sizeof(_BasicResponse_t)
};
/******************************************************************************
sl_NetAppMDNSRegisterService
@ -339,15 +345,13 @@ const _SlCmdCtrl_t _SlRegisterServiceCtrl =
******************************************************************************/
#if _SL_INCLUDE_FUNC(sl_NetAppMDNSRegisterUnregisterService)
_i16 sl_NetAppMDNSRegisterUnregisterService( const _i8* pServiceName,
_u8 ServiceNameLen,
const _u8 ServiceNameLen,
const _i8* pText,
_u8 TextLen,
_u16 Port,
_u32 TTL,
_u32 Options)
const _u8 TextLen,
const _u16 Port,
const _u32 TTL,
const _u32 Options)
{
_SlNetappMdnsRegisterServiceMsg_u Msg;
@ -390,7 +394,7 @@ _i16 sl_NetAppMDNSRegisterUnregisterService( const _i8* pServiceName,
return -1;
}
sl_Memset(ServiceNameAndTextBuffer,0,NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH);
_SlDrvMemZero(ServiceNameAndTextBuffer, NETAPP_MDNS_MAX_SERVICE_NAME_AND_TEXT_LENGTH);
/*Copy the service name*/
@ -410,10 +414,9 @@ _i16 sl_NetAppMDNSRegisterUnregisterService( const _i8* pServiceName,
}
CmdExt.TxPayloadLen = (TextLen + ServiceNameLen);
CmdExt.RxPayloadLen = 0;
_SlDrvResetCmdExt(&CmdExt);
CmdExt.TxPayloadLen = (TextLen + ServiceNameLen);
CmdExt.pTxPayload = (_u8 *)ServiceNameAndTextBuffer;
CmdExt.pRxPayload = NULL;
VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlRegisterServiceCtrl, &Msg, &CmdExt));
@ -428,12 +431,12 @@ _i16 sl_NetAppMDNSRegisterUnregisterService( const _i8* pServiceName,
#if _SL_INCLUDE_FUNC(sl_NetAppMDNSRegisterService)
_i16 sl_NetAppMDNSRegisterService( const _i8* pServiceName,
_u8 ServiceNameLen,
const _u8 ServiceNameLen,
const _i8* pText,
_u8 TextLen,
_u16 Port,
_u32 TTL,
_u32 Options)
const _u8 TextLen,
const _u16 Port,
const _u32 TTL,
_u32 Options)
{
@ -478,7 +481,7 @@ _i16 sl_NetAppMDNSRegisterService( const _i8* pServiceName,
#if _SL_INCLUDE_FUNC(sl_NetAppMDNSUnRegisterService)
_i16 sl_NetAppMDNSUnRegisterService( const _i8* pServiceName,
_u8 ServiceNameLen)
const _u8 ServiceNameLen)
{
@ -585,7 +588,7 @@ typedef struct
_i16 Status;
_u32 *out_pAddr;
_u32 *out_pPort;
_u16 *inout_TextLen; // in: max len , out: actual len
_u16 *inout_TextLen; /* in: max len , out: actual len */
_i8 *out_pText;
}_GetHostByServiceAsyncResponse_t;
@ -596,6 +599,9 @@ typedef union
_BasicResponse_t Rsp;
}_SlGetHostByServiceMsg_u;
#if _SL_INCLUDE_FUNC(sl_NetAppDnsGetHostByService)
const _SlCmdCtrl_t _SlGetHostByServiceCtrl =
{
SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICE,
@ -603,14 +609,11 @@ const _SlCmdCtrl_t _SlGetHostByServiceCtrl =
sizeof(_BasicResponse_t)
};
/******************************************************************************/
#if _SL_INCLUDE_FUNC(sl_NetAppDnsGetHostByService)
_i32 sl_NetAppDnsGetHostByService(_i8 *pServiceName, /* string containing all (or only part): name + subtype + service */
_u8 ServiceLen,
_u8 Family, /* 4-IPv4 , 16-IPv6 */
const _u8 ServiceLen,
const _u8 Family, /* 4-IPv4 , 16-IPv6 */
_u32 pAddr[],
_u32 *pPort,
_u16 *pTextLen, /* in: max len , out: actual len */
@ -647,10 +650,10 @@ _i32 sl_NetAppDnsGetHostByService(_i8 *pServiceName, /* string containing all
/*Build the payload part of the command
Copy the service name and text to one buffer.*/
_SlDrvResetCmdExt(&CmdExt);
CmdExt.TxPayloadLen = ServiceLen;
CmdExt.RxPayloadLen = 0;
CmdExt.pTxPayload = (_u8 *)pServiceName;
CmdExt.pRxPayload = NULL;
/*set pointers to the output parameters (the returned parameters).
This pointers are belonged to local struct that is set to global Async response parameter.
@ -662,20 +665,14 @@ _i32 sl_NetAppDnsGetHostByService(_i8 *pServiceName, /* string containing all
AsyncRsp.out_pAddr = (_u32 *)pAddr;
/*Use Obj to issue the command, if not available try later */
ObjIdx = (_u8)_SlDrvWaitForPoolObj(GETHOSYBYSERVICE_ID,SL_MAX_SOCKETS);
ObjIdx = _SlDrvProtectAsyncRespSetting((_u8*)&AsyncRsp, GETHOSYBYSERVICE_ID, SL_MAX_SOCKETS);
if (MAX_CONCURRENT_ACTIONS == ObjIdx)
{
return SL_POOL_IS_EMPTY;
}
OSI_RET_OK_CHECK(sl_LockObjLock(&g_pCB->ProtectionLockObj, SL_OS_WAIT_FOREVER));
if (MAX_CONCURRENT_ACTIONS == ObjIdx)
{
return SL_POOL_IS_EMPTY;
}
g_pCB->ObjPool[ObjIdx].pRespArgs = (void *)&AsyncRsp;
OSI_RET_OK_CHECK(sl_LockObjUnlock(&g_pCB->ProtectionLockObj));
/* set bit to indicate IPv6 address is expected */
if (SL_AF_INET6 == Family)
{
g_pCB->ObjPool[ObjIdx].AdditionalData |= SL_NETAPP_FAMILY_MASK;
@ -688,7 +685,7 @@ _i32 sl_NetAppDnsGetHostByService(_i8 *pServiceName, /* string containing all
/* If the immediate reponse is O.K. than wait for aSYNC event response. */
if(SL_RET_CODE_OK == Msg.Rsp.status)
{
OSI_RET_OK_CHECK(sl_SyncObjWait(&g_pCB->ObjPool[ObjIdx].SyncObj, SL_OS_WAIT_FOREVER));
_SlDrvSyncObjWaitForever(&g_pCB->ObjPool[ObjIdx].SyncObj);
/* If we are - it means that Async event was sent.
The results are copied in the Async handle return functions */
@ -700,6 +697,7 @@ _i32 sl_NetAppDnsGetHostByService(_i8 *pServiceName, /* string containing all
return Msg.Rsp.status;
}
#endif
/******************************************************************************/
/******************************************************************************
@ -758,6 +756,7 @@ _i32 sl_NetAppDnsGetHostByService(_i8 *pServiceName, /* string containing all
******************************************************************************/
#ifndef SL_TINY_EXT
void _sl_HandleAsync_DnsGetHostByService(void *pVoidBuf)
{
@ -819,13 +818,11 @@ void _sl_HandleAsync_DnsGetHostByService(void *pVoidBuf)
/**************************************************************************************************/
OSI_RET_OK_CHECK(sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj));
_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
return;
}
}
/*****************************************************************************/
/* _sl_HandleAsync_DnsGetHostByAddr */
/*****************************************************************************/
@ -834,6 +831,7 @@ void _sl_HandleAsync_DnsGetHostByAddr(void *pVoidBuf)
SL_TRACE0(DBG_MSG, MSG_303, "STUB: _sl_HandleAsync_DnsGetHostByAddr not implemented yet!");
return;
}
#endif
/*****************************************************************************/
/* sl_DnsGetHostByName */
@ -850,24 +848,26 @@ typedef union
_BasicResponse_t Rsp;
}_SlGetHostByNameMsg_u;
#if _SL_INCLUDE_FUNC(sl_NetAppDnsGetHostByName)
const _SlCmdCtrl_t _SlGetHostByNameCtrl =
{
SL_OPCODE_NETAPP_DNSGETHOSTBYNAME,
sizeof(_GetHostByNameCommand_t),
sizeof(_BasicResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_NetAppDnsGetHostByName)
_i16 sl_NetAppDnsGetHostByName(_i8 * hostname, _u16 usNameLen, _u32* out_ip_addr,_u8 family)
_i16 sl_NetAppDnsGetHostByName(_i8 * hostname,const _u16 usNameLen, _u32* out_ip_addr,const _u8 family)
{
_SlGetHostByNameMsg_u Msg;
_SlCmdExt_t ExtCtrl;
_GetHostByNameAsyncResponse_u AsyncRsp;
_u8 ObjIdx = MAX_CONCURRENT_ACTIONS;
_SlDrvResetCmdExt(&ExtCtrl);
ExtCtrl.TxPayloadLen = usNameLen;
ExtCtrl.RxPayloadLen = 0;
ExtCtrl.pTxPayload = (_u8 *)hostname;
ExtCtrl.pRxPayload = 0;
Msg.Cmd.Len = usNameLen;
Msg.Cmd.family = family;
@ -878,22 +878,24 @@ _i16 sl_NetAppDnsGetHostByName(_i8 * hostname, _u16 usNameLen, _u32* out_ip_add
{
return SL_POOL_IS_EMPTY;
}
OSI_RET_OK_CHECK(sl_LockObjLock(&g_pCB->ProtectionLockObj, SL_OS_WAIT_FOREVER));
_SlDrvProtectionObjLockWaitForever();
g_pCB->ObjPool[ObjIdx].pRespArgs = (_u8 *)&AsyncRsp;
/*set bit to indicate IPv6 address is expected */
if (SL_AF_INET6 == family)
if (SL_AF_INET6 == family)
{
g_pCB->ObjPool[ObjIdx].AdditionalData |= SL_NETAPP_FAMILY_MASK;
}
OSI_RET_OK_CHECK(sl_LockObjUnlock(&g_pCB->ProtectionLockObj));
_SlDrvProtectionObjUnLock();
VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlGetHostByNameCtrl, &Msg, &ExtCtrl));
if(SL_RET_CODE_OK == Msg.Rsp.status)
{
OSI_RET_OK_CHECK(sl_SyncObjWait(&g_pCB->ObjPool[ObjIdx].SyncObj, SL_OS_WAIT_FOREVER));
{
_SlDrvSyncObjWaitForever(&g_pCB->ObjPool[ObjIdx].SyncObj);
Msg.Rsp.status = AsyncRsp.IpV4.status;
if(SL_OS_RET_CODE_OK == (_i16)Msg.Rsp.status)
@ -907,6 +909,8 @@ _i16 sl_NetAppDnsGetHostByName(_i8 * hostname, _u16 usNameLen, _u32* out_ip_add
return Msg.Rsp.status;
}
#endif
/******************************************************************************/
/* _sl_HandleAsync_DnsGetHostByName */
/******************************************************************************/
@ -914,7 +918,7 @@ void _sl_HandleAsync_DnsGetHostByName(void *pVoidBuf)
{
_GetHostByNameIPv4AsyncResponse_t *pMsgArgs = (_GetHostByNameIPv4AsyncResponse_t *)_SL_RESP_ARGS_START(pVoidBuf);
OSI_RET_OK_CHECK(sl_LockObjLock(&g_pCB->ProtectionLockObj, SL_OS_WAIT_FOREVER));
_SlDrvProtectionObjLockWaitForever();
VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs);
@ -928,13 +932,13 @@ void _sl_HandleAsync_DnsGetHostByName(void *pVoidBuf)
{
sl_Memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_GetHostByNameIPv4AsyncResponse_t));
}
OSI_RET_OK_CHECK(sl_SyncObjSignal(&(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj)));
OSI_RET_OK_CHECK(sl_LockObjUnlock(&g_pCB->ProtectionLockObj));
_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
_SlDrvProtectionObjUnLock();
return;
}
#ifndef SL_TINY_EXT
void CopyPingResultsToReport(_PingReportResponse_t *pResults,SlPingReport_t *pReport)
{
pReport->PacketsSent = pResults->numSendsPings;
@ -945,7 +949,6 @@ void CopyPingResultsToReport(_PingReportResponse_t *pResults,SlPingReport_t *pRe
pReport->TestTime = pResults->testTime;
}
/*****************************************************************************/
/* _sl_HandleAsync_PingResponse */
/*****************************************************************************/
@ -962,19 +965,20 @@ void _sl_HandleAsync_PingResponse(void *pVoidBuf)
else
{
OSI_RET_OK_CHECK(sl_LockObjLock(&g_pCB->ProtectionLockObj, SL_OS_WAIT_FOREVER));
_SlDrvProtectionObjLockWaitForever();
VERIFY_SOCKET_CB(NULL != g_pCB->PingCB.PingAsync.pAsyncRsp);
if (NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs)
{
sl_Memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_PingReportResponse_t));
OSI_RET_OK_CHECK(sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj));
_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
}
OSI_RET_OK_CHECK(sl_LockObjUnlock(&g_pCB->ProtectionLockObj));
_SlDrvProtectionObjUnLock();
}
return;
}
#endif
/*****************************************************************************/
/* sl_PingStart */
@ -994,15 +998,15 @@ typedef enum
#if _SL_INCLUDE_FUNC(sl_NetAppPingStart)
_i16 sl_NetAppPingStart(SlPingStartCommand_t* pPingParams,_u8 family,SlPingReport_t *pReport,const P_SL_DEV_PING_CALLBACK pPingCallback)
_i16 sl_NetAppPingStart(const SlPingStartCommand_t* pPingParams,const _u8 family,SlPingReport_t *pReport,const P_SL_DEV_PING_CALLBACK pPingCallback)
{
_SlCmdCtrl_t CmdCtrl = {0, sizeof(_PingStartCommand_t), sizeof(_BasicResponse_t)};
_SlPingStartMsg_u Msg;
_PingReportResponse_t PingRsp;
_u8 ObjIdx = MAX_CONCURRENT_ACTIONS;
_u8 ObjIdx = MAX_CONCURRENT_ACTIONS;
if( 0 == pPingParams->Ip ) // stop any ongoing ping
{
if( 0 == pPingParams->Ip )
{/* stop any ongoing ping */
return _SlDrvBasicCmd(SL_OPCODE_NETAPP_PINGSTOP);
}
@ -1023,6 +1027,7 @@ _i16 sl_NetAppPingStart(SlPingStartCommand_t* pPingParams,_u8 family,SlPingRepor
Msg.Cmd.totalNumberOfAttempts = pPingParams->TotalNumberOfAttempts;
Msg.Cmd.flags = pPingParams->Flags;
if( pPingCallback )
{
pPingCallBackFunc = pPingCallback;
@ -1042,7 +1047,7 @@ _i16 sl_NetAppPingStart(SlPingStartCommand_t* pPingParams,_u8 family,SlPingRepor
OSI_RET_OK_CHECK(sl_LockObjUnlock(&g_pCB->ProtectionLockObj));
}
VERIFY_RET_OK(_SlDrvCmdOp(&CmdCtrl, &Msg, NULL));
/*send the command*/
if(CMD_PING_TEST_RUNNING == (_i16)Msg.Rsp.status || CMD_PING_TEST_STOPPED == (_i16)Msg.Rsp.status )
@ -1050,7 +1055,8 @@ _i16 sl_NetAppPingStart(SlPingStartCommand_t* pPingParams,_u8 family,SlPingRepor
/* block waiting for results if no callback function is used */
if( NULL == pPingCallback )
{
OSI_RET_OK_CHECK(sl_SyncObjWait(&g_pCB->ObjPool[ObjIdx].SyncObj, SL_OS_WAIT_FOREVER));
_SlDrvSyncObjWaitForever(&g_pCB->ObjPool[ObjIdx].SyncObj);
if( SL_OS_RET_CODE_OK == (_i16)PingRsp.status )
{
CopyPingResultsToReport(&PingRsp,pReport);
@ -1079,6 +1085,9 @@ typedef union
_BasicResponse_t Rsp;
}_SlNetAppMsgSet_u;
#if _SL_INCLUDE_FUNC(sl_NetAppSet)
const _SlCmdCtrl_t _SlNetAppSetCmdCtrl =
{
SL_OPCODE_NETAPP_NETAPPSET,
@ -1086,16 +1095,15 @@ const _SlCmdCtrl_t _SlNetAppSetCmdCtrl =
sizeof(_BasicResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_NetAppSet)
_i32 sl_NetAppSet(_u8 AppId ,_u8 Option,_u8 OptionLen, _u8 *pOptionValue)
_i32 sl_NetAppSet(const _u8 AppId ,const _u8 Option,const _u8 OptionLen,const _u8 *pOptionValue)
{
_SlNetAppMsgSet_u Msg;
_SlCmdExt_t CmdExt;
_SlDrvResetCmdExt(&CmdExt);
CmdExt.TxPayloadLen = (OptionLen+3) & (~3);
CmdExt.RxPayloadLen = 0;
CmdExt.pTxPayload = (_u8 *)pOptionValue;
CmdExt.pRxPayload = NULL;
Msg.Cmd.AppId = AppId;
@ -1117,6 +1125,9 @@ typedef union
_BasicResponse_t Rsp;
}_SlNetAppMsgSendTokenValue_u;
#if defined(sl_HttpServerCallback) || defined(EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS)
const _SlCmdCtrl_t _SlNetAppSendTokenValueCmdCtrl =
{
SL_OPCODE_NETAPP_HTTPSENDTOKENVALUE,
@ -1124,7 +1135,7 @@ const _SlCmdCtrl_t _SlNetAppSendTokenValueCmdCtrl =
sizeof(_BasicResponse_t)
};
_u16 sl_NetAppSendTokenValue(slHttpServerData_t * Token_value)
_u16 _sl_NetAppSendTokenValue(slHttpServerData_t * Token_value)
{
_SlNetAppMsgSendTokenValue_u Msg;
_SlCmdExt_t CmdExt;
@ -1143,6 +1154,8 @@ _u16 sl_NetAppSendTokenValue(slHttpServerData_t * Token_value)
return Msg.Rsp.status;
}
#endif
/*****************************************************************************/
/* sl_NetAppGet */
@ -1153,6 +1166,8 @@ typedef union
_NetAppSetGet_t Rsp;
}_SlNetAppMsgGet_u;
#if _SL_INCLUDE_FUNC(sl_NetAppGet)
const _SlCmdCtrl_t _SlNetAppGetCmdCtrl =
{
SL_OPCODE_NETAPP_NETAPPGET,
@ -1160,8 +1175,7 @@ const _SlCmdCtrl_t _SlNetAppGetCmdCtrl =
sizeof(_NetAppSetGet_t)
};
#if _SL_INCLUDE_FUNC(sl_NetAppGet)
_i32 sl_NetAppGet(_u8 AppId, _u8 Option,_u8 *pOptionLen, _u8 *pOptionValue)
_i32 sl_NetAppGet(const _u8 AppId,const _u8 Option,_u8 *pOptionLen, _u8 *pOptionValue)
{
_SlNetAppMsgGet_u Msg;
_SlCmdExt_t CmdExt;
@ -1170,11 +1184,10 @@ _i32 sl_NetAppGet(_u8 AppId, _u8 Option,_u8 *pOptionLen, _u8 *pOptionValue)
{
return SL_EZEROLEN;
}
CmdExt.TxPayloadLen = 0;
_SlDrvResetCmdExt(&CmdExt);
CmdExt.RxPayloadLen = *pOptionLen;
CmdExt.pTxPayload = NULL;
CmdExt.pRxPayload = (_u8 *)pOptionValue;
CmdExt.ActualRxPayloadLen = 0;
Msg.Cmd.AppId = AppId;
Msg.Cmd.ConfigOpt = Option;
@ -1199,19 +1212,21 @@ _i32 sl_NetAppGet(_u8 AppId, _u8 Option,_u8 *pOptionLen, _u8 *pOptionValue)
/*****************************************************************************/
/* _SlDrvNetAppEventHandler */
/*****************************************************************************/
void _SlDrvNetAppEventHandler(void *pArgs)
void _SlDrvNetAppEventHandler(void* pArgs)
{
_SlResponseHeader_t *pHdr = (_SlResponseHeader_t *)pArgs;
#ifdef sl_HttpServerCallback
#if defined(sl_HttpServerCallback) || defined(EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS)
SlHttpServerEvent_t httpServerEvent;
SlHttpServerResponse_t httpServerResponse;
#endif
switch(pHdr->GenHeader.Opcode)
{
case SL_OPCODE_NETAPP_DNSGETHOSTBYNAMEASYNCRESPONSE:
case SL_OPCODE_NETAPP_DNSGETHOSTBYNAMEASYNCRESPONSE_V6:
_sl_HandleAsync_DnsGetHostByName(pArgs);
break;
#ifndef SL_TINY_EXT
case SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICEASYNCRESPONSE:
case SL_OPCODE_NETAPP_MDNSGETHOSTBYSERVICEASYNCRESPONSE_V6:
_sl_HandleAsync_DnsGetHostByService(pArgs);
@ -1219,9 +1234,11 @@ void _SlDrvNetAppEventHandler(void *pArgs)
case SL_OPCODE_NETAPP_PINGREPORTREQUESTRESPONSE:
_sl_HandleAsync_PingResponse(pArgs);
break;
#endif
#if defined(sl_HttpServerCallback) || defined(EXT_LIB_REGISTERED_HTTP_SERVER_EVENTS)
case SL_OPCODE_NETAPP_HTTPGETTOKENVALUE:
{
#ifdef sl_HttpServerCallback
{
_u8 *pTokenName;
slHttpServerData_t Token_value;
sl_NetAppHttpServerGetToken_t *httpGetToken = (sl_NetAppHttpServerGetToken_t *)_SL_RESP_ARGS_START(pHdr);
@ -1229,30 +1246,29 @@ void _SlDrvNetAppEventHandler(void *pArgs)
httpServerResponse.Response = SL_NETAPP_HTTPSETTOKENVALUE;
httpServerResponse.ResponseData.token_value.len = MAX_TOKEN_VALUE_LEN;
httpServerResponse.ResponseData.token_value.data = (_u8 *)_SL_RESP_ARGS_START(pHdr) + MAX_TOKEN_NAME_LEN; //Reuse the async buffer for getting the token value response from the user
httpServerEvent.Event = SL_NETAPP_HTTPGETTOKENVALUE_EVENT;
/* Reuse the async buffer for getting the token value response from the user */
httpServerResponse.ResponseData.token_value.data = (_u8 *)_SL_RESP_ARGS_START(pHdr) + MAX_TOKEN_NAME_LEN;
httpServerEvent.Event = SL_NETAPP_HTTPGETTOKENVALUE_EVENT;
httpServerEvent.EventData.httpTokenName.len = httpGetToken->token_name_len;
httpServerEvent.EventData.httpTokenName.data = pTokenName;
Token_value.token_name = pTokenName;
sl_HttpServerCallback (&httpServerEvent, &httpServerResponse);
_SlDrvHandleHttpServerEvents (&httpServerEvent, &httpServerResponse);
Token_value.value_len = httpServerResponse.ResponseData.token_value.len;
Token_value.name_len = httpServerEvent.EventData.httpTokenName.len;
Token_value.token_value = httpServerResponse.ResponseData.token_value.data;
sl_NetAppSendTokenValue(&Token_value);
#endif
_sl_NetAppSendTokenValue(&Token_value);
}
break;
case SL_OPCODE_NETAPP_HTTPPOSTTOKENVALUE:
{
#ifdef sl_HttpServerCallback
_u8 *pPostParams;
sl_NetAppHttpServerPostToken_t *httpPostTokenArgs = (sl_NetAppHttpServerPostToken_t *)_SL_RESP_ARGS_START(pHdr);
@ -1273,13 +1289,16 @@ void _SlDrvNetAppEventHandler(void *pArgs)
httpServerResponse.Response = SL_NETAPP_RESPONSE_NONE;
sl_HttpServerCallback (&httpServerEvent, &httpServerResponse);
#endif
_SlDrvHandleHttpServerEvents (&httpServerEvent, &httpServerResponse);
}
break;
#endif
default:
SL_ERROR_TRACE1(MSG_305, "ASSERT: _SlDrvNetAppEventHandler : invalid opcode = 0x%x", pHdr->GenHeader.Opcode);
SL_ERROR_TRACE2(MSG_305, "ASSERT: _SlDrvNetAppEventHandler : invalid opcode = 0x%x = %1", pHdr->GenHeader.Opcode, pHdr->GenHeader.Opcode);
VERIFY_PROTOCOL(0);
}
}

View File

@ -52,6 +52,8 @@ typedef union
_BasicResponse_t Rsp;
}_SlNetCfgMsgSet_u;
#if _SL_INCLUDE_FUNC(sl_NetCfgSet)
const _SlCmdCtrl_t _SlNetCfgSetCmdCtrl =
{
SL_OPCODE_DEVICE_NETCFG_SET_COMMAND,
@ -59,16 +61,15 @@ const _SlCmdCtrl_t _SlNetCfgSetCmdCtrl =
sizeof(_BasicResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_NetCfgSet)
_i32 sl_NetCfgSet(_u8 ConfigId ,_u8 ConfigOpt,_u8 ConfigLen, _u8 *pValues)
_i32 sl_NetCfgSet(const _u8 ConfigId ,const _u8 ConfigOpt,const _u8 ConfigLen,const _u8 *pValues)
{
_SlNetCfgMsgSet_u Msg;
_SlCmdExt_t CmdExt;
_SlDrvResetCmdExt(&CmdExt);
CmdExt.TxPayloadLen = (ConfigLen+3) & (~3);
CmdExt.RxPayloadLen = 0;
CmdExt.pTxPayload = (_u8 *)pValues;
CmdExt.pRxPayload = NULL;
Msg.Cmd.ConfigId = ConfigId;
@ -91,6 +92,8 @@ typedef union
_NetCfgSetGet_t Rsp;
}_SlNetCfgMsgGet_u;
#if _SL_INCLUDE_FUNC(sl_NetCfgGet)
const _SlCmdCtrl_t _SlNetCfgGetCmdCtrl =
{
SL_OPCODE_DEVICE_NETCFG_GET_COMMAND,
@ -98,8 +101,7 @@ const _SlCmdCtrl_t _SlNetCfgGetCmdCtrl =
sizeof(_NetCfgSetGet_t)
};
#if _SL_INCLUDE_FUNC(sl_NetCfgGet)
_i32 sl_NetCfgGet(_u8 ConfigId, _u8 *pConfigOpt,_u8 *pConfigLen, _u8 *pValues)
_i32 sl_NetCfgGet(const _u8 ConfigId, _u8 *pConfigOpt,_u8 *pConfigLen, _u8 *pValues)
{
_SlNetCfgMsgGet_u Msg;
_SlCmdExt_t CmdExt;
@ -108,11 +110,10 @@ _i32 sl_NetCfgGet(_u8 ConfigId, _u8 *pConfigOpt,_u8 *pConfigLen, _u8 *pValues)
{
return SL_EZEROLEN;
}
CmdExt.TxPayloadLen = 0;
_SlDrvResetCmdExt(&CmdExt);
CmdExt.RxPayloadLen = *pConfigLen;
CmdExt.pTxPayload = NULL;
CmdExt.pRxPayload = (_u8 *)pValues;
CmdExt.ActualRxPayloadLen = 0;
Msg.Cmd.ConfigLen = *pConfigLen;
Msg.Cmd.ConfigId = ConfigId;
@ -128,8 +129,15 @@ _i32 sl_NetCfgGet(_u8 ConfigId, _u8 *pConfigOpt,_u8 *pConfigLen, _u8 *pValues)
}
if (CmdExt.RxPayloadLen < CmdExt.ActualRxPayloadLen)
{
*pConfigLen = (_u8)CmdExt.RxPayloadLen;
return SL_ESMALLBUF;
*pConfigLen = (_u8)CmdExt.RxPayloadLen;
if( SL_MAC_ADDRESS_GET == ConfigId )
{
return SL_RET_CODE_OK; /* sp fix */
}
else
{
return SL_ESMALLBUF;
}
}
else
{

View File

@ -47,7 +47,12 @@
#include "nonos.h"
#define NONOS_MAX_SPAWN_ENTRIES 5
#ifndef SL_TINY_EXT
#define NONOS_MAX_SPAWN_ENTRIES 5
#else
#define NONOS_MAX_SPAWN_ENTRIES 1
#endif
typedef struct
{
@ -71,6 +76,9 @@ _SlNonOsRetVal_t _SlNonOsSemSet(_SlNonOsSemObj_t* pSemObj , _SlNonOsSemObj_t Val
_SlNonOsRetVal_t _SlNonOsSemGet(_SlNonOsSemObj_t* pSyncObj, _SlNonOsSemObj_t WaitValue, _SlNonOsSemObj_t SetValue, _SlNonOsTime_t Timeout)
{
#ifdef _SlSyncWaitLoopCallback
_SlNonOsTime_t timeOutRequest = Timeout;
#endif
while (Timeout>0)
{
if (WaitValue == *pSyncObj)
@ -84,7 +92,7 @@ _SlNonOsRetVal_t _SlNonOsSemGet(_SlNonOsSemObj_t* pSyncObj, _SlNonOsSemObj_t Wai
}
_SlNonOsMainLoopTask();
#ifdef _SlSyncWaitLoopCallback
if( __NON_OS_SYNC_OBJ_SIGNAL_VALUE == WaitValue )
if( (__NON_OS_SYNC_OBJ_SIGNAL_VALUE == WaitValue) && (timeOutRequest != NONOS_NO_WAIT) )
{
if (WaitValue == *pSyncObj)
{
@ -109,45 +117,55 @@ _SlNonOsRetVal_t _SlNonOsSemGet(_SlNonOsSemObj_t* pSyncObj, _SlNonOsSemObj_t Wai
_SlNonOsRetVal_t _SlNonOsSpawn(_SlSpawnEntryFunc_t pEntry , void* pValue , _u32 flags)
{
_i16 i;
for (i=0 ; i<NONOS_MAX_SPAWN_ENTRIES ; i++)
{
_SlNonOsSpawnEntry_t* pE = &g__SlNonOsCB.SpawnEntries[i];
if (NULL == pE->pEntry)
{
pE->pValue = pValue;
pE->pEntry = pEntry;
break;
}
}
return NONOS_RET_OK;
_i8 i = 0;
#ifndef SL_TINY_EXT
for (i=0 ; i<NONOS_MAX_SPAWN_ENTRIES ; i++)
#endif
{
_SlNonOsSpawnEntry_t* pE = &g__SlNonOsCB.SpawnEntries[i];
if (NULL == pE->pEntry)
{
pE->pValue = pValue;
pE->pEntry = pEntry;
#ifndef SL_TINY_EXT
break;
#endif
}
}
return NONOS_RET_OK;
}
_SlNonOsRetVal_t _SlNonOsMainLoopTask(void)
{
_i16 i;
_i8 i=0;
for (i=0 ; i<NONOS_MAX_SPAWN_ENTRIES ; i++)
{
_SlNonOsSpawnEntry_t* pE = &g__SlNonOsCB.SpawnEntries[i];
_SlSpawnEntryFunc_t pF = pE->pEntry;
if (NULL != pF)
{
if((g_pCB)->RxIrqCnt != (g_pCB)->RxDoneCnt)
#ifndef SL_TINY_EXT
for (i=0 ; i<NONOS_MAX_SPAWN_ENTRIES ; i++)
#endif
{
_SlNonOsSpawnEntry_t* pE = &g__SlNonOsCB.SpawnEntries[i];
_SlSpawnEntryFunc_t pF = pE->pEntry;
if (NULL != pF)
{
if(RxIrqCnt != (g_pCB)->RxDoneCnt)
{
pF(0);/*(pValue);*/
pF(0); /* (pValue) */
}
pE->pEntry = NULL;
pE->pValue = NULL;
}
}
return NONOS_RET_OK;
pE->pEntry = NULL;
pE->pValue = NULL;
}
}
return NONOS_RET_OK;
}
#endif /*(SL_PLATFORM != SL_PLATFORM_NON_OS)*/

View File

@ -45,29 +45,57 @@
#include "driver.h"
/*******************************************************************************/
/* Functions prototypes */
/*******************************************************************************/
void _sl_BuildAddress(const SlSockAddr_t *addr, _i16 addrlen, _SocketAddrCommand_u *pCmd);
void _sl_ParseAddress(_SocketAddrResponse_u *pRsp, SlSockAddr_t *addr, SlSocklen_t *addrlen);
void _sl_BuildAddress(const SlSockAddr_t *addr, _SocketAddrCommand_u *pCmd);
void _sl_HandleAsync_Connect(void *pVoidBuf);
#ifndef SL_TINY_EXT
void _sl_ParseAddress(_SocketAddrResponse_u *pRsp, SlSockAddr_t *addr, SlSocklen_t *addrlen);
void _sl_HandleAsync_Accept(void *pVoidBuf);
void _sl_HandleAsync_Select(void *pVoidBuf);
_u16 _sl_TruncatePayloadByProtocol(const _i16 pSd,const _u16 length);
#endif
_u16 _sl_TruncatePayloadByProtocol(const _i16 pSd, const _u16 length);
/*******************************************************************************/
/* Functions */
/*******************************************************************************/
/* ******************************************************************************/
/* _sl_BuildAddress */
/* ******************************************************************************/
void _sl_BuildAddress(const SlSockAddr_t *addr, _i16 addrlen, _SocketAddrCommand_u *pCmd)
{
/* Note: parsing of family and port in the generic way for all IPV4, IPV6 and EUI48 */
/* is possible as _i32 as these parameters are in the same offset and size for these */
/* three families. */
#define SL_SOCKET_PAYLOAD_BASE (1350)
const _u8 _SlPayloadByProtocolLUT[16] =
{
(1472 - SL_SOCKET_PAYLOAD_BASE), /* SL_SOCKET_PAYLOAD_TYPE_UDP_IPV4 */
(1460 - SL_SOCKET_PAYLOAD_BASE), /* SL_SOCKET_PAYLOAD_TYPE_TCP_IPV4 */
(1452 - SL_SOCKET_PAYLOAD_BASE), /* SL_SOCKET_PAYLOAD_TYPE_UDP_IPV6 */
(1440 - SL_SOCKET_PAYLOAD_BASE), /* SL_SOCKET_PAYLOAD_TYPE_TCP_IPV6 */
(1386 - SL_SOCKET_PAYLOAD_BASE), /* SL_SOCKET_PAYLOAD_TYPE_TCP_IPV4_SECURE */
(1386 - SL_SOCKET_PAYLOAD_BASE), /* SL_SOCKET_PAYLOAD_TYPE_UDP_IPV4_SECURE */
(1396 - SL_SOCKET_PAYLOAD_BASE), /* SL_SOCKET_PAYLOAD_TYPE_UDP_IPV6_SECURE */
(1396 - SL_SOCKET_PAYLOAD_BASE), /* SL_SOCKET_PAYLOAD_TYPE_TCP_IPV6_SECURE */
(1476 - SL_SOCKET_PAYLOAD_BASE), /* SL_SOCKET_PAYLOAD_TYPE_RAW_TRANCEIVER */
(1514 - SL_SOCKET_PAYLOAD_BASE), /* SL_SOCKET_PAYLOAD_TYPE_RAW_PACKET */
(1480 - SL_SOCKET_PAYLOAD_BASE), /* SL_SOCKET_PAYLOAD_TYPE_RAW_IP4 */
(1480 - SL_SOCKET_PAYLOAD_BASE), /* SL_SOCKET_PAYLOAD_TYPE_RAW_IP6 */
(1440 - SL_SOCKET_PAYLOAD_BASE), /* Default */
(1440 - SL_SOCKET_PAYLOAD_BASE), /* Default */
(1440 - SL_SOCKET_PAYLOAD_BASE), /* Default */
(1440 - SL_SOCKET_PAYLOAD_BASE) /* Default */
};
/* ******************************************************************************/
/* _sl_BuildAddress */
/* ******************************************************************************/
void _sl_BuildAddress(const SlSockAddr_t *addr, _SocketAddrCommand_u *pCmd)
{
/* Note: parsing of family and port in the generic way for all IPV4, IPV6 and EUI48
is possible as long as these parameters are in the same offset and size for these
three families. */
pCmd->IpV4.FamilyAndFlags = (addr->sa_family << 4) & 0xF0;
pCmd->IpV4.port = ((SlSockAddrIn_t *)addr)->sin_port;
@ -87,52 +115,19 @@ void _sl_BuildAddress(const SlSockAddr_t *addr, _i16 addrlen, _SocketAddrCommand
#endif
}
/* ******************************************************************************/
/* _sl_TruncatePayloadByProtocol */
/* ******************************************************************************/
_u16 _sl_TruncatePayloadByProtocol(const _i16 sd,const _u16 length)
/*****************************************************************************
_sl_TruncatePayloadByProtocol
*****************************************************************************/
_u16 _sl_TruncatePayloadByProtocol(const _i16 sd, const _u16 length)
{
_u16 maxLength;
switch(sd & SL_SOCKET_PAYLOAD_TYPE_MASK)
{
case SL_SOCKET_PAYLOAD_TYPE_UDP_IPV4:
maxLength = 1472;
break;
case SL_SOCKET_PAYLOAD_TYPE_TCP_IPV4:
maxLength = 1460;
break;
case SL_SOCKET_PAYLOAD_TYPE_UDP_IPV6:
maxLength = 1452;
break;
case SL_SOCKET_PAYLOAD_TYPE_TCP_IPV6:
maxLength = 1440;
break;
case SL_SOCKET_PAYLOAD_TYPE_TCP_IPV4_SECURE:
case SL_SOCKET_PAYLOAD_TYPE_UDP_IPV4_SECURE:
maxLength = 1402;
break;
case SL_SOCKET_PAYLOAD_TYPE_UDP_IPV6_SECURE:
case SL_SOCKET_PAYLOAD_TYPE_TCP_IPV6_SECURE:
maxLength = 1396;
break;
case SL_SOCKET_PAYLOAD_TYPE_RAW_TRANCEIVER:
maxLength = 1476;
break;
case SL_SOCKET_PAYLOAD_TYPE_RAW_PACKET:
maxLength = 1514;
break;
case SL_SOCKET_PAYLOAD_TYPE_RAW_IP4:
maxLength = 1480;
break;
default:
maxLength = 1440;
break;
}
unsigned int maxLength;
maxLength = SL_SOCKET_PAYLOAD_BASE + _SlPayloadByProtocolLUT[((sd & SL_SOCKET_PAYLOAD_TYPE_MASK) >> 4)];
if( length > maxLength )
{
return maxLength;
@ -146,6 +141,8 @@ _u16 _sl_TruncatePayloadByProtocol(const _i16 sd,const _u16 length)
/*******************************************************************************/
/* _sl_ParseAddress */
/*******************************************************************************/
#ifndef SL_TINY_EXT
void _sl_ParseAddress(_SocketAddrResponse_u *pRsp, SlSockAddr_t *addr, SlSocklen_t *addrlen)
{
/* Note: parsing of family and port in the generic way for all IPV4, IPV6 and EUI48 */
@ -172,6 +169,8 @@ void _sl_ParseAddress(_SocketAddrResponse_u *pRsp, SlSockAddr_t *addr, SlSock
#endif
}
#endif
/*******************************************************************************/
/* sl_Socket */
/*******************************************************************************/
@ -182,6 +181,10 @@ typedef union
_SocketResponse_t Rsp;
}_SlSockSocketMsg_u;
#if _SL_INCLUDE_FUNC(sl_Socket)
const _SlCmdCtrl_t _SlSockSocketCmdCtrl =
{
SL_OPCODE_SOCKET_SOCKET,
@ -189,7 +192,6 @@ const _SlCmdCtrl_t _SlSockSocketCmdCtrl =
sizeof(_SocketResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_Socket)
_i16 sl_Socket(_i16 Domain, _i16 Type, _i16 Protocol)
{
_SlSockSocketMsg_u Msg;
@ -220,6 +222,9 @@ typedef union
_SocketResponse_t Rsp;
}_SlSockCloseMsg_u;
#if _SL_INCLUDE_FUNC(sl_Close)
const _SlCmdCtrl_t _SlSockCloseCmdCtrl =
{
SL_OPCODE_SOCKET_CLOSE,
@ -227,7 +232,6 @@ const _SlCmdCtrl_t _SlSockCloseCmdCtrl =
sizeof(_SocketResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_Close)
_i16 sl_Close(_i16 sd)
{
_SlSockCloseMsg_u Msg;
@ -261,16 +265,21 @@ _i16 sl_Bind(_i16 sd, const SlSockAddr_t *addr, _i16 addrlen)
CmdCtrl.Opcode = SL_OPCODE_SOCKET_BIND;
CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv4Command_t);
break;
#ifndef SL_TINY_EXT
case SL_AF_INET6_EUI_48:
CmdCtrl.Opcode = SL_OPCODE_SOCKET_BIND_V6;
CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv6EUI48Command_t);
break;
#ifdef SL_SUPPORT_IPV6
case AF_INET6:
CmdCtrl.Opcode = SL_OPCODE_SOCKET_BIND_V6;
CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv6Command_t);
break;
#endif
#endif
case SL_AF_RF :
default:
return SL_RET_CODE_INVALID_INPUT;
@ -279,7 +288,7 @@ _i16 sl_Bind(_i16 sd, const SlSockAddr_t *addr, _i16 addrlen)
Msg.Cmd.IpV4.lenOrPadding = 0;
Msg.Cmd.IpV4.sd = (_u8)sd;
_sl_BuildAddress(addr, addrlen, &Msg.Cmd);
_sl_BuildAddress(addr, &Msg.Cmd);
VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&CmdCtrl, &Msg, NULL));
@ -305,11 +314,9 @@ _i16 sl_SendTo(_i16 sd, const void *pBuf, _i16 Len, _i16 flags, const SlSockAddr
_u16 ChunkLen;
_i16 RetVal;
_SlDrvResetCmdExt(&CmdExt);
CmdExt.TxPayloadLen = (_u16)Len;
CmdExt.RxPayloadLen = 0;
CmdExt.pTxPayload = (_u8 *)pBuf;
CmdExt.pRxPayload = NULL;
switch(to->sa_family)
{
@ -317,15 +324,17 @@ _i16 sl_SendTo(_i16 sd, const void *pBuf, _i16 Len, _i16 flags, const SlSockAddr
CmdCtrl.Opcode = SL_OPCODE_SOCKET_SENDTO;
CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv4Command_t);
break;
#ifndef SL_TINY_EXT
case SL_AF_INET6_EUI_48:
CmdCtrl.Opcode = SL_OPCODE_SOCKET_BIND_V6;
CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv6EUI48Command_t);
break;
break;
#ifdef SL_SUPPORT_IPV6
case AF_INET6:
CmdCtrl.Opcode = SL_OPCODE_SOCKET_SENDTO_V6;
CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv6Command_t);
break;
#endif
#endif
case SL_AF_RF:
default:
@ -338,7 +347,7 @@ _i16 sl_SendTo(_i16 sd, const void *pBuf, _i16 Len, _i16 flags, const SlSockAddr
Msg.Cmd.IpV4.sd = (_u8)sd;
_sl_BuildAddress(to, tolen, &Msg.Cmd);
_sl_BuildAddress(to, &Msg.Cmd);
Msg.Cmd.IpV4.FamilyAndFlags |= flags & 0x0F;
@ -380,6 +389,8 @@ const _SlCmdCtrl_t _SlRecvfomCmdCtrl =
sizeof(_SocketAddrResponse_u)
};
#if _SL_INCLUDE_FUNC(sl_RecvFrom)
_i16 sl_RecvFrom(_i16 sd, void *buf, _i16 Len, _i16 flags, SlSockAddr_t *from, SlSocklen_t *fromlen)
{
@ -387,33 +398,33 @@ _i16 sl_RecvFrom(_i16 sd, void *buf, _i16 Len, _i16 flags, SlSockAddr_t *from, S
_SlCmdExt_t CmdExt;
_i16 RetVal;
CmdExt.TxPayloadLen = 0;
CmdExt.RxPayloadLen = Len;
CmdExt.pTxPayload = NULL;
CmdExt.pRxPayload = (_u8 *)buf;
_SlDrvResetCmdExt(&CmdExt);
CmdExt.RxPayloadLen = Len;
CmdExt.pRxPayload = (_u8 *)buf;
Msg.Cmd.sd = (_u8)sd;
Msg.Cmd.StatusOrLen = Len;
/* no size truncation in recv path */
CmdExt.RxPayloadLen = Msg.Cmd.StatusOrLen;
Msg.Cmd.FamilyAndFlags = flags & 0x0F;
if(sizeof(SlSockAddrIn_t) == *fromlen)
{
Msg.Cmd.FamilyAndFlags = SL_AF_INET;
Msg.Cmd.FamilyAndFlags |= (SL_AF_INET << 4);
}
else if (sizeof(SlSockAddrIn6_t) == *fromlen)
{
Msg.Cmd.FamilyAndFlags = SL_AF_INET6;
Msg.Cmd.FamilyAndFlags |= (SL_AF_INET6 << 4);
}
else
{
return SL_RET_CODE_INVALID_INPUT;
}
Msg.Cmd.FamilyAndFlags = (Msg.Cmd.FamilyAndFlags << 4) & 0xF0;
Msg.Cmd.FamilyAndFlags |= flags & 0x0F;
RetVal = _SlDrvDataReadOp((_SlSd_t)sd, (_SlCmdCtrl_t *)&_SlRecvfomCmdCtrl, &Msg, &CmdExt);
if( RetVal != SL_OS_RET_CODE_OK )
{
@ -469,11 +480,11 @@ typedef union
#if _SL_INCLUDE_FUNC(sl_Connect)
_i16 sl_Connect(_i16 sd, const SlSockAddr_t *addr, _i16 addrlen)
{
_SlSockConnectMsg_u Msg;
_SlReturnVal_t RetVal;
_SlCmdCtrl_t CmdCtrl = {0, 0, sizeof(_SocketResponse_t)};
_SocketResponse_t AsyncRsp;
_u8 ObjIdx = MAX_CONCURRENT_ACTIONS;
_SlSockConnectMsg_u Msg;
_SlReturnVal_t RetVal;
_SlCmdCtrl_t CmdCtrl = {0, 0, sizeof(_SocketResponse_t)};
_SocketResponse_t AsyncRsp;
_u8 ObjIdx = MAX_CONCURRENT_ACTIONS;
switch(addr->sa_family)
@ -481,6 +492,7 @@ _i16 sl_Connect(_i16 sd, const SlSockAddr_t *addr, _i16 addrlen)
case SL_AF_INET :
CmdCtrl.Opcode = SL_OPCODE_SOCKET_CONNECT;
CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv4Command_t);
/* Do nothing - cmd already initialized to this type */
break;
case SL_AF_INET6_EUI_48:
CmdCtrl.Opcode = SL_OPCODE_SOCKET_CONNECT_V6;
@ -492,7 +504,7 @@ _i16 sl_Connect(_i16 sd, const SlSockAddr_t *addr, _i16 addrlen)
CmdCtrl.TxDescLen = sizeof(_SocketAddrIPv6Command_t);
break;
#endif
case SL_AF_RF :
case SL_AF_RF:
default:
return SL_RET_CODE_INVALID_INPUT;
}
@ -500,22 +512,17 @@ _i16 sl_Connect(_i16 sd, const SlSockAddr_t *addr, _i16 addrlen)
Msg.Cmd.IpV4.lenOrPadding = 0;
Msg.Cmd.IpV4.sd = (_u8)sd;
_sl_BuildAddress(addr, addrlen, &Msg.Cmd);
_sl_BuildAddress(addr, &Msg.Cmd);
/* Use Obj to issue the command, if not available try later */
ObjIdx = (_u8)_SlDrvWaitForPoolObj(CONNECT_ID, (_u8)(sd & BSD_SOCKET_ID_MASK));
if (MAX_CONCURRENT_ACTIONS == ObjIdx)
{
return SL_POOL_IS_EMPTY;
}
OSI_RET_OK_CHECK(sl_LockObjLock(&g_pCB->ProtectionLockObj, SL_OS_WAIT_FOREVER));
ObjIdx = _SlDrvProtectAsyncRespSetting((_u8*)&AsyncRsp, CONNECT_ID, sd & BSD_SOCKET_ID_MASK);
g_pCB->ObjPool[ObjIdx].pRespArgs = (_u8 *)&AsyncRsp;
if (MAX_CONCURRENT_ACTIONS == ObjIdx)
{
return SL_POOL_IS_EMPTY;
}
OSI_RET_OK_CHECK(sl_LockObjUnlock(&g_pCB->ProtectionLockObj));
/* send the command */
/* send the command */
VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&CmdCtrl, &Msg, NULL));
VERIFY_PROTOCOL(Msg.Rsp.sd == sd)
@ -523,18 +530,23 @@ _i16 sl_Connect(_i16 sd, const SlSockAddr_t *addr, _i16 addrlen)
if(SL_RET_CODE_OK == RetVal)
{
/* wait for async and get Data Read parameters */
OSI_RET_OK_CHECK(sl_SyncObjWait(&g_pCB->ObjPool[ObjIdx].SyncObj, SL_OS_WAIT_FOREVER));
/* wait for async and get Data Read parameters */
_SlDrvSyncObjWaitForever(&g_pCB->ObjPool[ObjIdx].SyncObj);
VERIFY_PROTOCOL(AsyncRsp.sd == sd);
RetVal = AsyncRsp.statusOrLen;
}
_SlDrvReleasePoolObj(ObjIdx);
return RetVal;
}
#endif
/*******************************************************************************/
/* _sl_HandleAsync_Connect */
/*******************************************************************************/
@ -542,16 +554,18 @@ void _sl_HandleAsync_Connect(void *pVoidBuf)
{
_SocketResponse_t *pMsgArgs = (_SocketResponse_t *)_SL_RESP_ARGS_START(pVoidBuf);
OSI_RET_OK_CHECK(sl_LockObjLock(&g_pCB->ProtectionLockObj, SL_OS_WAIT_FOREVER));
_SlDrvProtectionObjLockWaitForever();
VERIFY_PROTOCOL((pMsgArgs->sd & BSD_SOCKET_ID_MASK) <= SL_MAX_SOCKETS);
VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs);
((_SocketResponse_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs))->sd = pMsgArgs->sd;
((_SocketResponse_t *)(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs))->statusOrLen = pMsgArgs->statusOrLen;
OSI_RET_OK_CHECK(sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj));
OSI_RET_OK_CHECK(sl_LockObjUnlock(&g_pCB->ProtectionLockObj));
_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
_SlDrvProtectionObjUnLock();
return;
}
@ -581,17 +595,16 @@ _i16 sl_Send(_i16 sd, const void *pBuf, _i16 Len, _i16 flags)
_u32 tempVal;
_u8 runSingleChunk = FALSE;
_SlDrvResetCmdExt(&CmdExt);
CmdExt.TxPayloadLen = Len;
CmdExt.RxPayloadLen = 0;
CmdExt.pTxPayload = (_u8 *)pBuf;
/* Only for RAW transceiver type socket, relay the flags parameter in the 2 bytes (4 byte aligned) before the actual payload */
if ((sd & SL_SOCKET_PAYLOAD_TYPE_MASK) == SL_SOCKET_PAYLOAD_TYPE_RAW_TRANCEIVER)
{
tempVal = flags;
CmdExt.pRxPayload = (_u8 *)&tempVal;
CmdExt.RxPayloadLen = 4;
g_pCB->RelayFlagsViaRxPayload = TRUE;
CmdExt.RxPayloadLen = -4; /* mark as Rx data to send */
runSingleChunk = TRUE;
}
else
@ -601,7 +614,6 @@ _i16 sl_Send(_i16 sd, const void *pBuf, _i16 Len, _i16 flags)
ChunkLen = _sl_TruncatePayloadByProtocol(sd,Len);
CmdExt.TxPayloadLen = ChunkLen;
Msg.Cmd.StatusOrLen = ChunkLen;
Msg.Cmd.sd = (_u8)sd;
Msg.Cmd.FamilyAndFlags |= flags & 0x0F;
@ -636,6 +648,10 @@ typedef union
_BasicResponse_t Rsp;
}_SlListenMsg_u;
#if _SL_INCLUDE_FUNC(sl_Listen)
const _SlCmdCtrl_t _SlListenCmdCtrl =
{
SL_OPCODE_SOCKET_LISTEN,
@ -643,7 +659,6 @@ const _SlCmdCtrl_t _SlListenCmdCtrl =
sizeof(_BasicResponse_t),
};
#if _SL_INCLUDE_FUNC(sl_Listen)
_i16 sl_Listen(_i16 sd, _i16 backlog)
{
_SlListenMsg_u Msg;
@ -666,6 +681,10 @@ typedef union
_SocketResponse_t Rsp;
}_SlSockAcceptMsg_u;
#if _SL_INCLUDE_FUNC(sl_Accept)
const _SlCmdCtrl_t _SlAcceptCmdCtrl =
{
SL_OPCODE_SOCKET_ACCEPT,
@ -673,7 +692,6 @@ const _SlCmdCtrl_t _SlAcceptCmdCtrl =
sizeof(_BasicResponse_t),
};
#if _SL_INCLUDE_FUNC(sl_Accept)
_i16 sl_Accept(_i16 sd, SlSockAddr_t *addr, SlSocklen_t *addrlen)
{
_SlSockAcceptMsg_u Msg;
@ -686,19 +704,14 @@ _i16 sl_Accept(_i16 sd, SlSockAddr_t *addr, SlSocklen_t *addrlen)
Msg.Cmd.sd = (_u8)sd;
Msg.Cmd.family = (sizeof(SlSockAddrIn_t) == *addrlen) ? SL_AF_INET : SL_AF_INET6;
/* Use Obj to issue the command, if not available try later */
ObjIdx = (_u8)_SlDrvWaitForPoolObj(ACCEPT_ID, (_u8)(sd & BSD_SOCKET_ID_MASK));
if (MAX_CONCURRENT_ACTIONS == ObjIdx)
{
return SL_POOL_IS_EMPTY;
}
OSI_RET_OK_CHECK(sl_LockObjLock(&g_pCB->ProtectionLockObj, SL_OS_WAIT_FOREVER));
g_pCB->ObjPool[ObjIdx].pRespArgs = (_u8 *)&AsyncRsp;
ObjIdx = _SlDrvProtectAsyncRespSetting((_u8*)&AsyncRsp, ACCEPT_ID, sd & BSD_SOCKET_ID_MASK );
OSI_RET_OK_CHECK(sl_LockObjUnlock(&g_pCB->ProtectionLockObj));
if (MAX_CONCURRENT_ACTIONS == ObjIdx)
{
return SL_POOL_IS_EMPTY;
}
/* send the command */
VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlAcceptCmdCtrl, &Msg, NULL));
VERIFY_PROTOCOL(Msg.Rsp.sd == sd);
@ -707,9 +720,9 @@ _i16 sl_Accept(_i16 sd, SlSockAddr_t *addr, SlSocklen_t *addrlen)
if(SL_OS_RET_CODE_OK == RetVal)
{
/* wait for async and get Data Read parameters */
OSI_RET_OK_CHECK(sl_SyncObjWait(&g_pCB->ObjPool[ObjIdx].SyncObj, SL_OS_WAIT_FOREVER));
/* wait for async and get Data Read parameters */
_SlDrvSyncObjWaitForever(&g_pCB->ObjPool[ObjIdx].SyncObj);
VERIFY_PROTOCOL(AsyncRsp.IpV4.sd == sd);
RetVal = AsyncRsp.IpV4.statusOrLen;
@ -812,22 +825,44 @@ _u16 sl_Htons( _u16 val )
/*******************************************************************************/
/* _sl_HandleAsync_Accept */
/*******************************************************************************/
#ifndef SL_TINY_EXT
void _sl_HandleAsync_Accept(void *pVoidBuf)
{
_SocketAddrResponse_u *pMsgArgs = (_SocketAddrResponse_u *)_SL_RESP_ARGS_START(pVoidBuf);
OSI_RET_OK_CHECK(sl_LockObjLock(&g_pCB->ProtectionLockObj, SL_OS_WAIT_FOREVER));
_SlDrvProtectionObjLockWaitForever();
VERIFY_PROTOCOL(( pMsgArgs->IpV4.sd & BSD_SOCKET_ID_MASK) <= SL_MAX_SOCKETS);
VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs);
sl_Memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs,sizeof(_SocketAddrResponse_u));
OSI_RET_OK_CHECK(sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj));
_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
OSI_RET_OK_CHECK(sl_LockObjUnlock(&g_pCB->ProtectionLockObj));
_SlDrvProtectionObjUnLock();
return;
}
/*******************************************************************************/
/* _sl_HandleAsync_Select */
/*******************************************************************************/
void _sl_HandleAsync_Select(void *pVoidBuf)
{
_SelectAsyncResponse_t *pMsgArgs = (_SelectAsyncResponse_t *)_SL_RESP_ARGS_START(pVoidBuf);
_SlDrvProtectionObjLockWaitForever();
VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs);
sl_Memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_SelectAsyncResponse_t));
_SlDrvSyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj);
_SlDrvProtectionObjUnLock();
return;
}
#endif
/*******************************************************************************/
/* sl_Recv */
/*******************************************************************************/
@ -837,6 +872,9 @@ typedef union
_SocketResponse_t Rsp;
}_SlRecvMsg_u;
#if _SL_INCLUDE_FUNC(sl_Recv)
const _SlCmdCtrl_t _SlRecvCmdCtrl =
{
SL_OPCODE_SOCKET_RECV,
@ -844,16 +882,15 @@ const _SlCmdCtrl_t _SlRecvCmdCtrl =
sizeof(_SocketResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_Recv)
_i16 sl_Recv(_i16 sd, void *pBuf, _i16 Len, _i16 flags)
{
_SlRecvMsg_u Msg;
_SlCmdExt_t CmdExt;
_SlReturnVal_t status;
CmdExt.TxPayloadLen = 0;
_SlDrvResetCmdExt(&CmdExt);
CmdExt.RxPayloadLen = Len;
CmdExt.pTxPayload = NULL;
CmdExt.pRxPayload = (_u8 *)pBuf;
Msg.Cmd.sd = (_u8)sd;
@ -898,10 +935,10 @@ _i16 sl_SetSockOpt(_i16 sd, _i16 level, _i16 optname, const void *optval, SlSock
_SlSetSockOptMsg_u Msg;
_SlCmdExt_t CmdExt;
_SlDrvResetCmdExt(&CmdExt);
CmdExt.TxPayloadLen = optlen;
CmdExt.RxPayloadLen = 0;
CmdExt.pTxPayload = (_u8 *)optval;
CmdExt.pRxPayload = NULL;
Msg.Cmd.sd = (_u8)sd;
Msg.Cmd.level = (_u8)level;
@ -923,6 +960,9 @@ typedef union
_getSockOptResponse_t Rsp;
}_SlGetSockOptMsg_u;
#if _SL_INCLUDE_FUNC(sl_GetSockOpt)
const _SlCmdCtrl_t _SlGetSockOptCmdCtrl =
{
SL_OPCODE_SOCKET_GETSOCKOPT,
@ -930,7 +970,6 @@ const _SlCmdCtrl_t _SlGetSockOptCmdCtrl =
sizeof(_getSockOptResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_GetSockOpt)
_i16 sl_GetSockOpt(_i16 sd, _i16 level, _i16 optname, void *optval, SlSocklen_t *optlen)
{
_SlGetSockOptMsg_u Msg;
@ -940,11 +979,10 @@ _i16 sl_GetSockOpt(_i16 sd, _i16 level, _i16 optname, void *optval, SlSocklen_t
{
return SL_EZEROLEN;
}
CmdExt.TxPayloadLen = 0;
_SlDrvResetCmdExt(&CmdExt);
CmdExt.RxPayloadLen = *optlen;
CmdExt.pTxPayload = NULL;
CmdExt.pRxPayload = optval;
CmdExt.ActualRxPayloadLen = 0;
Msg.Cmd.sd = (_u8)sd;
Msg.Cmd.level = (_u8)level;
@ -975,6 +1013,11 @@ typedef union
_BasicResponse_t Rsp;
}_SlSelectMsg_u;
#ifndef SL_TINY_EXT
#if _SL_INCLUDE_FUNC(sl_Select)
const _SlCmdCtrl_t _SlSelectCmdCtrl =
{
SL_OPCODE_SOCKET_SELECT,
@ -982,7 +1025,7 @@ const _SlCmdCtrl_t _SlSelectCmdCtrl =
sizeof(_BasicResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_Select)
_i16 sl_Select(_i16 nfds, SlFdSet_t *readsds, SlFdSet_t *writesds, SlFdSet_t *exceptsds, struct SlTimeval_t *timeout)
{
_SlSelectMsg_u Msg;
@ -995,6 +1038,7 @@ _i16 sl_Select(_i16 nfds, SlFdSet_t *readsds, SlFdSet_t *writesds, SlFdSet_t *ex
Msg.Cmd.readFds = 0;
Msg.Cmd.writeFds = 0;
if( readsds )
{
@ -1031,23 +1075,21 @@ _i16 sl_Select(_i16 nfds, SlFdSet_t *readsds, SlFdSet_t *writesds, SlFdSet_t *ex
}
/* Use Obj to issue the command, if not available try later */
ObjIdx = (_u8)_SlDrvWaitForPoolObj(SELECT_ID, SL_MAX_SOCKETS);
ObjIdx = _SlDrvProtectAsyncRespSetting((_u8*)&AsyncRsp, SELECT_ID, SL_MAX_SOCKETS);
if (MAX_CONCURRENT_ACTIONS == ObjIdx)
{
return SL_POOL_IS_EMPTY;
}
OSI_RET_OK_CHECK(sl_LockObjLock(&g_pCB->ProtectionLockObj, SL_OS_WAIT_FOREVER));
if (MAX_CONCURRENT_ACTIONS == ObjIdx)
{
return SL_POOL_IS_EMPTY;
}
g_pCB->ObjPool[ObjIdx].pRespArgs = (_u8 *)&AsyncRsp;
OSI_RET_OK_CHECK(sl_LockObjUnlock(&g_pCB->ProtectionLockObj));
/* send the command */
VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlSelectCmdCtrl, &Msg, NULL));
if(SL_OS_RET_CODE_OK == (_i16)Msg.Rsp.status)
{
OSI_RET_OK_CHECK(sl_SyncObjWait(&g_pCB->ObjPool[ObjIdx].SyncObj, SL_OS_WAIT_FOREVER));
_SlDrvSyncObjWaitForever(&g_pCB->ObjPool[ObjIdx].SyncObj);
Msg.Rsp.status = AsyncRsp.status;
if( ((_i16)Msg.Rsp.status) >= 0 )
@ -1102,22 +1144,7 @@ void SL_FD_ZERO(SlFdSet_t *fdset)
}
#endif
#endif
/*******************************************************************************/
/* _sl_HandleAsync_Select */
/*******************************************************************************/
void _sl_HandleAsync_Select(void *pVoidBuf)
{
_SelectAsyncResponse_t *pMsgArgs = (_SelectAsyncResponse_t *)_SL_RESP_ARGS_START(pVoidBuf);
OSI_RET_OK_CHECK(sl_LockObjLock(&g_pCB->ProtectionLockObj, SL_OS_WAIT_FOREVER));
VERIFY_SOCKET_CB(NULL != g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs);
sl_Memcpy(g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].pRespArgs, pMsgArgs, sizeof(_SelectAsyncResponse_t));
OSI_RET_OK_CHECK(sl_SyncObjSignal(&g_pCB->ObjPool[g_pCB->FunctionParams.AsyncExt.ActionIndex].SyncObj));
OSI_RET_OK_CHECK(sl_LockObjUnlock(&g_pCB->ProtectionLockObj));
return;
}

View File

@ -93,8 +93,7 @@ void _SlInternalSpawnTaskEntry()
}
g_SlInternalSpawnCB.SpawnEntries[i].pNext = NULL;
sl_LockObjUnlock(&g_SlInternalSpawnCB.LockObj);
_SlDrvObjUnLock(&g_SlInternalSpawnCB.LockObj);
/* here we ready to execute entries */
@ -106,12 +105,12 @@ void _SlInternalSpawnTaskEntry()
do
{
/* get entry to execute */
sl_LockObjLock(&g_SlInternalSpawnCB.LockObj,SL_OS_WAIT_FOREVER);
_SlDrvObjLockWaitForever(&g_SlInternalSpawnCB.LockObj);
pEntry = g_SlInternalSpawnCB.pWaitForExe;
if ( NULL == pEntry )
{
sl_LockObjUnlock(&g_SlInternalSpawnCB.LockObj);
_SlDrvObjUnLock(&g_SlInternalSpawnCB.LockObj);
break;
}
g_SlInternalSpawnCB.pWaitForExe = pEntry->pNext;
@ -121,8 +120,7 @@ void _SlInternalSpawnTaskEntry()
LastEntry = TRUE;
}
sl_LockObjUnlock(&g_SlInternalSpawnCB.LockObj);
_SlDrvObjUnLock(&g_SlInternalSpawnCB.LockObj);
/* pEntry could be null in case that the sync was already set by some
of the entries during execution of earlier entry */
@ -130,8 +128,9 @@ void _SlInternalSpawnTaskEntry()
{
pEntry->pEntry(pEntry->pValue);
/* free the entry */
sl_LockObjLock(&g_SlInternalSpawnCB.LockObj,SL_OS_WAIT_FOREVER);
_SlDrvObjLockWaitForever(&g_SlInternalSpawnCB.LockObj);
pEntry->pNext = g_SlInternalSpawnCB.pFree;
g_SlInternalSpawnCB.pFree = pEntry;
@ -142,7 +141,7 @@ void _SlInternalSpawnTaskEntry()
LastEntry = FALSE;
}
sl_LockObjUnlock(&g_SlInternalSpawnCB.LockObj);
_SlDrvObjUnLock(&g_SlInternalSpawnCB.LockObj);
}
@ -162,7 +161,7 @@ _i16 _SlInternalSpawn(_SlSpawnEntryFunc_t pEntry , void* pValue , _u32 flags)
}
else
{
sl_LockObjLock(&g_SlInternalSpawnCB.LockObj,SL_OS_WAIT_FOREVER);
_SlDrvObjLockWaitForever(&g_SlInternalSpawnCB.LockObj);
pSpawnEntry = g_SlInternalSpawnCB.pFree;
g_SlInternalSpawnCB.pFree = pSpawnEntry->pNext;
@ -182,9 +181,10 @@ _i16 _SlInternalSpawn(_SlSpawnEntryFunc_t pEntry , void* pValue , _u32 flags)
g_SlInternalSpawnCB.pLastInWaitList = pSpawnEntry;
}
sl_LockObjUnlock(&g_SlInternalSpawnCB.LockObj);
_SlDrvObjUnLock(&g_SlInternalSpawnCB.LockObj);
/* this sync is called after releasing the lock object to avoid unnecessary context switches */
sl_SyncObjSignal(&g_SlInternalSpawnCB.SyncObj);
_SlDrvSyncObjSignal(&g_SlInternalSpawnCB.SyncObj);
}
return Res;

View File

@ -65,12 +65,12 @@ typedef struct
typedef union
{
_WlanConnectCmd_t Cmd;
_BasicResponse_t Rsp;
_BasicResponse_t Rsp;
}_SlWlanConnectMsg_u;
#if _SL_INCLUDE_FUNC(sl_WlanConnect)
_i16 sl_WlanConnect(_i8* pName, _i16 NameLen, _u8 *pMacAddr, SlSecParams_t* pSecParams , SlSecParamsExt_t* pSecExtParams)
_i16 sl_WlanConnect(const _i8* pName,const _i16 NameLen,const _u8 *pMacAddr,const SlSecParams_t* pSecParams ,const SlSecParamsExt_t* pSecExtParams)
{
_SlWlanConnectMsg_u Msg;
_SlCmdCtrl_t CmdCtrl;
@ -82,6 +82,11 @@ _i16 sl_WlanConnect(_i8* pName, _i16 NameLen, _u8 *pMacAddr, SlSecParams_t* pSe
/* verify SSID length */
VERIFY_PROTOCOL(NameLen <= MAX_SSID_LEN);
/* verify SSID is not NULL */
if( NULL == pName )
{
return SL_INVALPARAM;
}
/* update SSID length */
Msg.Cmd.Args.Common.SsidLen = (_u8)NameLen;
@ -108,7 +113,7 @@ _i16 sl_WlanConnect(_i8* pName, _i16 NameLen, _u8 *pMacAddr, SlSecParams_t* pSe
/* update key length */
Msg.Cmd.Args.Common.PasswordLen = pSecParams->KeyLen;
ARG_CHECK_PTR(pSecParams->Key);
/* copy key */
/* copy key */
sl_Memcpy(EAP_PASSWORD_STRING(&Msg), pSecParams->Key, pSecParams->KeyLen);
CmdCtrl.TxDescLen += pSecParams->KeyLen;
}
@ -156,7 +161,7 @@ _i16 sl_WlanConnect(_i8* pName, _i16 NameLen, _u8 *pMacAddr, SlSecParams_t* pSe
CmdCtrl.Opcode = SL_OPCODE_WLAN_WLANCONNECTCOMMAND;
CmdCtrl.TxDescLen += sizeof(_WlanConnectCommon_t);
/* copy SSID */
sl_Memcpy(SSID_STRING(&Msg), pName, NameLen);
sl_Memcpy(SSID_STRING(&Msg), pName, NameLen);
CmdCtrl.TxDescLen += NameLen;
/* Copy password if supplied */
if( NULL != pSecParams )
@ -182,7 +187,7 @@ _i16 sl_WlanConnect(_i8* pName, _i16 NameLen, _u8 *pMacAddr, SlSecParams_t* pSe
{
Msg.Cmd.Args.Common.PasswordLen = 0;
Msg.Cmd.Args.Common.SecType = SL_SEC_TYPE_OPEN;
}
}
}
/* If BSSID is not null, copy to buffer, otherwise set to 0 */
if(NULL != pMacAddr)
@ -191,7 +196,7 @@ _i16 sl_WlanConnect(_i8* pName, _i16 NameLen, _u8 *pMacAddr, SlSecParams_t* pSe
}
else
{
sl_Memset(Msg.Cmd.Args.Common.Bssid, 0, sizeof(Msg.Cmd.Args.Common.Bssid));
_SlDrvMemZero(Msg.Cmd.Args.Common.Bssid, sizeof(Msg.Cmd.Args.Common.Bssid));
}
@ -217,9 +222,11 @@ _i16 sl_WlanDisconnect(void)
typedef union
{
_WlanPoliciySetGet_t Cmd;
_BasicResponse_t Rsp;
_BasicResponse_t Rsp;
}_SlPolicyMsg_u;
#if _SL_INCLUDE_FUNC(sl_WlanPolicySet)
const _SlCmdCtrl_t _SlPolicySetCmdCtrl =
{
SL_OPCODE_WLAN_POLICYSETCOMMAND,
@ -227,16 +234,15 @@ const _SlCmdCtrl_t _SlPolicySetCmdCtrl =
sizeof(_BasicResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_WlanPolicySet)
_i16 sl_WlanPolicySet(_u8 Type , const _u8 Policy, _u8 *pVal,_u8 ValLen)
_i16 sl_WlanPolicySet(const _u8 Type , const _u8 Policy, _u8 *pVal,const _u8 ValLen)
{
_SlPolicyMsg_u Msg;
_SlCmdExt_t CmdExt;
_SlDrvResetCmdExt(&CmdExt);
CmdExt.TxPayloadLen = ValLen;
CmdExt.RxPayloadLen = 0;
CmdExt.pTxPayload = (_u8 *)pVal;
CmdExt.pRxPayload = NULL;
Msg.Cmd.PolicyType = Type;
@ -255,10 +261,12 @@ _i16 sl_WlanPolicySet(_u8 Type , const _u8 Policy, _u8 *pVal,_u8 ValLen)
/******************************************************************************/
typedef union
{
_WlanPoliciySetGet_t Cmd;
_WlanPoliciySetGet_t Rsp;
_WlanPoliciySetGet_t Cmd;
_WlanPoliciySetGet_t Rsp;
}_SlPolicyGetMsg_u;
#if _SL_INCLUDE_FUNC(sl_WlanPolicyGet)
const _SlCmdCtrl_t _SlPolicyGetCmdCtrl =
{
SL_OPCODE_WLAN_POLICYGETCOMMAND,
@ -266,8 +274,7 @@ const _SlCmdCtrl_t _SlPolicyGetCmdCtrl =
sizeof(_WlanPoliciySetGet_t)
};
#if _SL_INCLUDE_FUNC(sl_WlanPolicyGet)
_i16 sl_WlanPolicyGet(_u8 Type , _u8 Policy,_u8 *pVal,_u8 *pValLen)
_i16 sl_WlanPolicyGet(const _u8 Type ,_u8 Policy,_u8 *pVal,_u8 *pValLen)
{
_SlPolicyGetMsg_u Msg;
_SlCmdExt_t CmdExt;
@ -276,12 +283,10 @@ _i16 sl_WlanPolicyGet(_u8 Type , _u8 Policy,_u8 *pVal,_u8 *pValLen)
{
return SL_EZEROLEN;
}
CmdExt.TxPayloadLen = 0;
CmdExt.RxPayloadLen = *pValLen;
CmdExt.pTxPayload = NULL;
CmdExt.pRxPayload = pVal;
CmdExt.ActualRxPayloadLen = 0;
_SlDrvResetCmdExt(&CmdExt);
CmdExt.RxPayloadLen = *pValLen;
CmdExt.pRxPayload = pVal;
Msg.Cmd.PolicyType = Type;
Msg.Cmd.PolicyOption = Policy;
@ -313,20 +318,20 @@ _i16 sl_WlanPolicyGet(_u8 Type , _u8 Policy,_u8 *pVal,_u8 *pValLen)
/*******************************************************************************/
typedef struct
{
_WlanAddGetEapProfile_t Args;
_WlanAddGetEapProfile_t Args;
_i8 Strings[MAX_SSID_LEN + MAX_KEY_LEN + MAX_USER_LEN + MAX_ANON_USER_LEN];
}_SlProfileParams_t;
typedef union
{
_SlProfileParams_t Cmd;
_BasicResponse_t Rsp;
_SlProfileParams_t Cmd;
_BasicResponse_t Rsp;
}_SlProfileAddMsg_u;
#if _SL_INCLUDE_FUNC(sl_WlanProfileAdd)
_i16 sl_WlanProfileAdd(_i8* pName, _i16 NameLen, _u8 *pMacAddr, SlSecParams_t* pSecParams , SlSecParamsExt_t* pSecExtParams, _u32 Priority, _u32 Options)
_i16 sl_WlanProfileAdd(const _i8* pName,const _i16 NameLen,const _u8 *pMacAddr,const SlSecParams_t* pSecParams ,const SlSecParamsExt_t* pSecExtParams,const _u32 Priority,const _u32 Options)
{
_SlProfileAddMsg_u Msg;
_SlCmdCtrl_t CmdCtrl = {0};
@ -335,6 +340,11 @@ _i16 sl_WlanProfileAdd(_i8* pName, _i16 NameLen, _u8 *pMacAddr, SlSecParams_t*
/* update priority */
Msg.Cmd.Args.Common.Priority = (_u8)Priority;
/* verify SSID is not NULL */
if( NULL == pName )
{
return SL_INVALPARAM;
}
/* verify SSID length */
VERIFY_PROTOCOL(NameLen <= MAX_SSID_LEN);
/* update SSID length */
@ -349,7 +359,7 @@ _i16 sl_WlanProfileAdd(_i8* pName, _i16 NameLen, _u8 *pMacAddr, SlSecParams_t*
CmdCtrl.TxDescLen += sizeof(_WlanAddGetEapProfile_t);
/* copy SSID */
sl_Memcpy(EAP_PROFILE_SSID_STRING(&Msg), pName, NameLen);
sl_Memcpy(EAP_PROFILE_SSID_STRING(&Msg), pName, NameLen);
CmdCtrl.TxDescLen += NameLen;
/* Copy password if supplied */
@ -370,7 +380,7 @@ _i16 sl_WlanProfileAdd(_i8* pName, _i16 NameLen, _u8 *pMacAddr, SlSecParams_t*
}
VERIFY_PROTOCOL(pSecParams->KeyLen <= MAX_KEY_LEN);
/* update key length */
Msg.Cmd.Args.Common.PasswordLen = pSecParams->KeyLen;
Msg.Cmd.Args.Common.PasswordLen = pSecParams->KeyLen;
CmdCtrl.TxDescLen += pSecParams->KeyLen;
ARG_CHECK_PTR(pSecParams->Key);
/* copy key */
@ -470,7 +480,7 @@ _i16 sl_WlanProfileAdd(_i8* pName, _i16 NameLen, _u8 *pMacAddr, SlSecParams_t*
}
else
{
sl_Memset(Msg.Cmd.Args.Common.Bssid, 0, sizeof(Msg.Cmd.Args.Common.Bssid));
_SlDrvMemZero(Msg.Cmd.Args.Common.Bssid, sizeof(Msg.Cmd.Args.Common.Bssid));
}
VERIFY_RET_OK(_SlDrvCmdOp(&CmdCtrl, &Msg, NULL));
@ -484,9 +494,12 @@ _i16 sl_WlanProfileAdd(_i8* pName, _i16 NameLen, _u8 *pMacAddr, SlSecParams_t*
typedef union
{
_WlanProfileDelGetCommand_t Cmd;
_SlProfileParams_t Rsp;
_SlProfileParams_t Rsp;
}_SlProfileGetMsg_u;
#if _SL_INCLUDE_FUNC(sl_WlanProfileGet)
const _SlCmdCtrl_t _SlProfileGetCmdCtrl =
{
SL_OPCODE_WLAN_PROFILEGETCOMMAND,
@ -494,8 +507,7 @@ const _SlCmdCtrl_t _SlProfileGetCmdCtrl =
sizeof(_SlProfileParams_t)
};
#if _SL_INCLUDE_FUNC(sl_WlanProfileGet)
_i16 sl_WlanProfileGet(_i16 Index,_i8* pName, _i16 *pNameLen, _u8 *pMacAddr, SlSecParams_t* pSecParams, SlGetSecParamsExt_t* pEntParams, _u32 *pPriority)
_i16 sl_WlanProfileGet(const _i16 Index,_i8* pName, _i16 *pNameLen, _u8 *pMacAddr, SlSecParams_t* pSecParams, SlGetSecParamsExt_t* pEntParams, _u32 *pPriority)
{
_SlProfileGetMsg_u Msg;
Msg.Cmd.index = (_u8)Index;
@ -510,7 +522,7 @@ _i16 sl_WlanProfileGet(_i16 Index,_i8* pName, _i16 *pNameLen, _u8 *pMacAddr, Sl
pEntParams->UserLen = Msg.Rsp.Args.UserLen;
/* copy user name */
if (pEntParams->UserLen > 0)
{
{
sl_Memcpy(pEntParams->User, EAP_PROFILE_USER_STRING(&Msg), pEntParams->UserLen);
}
pEntParams->AnonUserLen = Msg.Rsp.Args.AnonUserLen;
@ -540,10 +552,13 @@ _i16 sl_WlanProfileGet(_i16 Index,_i8* pName, _i16 *pNameLen, _u8 *pMacAddr, Sl
/*******************************************************************************/
typedef union
{
_WlanProfileDelGetCommand_t Cmd;
_BasicResponse_t Rsp;
_WlanProfileDelGetCommand_t Cmd;
_BasicResponse_t Rsp;
}_SlProfileDelMsg_u;
#if _SL_INCLUDE_FUNC(sl_WlanProfileDel)
const _SlCmdCtrl_t _SlProfileDelCmdCtrl =
{
SL_OPCODE_WLAN_PROFILEDELCOMMAND,
@ -551,8 +566,7 @@ const _SlCmdCtrl_t _SlProfileDelCmdCtrl =
sizeof(_BasicResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_WlanProfileDel)
_i16 sl_WlanProfileDel(_i16 Index)
_i16 sl_WlanProfileDel(const _i16 Index)
{
_SlProfileDelMsg_u Msg;
@ -574,6 +588,9 @@ typedef union
_WlanGetNetworkListResponse_t Rsp;
}_SlWlanGetNetworkListMsg_u;
#if _SL_INCLUDE_FUNC(sl_WlanGetNetworkList)
const _SlCmdCtrl_t _SlWlanGetNetworkListCtrl =
{
SL_OPCODE_WLAN_SCANRESULTSGETCOMMAND,
@ -581,9 +598,7 @@ const _SlCmdCtrl_t _SlWlanGetNetworkListCtrl =
sizeof(_WlanGetNetworkListResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_WlanGetNetworkList)
_i16 sl_WlanGetNetworkList(_u8 Index, _u8 Count, Sl_WlanNetworkEntry_t *pEntries)
_i16 sl_WlanGetNetworkList(const _u8 Index,const _u8 Count, Sl_WlanNetworkEntry_t *pEntries)
{
_i16 retVal = 0;
_SlWlanGetNetworkListMsg_u Msg;
@ -593,9 +608,9 @@ _i16 sl_WlanGetNetworkList(_u8 Index, _u8 Count, Sl_WlanNetworkEntry_t *pEntries
{
return SL_EZEROLEN;
}
CmdExt.TxPayloadLen = 0;
_SlDrvResetCmdExt(&CmdExt);
CmdExt.RxPayloadLen = sizeof(Sl_WlanNetworkEntry_t)*(Count);
CmdExt.pTxPayload = NULL;
CmdExt.pRxPayload = (_u8 *)pEntries;
Msg.Cmd.index = Index;
@ -619,10 +634,28 @@ _i16 sl_WlanGetNetworkList(_u8 Index, _u8 Count, Sl_WlanNetworkEntry_t *pEntries
/* Set command */
typedef union
{
_WlanRxFilterAddCommand_t Cmd;
_WlanRxFilterAddCommand_t Cmd;
_WlanRxFilterAddCommandReponse_t Rsp;
}_SlrxFilterAddMsg_u;
/* Set command */
typedef union _SlRxFilterSetMsg_u
{
_WlanRxFilterSetCommand_t Cmd;
_WlanRxFilterSetCommandReponse_t Rsp;
}_SlRxFilterSetMsg_u;
/* Get command */
typedef union _SlRxFilterGetMsg_u
{
_WlanRxFilterGetCommand_t Cmd;
_WlanRxFilterGetCommandReponse_t Rsp;
}_SlRxFilterGetMsg_u;
#if _SL_INCLUDE_FUNC(sl_WlanRxFilterAdd)
const _SlCmdCtrl_t _SlRxFilterAddtCmdCtrl =
{
SL_OPCODE_WLAN_WLANRXFILTERADDCOMMAND,
@ -631,47 +664,14 @@ const _SlCmdCtrl_t _SlRxFilterAddtCmdCtrl =
};
/* Set command */
typedef union _SlRxFilterSetMsg_u
{
_WlanRxFilterSetCommand_t Cmd;
_WlanRxFilterSetCommandReponse_t Rsp;
}_SlRxFilterSetMsg_u;
const _SlCmdCtrl_t _SlRxFilterSetCmdCtrl =
{
SL_OPCODE_WLAN_WLANRXFILTERSETCOMMAND,
sizeof(_WlanRxFilterSetCommand_t),
sizeof(_WlanRxFilterSetCommandReponse_t)
};
/* Get command */
typedef union _SlRxFilterGetMsg_u
{
_WlanRxFilterGetCommand_t Cmd;
_WlanRxFilterGetCommandReponse_t Rsp;
}_SlRxFilterGetMsg_u;
const _SlCmdCtrl_t _SlRxFilterGetCmdCtrl =
{
SL_OPCODE_WLAN_WLANRXFILTERGETCOMMAND,
sizeof(_WlanRxFilterGetCommand_t),
sizeof(_WlanRxFilterGetCommandReponse_t)
};
/*******************************************************************************/
/* RX filters */
/*******************************************************************************/
#if _SL_INCLUDE_FUNC(sl_WlanRxFilterAdd)
SlrxFilterID_t sl_WlanRxFilterAdd( SlrxFilterRuleType_t RuleType,
SlrxFilterFlags_t FilterFlags,
const SlrxFilterRule_t* const Rule,
const SlrxFilterTrigger_t* const Trigger,
const SlrxFilterAction_t* const Action,
/*****************************************************************************
RX filters
*****************************************************************************/
SlrxFilterID_t sl_WlanRxFilterAdd( SlrxFilterRuleType_t RuleType,
SlrxFilterFlags_t FilterFlags,
const SlrxFilterRule_t* const Rule,
const SlrxFilterTrigger_t* const Trigger,
const SlrxFilterAction_t* const Action,
SlrxFilterID_t* pFilterId)
{
@ -697,6 +697,14 @@ SlrxFilterID_t sl_WlanRxFilterAdd( SlrxFilterRuleType_t RuleType
/* RX filters */
/*******************************************************************************/
#if _SL_INCLUDE_FUNC(sl_WlanRxFilterSet)
const _SlCmdCtrl_t _SlRxFilterSetCmdCtrl =
{
SL_OPCODE_WLAN_WLANRXFILTERSETCOMMAND,
sizeof(_WlanRxFilterSetCommand_t),
sizeof(_WlanRxFilterSetCommandReponse_t)
};
_i16 sl_WlanRxFilterSet(const SLrxFilterOperation_t RxFilterOperation,
const _u8* const pInputBuffer,
_u16 InputbufferLength)
@ -704,10 +712,10 @@ _i16 sl_WlanRxFilterSet(const SLrxFilterOperation_t RxFilterOperation,
_SlRxFilterSetMsg_u Msg;
_SlCmdExt_t CmdExt;
_SlDrvResetCmdExt(&CmdExt);
CmdExt.TxPayloadLen = InputbufferLength;
CmdExt.pTxPayload = (_u8 *)pInputBuffer;
CmdExt.RxPayloadLen = 0;
CmdExt.pRxPayload = (_u8 *)NULL;
Msg.Cmd.RxFilterOperation = RxFilterOperation;
Msg.Cmd.InputBufferLength = InputbufferLength;
@ -724,6 +732,15 @@ _i16 sl_WlanRxFilterSet(const SLrxFilterOperation_t RxFilterOperation,
/* RX filters */
/******************************************************************************/
#if _SL_INCLUDE_FUNC(sl_WlanRxFilterGet)
const _SlCmdCtrl_t _SlRxFilterGetCmdCtrl =
{
SL_OPCODE_WLAN_WLANRXFILTERGETCOMMAND,
sizeof(_WlanRxFilterGetCommand_t),
sizeof(_WlanRxFilterGetCommandReponse_t)
};
_i16 sl_WlanRxFilterGet(const SLrxFilterOperation_t RxFilterOperation,
_u8* pOutputBuffer,
_u16 OutputbufferLength)
@ -735,11 +752,10 @@ _i16 sl_WlanRxFilterGet(const SLrxFilterOperation_t RxFilterOperation,
{
return SL_EZEROLEN;
}
CmdExt.TxPayloadLen = 0;
CmdExt.pTxPayload = NULL;
_SlDrvResetCmdExt(&CmdExt);
CmdExt.RxPayloadLen = OutputbufferLength;
CmdExt.pRxPayload = (_u8 *)pOutputBuffer;
CmdExt.ActualRxPayloadLen = 0;
Msg.Cmd.RxFilterOperation = RxFilterOperation;
Msg.Cmd.OutputBufferLength = OutputbufferLength;
@ -774,10 +790,11 @@ _i16 sl_WlanRxStatStop(void)
#endif
#if _SL_INCLUDE_FUNC(sl_WlanRxStatGet)
_i16 sl_WlanRxStatGet(SlGetRxStatResponse_t *pRxStat,_u32 Flags)
_i16 sl_WlanRxStatGet(SlGetRxStatResponse_t *pRxStat,const _u32 Flags)
{
_SlCmdCtrl_t CmdCtrl = {SL_OPCODE_WLAN_GETRXSTATCOMMAND, 0, sizeof(SlGetRxStatResponse_t)};
sl_Memset(pRxStat,0,sizeof(SlGetRxStatResponse_t));
_SlDrvMemZero(pRxStat, sizeof(SlGetRxStatResponse_t));
VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&CmdCtrl, pRxStat, NULL));
return 0;
@ -804,16 +821,18 @@ _i16 sl_WlanSmartConfigStop(void)
typedef struct
{
_WlanSmartConfigStartCommand_t Args;
_WlanSmartConfigStartCommand_t Args;
_i8 Strings[3 * MAX_SMART_CONFIG_KEY]; /* public key + groupId1 key + groupId2 key */
}_SlSmartConfigStart_t;
typedef union
{
_SlSmartConfigStart_t Cmd;
_BasicResponse_t Rsp;
_SlSmartConfigStart_t Cmd;
_BasicResponse_t Rsp;
}_SlSmartConfigStartMsg_u;
#if _SL_INCLUDE_FUNC(sl_WlanSmartConfigStart)
const _SlCmdCtrl_t _SlSmartConfigStartCmdCtrl =
{
SL_OPCODE_WLAN_SMART_CONFIG_START_COMMAND,
@ -821,7 +840,6 @@ const _SlCmdCtrl_t _SlSmartConfigStartCmdCtrl =
sizeof(_BasicResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_WlanSmartConfigStart)
_i16 sl_WlanSmartConfigStart( const _u32 groupIdBitmask,
const _u8 cipher,
const _u8 publicKeyLen,
@ -858,10 +876,12 @@ _i16 sl_WlanSmartConfigStart( const _u32 groupIdBitmask,
/*******************************************************************************/
typedef union
{
_WlanSetMode_t Cmd;
_BasicResponse_t Rsp;
_WlanSetMode_t Cmd;
_BasicResponse_t Rsp;
}_SlwlanSetModeMsg_u;
#if _SL_INCLUDE_FUNC(sl_WlanSetMode)
const _SlCmdCtrl_t _SlWlanSetModeCmdCtrl =
{
SL_OPCODE_WLAN_SET_MODE,
@ -873,8 +893,6 @@ const _SlCmdCtrl_t _SlWlanSetModeCmdCtrl =
WLAN_SET_STA_MODE = 1
WLAN_SET_AP_MODE = 2
WLAN_SET_P2P_MODE = 3 */
#if _SL_INCLUDE_FUNC(sl_WlanSetMode)
_i16 sl_WlanSetMode(const _u8 mode)
{
_SlwlanSetModeMsg_u Msg;
@ -884,7 +902,6 @@ _i16 sl_WlanSetMode(const _u8 mode)
VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlWlanSetModeCmdCtrl , &Msg, NULL));
return (_i16)Msg.Rsp.status;
}
#endif
@ -896,10 +913,13 @@ _i16 sl_WlanSetMode(const _u8 mode)
/* ******************************************************************************/
typedef union
{
_WlanCfgSetGet_t Cmd;
_BasicResponse_t Rsp;
_WlanCfgSetGet_t Cmd;
_BasicResponse_t Rsp;
}_SlWlanCfgSetMsg_u;
#if _SL_INCLUDE_FUNC(sl_WlanSet)
const _SlCmdCtrl_t _SlWlanCfgSetCmdCtrl =
{
SL_OPCODE_WLAN_CFG_SET,
@ -907,18 +927,14 @@ const _SlCmdCtrl_t _SlWlanCfgSetCmdCtrl =
sizeof(_BasicResponse_t)
};
#if _SL_INCLUDE_FUNC(sl_WlanSet)
_i16 sl_WlanSet(_u16 ConfigId ,_u16 ConfigOpt,_u16 ConfigLen, _u8 *pValues)
_i16 sl_WlanSet(const _u16 ConfigId ,const _u16 ConfigOpt,const _u16 ConfigLen,const _u8 *pValues)
{
_SlWlanCfgSetMsg_u Msg;
_SlCmdExt_t CmdExt;
_SlDrvResetCmdExt(&CmdExt);
CmdExt.TxPayloadLen = (ConfigLen+3) & (~3);
CmdExt.RxPayloadLen = 0;
CmdExt.pTxPayload = (_u8 *)pValues;
CmdExt.pRxPayload = NULL;
Msg.Cmd.ConfigId = ConfigId;
Msg.Cmd.ConfigLen = ConfigLen;
@ -936,10 +952,12 @@ _i16 sl_WlanSet(_u16 ConfigId ,_u16 ConfigOpt,_u16 ConfigLen, _u8 *pValues)
/******************************************************************************/
typedef union
{
_WlanCfgSetGet_t Cmd;
_WlanCfgSetGet_t Rsp;
_WlanCfgSetGet_t Cmd;
_WlanCfgSetGet_t Rsp;
}_SlWlanCfgMsgGet_u;
#if _SL_INCLUDE_FUNC(sl_WlanGet)
const _SlCmdCtrl_t _SlWlanCfgGetCmdCtrl =
{
SL_OPCODE_WLAN_CFG_GET,
@ -947,8 +965,7 @@ const _SlCmdCtrl_t _SlWlanCfgGetCmdCtrl =
sizeof(_WlanCfgSetGet_t)
};
#if _SL_INCLUDE_FUNC(sl_WlanGet)
_i16 sl_WlanGet(_u16 ConfigId, _u16 *pConfigOpt,_u16 *pConfigLen, _u8 *pValues)
_i16 sl_WlanGet(const _u16 ConfigId, _u16 *pConfigOpt,_u16 *pConfigLen, _u8 *pValues)
{
_SlWlanCfgMsgGet_u Msg;
_SlCmdExt_t CmdExt;
@ -957,11 +974,10 @@ _i16 sl_WlanGet(_u16 ConfigId, _u16 *pConfigOpt,_u16 *pConfigLen, _u8 *pValues)
{
return SL_EZEROLEN;
}
CmdExt.TxPayloadLen = 0;
_SlDrvResetCmdExt(&CmdExt);
CmdExt.RxPayloadLen = *pConfigLen;
CmdExt.pTxPayload = NULL;
CmdExt.pRxPayload = (_u8 *)pValues;
CmdExt.ActualRxPayloadLen = 0;
Msg.Cmd.ConfigId = ConfigId;
if( pConfigOpt )