Morse Micro IoT SDK  2.10.4
WLAN Control API for Station (STA) mode

Detailed Description

API for configuration and control of Station (STA) mode.

Modules

 [Deprecated] WLAN offload features
 WLAN offload features enable offloading some high level networking features to the WLAN chip.
 
 [Deprecated] WLAN Standby features
 The standby mode allows the system to power off or put the host processor in a deep sleep mode while the Morse chip takes over certain functionality to keep the connection alive with the provision to wake up the host processor when certain conditions are met.
 
 WNM Sleep management
 

Data Structures

struct  mmwlan_sta_event_cb_args
 Argument passed to the STA event callback. More...
 
struct  mmwlan_sta_args
 Arguments data structure for mmwlan_sta_enable(). More...
 
struct  mmwlan_twt_config_args
 Structure for storing Target Wake Time (TWT) configuration arguments. More...
 

Macros

#define DEFAULT_BGSCAN_SHORT_INTERVAL_S   (0)
 Default Background scan short interval in seconds. More...
 
#define DEFAULT_BGSCAN_THRESHOLD_DBM   (0)
 Default Background scan signal threshold in dBm. More...
 
#define DEFAULT_BGSCAN_LONG_INTERVAL_S   (0)
 Default Background scan long interval in seconds. More...
 
#define DEFAULT_TWT_WAKE_INTERVAL_US   (300000000)
 Default Target Wake Time (TWT) interval in micro seconds. More...
 
#define DEFAULT_TWT_MIN_WAKE_DURATION_US   (65280)
 Default min Target Wake Time (TWT) duration in micro seconds. More...
 
#define MMWLAN_DEFAULT_SCAN_INTERVAL_BASE_S   (2)
 Default value for the scan_interval_base_s field of mmwlan_sta_args. More...
 
#define MMWLAN_DEFAULT_SCAN_INTERVAL_LIMIT_S   (512)
 Default value for the scan_interval_limit_s field of mmwlan_sta_args. More...
 
#define MMWLAN_RAW_MAX_PRIORITY   (7)
 Maximum allowable Restricted Access Window (RAW) priority for STA. More...
 
#define MMWLAN_STA_ARGS_INIT
 Initializer for mmwlan_sta_args. More...
 
#define MMWLAN_DEFAULT_DYNAMIC_PS_TIMEOUT_MS   100;
 Default timeout after network activity to signal sleep. More...
 
#define MMWLAN_TWT_CONFIG_ARGS_INIT
 Initializer for mmwlan_twt_config_args. More...
 

Typedefs

typedef void(* mmwlan_sta_status_cb_t) (enum mmwlan_sta_state sta_state)
 STA status callback function prototype. More...
 
typedef void(* mmwlan_sta_event_cb_t) (const struct mmwlan_sta_event_cb_args *sta_event, void *arg)
 STA event callback prototype. More...
 

Enumerations

enum  mmwlan_cac_mode { MMWLAN_CAC_DISABLED , MMWLAN_CAC_ENABLED }
 Enumeration of Centralized Authentication Control (CAC) modes. More...
 
enum  mmwlan_4addr_mode { MMWLAN_4ADDR_MODE_DISABLED , MMWLAN_4ADDR_MODE_ENABLED }
 Enumeration of Linux 4-address mode settings. More...
 
enum  mmwlan_ps_mode { MMWLAN_PS_DISABLED , MMWLAN_PS_ENABLED }
 Enumeration of supported 802.11 power save modes. More...
 
enum  mmwlan_station_type { MMWLAN_STA_TYPE_SENSOR = 0x01 , MMWLAN_STA_TYPE_NON_SENSOR = 0x02 }
 Enumeration of S1G non-AP STA types. More...
 
enum  mmwlan_sta_state { MMWLAN_STA_DISABLED , MMWLAN_STA_CONNECTING , MMWLAN_STA_CONNECTED }
 Enumeration of states in STA mode. More...
 
