Morse Micro IoT SDK  2.9.7

Detailed Description

API for communicating with the WLAN transceiver.

There are different interfaces supported for communicating with the transceiver:

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

Modules

 WLAN HAL API for SPI interface
 API for communicating with the WLAN transceiver over an SPI interface.
 
 WLAN HAL API for packet memory allocation
 API for allocating and freeing packet memory.
 
 WLAN HAL API for SDIO interface
 API for communicating with the WLAN transceiver over an SDIO interface.
 

Data Structures

struct  mmhal_robuf
 Read-only buffer data structure. More...
 

Macros

#define MMHAL_WLAN_FW_BCF_MIN_READ_LENGTH   (4)
 Minimum length of data to be returned by mmhal_wlan_read_bcf_file() and mmhal_wlan_read_fw_file(). More...
 
#define MMHAL_WLAN_MMPKT_TX_MAX_SIZE   (1664)
 This value represents the maximum size of a TX packet that can be allocated within the TX pool. More...
 
#define MMHAL_WLAN_MMPKT_RX_MAX_SIZE   (1668)
 This value represents the maximum size of a RX packet that can be allocated within the RX pool. More...
 
#define MMPKTMEM_TX_POOL_N_BLOCKS   (20)
 Size of the TX pool in blocks. More...
 
#define MMPKTMEM_RX_POOL_N_BLOCKS   (23)
 Size of the RX pool in blocks. More...
 

Typedefs

typedef void(* mmhal_irq_handler_t) (void)
 Function prototype for interrupt handler callbacks. More...
 

Functions

void mmhal_wlan_init (void)
 Initialize the WLAN HAL. More...
 
void mmhal_wlan_deinit (void)
 Deinitialize the WLAN HAL. More...
 
void mmhal_read_mac_addr (uint8_t *mac_addr)
 Get MAC address override. More...
 
void mmhal_wlan_wake_assert (void)
 Assert the WLAN wake pin.
 
void mmhal_wlan_wake_deassert (void)
 Deassert the WLAN wake pin.
 
bool mmhal_wlan_busy_is_asserted (void)
 Tests whether the busy pin is currently asserted. More...
 
void mmhal_wlan_register_busy_irq_handler (mmhal_irq_handler_t handler)
 Register a handler for busy interrupts. More...
 
void mmhal_wlan_set_busy_irq_enabled (bool enabled)
 Sets whether the busy interrupt is enabled. More...
 
void mmhal_wlan_read_bcf_file (uint32_t offset, uint32_t requested_len, struct mmhal_robuf *robuf)
 Retrieves the content of the Morse Micro Board Configuration File and places it into the given buffer. More...
 
void mmhal_wlan_read_fw_file (uint32_t offset, uint32_t requested_len, struct mmhal_robuf *robuf)
 Retrieves the content of the Morse Micro Chip Firmware and places it into the given buffer. More...
 

Macro Definition Documentation

◆ MMHAL_WLAN_FW_BCF_MIN_READ_LENGTH

#define MMHAL_WLAN_FW_BCF_MIN_READ_LENGTH   (4)

Minimum length of data to be returned by mmhal_wlan_read_bcf_file() and mmhal_wlan_read_fw_file().

Definition at line 182 of file mmhal_wlan.h.

◆ MMHAL_WLAN_MMPKT_RX_MAX_SIZE

#define MMHAL_WLAN_MMPKT_RX_MAX_SIZE   (1668)

This value represents the maximum size of a RX packet that can be allocated within the RX pool.

It includes the packet size and the RX metadata

Definition at line 456 of file mmhal_wlan.h.

◆ MMHAL_WLAN_MMPKT_TX_MAX_SIZE

#define MMHAL_WLAN_MMPKT_TX_MAX_SIZE   (1664)

This value represents the maximum size of a TX packet that can be allocated within the TX pool.

It includes the packet size and the TX metadata.

Definition at line 450 of file mmhal_wlan.h.

◆ MMPKTMEM_RX_POOL_N_BLOCKS

#define MMPKTMEM_RX_POOL_N_BLOCKS   (23)

Size of the RX pool in blocks.

Note
Values less than 23 may result in instability.

Definition at line 471 of file mmhal_wlan.h.

