Morse Micro IoT SDK  2.9.7

Detailed Description

Data Structures

struct  mmwlan_tx_metadata
 Metadata for TX packets. More...
 

Macros

#define MMWLAN_TX_DEFAULT_TIMEOUT_MS   (1000)
 Default transmit timeout. More...
 
#define MMWLAN_TX_DEFAULT_QOS_TID   (0)
 Default QoS Traffic ID (TID) to use for transmit (mmwlan_tx()). More...
 
#define MMWLAN_MAX_QOS_TID   (7)
 Maximum Traffic ID (TID) supported for QoS traffic. More...
 
#define MMWLAN_TX_METADATA_INIT   { MMWLAN_TX_DEFAULT_QOS_TID }
 Initializer for mmwlan_tx_metadata. More...
 

Typedefs

typedef void(* mmwlan_link_state_cb_t) (enum mmwlan_link_state link_state, void *arg)
 Prototype for link state change callbacks. More...
 
typedef void(* mmwlan_rx_cb_t) (uint8_t *header, unsigned header_len, uint8_t *payload, unsigned payload_len, void *arg)
 Receive data packet callback function. More...
 
typedef void(* mmwlan_rx_pkt_cb_t) (struct mmpkt *mmpkt, void *arg)
 Receive data packet callback function, consuming an mmpkt. More...
 
typedef void(* mmwlan_tx_flow_control_cb_t) (enum mmwlan_tx_flow_control_state state, void *arg)
 Transmit flow control callback function type. More...
 

Enumerations

enum  mmwlan_link_state { MMWLAN_LINK_DOWN , MMWLAN_LINK_UP }
 Enumeration of link states. More...
 