enum  mmwlan_sta_event {
  MMWLAN_STA_EVT_SCAN_REQUEST , MMWLAN_STA_EVT_SCAN_COMPLETE , MMWLAN_STA_EVT_SCAN_ABORT , MMWLAN_STA_EVT_AUTH_REQUEST ,
  MMWLAN_STA_EVT_ASSOC_REQUEST , MMWLAN_STA_EVT_DEAUTH_TX , MMWLAN_STA_EVT_CTRL_PORT_OPEN , MMWLAN_STA_EVT_CTRL_PORT_CLOSED
}
 Enumeration of STA events. More...
 
enum  mmwlan_twt_mode { MMWLAN_TWT_DISABLED , MMWLAN_TWT_REQUESTER , MMWLAN_TWT_RESPONDER }
 Enumeration of Target Wake Time (TWT) modes. More...
 
enum  mmwlan_twt_setup_command { MMWLAN_TWT_SETUP_REQUEST , MMWLAN_TWT_SETUP_SUGGEST , MMWLAN_TWT_SETUP_DEMAND }
 Enumeration of Target Wake Time (TWT) setup commands. More...
 

Functions

enum mmwlan_status mmwlan_sta_enable (const struct mmwlan_sta_args *args, mmwlan_sta_status_cb_t sta_status_cb)
 Enable station mode. More...
 
enum mmwlan_status mmwlan_sta_disable (void)
 Disable station mode. More...
 
enum mmwlan_sta_state mmwlan_get_sta_state (void)
 Gets the current WLAN STA state. More...
 
enum mmwlan_status mmwlan_set_power_save_mode (enum mmwlan_ps_mode mode)
 Sets whether or not the 802.11 power save is enabled. More...
 
enum mmwlan_status mmwlan_set_dynamic_ps_timeout (uint32_t timeout_ms)
 Sets the time after network activity before the STA will notify the AP that it will go to sleep using a QoS Null frame and when the host will release its veto (via the wake pin) on chip sleep. More...
 
enum mmwlan_status mmwlan_set_non_tim_mode_enabled (bool non_tim_mode_enabled)
 Sets whether or not non-TIM mode support is enabled. More...
 
enum mmwlan_status mmwlan_twt_add_configuration (const struct mmwlan_twt_config_args *twt_config_args)
 Add configurations for Target Wake Time (TWT). More...
 
uint16_t mmwlan_get_aid (void)
 Gets the station's AID. More...
 
enum mmwlan_status mmwlan_get_bssid (uint8_t *bssid)
 Gets the BSSID of the AP to which the STA is associated. More...
 
int32_t mmwlan_get_rssi (void)
 Gets the RSSI measured from the AP. More...
 
enum mmwlan_status mmwlan_set_listen_interval (uint16_t interval)
 Sets the listen interval to be indicated in the association response frame. More...
 

Macro Definition Documentation

◆ DEFAULT_BGSCAN_LONG_INTERVAL_S

#define DEFAULT_BGSCAN_LONG_INTERVAL_S   (0)

Default Background scan long interval in seconds.

Setting to 0 will disable background scanning.

Definition at line 942 of file mmwlan.h.

◆ DEFAULT_BGSCAN_SHORT_INTERVAL_S

#define DEFAULT_BGSCAN_SHORT_INTERVAL_S   (0)

Default Background scan short interval in seconds.

Setting to 0 will disable background scanning.

Definition at line 935 of file mmwlan.h.

◆ DEFAULT_BGSCAN_THRESHOLD_DBM

#define DEFAULT_BGSCAN_THRESHOLD_DBM   (0)

Default Background scan signal threshold in dBm.

Definition at line 938 of file mmwlan.h.

◆ DEFAULT_TWT_MIN_WAKE_DURATION_US

#define DEFAULT_TWT_MIN_WAKE_DURATION_US   (65280)

