SimpleLink Host Driver  0.0.5.1
 All Data Structures Functions Variables Groups
Device

Data Structures

struct  _SlPartialVersion
 
struct  SlVersionFull
 
struct  sl_DeviceReport
 
union  SlDeviceEventData_u
 
struct  SlDeviceEvent_t
 
struct  SlDateTime_t
 

Macros

#define SL_DEVICE_GENERAL_CONFIGURATION   (1)
 
#define SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME   (11)
 
#define SL_DEVICE_GENERAL_VERSION   (12)
 
#define SL_DEVICE_STATUS   (2)
 
#define SL_EVENT_CLASS_GLOBAL   (0)
 
#define SL_EVENT_CLASS_DEVICE   (1)
 
#define SL_EVENT_CLASS_WLAN   (2)
 
#define SL_EVENT_CLASS_BSD   (3)
 
#define SL_EVENT_CLASS_NETAPP   (4)
 
#define SL_EVENT_CLASS_NETCFG   (5)
 
#define SL_EVENT_CLASS_NVMEM   (6)
 
#define SL_WLAN_CONNECT_EVENT   (1)
 
#define SL_WLAN_DISCONNECT_EVENT   (2)
 
#define SL_WLAN_SMART_CONFIG_START_EVENT   (3)
 
#define SL_WLAN_SMART_CONFIG_STOP_EVENT   (4)
 
#define SL_WLAN_STA_CONNECTED_EVENT   (5)
 
#define SL_WLAN_STA_DISCONNECTED_EVENT   (6)
 
#define SL_WLAN_P2P_DEV_FOUND_EVENT   (7)
 
#define SL_WLAN_P2P_NEG_REQ_RECEIVED_EVENT   (8)
 
#define SL_WLAN_CONNECTION_FAILED_EVENT   (9)
 
#define SL_DEVICE_FATAL_ERROR_EVENT   (1)
 
#define SL_SOCKET_TX_FAILED_EVENT   (1)
 
#define SL_SOCKET_SSL_ACCEPT_EVENT   (2)
 
#define SL_NETAPP_IPACQUIRED_EVENT   (1)
 
#define SL_NETAPP_IPACQUIRED_V6_EVENT   (2)
 
#define SL_POOL_IS_EMPTY   -2000
 
#define SL_ESMALLBUF   -2001
 
#define SL_EZEROLEN   -2002
 
#define SL_INVALPARAM   -2003
 
#define EVENT_DROPPED_DEVICE_ASYNC_GENERAL_ERROR   0x00000001L
 
#define STATUS_DEVICE_SMART_CONFIG_ACTIVE   0x80000000L
 
#define EVENT_DROPPED_WLAN_WLANASYNCONNECTEDRESPONSE   0x00000001L
 
#define EVENT_DROPPED_WLAN_WLANASYNCDISCONNECTEDRESPONSE   0x00000002L
 
#define EVENT_DROPPED_WLAN_STA_CONNECTED   0x00000004L
 
#define EVENT_DROPPED_WLAN_STA_DISCONNECTED   0x00000008L
 
#define STATUS_WLAN_STA_CONNECTED   0x80000000L
 
#define EVENT_DROPPED_NETAPP_IPACQUIRED   0x00000001L
 
#define EVENT_DROPPED_NETAPP_IPACQUIRED_V6   0x00000002L
 
#define EVENT_DROPPED_NETAPP_IP_LEASED   0x00000004L
 
#define EVENT_DROPPED_NETAPP_IP_RELEASED   0x00000008L
 
#define EVENT_DROPPED_SOCKET_TXFAILEDASYNCRESPONSE   0x00000001L
 

Enumerations

enum  SlErrorSender_e {
  SL_ERR_SENDER_HEALTH_MON, SL_ERR_SENDER_CLI_UART, SL_ERR_SENDER_SUPPLICANT, SL_ERR_SENDER_NETWORK_STACK,
  SL_ERR_NUM_SENDER_LAST =0xFF
}
 

Functions

long sl_DevSet (unsigned char DeviceSetId, unsigned char Option, unsigned char ConfigLen, unsigned char *pValues)
 Internal function for setting device configurations. More...
 
long sl_DevGet (unsigned char DeviceGetId, unsigned char *pOption, unsigned char *pConfigLen, unsigned char *pValues)
 Internal function for getting device configurations. More...
 
int sl_Start (const void *pIfHdl, char *pDevName, const P_INIT_CALLBACK pInitCallBack)
 Start the SimpleLink device. More...
 
int sl_Stop (unsigned short timeout)
 Stop the SimpleLink device. More...
 
int sl_EventMaskSet (unsigned char EventClass, unsigned long Mask)
 Set asynchronous event mask. More...
 
int sl_EventMaskGet (unsigned char EventClass, unsigned long *pMask)
 Get current event mask of the device. More...
 

Detailed Description

Macro Definition Documentation

#define EVENT_DROPPED_DEVICE_ASYNC_GENERAL_ERROR   0x00000001L

Declare the different event group classifications for sl_DevGet

Function Documentation

