CC3000HostDriver for device TI CC3000 some changes were made due to mbed compiler and the use of void*

Dependents:   CC3000Test

Embed: (wiki syntax)

« Back to documentation index

Wlan_api

Wlan_api

Functions

static void SimpleLink_Init_Start (unsigned short usPatchesAvailableAtHost)
 SimpleLink_Init_Start.
void wlan_init (tWlanCB sWlanCB, tFWPatches sFWPatches, tDriverPatches sDriverPatches, tBootLoaderPatches sBootLoaderPatches, tWlanReadInteruptPin sReadWlanInterruptPin, tWlanInterruptEnable sWlanInterruptEnable, tWlanInterruptDisable sWlanInterruptDisable, tWriteWlanPin sWriteWlanPin)
 wlan_init
void SpiReceiveHandler (void *pvBuffer)
 SpiReceiveHandler.
void wlan_start (unsigned short usPatchesAvailableAtHost)
 wlan_start
void wlan_stop (void)
 wlan_stop
long wlan_connect (unsigned long ulSecType, char *ssid, long ssid_len, unsigned char *bssid, unsigned char *key, long key_len)
 wlan_connect
long wlan_disconnect ()
 wlan_disconnect
long wlan_ioctl_set_connection_policy (unsigned long should_connect_to_open_ap, unsigned long ulShouldUseFastConnect, unsigned long ulUseProfiles)
 wlan_ioctl_set_connection_policy
long wlan_add_profile (unsigned long ulSecType, unsigned char *ucSsid, unsigned long ulSsidLen, unsigned char *ucBssid, unsigned long ulPriority, unsigned long ulPairwiseCipher_Or_TxKeyLen, unsigned long ulGroupCipher_TxKeyIndex, unsigned long ulKeyMgmt, unsigned char *ucPf_OrKey, unsigned long ulPassPhraseLen)
 wlan_add_profile
long wlan_ioctl_del_profile (unsigned long ulIndex)
 wlan_ioctl_del_profile
long wlan_ioctl_get_scan_results (unsigned long ulScanTimeout, unsigned char *ucResults)
 wlan_ioctl_get_scan_results
long wlan_ioctl_set_scan_params (unsigned long uiEnable, unsigned long uiMinDwellTime, unsigned long uiMaxDwellTime, unsigned long uiNumOfProbeRequests, unsigned long uiChannelMask, long iRSSIThreshold, unsigned long uiSNRThreshold, unsigned long uiDefaultTxPower, unsigned long *aiIntervalList)
 wlan_ioctl_set_scan_params
long wlan_set_event_mask (unsigned long ulMask)
 wlan_set_event_mask
long wlan_ioctl_statusget (void)
 wlan_ioctl_statusget
long wlan_smart_config_start (unsigned long algoEncryptedFlag)
 wlan_smart_config_start
long wlan_smart_config_stop (void)
 wlan_smart_config_stop
long wlan_smart_config_set_prefix (char *cNewPrefix)
 wlan_smart_config_set_prefix
long wlan_smart_config_process ()
 wlan_smart_config_process

Function Documentation

static void SimpleLink_Init_Start ( unsigned short  usPatchesAvailableAtHost ) [static]

SimpleLink_Init_Start.

Parameters:
usPatchesAvailableAtHostflag to indicate if patches available from host or from EEPROM. Due to the fact the patches are burn to the EEPROM using the patch programmer utility, the patches will be available from the EEPROM and not from the host.
Returns:
none

Send HCI_CMND_SIMPLE_LINK_START to CC3000

Definition at line 115 of file wlan.cpp.

void SpiReceiveHandler ( void *  pvBuffer )

SpiReceiveHandler.

Parameters:
pvBuffer- pointer to the received data buffer The function triggers Received event/data processing
Pointerto the received data
Returns:
none

The function triggers Received event/data processing. It is called from the SPI library to receive the data

Definition at line 221 of file wlan.cpp.