Default min Target Wake Time (TWT) duration in micro seconds.

Definition at line 948 of file mmwlan.h.

◆ DEFAULT_TWT_WAKE_INTERVAL_US

#define DEFAULT_TWT_WAKE_INTERVAL_US   (300000000)

Default Target Wake Time (TWT) interval in micro seconds.

Definition at line 945 of file mmwlan.h.

◆ MMWLAN_DEFAULT_DYNAMIC_PS_TIMEOUT_MS

#define MMWLAN_DEFAULT_DYNAMIC_PS_TIMEOUT_MS   100;

Default timeout after network activity to signal sleep.

Definition at line 1269 of file mmwlan.h.

◆ MMWLAN_DEFAULT_SCAN_INTERVAL_BASE_S

#define MMWLAN_DEFAULT_SCAN_INTERVAL_BASE_S   (2)

Default value for the scan_interval_base_s field of mmwlan_sta_args.

Definition at line 951 of file mmwlan.h.

◆ MMWLAN_DEFAULT_SCAN_INTERVAL_LIMIT_S

#define MMWLAN_DEFAULT_SCAN_INTERVAL_LIMIT_S   (512)

Default value for the scan_interval_limit_s field of mmwlan_sta_args.

Definition at line 954 of file mmwlan.h.

◆ MMWLAN_RAW_MAX_PRIORITY

#define MMWLAN_RAW_MAX_PRIORITY   (7)

Maximum allowable Restricted Access Window (RAW) priority for STA.

Definition at line 957 of file mmwlan.h.

◆ MMWLAN_STA_ARGS_INIT

#define MMWLAN_STA_ARGS_INIT
Value:
{ \
.ssid = { 0 }, \
.ssid_len = 0, \
.bssid = { 0 }, \
.security_type = MMWLAN_OPEN, \
.passphrase = { 0 }, \
.passphrase_len = 0, \
.pmf_mode = MMWLAN_PMF_REQUIRED, \
.raw_sta_priority = -1, \
.sta_type = MMWLAN_STA_TYPE_NON_SENSOR, \
.sae_owe_ec_groups = { 0 }, \
.cac_mode = MMWLAN_CAC_DISABLED, \
.bgscan_short_interval_s = DEFAULT_BGSCAN_SHORT_INTERVAL_S, \
.bgscan_signal_threshold_dbm = DEFAULT_BGSCAN_THRESHOLD_DBM, \
.bgscan_long_interval_s = DEFAULT_BGSCAN_LONG_INTERVAL_S, \
.scan_rx_cb = NULL, \
.scan_rx_cb_arg = NULL, \
.scan_interval_base_s = MMWLAN_DEFAULT_SCAN_INTERVAL_BASE_S, \
.scan_interval_limit_s = MMWLAN_DEFAULT_SCAN_INTERVAL_LIMIT_S, \
.extra_assoc_ies = NULL, \
.extra_assoc_ies_len = 0, \
.sta_evt_cb = NULL, \
.sta_evt_cb_arg = NULL, \
}
#define MMWLAN_DEFAULT_SCAN_INTERVAL_LIMIT_S
Default value for the scan_interval_limit_s field of mmwlan_sta_args.
Definition: mmwlan.h:954
#define DEFAULT_BGSCAN_THRESHOLD_DBM
Default Background scan signal threshold in dBm.
Definition: mmwlan.h:938
#define MMWLAN_DEFAULT_SCAN_INTERVAL_BASE_S
Default value for the scan_interval_base_s field of mmwlan_sta_args.
Definition: mmwlan.h:951
#define DEFAULT_BGSCAN_LONG_INTERVAL_S
Default Background scan long interval in seconds.
Definition: mmwlan.h:942
#define DEFAULT_BGSCAN_SHORT_INTERVAL_S
Default Background scan short interval in seconds.
Definition: mmwlan.h:935
@ MMWLAN_4ADDR_MODE_DISABLED
4 Address Mode disabled
Definition: mmwlan.h:972
@ MMWLAN_CAC_DISABLED
CAC disabled.
Definition: mmwlan.h:963
@ MMWLAN_PMF_REQUIRED
Protected management frames must be used.
Definition: mmwlan.h:128
@ MMWLAN_OPEN
Open (no security)
Definition: mmwlan.h:117

