SimpleLink CC31xx/CC32xx Host Driver  Version 3.0.1.71
Simplifies the implementation of Internet connectivity
Device

Controls the behaviour of the CC31xx/CC32xx device (start/stop, events masking and obtaining specific device status) More...

Functions

_i16 sl_Start (const void *pIfHdl, _i8 *pDevName, const P_INIT_CALLBACK pInitCallBack)
 Start the SimpleLink device. More...
 
_i16 sl_Stop (const _u16 Timeout)
 Stop the SimpleLink device. More...
 
_i16 sl_DeviceSet (const _u8 DeviceSetId, const _u8 Option, const _u16 ConfigLen, const _u8 *pValues)
 Setting device configurations. More...
 
_i16 sl_DeviceGet (const _u8 DeviceGetId, _u8 *pOption, _u16 *pConfigLen, _u8 *pValues)
 Internal function for getting device configurations. More...
 
_i16 sl_DeviceEventMaskSet (const _u8 EventClass, const _u32 Mask)
 Set asynchronous event mask. More...
 
_i16 sl_DeviceEventMaskGet (const _u8 EventClass, _u32 *pMask)
 Get current event mask of the device. More...
 
void * sl_Task (void *pEntry)
 The SimpleLink task entry. More...
 
_i16 sl_DeviceUartSetMode (const SlDeviceUartIfParams_t *pUartParams)
 Setting the internal uart mode. More...
 
_i32 sl_WifiConfig ()
 Configure SimpleLink to default state. More...
 
_i16 sl_DeviceStatStart (const _u32 Flags)
 Start collecting Device statistics (including RX statistics), for unlimited time. More...
 
_i16 sl_DeviceStatGet (const _u16 ConfigId, _u16 length, void *buffer)
 Getting DEVICE statistics. More...
 
_i16 sl_DeviceStatStop (const _u32 Flags)
 Stop collecting Device statistic, (if previous called sl_DeviceStatStart) More...
 

Typedefs

typedef struct SlDeviceFatalNoCmdAck_t SlDeviceFatalCmdTimeout_t
 
typedef void(* P_INIT_CALLBACK) (_u32 Status, SlDeviceInitInfo_t *DeviceInitInfo)
 

Enumerations

enum  SlDeviceEventId_e {
  SL_DEVICE_EVENT_FATAL_DEVICE_ABORT = 1,
  SL_DEVICE_EVENT_FATAL_DRIVER_ABORT,
  SL_DEVICE_EVENT_FATAL_SYNC_LOSS,
  SL_DEVICE_EVENT_FATAL_NO_CMD_ACK,
  SL_DEVICE_EVENT_FATAL_CMD_TIMEOUT,
  SL_DEVICE_EVENT_RESET_REQUEST,
  SL_DEVICE_EVENT_ERROR,
  SL_DEVICE_EVENT_MAX
}
 
enum  SlDeviceSource_e {
  SL_DEVICE_SOURCE_OTHER,
  SL_DEVICE_SOURCE_WLAN,
  SL_DEVICE_SOURCE_NETCFG,
  SL_DEVICE_SOURCE_NETAPP,
  SL_DEVICE_SOURCE_SECURITY,
  SL_DEVICE_SOURCE_LAST = 0xFF
}
 
enum  SlDeviceResetRequestCaller_e {
  SL_DEVICE_RESET_REQUEST_CALLER_PROVISIONING,
  SL_DEVICE_RESET_REQUEST_CALLER_PROVISIONING_EXTERNAL_CONFIGURATION,
  SL_DEVICE_RESET_REQUEST_NUM_OF_CALLERS
}
 

Detailed Description

Controls the behaviour of the CC31xx/CC32xx device (start/stop, events masking and obtaining specific device status)

Function Documentation

§ sl_DeviceEventMaskGet()

_i16 sl_DeviceEventMaskGet ( const _u8  EventClass,
_u32 *  pMask 
)

Get current event mask of the device.

Return the events bit mask from the device. In case event is masked, the device will not send that event.

Parameters
[in]EventClassThe classification groups that the mask is referred to. Need to be one of the following:
  • SL_DEVICE_EVENT_CLASS_GLOBAL
  • SL_DEVICE_EVENT_CLASS_DEVICE
  • SL_DEVICE_EVENT_CLASS_WLAN
  • SL_DEVICE_EVENT_CLASS_BSD
  • SL_DEVICE_EVENT_CLASS_NETAPP
  • SL_DEVICE_EVENT_CLASS_NETCFG
  • SL_DEVICE_EVENT_CLASS_FS
[out]pMaskPointer to mask bitmap where the value should be stored. Bitmasks are the same as in sl_DeviceEventMaskSet
Returns
Zero on success, or a negative value if an error occurred
See also
sl_DeviceEventMaskSet
Note
Belongs to ext_api
Warning
Example
  • Getting an event mask for WLAN class:
    _u32 maskWlan;
    sl_DeviceEventMaskGet(SL_DEVICE_EVENT_CLASS_WLAN,&maskWlan);

Definition at line 458 of file device.c.

459 {
460  _SlEventMaskGetMsg_u Msg;
461 
462  /* verify that this api is allowed. if not allowed then
463  ignore the API execution and return immediately with an error */
464  VERIFY_API_ALLOWED(SL_OPCODE_SILO_DEVICE);
465 
466  Msg.Cmd.Group = EventClass;
467 
468  VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlEventMaskGetCmdCtrl, &Msg, NULL));
469 
470  *pMask = Msg.Rsp.Mask;
471 
472  return SL_RET_CODE_OK;
473 }

§ sl_DeviceEventMaskSet()

_i16 sl_DeviceEventMaskSet ( const _u8  EventClass,
const _u32  Mask 
)

Set asynchronous event mask.

Mask asynchronous events from the device.
Masked events do not generate asynchronous messages from the device.
By default - all events are active

Parameters
[in]EventClassThe classification groups that the mask is referred to. Need to be one of the following:
  • SL_DEVICE_EVENT_CLASS_DEVICE
  • SL_DEVICE_EVENT_CLASS_WLAN
  • SL_DEVICE_EVENT_CLASS_BSD
  • SL_DEVICE_EVENT_CLASS_NETAPP
  • SL_DEVICE_EVENT_CLASS_NETCFG
  • SL_DEVICE_EVENT_CLASS_FS