long wlan_add_profile ( unsigned long  ulSecType,
unsigned char *  ucSsid,
unsigned long  ulSsidLen,
unsigned char *  ucBssid,
unsigned long  ulPriority,
unsigned long  ulPairwiseCipher_Or_TxKeyLen,
unsigned long  ulGroupCipher_TxKeyIndex,
unsigned long  ulKeyMgmt,
unsigned char *  ucPf_OrKey,
unsigned long  ulPassPhraseLen 
)

wlan_add_profile

Parameters:
ulSecTypeWLAN_SEC_UNSEC,WLAN_SEC_WEP,WLAN_SEC_WPA,WLAN_SEC_WPA2
ucSsidssid SSID up to 32 bytes
ulSsidLenssid length
ucBssidbssid 6 bytes
ulPriorityulPriority profile priority. Lowest priority:0.
ulPairwiseCipher_Or_TxKeyLenkey length for WEP security
ulGroupCipher_TxKeyIndexkey index
ulKeyMgmtKEY management
ucPf_OrKeysecurity key
ulPassPhraseLensecurity key length for WPA
Returns:
On success, zero is returned. On error, -1 is returned

When auto start is enabled, the device connects to station from the profiles table. Up to 7 profiles are supported. If several profiles configured the device choose the highest priority profile, within each priority group, device will choose profile based on security policy, signal strength, etc parameters. All the profiles are stored in CC3000 NVMEM.

See also:
wlan_ioctl_del_profile

Definition at line 588 of file wlan.cpp.

long wlan_connect ( unsigned long  ulSecType,
char *  ssid,
long  ssid_len,
unsigned char *  bssid,
unsigned char *  key,
long  key_len 
)

wlan_connect

Parameters:
sec_typesecurity options: WLAN_SEC_UNSEC, WLAN_SEC_WEP (ASCII support only), WLAN_SEC_WPA or WLAN_SEC_WPA2
ssidup to 32 bytes and is ASCII SSID of the AP
ssid_lenlength of the SSID
bssid6 bytes specified the AP bssid
keyup to 16 bytes specified the AP security key
key_lenkey length
Returns:
On success, zero is returned. On error, negative is returned. Note that even though a zero is returned on success to trigger connection operation, it does not mean that CCC3000 is already connected. An asynchronous "Connected" event is generated when actual association process finishes and CC3000 is connected to the AP. If DHCP is set, An asynchronous "DHCP" event is generated when DHCP process is finish.

Connect to AP

Warning:
Please Note that when connection to AP configured with security type WEP, please confirm that the key is set as ASCII and not as HEX.
See also:
wlan_disconnect

Definition at line 387 of file wlan.cpp.

long wlan_disconnect (  )

wlan_disconnect

Returns:
0 disconnected done, other CC3000 already disconnected

Disconnect connection from AP.

See also:
wlan_connect

Definition at line 481 of file wlan.cpp.

void wlan_init ( tWlanCB  sWlanCB,
tFWPatches  sFWPatches,
tDriverPatches  sDriverPatches,
tBootLoaderPatches  sBootLoaderPatches,
tWlanReadInteruptPin  sReadWlanInterruptPin,
tWlanInterruptEnable  sWlanInterruptEnable,
tWlanInterruptDisable  sWlanInterruptDisable,
tWriteWlanPin  sWriteWlanPin 
)

wlan_init

Parameters:
sWlanCBAsynchronous events callback. 0 no event call back. -call back parameters: 1) event_type: HCI_EVNT_WLAN_UNSOL_CONNECT connect event, HCI_EVNT_WLAN_UNSOL_DISCONNECT disconnect event, HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE config done, HCI_EVNT_WLAN_UNSOL_DHCP dhcp report, HCI_EVNT_WLAN_ASYNC_PING_REPORT ping report OR HCI_EVNT_WLAN_KEEPALIVE keepalive. 2) data: pointer to extra data that received by the event (NULL no data). 3) length: data length. -Events with extra data: HCI_EVNT_WLAN_UNSOL_DHCP: 4 bytes IP, 4 bytes Mask, 4 bytes default gateway, 4 bytes DHCP server and 4 bytes for DNS server. HCI_EVNT_WLAN_ASYNC_PING_REPORT: 4 bytes Packets sent, 4 bytes Packets received, 4 bytes Min round time, 4 bytes Max round time and 4 bytes for Avg round time.
sFWPatches0 no patch or pointer to FW patches
sDriverPatches0 no patch or pointer to driver patches
sBootLoaderPatches0 no patch or pointer to bootloader patches
sReadWlanInterruptPininit callback. the callback read wlan interrupt status.
sWlanInterruptEnableinit callback. the callback enable wlan interrupt.
sWlanInterruptDisableinit callback. the callback disable wlan interrupt.
sWriteWlanPininit callback. the callback write value to device pin.
Returns:
none
See also:
wlan_set_event_mask , wlan_start , wlan_stop