Initializer for mmwlan_sta_args.

See also
mmwlan_sta_args

Definition at line 1183 of file mmwlan.h.

◆ MMWLAN_TWT_CONFIG_ARGS_INIT

#define MMWLAN_TWT_CONFIG_ARGS_INIT
Value:
{ \
.twt_mode = MMWLAN_TWT_DISABLED, \
.twt_wake_interval_us = DEFAULT_TWT_WAKE_INTERVAL_US, \
.twt_wake_interval_mantissa = 0, \
.twt_wake_interval_exponent = 0, \
.twt_min_wake_duration_us = DEFAULT_TWT_MIN_WAKE_DURATION_US, \
.twt_setup_command = MMWLAN_TWT_SETUP_REQUEST, \
}
#define DEFAULT_TWT_WAKE_INTERVAL_US
Default Target Wake Time (TWT) interval in micro seconds.
Definition: mmwlan.h:945
#define DEFAULT_TWT_MIN_WAKE_DURATION_US
Default min Target Wake Time (TWT) duration in micro seconds.
Definition: mmwlan.h:948
@ MMWLAN_TWT_SETUP_REQUEST
TWT setup request command.
Definition: mmwlan.h:1332
@ MMWLAN_TWT_DISABLED
TWT disabled.
Definition: mmwlan.h:1321

Initializer for mmwlan_twt_config_args.

For example:

#define MMWLAN_TWT_CONFIG_ARGS_INIT
Initializer for mmwlan_twt_config_args.
Definition: mmwlan.h:1375
Structure for storing Target Wake Time (TWT) configuration arguments.
Definition: mmwlan.h:1341

Definition at line 1375 of file mmwlan.h.

Typedef Documentation

◆ mmwlan_sta_event_cb_t

typedef void(* mmwlan_sta_event_cb_t) (const struct mmwlan_sta_event_cb_args *sta_event, void *arg)

STA event callback prototype.

Warning
BETA NOTICE: This is beta API that is under development; breaking changes may be introduced in future releases.

Definition at line 1050 of file mmwlan.h.

◆ mmwlan_sta_status_cb_t

typedef void(* mmwlan_sta_status_cb_t) (enum mmwlan_sta_state sta_state)

STA status callback function prototype.

Definition at line 1006 of file mmwlan.h.

Enumeration Type Documentation

◆ mmwlan_4addr_mode

Enumeration of Linux 4-address mode settings.

Enumerator
MMWLAN_4ADDR_MODE_DISABLED 

4 Address Mode disabled

MMWLAN_4ADDR_MODE_ENABLED 

4 Address Mode enabled

Definition at line 969 of file mmwlan.h.

◆ mmwlan_cac_mode

Enumeration of Centralized Authentication Control (CAC) modes.

Enumerator
MMWLAN_CAC_DISABLED 

CAC disabled.

MMWLAN_CAC_ENABLED 

CAC enabled.

Definition at line 960 of file mmwlan.h.

◆ mmwlan_ps_mode

Enumeration of supported 802.11 power save modes.

Enumerator
MMWLAN_PS_DISABLED 

Power save disabled.

MMWLAN_PS_ENABLED 

Power save enabled.

Definition at line 978 of file mmwlan.h.

◆ mmwlan_sta_event

Enumeration of STA events.

Warning
BETA NOTICE: This is beta API that is under development; breaking changes may be introduced in future releases.
Enumerator
MMWLAN_STA_EVT_SCAN_REQUEST 

The STA is starting a scan.