[in]MaskEvent Mask bitmap. Valid mask are (per group):
  • SL_DEVICE_EVENT_CLASS_WLAN user events
    • SL_WLAN_EVENT_CONNECT
    • SL_WLAN_EVENT_P2P_CONNECT
    • SL_WLAN_EVENT_DISCONNECT
    • SL_WLAN_EVENT_P2P_DISCONNECT
    • SL_WLAN_EVENT_STA_ADDED
    • SL_WLAN_EVENT_STA_REMOVED
    • SL_WLAN_EVENT_P2P_CLIENT_ADDED
    • SL_WLAN_EVENT_P2P_CLIENT_REMOVED
    • SL_WLAN_EVENT_P2P_DEVFOUND
    • SL_WLAN_EVENT_P2P_REQUEST
    • SL_WLAN_EVENT_P2P_CONNECTFAIL
    • SL_WLAN_EVENT_PROVISIONING_STATUS
    • SL_WLAN_EVENT_PROVISIONING_PROFILE_ADDED
    • SL_WLAN_EVENT_RXFILTER
  • SL_DEVICE_EVENT_CLASS_DEVICE user events
    • SL_DEVICE_EVENT_ERROR
  • SL_DEVICE_EVENT_CLASS_BSD user events
    • SL_SOCKET_TX_FAILED_EVENT
    • SL_SOCKET_ASYNC_EVENT
  • SL_DEVICE_EVENT_CLASS_NETAPP user events
    • SL_NETAPP_EVENT_IPV4_ACQUIRED
    • SL_NETAPP_EVENT_IPV6_ACQUIRED
    • SL_NETAPP_EVENT_DHCPV4_LEASED
    • SL_NETAPP_EVENT_DHCPV4_RELEASED
    • SL_NETAPP_EVENT_IP_COLLISION
    • SL_NETAPP_EVENT_IPV4_LOST
    • SL_NETAPP_EVENT_DHCP_IPV4_ACQUIRE_TIMEOUT
    • SL_NETAPP_EVENT_IPV6_LOST
Returns
Zero on success, or a negative value if an error occurred
Persistent System Persistent
See also
sl_DeviceEventMaskGet
Note
Belongs to ext_api
Warning
Example
  • Masking connection/disconnection async events from WLAN class:
    sl_DeviceEventMaskSet(SL_DEVICE_EVENT_CLASS_WLAN, (SL_DEVICE_EVENT_BIT(SL_WLAN_EVENT_CONNECT) | SL_DEVICE_EVENT_BIT(SL_WLAN_EVENT_DISCONNECT) ) );

Definition at line 420 of file device.c.

421 {
422  _SlEventMaskSetMsg_u Msg;
423 
424  /* verify that this api is allowed. if not allowed then
425  ignore the API execution and return immediately with an error */
426  VERIFY_API_ALLOWED(SL_OPCODE_SILO_DEVICE);
427 
428  Msg.Cmd.Group = EventClass;
429  Msg.Cmd.Mask = Mask;
430 
431  VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlEventMaskSetCmdCtrl, &Msg, NULL));
432 
433  return (_i16)Msg.Rsp.status;
434 }

§ sl_DeviceGet()

_i16 sl_DeviceGet ( const _u8  DeviceGetId,
_u8 *  pOption,
_u16 *  pConfigLen,
_u8 *  pValues 
)

Internal function for getting device configurations.

Parameters
[in]DeviceGetIdconfiguration id:
  • SL_DEVICE_STATUS
  • SL_DEVICE_GENERAL
  • SL_DEVICE_IOT
[out]pOptionGet configurations option:
  • SL_DEVICE_STATUS:
    • SL_DEVICE_EVENT_CLASS_DEVICE
    • SL_DEVICE_EVENT_CLASS_WLAN
    • SL_DEVICE_EVENT_CLASS_BSD
    • SL_DEVICE_EVENT_CLASS_NETAPP
    • SL_DEVICE_EVENT_CLASS_NETCFG
    • SL_DEVICE_EVENT_CLASS_FS
  • SL_DEVICE_GENERAL:
    • SL_DEVICE_GENERAL_VERSION
    • SL_DEVICE_GENERAL_DATE_TIME
    • SL_DEVICE_GENERAL_PERSISTENT
  • SL_DEVICE_IOT:
    • SL_DEVICE_IOT_UDID
    • SL_DEVICE_DICE_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 requested configurations values
Returns
Zero on success, or a negative value if an error occurred
See also
Note
Warning
Examples
  • Getting WLAN class status (status is always cleared on read):
    _u32 statusWlan;
    _u8 pConfigOpt;
    _u16 pConfigLen;
    pConfigOpt = SL_DEVICE_EVENT_CLASS_WLAN;
    pConfigLen = sizeof(_u32);
    sl_DeviceGet(SL_DEVICE_STATUS,&pConfigOpt,&pConfigLen,(_u8 *)(&statusWlan));
    if (SL_DEVICE_STATUS_WLAN_STA_CONNECTED & statusWlan )
    {
    printf("Device is connected\n");
    }
    if (SL_DEVICE_EVENT_DROPPED_WLAN_RX_FILTERS & statusWlan )
    {
    printf("RX filer event dropped\n");
    }

  • Getting version:
    pConfigLen = sizeof(ver);
    pConfigOpt = SL_DEVICE_GENERAL_VERSION;
    sl_DeviceGet(SL_DEVICE_GENERAL,&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",
    ver.ChipId,
    ver.FwVersion[0],ver.FwVersion[1],
    ver.FwVersion[2],ver.FwVersion[3],
    ver.PhyVersion[0],ver.PhyVersion[1],
    ver.PhyVersion[2],ver.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:
    SlDateTime_t dateTime = {0};
    _i16 configLen = sizeof(SlDateTime_t);
    _i8 configOpt = SL_DEVICE_GENERAL_DATE_TIME;
    sl_DeviceGet(SL_DEVICE_GENERAL,&configOpt, &configLen,(_u8 *)(&dateTime));
    printf("Day %d,Mon %d,Year %d,Hour %,Min %d,Sec %d\n",dateTime.tm_day,dateTime.tm_mon,dateTime.tm_year,
    dateTime.tm_hour,dateTime.tm_min,dateTime.tm_sec);
  • Getting persistency system configuration:
    _i16 configLen = sizeof(_u8);
    _i8 configOpt = SL_DEVICE_GENERAL_PERSISTENT;
    sl_DeviceGet(SL_DEVICE_GENERAL,&configOpt, &configLen,&persistent);
  • Getting DICE version:
    _i8 ver[2] = {0};
    _i16 configSize = sizeof(ver);
    _i8 configOpt = SL_DEVICE_DICE_VERSION;
    sl_DeviceGet(SL_DEVICE_IOT, &configOpt, &configSize,(uint8_t*)(&ver));

Definition at line 499 of file device.c.

500 {
501  _SlDeviceMsgGet_u Msg;
502  _SlCmdExt_t CmdExt;
503 
504  /* verify that this api is allowed. if not allowed then
505  ignore the API execution and return immediately with an error */
506  VERIFY_API_ALLOWED(SL_OPCODE_SILO_DEVICE);
507 
508  if (*pConfigLen == 0)
509  {
510  return SL_EZEROLEN;
511  }
512 
513  if( pOption )
514  {
515 
516  _SlDrvResetCmdExt(&CmdExt);
517  CmdExt.RxPayloadLen = (_i16)*pConfigLen;
518  CmdExt.pRxPayload = (_u8 *)pValues;
519 
520  Msg.Cmd.DeviceSetId = DeviceGetId;
521 
522  Msg.Cmd.Option = (_u16)*pOption;
523 
524  VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlDeviceGetCmdCtrl, &Msg, &CmdExt));
525 
526  if( pOption )
527  {
528  *pOption = (_u8)Msg.Rsp.Option;
529  }
530 
531  if (CmdExt.RxPayloadLen < CmdExt.ActualRxPayloadLen)
532  {
533  *pConfigLen = (_u16)CmdExt.RxPayloadLen;
534 
535  return SL_ESMALLBUF;
536  }
537  else
538  {
539  *pConfigLen = (_u16)CmdExt.ActualRxPayloadLen;
540  }
541 
542  return (_i16)Msg.Rsp.Status;
543  }
544  else
545  {
546  return SL_RET_CODE_INVALID_INPUT;
547  }
548 }