Initialize wlan driver

Warning:
This function must be called before ANY other wlan driver function

Definition at line 180 of file wlan.cpp.

long wlan_ioctl_del_profile ( unsigned long  ulIndex )

wlan_ioctl_del_profile

Parameters:
indexnumber of profile to delete
Returns:
On success, zero is returned. On error, -1 is returned

Delete WLAN profile

In order to delete all stored profile, set index to 255.

See also:
wlan_add_profile

Definition at line 741 of file wlan.cpp.

long wlan_ioctl_get_scan_results ( unsigned long  ulScanTimeout,
unsigned char *  ucResults 
)

wlan_ioctl_get_scan_results

Parameters:
[in]scan_timeoutparameter not supported
[out]ucResultsscan results (_wlan_full_scan_results_args_t)
Returns:
On success, zero is returned. On error, -1 is returned

Gets entry from scan result table. The scan results are returned one by one, and each entry represents a single AP found in the area. The following is a format of the scan result:

  • 4 Bytes: number of networks found

4 Bytes: The status of the scan: 0 - aged results, 1 - results valid, 2 - no results

  • 42 bytes: Result entry, where the bytes are arranged as follows:
  • 1 bit isValid - is result valid or not

7 bits rssi - RSSI value;

  • 2 bits: securityMode - security mode of the AP: 0 - Open, 1 - WEP, 2 WPA, 3 WPA2
    • 6 bits: SSID name length
    • 2 bytes: the time at which the entry has entered into scans result table
    • 32 bytes: SSID name
  • 6 bytes: BSSID

scan_timeout, is not supported on this version.

See also:
wlan_ioctl_set_scan_params
Parameters:
[in]scan_timeoutparameter not supported
[out]ucResultsscan result (_wlan_full_scan_results_args_t)
Returns:
On success, zero is returned. On error, -1 is returned

Gets entry from scan result table. The scan results are returned one by one, and each entry represents a single AP found in the area. The following is a format of the scan result:

  • 4 Bytes: number of networks found

4 Bytes: The status of the scan: 0 - aged results, 1 - results valid, 2 - no results

  • 42 bytes: Result entry, where the bytes are arranged as follows:
  • 1 bit isValid - is result valid or not

7 bits rssi - RSSI value;

  • 2 bits: securityMode - security mode of the AP: 0 - Open, 1 - WEP, 2 WPA, 3 WPA2
    • 6 bits: SSID name length
    • 2 bytes: the time at which the entry has entered into scans result table
    • 32 bytes: SSID name
  • 6 bytes: BSSID

scan_timeout, is not supported on this version.

See also:
wlan_ioctl_set_scan_params

Definition at line 799 of file wlan.cpp.

long wlan_ioctl_set_connection_policy ( unsigned long  should_connect_to_open_ap,
unsigned long  ulShouldUseFastConnect,
unsigned long  ulUseProfiles 
)

wlan_ioctl_set_connection_policy

Parameters:
should_connect_to_open_apenable(1), disable(0) connect to any available AP. This parameter corresponds to the configuration of item # 3 in the brief description.
should_use_fast_connectenable(1), disable(0). if enabled, tries to connect to the last connected AP. This parameter corresponds to the configuration of item # 1 in the brief description.
auto_startenable(1), disable(0) auto connect after reset and periodically reconnect if needed. This configuration configures option 2 in the above description.
Returns:
On success, zero is returned. On error, -1 is returned