MMWLAN_STA_EVT_SCAN_COMPLETE 

The STA has finished a scan.

MMWLAN_STA_EVT_SCAN_ABORT 

The STA has aborted a scan early.

MMWLAN_STA_EVT_AUTH_REQUEST 

The STA is sending an authentication request to the AP.

MMWLAN_STA_EVT_ASSOC_REQUEST 

The STA is sending an association request to the AP.

MMWLAN_STA_EVT_DEAUTH_TX 

The STA is sending a de-authorization request to the AP.

MMWLAN_STA_EVT_CTRL_PORT_OPEN 

The Supplicant IEEE 802.1X Controlled Port is now open meaning that the STA is fully authenticated and data transmission can begin.

MMWLAN_STA_EVT_CTRL_PORT_CLOSED 

The Supplicant IEEE 802.1X Controlled Port is now closed.

Definition at line 1014 of file mmwlan.h.

◆ mmwlan_sta_state

Enumeration of states in STA mode.

Definition at line 998 of file mmwlan.h.

◆ mmwlan_station_type

Enumeration of S1G non-AP STA types.

Definition at line 989 of file mmwlan.h.

◆ mmwlan_twt_mode

Enumeration of Target Wake Time (TWT) modes.

Note
TWT is only supported as a requester.
Enumerator
MMWLAN_TWT_DISABLED 

TWT disabled.

MMWLAN_TWT_REQUESTER 

TWT enabled as a requester.

MMWLAN_TWT_RESPONDER 

TWT enabled as a responder.

Definition at line 1318 of file mmwlan.h.

◆ mmwlan_twt_setup_command

Enumeration of Target Wake Time (TWT) setup commands.

Enumerator
MMWLAN_TWT_SETUP_REQUEST 

TWT setup request command.

MMWLAN_TWT_SETUP_SUGGEST 

TWT setup suggest command.

MMWLAN_TWT_SETUP_DEMAND 

TWT setup demand command.

Definition at line 1329 of file mmwlan.h.

Function Documentation

◆ mmwlan_get_aid()

uint16_t mmwlan_get_aid ( void  )

Gets the station's AID.

Returns
AID of station, or 0 if not associated

◆ mmwlan_get_bssid()

enum mmwlan_status mmwlan_get_bssid ( uint8_t *  bssid)

Gets the BSSID of the AP to which the STA is associated.

Parameters
bssidBuffer to receive the BSSID. Length must be MMWLAN_MAC_ADDR_LEN. Will only be set if MMWLAN_SUCCESS is returned.
Returns
MMWLAN_SUCCESS on success, else an appropriate error code.

◆ mmwlan_get_rssi()

int32_t mmwlan_get_rssi ( void  )

Gets the RSSI measured from the AP.

When power save is enabled, this will only be updated when traffic is received from the AP.

Returns
last known RSSI of the AP or INT32_MIN on error.

◆ mmwlan_get_sta_state()

enum mmwlan_sta_state mmwlan_get_sta_state ( void  )

Gets the current WLAN STA state.

Returns
the current WLAN STA state.

◆ mmwlan_set_dynamic_ps_timeout()

enum mmwlan_status mmwlan_set_dynamic_ps_timeout ( uint32_t  timeout_ms)

Sets the time after network activity before the STA will notify the AP that it will go to sleep using a QoS Null frame and when the host will release its veto (via the wake pin) on chip sleep.

                     network traffic                          QoS Null
        |----------------------------------------|               |
        +--------------------------------------------------------+

Wake Pin | | --------—+ +------— |------------—| dynamic_ps_timeout_ms |------— sleep permitted

Warning
Reducing this value will cause the MM-Chip to sleep more aggressively. This may lead to unexpected behavior such as increased latency and/or dropped packets.
Parameters
timeout_msTimeout after network activity before signaling sleep.
Returns
MMWLAN_SUCCESS on success, else an appropriate error code.