§ sl_DeviceSet()

_i16 sl_DeviceSet ( const _u8  DeviceSetId,
const _u8  Option,
const _u16  ConfigLen,
const _u8 *  pValues 
)

Setting device configurations.

Parameters
[in]DeviceSetIdconfiguration id:
  • SL_DEVICE_GENERAL
[in]Optionconfigurations option:
  • SL_DEVICE_GENERAL_DATE_TIME
  • SL_DEVICE_GENERAL_PERSISTENT
[in]ConfigLenconfigurations len
[in]pValuesconfigurations values
Returns
Zero on success, or a negative value if an error occurred
Persistent
SL_DEVICE_GENERAL_DATE_TIME - System Persistent (kept during hibernate only, See Note for details)
SL_DEVICE_GENERAL_PERSISTENT - Persistent
See also
Note
Persistency for SL_DEVICE_GENERAL_DATE_TIME - The original setted value will be kept as System Persistence.
The updated date and time though, will be kept during hibernate only.
Warning
Examples:
  • Setting device time and date example:
    SlDateTime_t dateTime= {0};
    dateTime.tm_day = (_u32)23; // Day of month (DD format) range 1-31
    dateTime.tm_mon = (_u32)6; // Month (MM format) in the range of 1-12
    dateTime.tm_year = (_u32)2014; // Year (YYYY format)
    dateTime.tm_hour = (_u32)17; // Hours in the range of 0-23
    dateTime.tm_min = (_u32)55; // Minutes in the range of 0-59
    dateTime.tm_sec = (_u32)22; // Seconds in the range of 0-59
    sl_DeviceSet(SL_DEVICE_GENERAL,
    SL_DEVICE_GENERAL_DATE_TIME,
    sizeof(SlDateTime_t),
    (_u8 *)(&dateTime));

  • Setting system persistent configuration:
    Sets the default system-wide configuration persistence mode. In case true, all APIs that follow 'system configured' persistence (see persistence attribute noted per API) shall maintain the configured settings. In case false, all calls to APIs that follow 'system configured' persistence shall be volatile. Configuration should revert to default after reset or power recycle
    _u8 persistent = 1;
    sl_DeviceSet(SL_DEVICE_GENERAL,
    SL_DEVICE_GENERAL_PERSISTENT,
    sizeof(_u8),
    (_u8 *)(&persistent));

Definition at line 571 of file device.c.

572 {
573  _SlDeviceMsgSet_u Msg;
574  _SlCmdExt_t CmdExt;
575 
576  /* verify that this api is allowed. if not allowed then
577  ignore the API execution and return immediately with an error */
578  VERIFY_API_ALLOWED(SL_OPCODE_SILO_DEVICE);
579 
580  _SlDrvResetCmdExt(&CmdExt);
581 
582  CmdExt.TxPayload1Len = (ConfigLen+3) & (~3);
583  CmdExt.pTxPayload1 = (_u8 *)pValues;
584 
585  Msg.Cmd.DeviceSetId = DeviceSetId;
586  Msg.Cmd.ConfigLen = ConfigLen;
587  Msg.Cmd.Option = Option;
588 
589  VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlDeviceSetCmdCtrl, &Msg, &CmdExt));
590 
591  return (_i16)Msg.Rsp.status;
592 }

§ sl_DeviceStatGet()

_i16 sl_DeviceStatGet ( const _u16  ConfigId,
_u16  length,
void *  buffer 
)

Getting DEVICE statistics.

Parameters
[in]ConfigId- configuration id
  • SL_DEVICE_STAT_WLAN_RX
  • SL_DEVICE_STAT_PM
[in]length- length of output data
[out]buffer- buffer for the requested device statistics
Returns
Zero on success, or negative error code on failure
See also
sl_DeviceStatGet, sl_DeviceStatStart
Note
There is 2 prototypes of variable - Accumulated and Clear On Read. -Accumulated data will be store from the init time of the system. -Clear On Read data will be delete when sl_DeviceStatGet(clear on read per ConfigId) or sl_DeviceStatStart(clear on read all the ConfigId's) are used. The division between Accumulated and Clear On Read is at the internal struct. For the Accumulated types store in: SlDeviceGetPmStatAcc_t struct. and the Clear On Read types store in: SlDeviceGetPmStatClrOnRdTypes_t struct.
Warning
Examples

Definition at line 749 of file device.c.

750 {
751  _i16 RetVal = 0;
752  SL_DRV_PROTECTION_OBJ_LOCK_FOREVER();
753  /* Device statistics and Rx statistics cannot run parallel */
754  if(SL_IS_WLAN_RX_STAT_IN_PROGRESS)
755  {
756  SL_DRV_PROTECTION_OBJ_UNLOCK();
757  return SL_RET_CODE_WLAN_RX_STAT_IN_PROGRESS;
758  }
759  else
760  {
761  SL_DRV_PROTECTION_OBJ_UNLOCK();
762  if(SL_DEVICE_STAT_WLAN_RX == ConfigId )
763  {
764  /* In this case we use SL_OPCODE_WLAN_GETRXSTATCOMMAND even though we are at "Device" module -
765  * duo to the fact we want keep this API to call the exact same deprecated API which called from Wlan */
766  _SlCmdCtrl_t CmdCtrl = {SL_OPCODE_WLAN_GETRXSTATCOMMAND, 0, (_SlArgSize_t)sizeof(SlDeviceGetStat_t)};
767 
768  /* verify that this api is allowed. if not allowed then
769  ignore the API execution and return immediately with an error */
770  VERIFY_API_ALLOWED(SL_OPCODE_SILO_WLAN);
771 
772  _SlDrvMemZero(buffer, (_u16)sizeof(SlDeviceGetStat_t));
773  VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&CmdCtrl, buffer, NULL));
774 
775  }
776  else
777  {
778  _u8 configOpt = ConfigId;
779  RetVal = sl_DeviceGet(SL_DEVICE_GENERAL,&configOpt,&length,(_u8* )buffer);
780  }
781 
782  return RetVal;
783  }
784 }
_i16 sl_DeviceGet(const _u8 DeviceGetId, _u8 *pOption, _u16 *pConfigLen, _u8 *pValues)
Internal function for getting device configurations.
Definition: device.c:499