long sl_DevGet ( unsigned char  DeviceGetId,
unsigned char *  pOption,
unsigned char *  pConfigLen,
unsigned char *  pValues 
)

Internal function for getting device configurations.

Returns
On success, zero is returned. On error, -1 is returned
Parameters
[in]DeviceGetIdconfiguration id - example SL_DEVICE_STATUS
[out]pOptionGet configurations option, example for get status options
  • SL_EVENT_CLASS_GLOBAL
  • SL_EVENT_CLASS_DEVICE
  • SL_EVENT_CLASS_WLAN
  • SL_EVENT_CLASS_BSD
  • SL_EVENT_CLASS_NETAPP
  • SL_EVENT_CLASS_NETCFG
  • SL_EVENT_CLASS_NVMEM
  • SL_EVENT_CLASS_VERSION
[out]pConfigLenThe length of the allocated memory as input, when the function complete, the value of this parameter would be the len that actually read from the device.
If the device return length that is longer from the input value, the function will cut the end of the returned structure and will return SL_ESMALLBUF
[out]pValuesGet configurations values
See Also
Note
Warning
Examples:
Example for getting WLAN class status:
unsigned long statusWlan;
unsigned char pConfigOpt;
pConfigOpt = SL_EVENT_CLASS_WLAN;
sl_DevGet(SL_DEVICE_GET_STATUS,&pConfigOpt,&pConfigLen,(unsigned char *)(&statusWlan));
Example for getting version:
pConfigOpt = SL_DEVICE_GENERAL_VERSION;
sl_DevGet(SL_DEVICE_GENERAL_CONFIGURATION,&pConfigOpt,&pConfigLen,(unsigned char *)(&ver));
printf("CHIP %d\nMAC 31.%d.%d.%d.%d\nPHY %d.%d.%d.%d\nNWP %d.%d.%d.%d\nROM %d\nHOST %d.%d.%d.%d\n",
ver.ChipFwAndPhyVersion.ChipId,
ver.ChipFwAndPhyVersion.FwVersion[0],ver.ChipFwAndPhyVersion.FwVersion[1],
ver.ChipFwAndPhyVersion.FwVersion[2],ver.ChipFwAndPhyVersion.FwVersion[3],
ver.ChipFwAndPhyVersion.PhyVersion[0],ver.ChipFwAndPhyVersion.PhyVersion[1],
ver.ChipFwAndPhyVersion.PhyVersion[2],ver.ChipFwAndPhyVersion.PhyVersion[3],
ver.NwpVersion[0],ver.NwpVersion[1],ver.NwpVersion[2],ver.NwpVersion[3],
ver.RomVersion,
SL_MAJOR_VERSION_NUM,SL_MINOR_VERSION_NUM,SL_VERSION_NUM,SL_SUB_VERSION_NUM);
Getting Device time and date example:
SlDateTime_t dateTime = {0};
char configLen = sizeof(SlDateTime_t);
char configOpt = SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME;
sl_DevGet(SL_DEVICE_GENERAL_CONFIGURATION,&configOpt, &configLen,(unsigned char *)(&dateTime));
printf("Day %d,Mon %d,Year %d,Hour %,Min %d,Sec %d\n",dateTime.sl_tm_day,dateTime.sl_tm_mon,dateTime.sl_tm_year
dateTime.sl_tm_hour,dateTime.sl_tm_min,dateTime.sl_tm_sec);
long sl_DevSet ( unsigned char  DeviceSetId,
unsigned char  Option,
unsigned char  ConfigLen,
unsigned char *  pValues 
)

Internal function for setting device configurations.

Returns
On success, zero is returned. On error, -1 is returned
Parameters
[in]DeviceSetIdconfiguration id
[in]Optionconfigurations option
[in]ConfigLenconfigurations len
[in]pValuesconfigurations values
See Also
Note
Warning
Setting device time and date example:
SlDateTime_t dateTime= {0};
dateTime.sl_tm_day = (unsigned long)23; // Day of month (DD format) range 1-13
dateTime.sl_tm_mon = (unsigned long)6; // Month (MM format) in the range of 1-12
dateTime.sl_tm_year = (unsigned long)2014; // Year (YYYY format)
dateTime.sl_tm_hour = (unsigned long)17; // Hours in the range of 0-23
dateTime.sl_tm_min = (unsigned long)55; // Minutes in the range of 0-59
dateTime.sl_tm_sec = (unsigned long)22; // Seconds in the range of 0-59
sl_DevSet(SL_DEVICE_GENERAL_CONFIGURATION,SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME,sizeof(SlDateTime_t),(unsigned char *)(&dateTime));
int sl_EventMaskGet ( unsigned char  EventClass,
unsigned long *  pMask 
)

Get current event mask of the device.

return the events bit mask from the device. In case that event is masked, the device is not sending this event.

Parameters
[in]EventClassThe classification groups that the mask is referred to. Need to be one of the following:
  • SL_EVENT_CLASS_GLOBAL
  • SL_EVENT_CLASS_DEVICE
  • SL_EVENT_CLASS_WLAN
  • SL_EVENT_CLASS_BSD
  • SL_EVENT_CLASS_NETAPP
  • SL_EVENT_CLASS_NETCFG
  • SL_EVENT_CLASS_NVMEM