◆ mmwlan_set_listen_interval()

enum mmwlan_status mmwlan_set_listen_interval ( uint16_t  interval)

Sets the listen interval to be indicated in the association response frame.

This informs the AP how often the STA will wake up. The AP uses the listen interval in determining the lifetime of frames that it buffers for a STA.

Parameters
[in]intervalInterval value in beacon or short beacon units. e.g. 5 will set the listen interval to the interval between 5 beacons. 0 will disable this feature.
Returns
MMWLAN_SUCCESS on success, else an appropriate error code.

◆ mmwlan_set_non_tim_mode_enabled()

enum mmwlan_status mmwlan_set_non_tim_mode_enabled ( bool  non_tim_mode_enabled)

Sets whether or not non-TIM mode support is enabled.

Upon successful non-TIM mode negotiation, the STA will ignore traffic indication map (TIM) and send PS-Poll every listen interval. This defaults to disabled and is for STA mode only.

Note
This must only be invoked when MMWLAN is inactive (i.e., STA mode not enabled).
This feature must be used along side listen interval. The feature will take no effect without it.
Parameters
non_tim_mode_enabledBoolean value indicating whether non-TIM mode support should be enabled.
Returns
MMWLAN_SUCCESS on success, else an appropriate error code.

◆ mmwlan_set_power_save_mode()

enum mmwlan_status mmwlan_set_power_save_mode ( enum mmwlan_ps_mode  mode)

Sets whether or not the 802.11 power save is enabled.

Defaults to MMWLAN_PS_ENABLED

Note
It is recommended to keep power save enabled if the STA will be duty cycle limited,
See also
mmregdb.c for regulatory duty cycle limits.
Parameters
modeenum indicating which 802.11 power save mode to use.
Returns
MMWLAN_SUCCESS on success, else an appropriate error code.

◆ mmwlan_sta_disable()

enum mmwlan_status mmwlan_sta_disable ( void  )

Disable station mode.

This will disconnect from the AP. It will also shut down the transceiver if nothing else is holding it open. Note that if the transceiver was booted by mmwlan_boot() then this function will not shut down the transceiver.

Returns
MMWLAN_SUCCESS if successful, else an appropriate error code.

◆ mmwlan_sta_enable()

enum mmwlan_status mmwlan_sta_enable ( const struct mmwlan_sta_args args,
mmwlan_sta_status_cb_t  sta_status_cb 
)

Enable station mode.

This will power on the transceiver then initiate connection to the given Access Point. If station mode is already enabled when this function is invoked then it will disconnect from (if already connected) and initiate connection to the given AP.

Note
The STA status callback (sta_status_cb) must not block and MMWLAN API functions may not be invoked from the callback.
A copy of args->extra_assoc_ies buffer will be made if args->extra_assoc_ies_len is non-zero. Caller is responsible for freeing the buffer in args after this function is called.
Warning
Channel list must be set before enabling station mode. mmwlan_set_channel_list().
Deprecated:
The sta_status_cb parameter should not be used. Please use mmwlan_sta_args.ext_sta_status_cb as the preferred callback method.
Parameters
argsSTA arguments (e.g., SSID, etc.). See mmwlan_sta_args.
sta_status_cbOptional callback to be invoked on STA state changes. May be NULL. Must be NULL if args->ext_sta_status_cb is not NULL.
Returns
MMWLAN_SUCCESS on success, else an appropriate error code.

◆ mmwlan_twt_add_configuration()

enum mmwlan_status mmwlan_twt_add_configuration ( const struct mmwlan_twt_config_args twt_config_args)

Add configurations for Target Wake Time (TWT).

Note
This is used to add TWT configuration for a new TWT agreement. This function must be invoked before mmwlan_sta_enable.
Parameters
twt_config_argsTWT configuration arguments mmwlan_twt_config_args.
Returns
MMWLAN_SUCCESS on success, else an appropriate error code.