§ sl_DeviceStatStart()

_i16 sl_DeviceStatStart ( const _u32  Flags)

Start collecting Device statistics (including RX statistics), for unlimited time.

Parameters const _u32 Flags, for future use.
Returns
Zero on success, or negative error code on failure
See also
sl_DeviceStatStop sl_DeviceStatGet
Warning
This API should replace and extend the existing API of sl_WlanRxStatStart. sl_WlanRxStatStart, sl_WlanRxStatStop and sl_WlanRxStatGet are deprecated API's and exist only for backwards compatibility reasons. The recommendation is to use ONLY sl_DeviceStatStart, sl_DeviceStatGet and sl_DeviceStatStop API's. The new APIs (sl_DeviceStat) contains all the capabilities of the deprecated APIs (sl_WlanRxStat). PAY ATTENTION: Once the user starts to work with one of the API's flow (sl_WlanRxStat/sl_DeviceStat) the other cannot be called until sl_XXStatStop is called. meaning: sl_WlanRxStat flow and sl_DeviceStat flow cannot run at the same time.
Example
  • Getting Device statistics:
    void CollectStatistics()
    {
    SlDeviceGetStat_t deviceRXStat; // this struct is equivalent to SlWlanGetRxStatResponse_t
    SlDeviceGetPmStat_t devicePMStat; // PM statistics (new statistics)
    int ret = 0;
    ret = sl_DeviceStatStart(0); // start statistics mode - only one mode can be use in parallel (as described above)
    if (ret != 0)
    {
    //check ret error
    }
    sleep(1); // sleep for 1 sec
    // this call is equivalent to sl_WlanRxStatGet(&rxStat,0)
    ret = sl_DeviceStatGet(SL_DEVICE_STAT_WLAN_RX, sizeof(SlDeviceGetStat_t), &deviceRXStat); // statistics has been cleared upon read
    if (ret != 0)
    {
    //check ret error
    }
    // new statistics
    ret = sl_DeviceStatGet(SL_DEVICE_STAT_PM, sizeof(SlDeviceGetPmStat_t), &devicePMStat); // statistics has been cleared upon read
    if (ret != 0)
    {
    //check ret error
    }
    // Use the statistics that has returned from the API's.
    if (ret != 0)
    {
    //check ret error
    }
    }

Definition at line 726 of file device.c.

727 {
728  SL_DRV_PROTECTION_OBJ_LOCK_FOREVER();
729  if(SL_IS_WLAN_RX_STAT_IN_PROGRESS)
730  {
731  SL_DRV_PROTECTION_OBJ_UNLOCK();
732  return SL_RET_CODE_WLAN_RX_STAT_IN_PROGRESS;
733  }
734  else
735  {
736  /* turn on flag indication for RX statistics is in progress
737  * to avoid parallel "starts" between
738  * Device statistics API and RX statistics API */
739  SL_SET_DEVICE_STAT_IN_PROGRESS;
740  SL_DRV_PROTECTION_OBJ_UNLOCK();
741  /* verify that this api is allowed. if not allowed then
742  ignore the API execution and return immediately with an error */
743  VERIFY_API_ALLOWED(SL_OPCODE_SILO_WLAN);
744  return _SlDrvBasicCmd(SL_OPCODE_WLAN_STARTRXSTATCOMMAND);
745  }
746 
747 }

§ sl_DeviceStatStop()

_i16 sl_DeviceStatStop ( const _u32  Flags)

Stop collecting Device statistic, (if previous called sl_DeviceStatStart)

Parameters const _u32 Flags, for future use.
Returns
Zero on success, or negative error code on failure
See also
sl_DeviceStatStart sl_DeviceStatGet
Warning
Cannot be use when sl_WlanRxStatStart in called.

Definition at line 786 of file device.c.

787 {
788  SL_DRV_PROTECTION_OBJ_LOCK_FOREVER();
789  if(SL_IS_WLAN_RX_STAT_IN_PROGRESS)
790  {
791  SL_DRV_PROTECTION_OBJ_UNLOCK();
792  return SL_RET_CODE_WLAN_RX_STAT_IN_PROGRESS;
793  }
794  else
795  {
796  SL_UNSET_DEVICE_STAT_IN_PROGRESS;
797  SL_DRV_PROTECTION_OBJ_UNLOCK();
798  /* verify that this api is allowed. if not allowed then
799  ignore the API execution and return immediately with an error */
800  VERIFY_API_ALLOWED(SL_OPCODE_SILO_WLAN);
801 
802  return _SlDrvBasicCmd(SL_OPCODE_WLAN_STOPRXSTATCOMMAND);
803 
804  }
805 
806 }

§ sl_DeviceUartSetMode()

_i16 sl_DeviceUartSetMode ( const SlDeviceUartIfParams_t pUartParams)

Setting the internal uart mode.

Parameters
[in]pUartParamsPointer to the uart configuration parameter set:
  • baudrate - up to 711 Kbps
  • flow control - enable/disable
  • comm port - the comm port number
Returns
On success zero is returned, otherwise - Failed.
Persistent Non- Persistent
See also
Note
Belongs to basic_api
Warning
This function must consider the host uart capability

Definition at line 828 of file device.c.

829 {
830  _SlUartSetModeMsg_u Msg;
831  _u32 magicCode = (_u32)0xFFFFFFFF;
832 
833  Msg.Cmd.BaudRate = pUartParams->BaudRate;
834  Msg.Cmd.FlowControlEnable = pUartParams->FlowControlEnable;
835 
836 
837  VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlUartSetModeCmdCtrl, &Msg, NULL));
838 
839  /* cmd response OK, we can continue with the handshake */
840  if (SL_RET_CODE_OK == Msg.Rsp.status)
841  {
842  sl_IfMaskIntHdlr();
843 
844  /* Close the comm port */
845  sl_IfClose(g_pCB->FD);
846 
847  /* Re-open the comm port */
848  sl_IfOpen((void * )pUartParams, SL_IF_UART_REOPEN_FLAGS);
849 
850  sl_IfUnMaskIntHdlr();
851 
852  /* send the magic code and wait for the response */
853  sl_IfWrite(g_pCB->FD, (_u8* )&magicCode, 4);
854 
855  magicCode = UART_SET_MODE_MAGIC_CODE;
856  sl_IfWrite(g_pCB->FD, (_u8* )&magicCode, 4);
857 
858  /* clear magic code */
859  magicCode = 0;
860 
861  /* wait (blocking) till the magic code to be returned from device */
862  sl_IfRead(g_pCB->FD, (_u8* )&magicCode, 4);
863 
864  /* check for the received magic code matching */
865  if (UART_SET_MODE_MAGIC_CODE != magicCode)
866  {
867  _SL_ASSERT(0);
868  }
869  }
870 
871  return (_i16)Msg.Rsp.status;
872 }