enum  mmwlan_tx_flow_control_state { MMWLAN_TX_READY , MMWLAN_TX_PAUSED }
 Enumeration of states that can be returned by the transmit flow control callback (as registered by mmwlan_register_tx_flow_control_cb(). More...
 

Functions

enum mmwlan_status mmwlan_register_link_state_cb (mmwlan_link_state_cb_t callback, void *arg)
 Register a link status callback. More...
 
enum mmwlan_status mmwlan_register_rx_cb (mmwlan_rx_cb_t callback, void *arg)
 Register a receive callback. More...
 
enum mmwlan_status mmwlan_register_rx_pkt_cb (mmwlan_rx_pkt_cb_t callback, void *arg)
 Register a receive callback which consumes an mmpkt. More...
 
enum mmwlan_status mmwlan_tx_wait_until_ready (uint32_t timeout_ms)
 Blocks until the transmit path is ready for transmit. More...
 
struct mmpktmmwlan_alloc_mmpkt_for_tx (uint32_t payload_len, uint8_t tid)
 Allocate an mmpkt data structure for transmission with at least enough space for the given payload length. More...
 
enum mmwlan_status mmwlan_tx_pkt (struct mmpkt *pkt, const struct mmwlan_tx_metadata *metadata)
 Transmit the given packet. More...
 
static enum mmwlan_status mmwlan_tx_tid (const uint8_t *data, unsigned len, uint8_t tid)
 Transmit the given packet using the given QoS Traffic ID (TID). More...
 
static enum mmwlan_status mmwlan_tx (const uint8_t *data, unsigned len)
 Transmit the given packet using MMWLAN_TX_DEFAULT_QOS_TID. More...
 
enum mmwlan_status mmwlan_register_tx_flow_control_cb (mmwlan_tx_flow_control_cb_t cb, void *arg)
 Register a transmit flow control callback. More...
 

Macro Definition Documentation

◆ MMWLAN_MAX_QOS_TID

#define MMWLAN_MAX_QOS_TID   (7)

Maximum Traffic ID (TID) supported for QoS traffic.

Definition at line 2389 of file mmwlan.h.

◆ MMWLAN_TX_DEFAULT_QOS_TID

#define MMWLAN_TX_DEFAULT_QOS_TID   (0)

Default QoS Traffic ID (TID) to use for transmit (mmwlan_tx()).

Definition at line 2386 of file mmwlan.h.

◆ MMWLAN_TX_DEFAULT_TIMEOUT_MS

#define MMWLAN_TX_DEFAULT_TIMEOUT_MS   (1000)

Default transmit timeout.

Used by mmwlan_tx() and mmwlan_tx_tid().

Definition at line 2383 of file mmwlan.h.

◆ MMWLAN_TX_METADATA_INIT

#define MMWLAN_TX_METADATA_INIT   { MMWLAN_TX_DEFAULT_QOS_TID }

Initializer for mmwlan_tx_metadata.

Definition at line 2417 of file mmwlan.h.

Typedef Documentation

◆ mmwlan_link_state_cb_t

typedef void(* mmwlan_link_state_cb_t) (enum mmwlan_link_state link_state, void *arg)

Prototype for link state change callbacks.

Parameters
link_stateThe new link state.
argOpaque argument that was given when the callback was registered.

Definition at line 2288 of file mmwlan.h.

◆ mmwlan_rx_cb_t

typedef void(* mmwlan_rx_cb_t) (uint8_t *header, unsigned header_len, uint8_t *payload, unsigned payload_len, void *arg)

Receive data packet callback function.

Parameters
headerBuffer containing the 802.3 header for this packet.
header_lenLength of the header.
payloadPacket payload (excluding header).
payload_lenLength of payload.
argOpaque argument that was given when the callback was registered.

Definition at line 2315 of file mmwlan.h.

◆ mmwlan_rx_pkt_cb_t

typedef void(* mmwlan_rx_pkt_cb_t) (struct mmpkt *mmpkt, void *arg)

Receive data packet callback function, consuming an mmpkt.

Parameters
mmpktThe mmpkt containing the received packet, including an 802.3 header. Ownership of the mmpkt is passed to this callback.
argOpaque argument that was given when the callback was registered.

Definition at line 2341 of file mmwlan.h.

◆ mmwlan_tx_flow_control_cb_t

typedef void(* mmwlan_tx_flow_control_cb_t) (enum mmwlan_tx_flow_control_state state, void *arg)

Transmit flow control callback function type.

When registered, this callback will be invoked when the transmit data path is paused and when unpaused.

Note
This function will always be invoked from the Upper MAC thread context. Therefore its invocation may not be synchronous with changes in flow control state.
Parameters
stateCurrent transmit flow control state.
argOpaque argument that was given when the function was registered.
Returns
MMWLAN_SUCCESS on success, else an appropriate error code.

Definition at line 2557 of file mmwlan.h.

Enumeration Type Documentation

◆ mmwlan_link_state

Enumeration of link states.

Enumerator
MMWLAN_LINK_DOWN 

The link is down.

MMWLAN_LINK_UP 

The link is up.

Definition at line 2276 of file mmwlan.h.

◆ mmwlan_tx_flow_control_state

Enumeration of states that can be returned by the transmit flow control callback (as registered by mmwlan_register_tx_flow_control_cb().

Enumerator
MMWLAN_TX_READY 

Transmit data path ready for packets (not paused).

MMWLAN_TX_PAUSED 

Transmit data path paused (blocked).

Definition at line 2539 of file mmwlan.h.

Function Documentation

◆ mmwlan_alloc_mmpkt_for_tx()

struct mmpkt * mmwlan_alloc_mmpkt_for_tx ( uint32_t  payload_len,
uint8_t  tid 
)

Allocate an mmpkt data structure for transmission with at least enough space for the given payload length.

The return mmpkt can be passed to mmwlan_tx_pkt().

Parameters
payload_lenMinimum space required for payload.
tidThe TID that this packet will be transmitted at. This may be used by the allocation function to, for example, prioritize allocation of certain classes of traffic.
Returns
the allocated mmpkt on success or NULL on failure.

◆ mmwlan_register_link_state_cb()

enum mmwlan_status mmwlan_register_link_state_cb ( mmwlan_link_state_cb_t  callback,
void *  arg 
)

Register a link status callback.

Note
Only one link status callback may be registered. Further registration will overwrite the previously registered callback.
The link status callback must not block and MMWLAN API functions may not be invoked from the callback.
Parameters
callbackThe callback to register.
argOpaque argument to be passed to the callback.
Returns
MMWLAN_SUCCESS on success, else an appropriate error code.

◆ mmwlan_register_rx_cb()

enum mmwlan_status mmwlan_register_rx_cb ( mmwlan_rx_cb_t  callback,
void *  arg 
)

Register a receive callback.

Note
Only one receive callback may be registered. Further registration will overwrite the previously registered callback.
Only a single receive callback may be registered at a time.
Parameters
callbackThe callback to register (NULL to unregister).
argOpaque argument to be passed to the callback.
Returns
MMWLAN_SUCCESS on success, else an appropriate error code.

◆ mmwlan_register_rx_pkt_cb()

enum mmwlan_status mmwlan_register_rx_pkt_cb ( mmwlan_rx_pkt_cb_t  callback,
void *  arg 
)

Register a receive callback which consumes an mmpkt.

Note
Only one receive callback of any type may be registered. Further registration will overwrite the previously registered callback.
Parameters
callbackThe callback to register (NULL to unregister).
argOpaque argument to be passed to the callback.
Returns
MMWLAN_SUCCESS on success, else an appropriate error code.

◆ mmwlan_register_tx_flow_control_cb()

enum mmwlan_status mmwlan_register_tx_flow_control_cb ( mmwlan_tx_flow_control_cb_t  cb,
void *  arg 
)

Register a transmit flow control callback.

This callback will be invoked when the tx data path is paused and when unpaused.

Note
This function will always be invoked from the Upper MAC thread context. Therefore its invocation may not be synchronous with changes in flow control state.
Parameters
cbThe callback to register.
argOpaque argument to pass to the callback.
Returns
MMWLAN_SUCCESS on success, else an appropriate error code.

◆ mmwlan_tx()

static enum mmwlan_status mmwlan_tx ( const uint8_t *  data,
unsigned  len 
)
inlinestatic

Transmit the given packet using MMWLAN_TX_DEFAULT_QOS_TID.

The packet must start with an 802.3 header that will be translated into an 802.11 header.

+----------+----------+-----------+------------------+
| DST ADDR | SRC ADDR | ETHERTYPE | Payload |
+----------+----------+-----------+------------------+
^ ^ ^
|--------802.3 MAC Header---------| |
| |
| |
| |
|<----------------------len------------------------->|
data
Parameters
dataPacket data.
lenLength of packet.
Returns
MMWLAN_SUCCESS on success, else an appropriate error code.

Definition at line 2530 of file mmwlan.h.

◆ mmwlan_tx_pkt()

enum mmwlan_status mmwlan_tx_pkt ( struct mmpkt pkt,
const struct mmwlan_tx_metadata metadata 
)

Transmit the given packet.

The packet must start with an 802.3 header, which will be translated into an 802.11 header by this function.

+----------+----------+-----------+------------------+
| DST ADDR | SRC ADDR | ETHERTYPE | Payload |
+----------+----------+-----------+------------------+
^ ^ ^
|--------802.3 MAC Header---------| |
| |
| |
| |
|<----------------------len------------------------->|
data
Note
The TID should be set in the tx metadata of txbuf before invoking this function.
This function is non-blocking. It will return immediately if the tx path is blocked. Use the tx flow control callback.
Warning
The given txbuf must be allocated by mmwlan_alloc_mmpkt_for_tx().
Parameters
pktmmpkt containing the packet to transmit. This will be consumed by this function.
metadataExtra information relating to the packet transmission. May be NULL, in which case default values will be used.
Returns
MMWLAN_SUCCESS on success, else an appropriate error code.

◆ mmwlan_tx_tid()

static enum mmwlan_status mmwlan_tx_tid ( const uint8_t *  data,
unsigned  len,
uint8_t  tid 
)
inlinestatic

Transmit the given packet using the given QoS Traffic ID (TID).

The packet must start with an 802.3 header that will be translated into an 802.11 header.

+----------+----------+-----------+------------------+
| DST ADDR | SRC ADDR | ETHERTYPE | Payload |
+----------+----------+-----------+------------------+
^ ^ ^
|--------802.3 MAC Header---------| |
| |
| |
| |
|<----------------------len------------------------->|
data
Parameters
dataPacket data.
lenLength of packet.
tidTID to use (0 - MMWLAN_MAX_QOS_TID).
Returns
MMWLAN_SUCCESS on success, else an appropriate error code.

Definition at line 2479 of file mmwlan.h.

◆ mmwlan_tx_wait_until_ready()

enum mmwlan_status mmwlan_tx_wait_until_ready ( uint32_t  timeout_ms)

Blocks until the transmit path is ready for transmit.

Parameters
timeout_msThe maximum time to wait, in milliseconds. If zero then this function does not block.
Returns
MMWLAN_SUCCESS on success, MMWLAN_TIMED_OUT if the transmit datapath was not ready within the given timeout, or another error code as appropriate.