When auto is enabled, the device tries to connect according the following policy: 1) If fast connect is enabled and last connection is valid, the device will try to connect to it without the scanning procedure (fast). The last connection will be marked as invalid, due to adding/removing profile. 2) If profile exists, the device will try to connect it (Up to seven profiles). 3) If fast and profiles are not found, and open mode is enabled, the device will try to connect to any AP. Note that the policy settings are stored in the CC3000 NVMEM.

See also:
wlan_add_profile , wlan_ioctl_del_profile

Definition at line 531 of file wlan.cpp.

long wlan_ioctl_set_scan_params ( unsigned long  uiEnable,
unsigned long  uiMinDwellTime,
unsigned long  uiMaxDwellTime,
unsigned long  uiNumOfProbeRequests,
unsigned long  uiChannelMask,
long  iRSSIThreshold,
unsigned long  uiSNRThreshold,
unsigned long  uiDefaultTxPower,
unsigned long *  aiIntervalList 
)

wlan_ioctl_set_scan_params

Parameters:
uiEnable- start/stop application scan: 1 = start scan with default interval value of 10 min. in order to set a different scan interval value apply the value in milliseconds. minimum 1 second. 0=stop). Wlan reset (wlan_stop() wlan_start()) is needed when changing scan interval value. Saved: No
uiMinDwellTimeminimum dwell time value to be used for each channel, in milliseconds. Saved: yes Recommended Value: 100 (Default: 20)
uiMaxDwellTimemaximum dwell time value to be used for each channel, in milliseconds. Saved: yes Recommended Value: 100 (Default: 30)
uiNumOfProbeRequestsmax probe request between dwell time. Saved: yes. Recommended Value: 5 (Default:2)
uiChannelMaskbitwise, up to 13 channels (0x1fff). Saved: yes. Default: 0x7ff
uiRSSIThresholdRSSI threshold. Saved: yes (Default: -80)
uiSNRThresholdNSR threshold. Saved: yes (Default: 0)
uiDefaultTxPowerprobe Tx power. Saved: yes (Default: 205)
aiIntervalListpointer to array with 16 entries (16 channels) each entry (unsigned long) holds timeout between periodic scan (connection scan) - in millisecond. Saved: yes. Default 2000ms.
Returns:
On success, zero is returned. On error, -1 is returned

start and stop scan procedure. Set scan parameters.

uiDefaultTxPower, is not supported on this version.

See also:
wlan_ioctl_get_scan_results
Parameters:
uiEnable- start/stop application scan: 1 = start scan with default interval value of 10 min. in order to set a different scan interval value apply the value in milliseconds. minimum 1 second. 0=stop). Wlan reset (wlan_stop() wlan_start()) is needed when changing scan interval value. Saved: No
uiMinDwellTimeminimum dwell time value to be used for each channel, in milliseconds. Saved: yes Recommended Value: 100 (Default: 20)
uiMaxDwellTimemaximum dwell time value to be used for each channel, in milliseconds. Saved: yes Recommended Value: 100 (Default: 30)
uiNumOfProbeRequestsmax probe request between dwell time. Saved: yes. Recommended Value: 5 (Default:2)
uiChannelMaskbitwise, up to 13 channels (0x1fff). Saved: yes. Default: 0x7ff
uiRSSIThresholdRSSI threshold. Saved: yes (Default: -80)
uiSNRThresholdNSR threshold. Saved: yes (Default: 0)
uiDefaultTxPowerprobe Tx power. Saved: yes (Default: 205)
aiIntervalListpointer to array with 16 entries (16 channels) each entry (unsigned long) holds timeout between periodic scan (connection scan) - in milliseconds. Saved: yes. Default 2000ms.
Returns:
On success, zero is returned. On error, -1 is returned

start and stop scan procedure. Set scan parameters.

uiDefaultTxPower, is not supported on this version.

See also:
wlan_ioctl_get_scan_results

Definition at line 860 of file wlan.cpp.

long wlan_ioctl_statusget ( void   )

wlan_ioctl_statusget