§ sl_Start()

_i16 sl_Start ( const void *  pIfHdl,
_i8 *  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
This pointer could be used to pass additional information to sl_IfOpen in case it is required (e.g. UART com port name)
[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
Returns the current active role (STA/AP/P2P/TAG) or an error code:
  • ROLE_STA, ROLE_AP, ROLE_P2P, ROLE_TAG in case of success and when pInitCallBack is NULL (the third parameter),
    or, in case of pInitCallBack is not null - sl_start will return zero in case of success, otherwise in failure one of the following is return:
  • SL_ERROR_ROLE_STA_ERR (Failure to load MAC/PHY in STA role)
  • SL_ERROR_ROLE_AP_ERR (Failure to load MAC/PHY in AP role)
  • SL_ERROR_ROLE_P2P_ERR (Failure to load MAC/PHY in P2P role)
  • SL_ERROR_CALIB_FAIL (Failure of calibration)
  • SL_ERROR_FS_CORRUPTED_ERR (FS is corrupted, Return to Factory Image or Program new image should be invoked (see sl_FsCtl, sl_FsProgram))
  • SL_ERROR_FS_ALERT_ERR (Device is locked, Return to Factory Image or Program new image should be invoked (see sl_FsCtl, sl_FsProgram))
  • SL_ERROR_RESTORE_IMAGE_COMPLETE (Return to factory image completed, perform reset)
  • SL_ERROR_ROLE_TAG_ERR (Failure to start TAG role)
  • SL_ERROR_FIPS_ERR (Failure to start with FIPS mode enabled)
  • SL_ERROR_GENERAL_ERR (General error during init)
See also
sl_Stop
Note
Belongs to basic_api
Warning
This function must be called before any other SimpleLink API is used, or after sl_Stop is called for reinit the device
Example:
  • 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");
    }

  • Open interface with a callback routine:
    void SimpleLinkInitCallback(_u32 status)
    {
    LOG("Handle SimpleLink Interface acording to ststus %d\n", status);
    }
    void main(void)
    {
    if (sl_Start(NULL, NULL, SimpleLinkInitCallback) < 0)
    {
    LOG("Error opening interface to device\n");
    }
    }

Definition at line 119 of file device.c.

120 {
121  _i16 ObjIdx = MAX_CONCURRENT_ACTIONS;
122  InitComplete_t AsyncRsp;
123  int ret = 0; // added for releasePoolObj
124 
125  _SlDrvMemZero(&AsyncRsp, sizeof(InitComplete_t));
126 
127  /* verify no error handling in progress. if in progress than
128  ignore the API execution and return immediately with an error */
129  VERIFY_NO_ERROR_HANDLING_IN_PROGRESS();
130  if (SL_IS_DEVICE_STARTED)
131  {
132  return SL_RET_CODE_DEV_ALREADY_STARTED;
133  }
134  /* Perform any preprocessing before enable networking services */
135 #ifdef sl_DeviceEnablePreamble
136  sl_DeviceEnablePreamble();
137 #endif
138 
139  /* ControlBlock init */
140  (void)_SlDrvDriverCBInit();
141 
142  /* open the interface: usually SPI or UART */
143  if (NULL == pIfHdl)
144  {
145  g_pCB->FD = sl_IfOpen((void *)pDevName, SL_IF_OPEN_FLAGS);
146  }
147  else
148  {
149  g_pCB->FD = (_SlFd_t)pIfHdl;
150  }
151 
152  ObjIdx = _SlDrvProtectAsyncRespSetting((_u8 *)&AsyncRsp, START_STOP_ID, SL_MAX_SOCKETS);
153 
154  if (ObjIdx < 0)
155  {
156  return ObjIdx;
157  }
158 
159  if( g_pCB->FD >= (_SlFd_t)0)
160  {
161  /* store the interface parameters for the internal call of the
162  sl_start to be called upon reset request handling */
163  DeviceCB.pIfHdl = pIfHdl;
164  DeviceCB.pDevName = pDevName;
165 
166  /* Mark that device is in progress! */
167  SL_SET_DEVICE_START_IN_PROGRESS;
168 
169  sl_DeviceDisable();
170 
171  sl_IfRegIntHdlr((SL_P_EVENT_HANDLER)_SlDrvRxIrqHandler, NULL);
172 
173  g_pCB->pInitCallback = pInitCallBack;
174  sl_DeviceEnable();
175 
176  if (NULL == pInitCallBack)
177  {
178  ret = _SlDrvWaitForInternalAsyncEvent(ObjIdx, INIT_COMPLETE_TIMEOUT, SL_OPCODE_DEVICE_INITCOMPLETE);
179 
180  SL_UNSET_DEVICE_START_IN_PROGRESS;
181 
182  SL_SET_DEVICE_STARTED;
183 
184  /* release Pool Object */
185  _SlDrvReleasePoolObj(g_pCB->FunctionParams.AsyncExt.ActionIndex);
186  if(ret < 0)
187  {
188  return ret;
189  }
190  else
191  {
192  return _SlDeviceGetStartResponseConvert(AsyncRsp.Status);
193  }
194  }
195  else
196  {
197  return SL_RET_CODE_OK;
198  }
199  }
200  return SL_BAD_INTERFACE;
201 }

§ sl_Stop()

_i16 sl_Stop ( const _u16  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.
Additional 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
Zero on success, or a negative value if an error occurred
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

Definition at line 280 of file device.c.

281 {
282  _i16 RetVal=0;
283  _SlStopMsg_u Msg;
284  _BasicResponse_t AsyncRsp;
285  _i16 ObjIdx = MAX_CONCURRENT_ACTIONS;
286  _u8 ReleasePoolObject = FALSE;
287  _u8 IsProvInProgress = FALSE;
288 
289  /* NOTE: don't check VERIFY_API_ALLOWED(), this command is not
290  * filtered in error handling and also not filtered in NWP lock state.
291  * If we are in the middle of assert handling than ignore stopping
292  * the device with timeout and force immediate shutdown as we would like
293  * to avoid any additional commands to the NWP */
294  if( (Timeout != 0) && (SL_IS_DEVICE_STARTED)
295  && (!SL_IS_RESTART_REQUIRED))
296  {
297  /* Clear the Async response structure */
298  _SlDrvMemZero(&AsyncRsp, sizeof(_BasicResponse_t));
299 
300  /* let the device make the shutdown using the defined timeout */
301  Msg.Cmd.Timeout = Timeout;
302 
303  IsProvInProgress = SL_IS_PROVISIONING_IN_PROGRESS;
304 
305  /* if provisioning in progress do not take pool object as we are not going to wait for it */
306  if (!IsProvInProgress)
307  {
308  ObjIdx = _SlDrvProtectAsyncRespSetting((_u8 *)&AsyncRsp, START_STOP_ID, SL_MAX_SOCKETS);
309  if (ObjIdx < 0)
310  {
311  return ObjIdx;
312  }
313 
314  ReleasePoolObject = TRUE;
315  }
316 
317  /* Set the stop-in-progress flag */
318  SL_SET_DEVICE_STOP_IN_PROGRESS;
319 
320  VERIFY_RET_OK(_SlDrvCmdOp((_SlCmdCtrl_t *)&_SlStopCmdCtrl, &Msg, NULL));
321 
322  int ret_pool = 0; // for _SlDrvReleasePoolObj
323  /* Do not wait for stop async event if provisioning is in progress */
324  if((SL_OS_RET_CODE_OK == (_i16)Msg.Rsp.status) && (!(IsProvInProgress)))
325  {
326  /* Wait for sync object to be signaled */
327  ret_pool = _SlDrvWaitForInternalAsyncEvent(ObjIdx, STOP_DEVICE_TIMEOUT, SL_OPCODE_DEVICE_STOP_ASYNC_RESPONSE);
328 
329  Msg.Rsp.status = AsyncRsp.status;
330  RetVal = Msg.Rsp.status;
331  }
332 
333  /* Release pool object only if taken */
334  if (ReleasePoolObject == TRUE)
335  {
336  _SlDrvReleasePoolObj(ObjIdx);
337  if(ret_pool < 0)
338  {
339  return ret_pool;
340  }
341  }
342 
343  /* This macro wait for the NWP to raise a ready for shutdown indication.
344  * This function is unique for the CC32XX family, and expected to return
345  * in less than 600 mSec, which is the time takes for NWP to gracefully shutdown. */
346  WAIT_NWP_SHUTDOWN_READY;
347  }
348  else
349  {
350  if ((!SL_IS_DEVICE_STARTED)
351  && (!SL_IS_RESTART_REQUIRED))
352  {
353  sl_DeviceDisable();
354  return SL_RET_CODE_DEV_NOT_STARTED;
355  }
356  /* Set the stop-in-progress flag */
357  SL_SET_DEVICE_STOP_IN_PROGRESS;
358  }
359  /* Release (signal) all active and pending commands */
360  _SlDrvReleaseAllActivePendingPoolObj();
361 
362 #ifdef SL_PLATFORM_MULTI_THREADED
363  /* Do not continue until all sync object deleted (in relevant context) */
364  while (g_pCB->NumOfDeletedSyncObj < MAX_CONCURRENT_ACTIONS)
365  {
366  usleep(100000);
367  }
368 #endif
369 
370  /* Lock during stopping the interface only if reset is not required (if reset requires it
371  means GlobalLockObj is already deleted and interface operations cannot be performed) */
372  if (!SL_IS_RESTART_REQUIRED)
373  {
374  SL_DRV_OBJ_LOCK_FOREVER(&GlobalLockObj);
375  }
376  sl_IfRegIntHdlr(NULL, NULL);
377  sl_DeviceDisable();
378  RetVal = sl_IfClose(g_pCB->FD);
379 
380  (void)_SlDrvDriverCBDeinit();
381 
382  /* clear the stop-in-progress flag */
383  SL_UNSET_DEVICE_STOP_IN_PROGRESS;
384 
385  /* clear the device started flag */
386  SL_UNSET_DEVICE_STARTED;
387 
388  if (!SL_IS_RESTART_REQUIRED)
389  {
390  SL_DRV_OBJ_UNLOCK(&GlobalLockObj);
391  }
392  /* Clear the restart device flag */
393  SL_UNSET_RESTART_REQUIRED;
394 
395  return RetVal;
396 }

§ sl_Task()

void* sl_Task ( void *  pEntry)

The SimpleLink task entry.

This function must be called from the main loop or from dedicated thread in the following cases:

  • Non-Os Platform - should be called from the mail loop
  • Multi Threaded Platform when the user does not implement the external spawn functions - should be called from dedicated thread allocated to the SimpleLink driver. In this mode the function never return.
parameters
None
Returns
None
See also
Note
Belongs to basic_api
Warning
This function must be called from a thread that is start running before any call to other SimpleLink API

Definition at line 105 of file device.c.

106 {
107 #ifdef _SlTaskEntry
108  return (void*)_SlTaskEntry();
109 #else
110  return (void*)0;
111 #endif
112 }

§ sl_WifiConfig()

_i32 sl_WifiConfig ( )

Configure SimpleLink to default state.

The sl_WifiConfig function allows to configure the device to a pre-configured state by sysconfig UI\ ti_drivers_net_wifi_Config.c. The configuration of the SimpleLink Wifi is usually persistent, and can be reconfigured at runtime. Reconfiguration should be performed only when needed since the process involves flash writes and might impact system lifetime (flash write endurance) and power consumption.

It's important to note that this is one example for a 'restore to default state' function, which meet the needs of this application. User who wish to incorporate this function into he's app, must adjust the implementation and make sure it meets he's needs.

Returns
Upon successful completion, the function shall return 0. In case of failure, this function would return -1.

Definition at line 46 of file wlanconfig.c.

47 {
48  _u8 ucConfigOpt;
49  _u16 uIPMode;
50  _i32 RetVal = -1;
51  _i32 RetVal_stop = -1;
52  _i32 Mode = -1;
53  SlNetCfgIpV4Args_t *ipV4 = NULL;
54  SlNetCfgIpV4Args_t localIpV4;
55  _u16 ipConfigSize = 0;
56 
57 
58  /* Turn NWP on */
59  Mode = sl_Start(NULL, NULL, NULL);
60  if (Mode < 0)
61  {
62  return Mode;
63  }
64 
65  while (1)
66  {
67  if ((SimpleLinkWifiCC32XX_config.Mode != SL_DEVICE_SYSCONFIG_AS_CONFIGURED) && (SimpleLinkWifiCC32XX_config.Mode != Mode))
68  {
69  /* Set NWP role */
70  RetVal = sl_WlanSetMode(SimpleLinkWifiCC32XX_config.Mode);
71  if (RetVal < 0)
72  {
73  break;
74  }
75 
76  /* For changes to take affect, we restart the NWP */
77  RetVal = sl_Stop(200);
78  if (RetVal < 0)
79  {
80  break;
81  }
82 
83  RetVal = sl_Start(NULL, NULL, NULL);
84  if (RetVal < 0)
85  {
86  break;
87  }
88 
89  if(SimpleLinkWifiCC32XX_config.Mode != RetVal)
90  {
91  RetVal = -1;
92  break;
93  }
94  }
95 
96  /* Set connection policy */
97  if (SimpleLinkWifiCC32XX_config.ConnectionPolicy != SL_DEVICE_SYSCONFIG_AS_CONFIGURED)
98  {
99  RetVal =
100  sl_WlanPolicySet(SL_WLAN_POLICY_CONNECTION,
101  SimpleLinkWifiCC32XX_config.ConnectionPolicy,
102  NULL,0);
103  if (RetVal < 0)
104  {
105  break;
106  }
107  }
108  if (SimpleLinkWifiCC32XX_config.ProvisioningStop)
109  {
110  /* Stop Provisioning */
111  RetVal = sl_WlanProvisioning(SL_WLAN_PROVISIONING_CMD_STOP,
112  0xFF,
113  0,
114  NULL,
115  0x0);
116  if (RetVal < 0)
117  {
118  break;
119  }
120  }
121  if (SimpleLinkWifiCC32XX_config.DeleteAllProfile)
122  {
123  /* Delete existing profiles */
124  RetVal = sl_WlanProfileDel(SL_WLAN_DEL_ALL_PROFILES);
125  if (RetVal < 0)
126  {
127  break;
128  }
129  }
130 
131  /* Configure ipv4/DHCP */
132  if (SimpleLinkWifiCC32XX_config.Ipv4Config != SL_DEVICE_SYSCONFIG_AS_CONFIGURED)
133  {
134  if (SimpleLinkWifiCC32XX_config.Mode == ROLE_STA)
135  {
136  uIPMode = SL_NETCFG_IPV4_STA_ADDR_MODE;
137  }
138  else if (SimpleLinkWifiCC32XX_config.Mode == ROLE_AP)
139  {
140  uIPMode = SL_NETCFG_IPV4_AP_ADDR_MODE;
141  }
142  if (SimpleLinkWifiCC32XX_config.Ipv4Config == SL_NETCFG_ADDR_STATIC)
143  {
144  ipV4 = &localIpV4;
145  ipConfigSize = sizeof(SlNetCfgIpV4Args_t);
146 
147  localIpV4.Ip = (_u32)SimpleLinkWifiCC32XX_config.Ipv4; // _u32 IP address
148  localIpV4.IpMask = (_u32)SimpleLinkWifiCC32XX_config.IpMask; // _u32 Subnet mask for this AP/P2P
149  localIpV4.IpGateway = (_u32)SimpleLinkWifiCC32XX_config.IpGateway; // _u32 Default gateway address
150  localIpV4.IpDnsServer = (_u32)SimpleLinkWifiCC32XX_config.IpDnsServer; // _u32 DNS server address
151  }
152  else if (SimpleLinkWifiCC32XX_config.Ipv4Config != SL_NETCFG_ADDR_DHCP)
153  {
154  RetVal = -1;
155  if (RetVal < 0)
156  {
157  break;
158  }
159  }
160 
161  RetVal = sl_NetCfgSet(uIPMode, SimpleLinkWifiCC32XX_config.Ipv4Config, ipConfigSize, (_u8 *)ipV4);
162  if (RetVal < 0)
163  {
164  break;
165  }
166  }
167 
168  /* Set scan policy */
169  if (SimpleLinkWifiCC32XX_config.ScanPolicy != SL_DEVICE_SYSCONFIG_AS_CONFIGURED)
170  {
171  _u32 intervalInSeconds = SimpleLinkWifiCC32XX_config.ScanIntervalInSeconds;
172  ucConfigOpt = SimpleLinkWifiCC32XX_config.ScanPolicy;
173  RetVal = sl_WlanPolicySet(SL_WLAN_POLICY_SCAN, ucConfigOpt, (_u8 *)&intervalInSeconds, sizeof(intervalInSeconds));
174  if (RetVal < 0)
175  {
176  break;
177  }
178  }
179 
180  /* Set NWP Power Management Policy */
181  if (SimpleLinkWifiCC32XX_config.PMPolicy != SL_DEVICE_SYSCONFIG_AS_CONFIGURED)
182  {
183  if (SimpleLinkWifiCC32XX_config.PMPolicy != SL_WLAN_LONG_SLEEP_INTERVAL_POLICY)
184  {
185  RetVal = sl_WlanPolicySet(SL_WLAN_POLICY_PM, SimpleLinkWifiCC32XX_config.PMPolicy, NULL,0);
186  if (RetVal < 0)
187  {
188  break;
189  }
190  }
191  else
192  {
193  SlWlanPmPolicyParams_t PmPolicyParams;
194  memset(&PmPolicyParams,0,sizeof(SlWlanPmPolicyParams_t));
195  PmPolicyParams.MaxSleepTimeMs = SimpleLinkWifiCC32XX_config.MaxSleepTimeMS; //max sleep time in mSec
196  RetVal = sl_WlanPolicySet(SL_WLAN_POLICY_PM, SimpleLinkWifiCC32XX_config.PMPolicy, (_u8*)&PmPolicyParams, sizeof(PmPolicyParams));
197  if (RetVal < 0)
198  {
199  break;
200  }
201  }
202  }
203 
204  /* Set DHCP Server Configuration */
205  if (SimpleLinkWifiCC32XX_config.DHCPServer)
206  {
207  SlNetAppDhcpServerBasicOpt_t dhcpParams;
208  _u8 outLen = sizeof(SlNetAppDhcpServerBasicOpt_t);
209  dhcpParams.lease_time = SimpleLinkWifiCC32XX_config.LeaseTime; // lease time (in seconds) of the IP Address
210  dhcpParams.ipv4_addr_start = (_u32)SimpleLinkWifiCC32XX_config.StartAddress; // first IP Address for allocation. IP Address should be set as Hex number - i.e. 0A0B0C01 for (10.11.12.1)
211  dhcpParams.ipv4_addr_last = (_u32)SimpleLinkWifiCC32XX_config.LastAddress; // last IP Address for allocation. IP Address should be set as Hex number - i.e. 0A0B0C01 for (10.11.12.1)
212  RetVal = sl_NetAppStop(SL_NETAPP_DHCP_SERVER_ID); // Stop DHCP server before settings
213  if (RetVal < 0)
214  {
215  break;
216  }
217  RetVal = sl_NetAppSet(SL_NETAPP_DHCP_SERVER_ID, SL_NETAPP_DHCP_SRV_BASIC_OPT, outLen, (_u8* )&dhcpParams); // set parameters
218  if (RetVal < 0)
219  {
220  break;
221  }
222  if (SimpleLinkWifiCC32XX_config.Mode == ROLE_AP)
223  {
224  RetVal = sl_NetAppStart(SL_NETAPP_DHCP_SERVER_ID); // Start DHCP server with new settings
225  if (RetVal < 0)
226  {
227  break;
228  }
229  }
230  }
231  else
232  {
233  sl_NetAppStop(SL_NETAPP_DHCP_SERVER_ID);
234  }
235  break;
236  }
237  /* Jump here if error occurred or after all the configurations was set successfully */
238  /* For changes to take affect, we restart the NWP - sl_start will be call by application */
239  RetVal_stop = sl_Stop(200);
240  if (RetVal_stop < 0)
241  {
242  return RetVal_stop;
243  }
244  return(RetVal);
245 }
_i16 sl_WlanSetMode(const _u8 Mode)
Wlan set mode.
Definition: wlan.c:1124
_i16 sl_NetAppSet(const _u8 AppId, const _u8 Option, const _u8 OptionLen, const _u8 *pOptionValue)
Setting network application configurations.
Definition: netapp.c:1136
_i16 sl_WlanProvisioning(_u8 ProvisioningCmd, _u8 RequestedRoleAfterSuccess, _u16 InactivityTimeoutSec, char *pSmartConfigKey, _u32 Flags)
The simpleLink will switch to the appropriate role according to the provisioning mode requested and w...
Definition: wlan.c:1060
_i16 sl_Stop(const _u16 Timeout)
Stop the SimpleLink device.
Definition: device.c:280
_i16 sl_WlanPolicySet(const _u8 Type, const _u8 Policy, _u8 *pVal, const _u8 ValLen)
Set policy values.
Definition: wlan.c:242
_i16 sl_NetCfgSet(const _u16 ConfigId, const _u16 ConfigOpt, const _u16 ConfigLen, const _u8 *pValues)
Setting network configurations.
Definition: netcfg.c:63
_i16 sl_WlanProfileDel(const _i16 Index)
Delete WLAN profile.
Definition: wlan.c:784
_i16 sl_NetAppStart(const _u32 AppBitMap)
Starts a network application.
Definition: netapp.c:103
_i16 sl_NetAppStop(const _u32 AppBitMap)
Stops a network application.
Definition: netapp.c:129
_i16 sl_Start(const void *pIfHdl, _i8 *pDevName, const P_INIT_CALLBACK pInitCallBack)
Start the SimpleLink device.
Definition: device.c:119

Data Structure Documentation

§ SlDeviceEventResetRequest_t

struct SlDeviceEventResetRequest_t

Definition at line 87 of file device.h.

Data Fields
_u16 Caller
_i16 Status

§ SlDeviceEventError_t

struct SlDeviceEventError_t

Definition at line 104 of file device.h.

Data Fields
_i16 Code
SlDeviceSource_e Source

§ SlDeviceEventData_u

union SlDeviceEventData_u

Definition at line 110 of file device.h.

Data Fields
SlDeviceEventError_t Error
SlDeviceEventResetRequest_t ResetRequest

§ SlDeviceEvent_t

struct SlDeviceEvent_t

Definition at line 125 of file device.h.

Data Fields
SlDeviceEventData_u Data
_u32 Id

§ SlDeviceFatalDeviceAssert_t

struct SlDeviceFatalDeviceAssert_t

Definition at line 139 of file device.h.

Data Fields
_u32 Code
_u32 Value

§ SlDeviceFatalNoCmdAck_t

struct SlDeviceFatalNoCmdAck_t

Definition at line 146 of file device.h.

Data Fields
_u32 Code

§ SlDeviceFatalData_u

union SlDeviceFatalData_u

Definition at line 152 of file device.h.

Data Fields
SlDeviceFatalCmdTimeout_t CmdTimeout
SlDeviceFatalDeviceAssert_t DeviceAssert
SlDeviceFatalNoCmdAck_t NoCmdAck

§ SlDeviceFatal_t

struct SlDeviceFatal_t

Definition at line 160 of file device.h.

Data Fields
SlDeviceFatalData_u Data
_u32 Id

§ SlDeviceUartIfParams_t

struct SlDeviceUartIfParams_t

Definition at line 239 of file device.h.

Data Fields
_u32 BaudRate
_u8 CommPort
_u8 FlowControlEnable

§ SlDeviceVersion_t

struct SlDeviceVersion_t

Definition at line 261 of file device.h.

Data Fields
_u32 ChipId
_u8 FwVersion[4]
_u8 NwpVersion[4]
_u16 Padding
_u8 PhyVersion[4]
_u16 RomVersion

§ SlDateTime_t

struct SlDateTime_t

Definition at line 272 of file device.h.

Data Fields
_u32 reserved[3]
_u32 tm_day
_u32 tm_hour
_u32 tm_min
_u32 tm_mon
_u32 tm_sec
_u32 tm_week_day
_u32 tm_year
_u32 tm_year_day

§ SlDeviceInitInfo_t

struct SlDeviceInitInfo_t

Definition at line 293 of file device.h.

Data Fields
_u32 ChipId
_u32 MoreData

§ SlDeviceGetStat_t

struct SlDeviceGetStat_t

Definition at line 302 of file device.h.

Data Fields
_i16 AvarageDataCtrlRssi
_i16 AvarageMgMntRssi
_u32 GetTimeStamp
_u16 RateHistogram[SL_WLAN_NUM_OF_RATE_INDEXES]
_u32 ReceivedAddressMismatchPacketsNumber
_u32 ReceivedFcsErrorPacketsNumber
_u32 ReceivedValidPacketsNumber
_u16 RssiHistogram[SL_WLAN_SIZE_OF_RSSI_HISTOGRAM]
_u32 StartTimeStamp

§ SlDeviceGetPmStatClrOnRdTypes_t

struct SlDeviceGetPmStatClrOnRdTypes_t

Definition at line 315 of file device.h.

Data Fields
_u32 Disconnects
_u32 ReceivedBytesCount
_u32 reserved[4]
_u32 TxFramesCount

§ SlDeviceGetPmStatAcc_t

struct SlDeviceGetPmStatAcc_t

Definition at line 330 of file device.h.

Data Fields
_u32 TimeMacAwake[2]
_u32 TimeMacListen11B[2]
_u32 TimeMacSleep[2]
_u32 TimeNWPAwake[2]
_u32 TimeNWPDeepSleep[2]
_u32 TimeNWPStandBy[2]

§ SlDeviceGetPmStat_t

struct SlDeviceGetPmStat_t

Definition at line 341 of file device.h.

Data Fields
_u32 GetTimeStamp
SlDeviceGetPmStatAcc_t PmAcc
SlDeviceGetPmStatClrOnRdTypes_t PmClrOnRd
_u32 Reserved[4]
_u32 StartTimeStamp