Morse Micro IoT SDK  2.9.7
WLAN HAL API for packet memory allocation

Detailed Description

API for allocating and freeing packet memory.

Warning
These functions shall not be called directly by the end application they are for use by Morselib.

Data Structures

struct  mmhal_wlan_pktmem_init_args
 Initialization arguments passed to mmhal_wlan_pktmem_init(). More...
 

Typedefs

typedef void(* mmhal_wlan_pktmem_tx_flow_control_cb_t) (void)
 Flow control callback that can be invoked by the transmit packet memory manager to pause and resume the data path in response to resource availability. More...
 

Enumerations

enum  mmhal_wlan_pkt_class {
  MMHAL_WLAN_PKT_DATA_TID0 , MMHAL_WLAN_PKT_DATA_TID1 , MMHAL_WLAN_PKT_DATA_TID2 , MMHAL_WLAN_PKT_DATA_TID3 ,
  MMHAL_WLAN_PKT_DATA_TID4 , MMHAL_WLAN_PKT_DATA_TID5 , MMHAL_WLAN_PKT_DATA_TID6 , MMHAL_WLAN_PKT_DATA_TID7 ,
  MMHAL_WLAN_PKT_MANAGEMENT , MMHAL_WLAN_PKT_COMMAND
}
 Enumeration of packet classes used by mmhal_wlan_alloc_mmpkt_for_tx(). More...
 

Functions

void mmhal_wlan_pktmem_init (struct mmhal_wlan_pktmem_init_args *args)
 Invoked by the driver to initialize the packet memory in the HAL. More...
 
void mmhal_wlan_pktmem_deinit (void)
 Invoked by the driver to deinitialize the packet memory in the HAL. More...
 
enum mmwlan_tx_flow_control_state mmhal_wlan_pktmem_tx_flow_control_state (void)
 Gets the current TX flow control state. More...
 
struct mmpktmmhal_wlan_alloc_mmpkt_for_tx (uint8_t pkt_class, uint32_t space_at_start, uint32_t space_at_end, uint32_t metadata_length)
 Allocates an mmpkt for transmission. More...
 
struct mmpktmmhal_wlan_alloc_mmpkt_for_rx (uint8_t pkt_class, uint32_t capacity, uint32_t metadata_length)
 Allocates an mmpkt for reception. More...
 

Typedef Documentation

◆ mmhal_wlan_pktmem_tx_flow_control_cb_t

typedef void(* mmhal_wlan_pktmem_tx_flow_control_cb_t) (void)

Flow control callback that can be invoked by the transmit packet memory manager to pause and resume the data path in response to resource availability.

Definition at line 358 of file mmhal_wlan.h.

Enumeration Type Documentation

◆ mmhal_wlan_pkt_class

Enumeration of packet classes used by mmhal_wlan_alloc_mmpkt_for_tx().

These definitions must match the corresponding values in mmdrv_pkt_class.

Enumerator
MMHAL_WLAN_PKT_DATA_TID0 

Data TID0.

MMHAL_WLAN_PKT_DATA_TID1 

Data TID1.

MMHAL_WLAN_PKT_DATA_TID2 

Data TID2.

MMHAL_WLAN_PKT_DATA_TID3 

Data TID3.

MMHAL_WLAN_PKT_DATA_TID4 

Data TID4.

MMHAL_WLAN_PKT_DATA_TID5 

Data TID5.

MMHAL_WLAN_PKT_DATA_TID6 

Data TID6.

MMHAL_WLAN_PKT_DATA_TID7 

Data TID7.

MMHAL_WLAN_PKT_MANAGEMENT 

802.11 Management and other important frames

MMHAL_WLAN_PKT_COMMAND 

Commands from driver to chip.

Definition at line 392 of file mmhal_wlan.h.

Function Documentation

◆ mmhal_wlan_alloc_mmpkt_for_rx()

struct mmpkt * mmhal_wlan_alloc_mmpkt_for_rx ( uint8_t  pkt_class,
uint32_t  capacity,
uint32_t  metadata_length 
)

Allocates an mmpkt for reception.

Parameters
pkt_classThe class of packet (to allow for prioritization). Currently used values are MMHAL_WLAN_PKT_DATA_TID0 for data and management frames, and MMHAL_WLAN_PKT_COMMAND for critical buffers used internally by the driver (e.g., for command responses) where known.
capacityAmount of space to allocate for data. A value of UINT32_MAX should allocate the largest available mmpkt (if supported).
metadata_lengthAmount of space to allocate for metadata (used internally by the Morse driver).
Returns
a pointer to the allocated packet on success or NULL on allocation failure.

◆ mmhal_wlan_alloc_mmpkt_for_tx()

struct mmpkt * mmhal_wlan_alloc_mmpkt_for_tx ( uint8_t  pkt_class,
uint32_t  space_at_start,
uint32_t  space_at_end,
uint32_t  metadata_length 
)

Allocates an mmpkt for transmission.

When the pool of mmpkt buffers available for TX is exhausted, the HAL should pause the TX path using the flow control callback that was registered when mmhal_wlan_pktmem_init() was invoked. Similarly, when the buffers become available again (and assuming the TX path is not otherwise blocked) the driver should unpause the TX path.

Parameters
pkt_classThe class of packet (to allow for prioritization).
space_at_startAmount of space to allocate at start of mmpkt (for prepend).
space_at_endAmount of space to allocate at end of mmpkt (for append).
metadata_lengthAmount of space to allocate for metadata (used internally by the Morse driver).
Returns
a pointer to the allocated packet on success or NULL on allocation failure.

◆ mmhal_wlan_pktmem_deinit()

void mmhal_wlan_pktmem_deinit ( void  )

Invoked by the driver to deinitialize the packet memory in the HAL.

This can free reserved memory and check for memory leaks.

◆ mmhal_wlan_pktmem_init()

void mmhal_wlan_pktmem_init ( struct mmhal_wlan_pktmem_init_args args)

Invoked by the driver to initialize the packet memory in the HAL.

Parameters
argsInitialization arguments.

◆ mmhal_wlan_pktmem_tx_flow_control_state()

enum mmwlan_tx_flow_control_state mmhal_wlan_pktmem_tx_flow_control_state ( void  )

Gets the current TX flow control state.

Returns
The current flow control state.