◆ MMPKTMEM_TX_POOL_N_BLOCKS

#define MMPKTMEM_TX_POOL_N_BLOCKS   (20)

Size of the TX pool in blocks.

Definition at line 462 of file mmhal_wlan.h.

Typedef Documentation

◆ mmhal_irq_handler_t

typedef void(* mmhal_irq_handler_t) (void)

Function prototype for interrupt handler callbacks.

Definition at line 42 of file mmhal_wlan.h.

Function Documentation

◆ mmhal_read_mac_addr()

void mmhal_read_mac_addr ( uint8_t *  mac_addr)

Get MAC address override.

This function allows the HAL to override the MAC address to be used by the device. The MAC address override should be written to mac_addr. If no override is required then mac_addr should be left untouched.

Parameters
mac_addrLocation where the MAC address will be stored. When called this will contain the MAC address provided by the transceiver if available or all zeros if no MAC address is available from the transceiver.

◆ mmhal_wlan_busy_is_asserted()

bool mmhal_wlan_busy_is_asserted ( void  )

Tests whether the busy pin is currently asserted.

Note
This is whether it is logically asserted and does not necessarily represent the level of the GPIO pin.
Returns
true if asserted, else false.

◆ mmhal_wlan_deinit()

void mmhal_wlan_deinit ( void  )

Deinitialize the WLAN HAL.

Things to do here may include:

  • Disable SPI peripheral
  • Disable GPIOs
  • Disable power to the Morse Micro transceiver

◆ mmhal_wlan_init()

void mmhal_wlan_init ( void  )

Initialize the WLAN HAL.

Things to do here may include:

  • Enable SPI peripheral
  • Configure GPIOs
  • Enable power to the Morse Micro transceiver
Note
If enabling power for the Morse Micro transceiver in this function you may need to add a blocking delay to allow the power rail to stabilize. This is hardware specific so is not accounted for in the calling function.

◆ mmhal_wlan_read_bcf_file()

void mmhal_wlan_read_bcf_file ( uint32_t  offset,
uint32_t  requested_len,
struct mmhal_robuf robuf 
)

Retrieves the content of the Morse Micro Board Configuration File and places it into the given buffer.

Parameters
offsetOffset from which to start reading the bcf
requested_lenLength of data we would like to read. The length of the data returned by this function may be less than requested_len, but must be at least MMHAL_WLAN_FW_BCF_MIN_READ_LENGTH.
robufRead-only buffer data structure to be filled out by this function.
Note
On error, this function should set robuf->buf to NULL.
The caller must zero robuf before invoking the function.
The BCF must be in mbin format.
Warning
The caller is responsible for checking robuf->free_cb and calling when the buffer is no longer required. Ignored if robuf->free_cb is NULL.

◆ mmhal_wlan_read_fw_file()

void mmhal_wlan_read_fw_file ( uint32_t  offset,
uint32_t  requested_len,
struct mmhal_robuf robuf 
)

Retrieves the content of the Morse Micro Chip Firmware and places it into the given buffer.

Parameters
offsetOffset from which to start reading the bcf
requested_lenLength of data we would like to read. The length of the data returned by this function may be less than requested_len, but must be at least MMHAL_WLAN_FW_BCF_MIN_READ_LENGTH.
robufRead-only buffer data structure to be filled out by this function.
Note
On error, this function should set robuf->buf to NULL.
The caller must zero robuf before invoking the function.
The firmware must be in mbin format.
Warning
The caller is responsible for checking robuf->free_cb and calling when the buffer is no longer required. Ignored if robuf->free_cb is NULL.

◆ mmhal_wlan_register_busy_irq_handler()

void mmhal_wlan_register_busy_irq_handler ( mmhal_irq_handler_t  handler)

Register a handler for busy interrupts.

Parameters
handlerThe handler to register.

◆ mmhal_wlan_set_busy_irq_enabled()

void mmhal_wlan_set_busy_irq_enabled ( bool  enabled)

Sets whether the busy interrupt is enabled.

Warning
The interrupt handler function must be configured using mmhal_wlan_register_busy_irq_handler() before enabling the interrupt.
Parameters
enabledtrue to enable or false to disable.