Parameters:
none
Returns:
WLAN_STATUS_DISCONNECTED, WLAN_STATUS_SCANING, STATUS_CONNECTING or WLAN_STATUS_CONNECTED

get wlan status: disconnected, scanning, connecting or connected

Definition at line 977 of file wlan.cpp.

long wlan_set_event_mask ( unsigned long  ulMask )

wlan_set_event_mask

Parameters:
maskmask option: HCI_EVNT_WLAN_UNSOL_CONNECT connect event HCI_EVNT_WLAN_UNSOL_DISCONNECT disconnect event HCI_EVNT_WLAN_ASYNC_SIMPLE_CONFIG_DONE smart config done HCI_EVNT_WLAN_UNSOL_INIT init done HCI_EVNT_WLAN_UNSOL_DHCP dhcp event report HCI_EVNT_WLAN_ASYNC_PING_REPORT ping report HCI_EVNT_WLAN_KEEPALIVE keepalive HCI_EVNT_WLAN_TX_COMPLETE - disable information on end of transmission Saved: no.
Returns:
On success, zero is returned. On error, -1 is returned

Mask event according to bit mask. In case that event is masked (1), the device will not send the masked event to host.

Definition at line 920 of file wlan.cpp.

long wlan_smart_config_process (  )

wlan_smart_config_process

Parameters:
none
Returns:
On success, zero is returned. On error, -1 is returned

process the acquired data and store it as a profile. The acquired AP information is stored in CC3000 EEPROM encrypted. The encrypted data is decrypted and stored as a profile. behavior is as defined by connection policy.

Definition at line 1134 of file wlan.cpp.

long wlan_smart_config_set_prefix ( char *  cNewPrefix )

wlan_smart_config_set_prefix

Parameters:
newPrefix3 bytes identify the SSID prefix for the Smart Config.
Returns:
On success, zero is returned. On error, -1 is returned

Configure station ssid prefix. The prefix is used internally in CC3000. It should always be TTT.

The prefix is stored in CC3000 NVMEM

See also:
wlan_smart_config_start , wlan_smart_config_stop

Definition at line 1087 of file wlan.cpp.

long wlan_smart_config_start ( unsigned long  algoEncryptedFlag )

wlan_smart_config_start

Parameters:
algoEncryptedFlagindicates whether the information is encrypted
Returns:
On success, zero is returned. On error, -1 is returned

Start to acquire device profile. The device acquire its own profile, if profile message is found. The acquired AP information is stored in CC3000 EEPROM only in case AES128 encryption is used. In case AES128 encryption is not used, a profile is created by CC3000 internally.

An asynchronous event - Smart Config Done will be generated as soon as the process finishes successfully.

See also:
wlan_smart_config_set_prefix , wlan_smart_config_stop

Definition at line 1016 of file wlan.cpp.

long wlan_smart_config_stop ( void   )

wlan_smart_config_stop

Parameters:
algoEncryptedFlagindicates whether the information is encrypted
Returns:
On success, zero is returned. On error, -1 is returned

Stop the acquire profile procedure

See also:
wlan_smart_config_start , wlan_smart_config_set_prefix

Definition at line 1053 of file wlan.cpp.

void wlan_start ( unsigned short  usPatchesAvailableAtHost )

wlan_start

Parameters:
usPatchesAvailableAtHost- flag to indicate if patches available from host or from EEPROM. Due to the fact the patches are burn to the EEPROM using the patch programmer utility, the patches will be available from the EEPROM and not from the host.
Returns:
none

Start WLAN device. This function asserts the enable pin of the device (WLAN_EN), starting the HW initialization process. The function blocked until device Initialization is completed. Function also configure patches (FW, driver or bootloader) and calls appropriate device callbacks.

Prior calling the function wlan_init shall be called. This function must be called after wlan_init and before any other wlan API

See also:
wlan_init , wlan_stop

Definition at line 258 of file wlan.cpp.

void wlan_stop ( void   )

wlan_stop

Parameters:
none
Returns:
none

Stop WLAN device by putting it into reset state.

See also:
wlan_start

Definition at line 334 of file wlan.cpp.