[out]pMaskPointer to Mask bitmap where the value should be stored. Bitmasks are the same as in sl_EventMaskSet
Returns
On success, zero is returned. On error, -1 is returned
See Also
sl_EventMaskSet
Note
belongs to ext_api
Warning
Example:
An example of getting an event mask for WLAN class
unsigned long maskWlan;
sl_StatusGet(SL_EVENT_CLASS_WLAN,&maskWlan);
int sl_EventMaskSet ( unsigned char  EventClass,
unsigned long  Mask 
)

Set asynchronous event mask.

Mask asynchronous events from the device. Masked events do not generate asynchronous messages from the device.

Parameters
[in]EventClassThe classification groups that the mask is referred to. Need to be one of the following:
  • SL_EVENT_CLASS_GLOBAL
  • SL_EVENT_CLASS_DEVICE
  • SL_EVENT_CLASS_WLAN
  • SL_EVENT_CLASS_BSD
  • SL_EVENT_CLASS_NETAPP
  • SL_EVENT_CLASS_NETCFG
  • SL_EVENT_CLASS_NVMEM
[in]MaskEvent Mask bitmap. Valid mask are (per group):
  • SL_EVENT_CLASS_WLAN user events
    • SL_WLAN_CONNECT_EVENT
    • SL_WLAN_DISCONNECT_EVENT
    • SL_WLAN_STA_CONNECTED_EVENT
    • SL_WLAN_STA_DISCONNECTED_EVENT
  • Smart Config events
    • SL_WLAN_SMART_CONFIG_START_EVENT
    • SL_WLAN_SMART_CONFIG_STOP_EVENT
  • SL_EVENT_CLASS_DEVICE user events
    • SL_DEVICE_FATAL_ERROR_EVENT
  • SL_EVENT_CLASS_BSD user events
    • SL_SOCKET_TX_FAILED_EVENT
    • SL_SOCKET_SSL_ACCEPT_EVENT
  • SL_EVENT_CLASS_NETAPP user events
    • SL_NETAPP_IPACQUIRED_EVENT
    • SL_NETAPP_IPACQUIRED_V6_EVENT
Returns
On success, zero is returned. On error, -1 is returned
See Also
sl_EventMaskGet
Note
belongs to ext_api
Warning
Example:
An example of masking out connection/disconnection from WLAN class:
sl_EventMaskSet(SL_EVENT_CLASS_WLAN, (SL_WLAN_CONNECT_EVENT | SL_WLAN_DISCONNECT_EVENT) );
int sl_Start ( const void *  pIfHdl,
char *  pDevName,
const P_INIT_CALLBACK  pInitCallBack 
)

Start the SimpleLink device.

This function initialize the communication interface, set the enable pin of the device, and call to the init complete callback.

Parameters
[in]pIfHdlOpened Interface Object. In case the interface must be opened outside the SimpleLink Driver, the user might give the handler to be used in
any access of the communication interface with the device (UART/SPI).
The SimpleLink driver will open an interface port only if this parameter is null!
[in]pDevNameThe name of the device to open. Could be used when the pIfHdl is null, to transfer information to the open interface function
[in]pInitCallBackPointer to function that would be called on completion of the initialization process.
If this parameter is NULL the function is blocked until the device initialization is completed, otherwise the function returns immediately.
Returns
Roles
  • ROLE_STA, ROLE_AP, ROLE_P2P in case of success, otherwise in failure one of the following is return:
  • ROLE_STA_ERR (Failure to load MAC in STA role)
  • ROLE_AP_ERR (Failure to load MAC in AP role)
  • ROLE_P2P_ERR (Failure to load MAC in P2P role)
See Also
sl_Stop
Note
belongs to basic_api
Warning
This function must be called before any other SimpleLink API is used
Example:
An example for open interface without callback routine. The interface name and handler are
handled by the sl_IfOpen routine:
if( sl_Start(NULL, NULL, NULL) == 0)
{
LOG("Error opening interface to device\n");
}
int sl_Stop ( unsigned short  timeout)

Stop the SimpleLink device.

This function clears the enable pin of the device, closes the communication
interface and invokes the stop complete callback

Parameters
[in]timeoutStop timeout in msec. Should be used to give the device time to finish
any transmission/reception that is not completed when the function was called.
Addional options:
  • 0 Enter to hibernate immediately
  • 0xFFFF Host waits for device's response before
    hibernating, without timeout protection
  • 0 < Timeout[msec] < 0xFFFF Host waits for device's response before
    hibernating, with a defined timeout protection
    This timeout defines the max time to wait. The NWP
    response can be sent earlier than this timeout.
Returns
On success, zero is returned. On error, -1 is returned
See Also
sl_Start
Note
This API will shutdown the device and invoke the "i/f close" function regardless
if it was opened implicitly or explicitly.
It is up to the platform interface library to properly handle interface close
routine
belongs to basic_api
Warning