Functions#
This section provides a reference to the External Host Interface API Functions.
Modules#
sl_si91x_host_init_configuration_t
Typedefs#
Function pointer type for the host RX interrupt handler.
Function pointer type for the host receive done handler.
Functions#
Retrieve data from a buffer with a specified offset.
Delay execution for a specified number of milliseconds.
Retrieves the current timestamp.
Calculates the elapsed time since a given starting timestamp.
Checks if the device is initialized.
Holds the SI91x host in a reset state.
Releases the SI91x host from reset state.
Initializes the host interface for the Si91x device.
Deinitializes the SI91x host by releasing resources.
Enables the high-speed bus for the SI91x host interface.
Processes a received data frame from the Wi-Fi interface.
Enables the bus interrupt for the SI91x host interface.
Disables the bus interrupt for the host interface.
Sets the sleep indicator for the SI91x host.
Clears the sleep indicator signal for the host.
Retrieves the current state of the wake indicator pin.
Perform an SPI transfer.
Asserts the SPI bus chip select.
De-asserts the SPI bus chip select.
Transfers data over the UART interface.
Flushes the UART RX buffer by reading and discarding all incoming data.
Enables hardware flow control for the UART interface on the host.
Checks if the host MCU is currently in an interrupt context.
Typedef Documentation#
sl_si91x_host_rx_irq_handler#
sl_si91x_host_rx_irq_handler )(void)
Function pointer type for the host RX interrupt handler.
This function pointer is used to define a callback for handling host receive (RX) interrupts.
Returns
sl_status_t. See Status Codes and WiSeConnect Status Codes for details.
sl_si91x_host_rx_done_handler#
sl_si91x_host_rx_done_handler )(void)
Function pointer type for the host receive done handler.
This function pointer is used to define a callback that is invoked when the host interface completes a receive operation.
Function Documentation#
sl_si91x_host_get_buffer_data#
void * sl_si91x_host_get_buffer_data (sl_wifi_buffer_t * buffer, uint16_t offset, uint16_t * data_length)
Retrieve data from a buffer with a specified offset.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_wifi_buffer_t * | [in] | buffer | A pointer to an sl_wifi_buffer_t structure from which data is to be retrieved. |
uint16_t | [in] | offset | Offset from the start of the buffer where data retrieval begins. |
uint16_t * | [out] | data_length | Pointer to a variable where the remaining data length from the offset will be stored. |
This function is designed to retrieve data from a buffer at a specified offset.
Returns
Pointer to the data at the specified offset within the buffer.
sl_si91x_host_delay_ms#
void sl_si91x_host_delay_ms (uint32_t delay_milliseconds)
Delay execution for a specified number of milliseconds.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | delay_milliseconds | The time delay in milliseconds. |
This function introduces a delay for the specified amount of time in milliseconds. It uses the underlying OS delay function (osDelay
) to yield the CPU, allowing other tasks to execute during the delay period. This ensures that the delay does not block the execution flow.
sl_si91x_host_get_timestamp#
sl_si91x_host_timestamp_t sl_si91x_host_get_timestamp (void )
Retrieves the current timestamp.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This function retrieves the current timestamp from the host system. The timestamp can be used for various purposes such as logging, time measurements, and synchronization.
Returns
The current timestamp of type sl_si91x_host_timestamp_t.
sl_si91x_host_elapsed_time#
sl_si91x_host_timestamp_t sl_si91x_host_elapsed_time (uint32_t starting_timestamp)
Calculates the elapsed time since a given starting timestamp.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | starting_timestamp | The starting timestamp from which the elapsed time is calculated. |
This function calculates the difference between the current timestamp and a provided starting timestamp. It is useful for measuring the time elapsed during operations.
Returns
The elapsed time in milliseconds of type sl_si91x_host_timestamp_t.
sl_si91x_is_device_initialized#
bool sl_si91x_is_device_initialized (void )
Checks if the device is initialized.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This function verifies whether the device has been properly initialized. It is typically used to ensure that the device is ready for operation before performing any further actions.
Returns
Returns
true
if the device is initialized,false
otherwise.
sl_si91x_host_hold_in_reset#
void sl_si91x_host_hold_in_reset (void )
Holds the SI91x host in a reset state.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This function drives the reset pin of the SI91x host to a low state, effectively holding the device in a reset condition.
sl_si91x_host_release_from_reset#
void sl_si91x_host_release_from_reset (void )
Releases the SI91x host from reset state.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This function sets the specified GPIO pin high to release the SI91x host from its reset state.
sl_si91x_host_init#
sl_status_t sl_si91x_host_init (const sl_si91x_host_init_configuration_t * config)
Initializes the host interface for the Si91x device.
Type | Direction | Argument Name | Description |
---|---|---|---|
const sl_si91x_host_init_configuration_t * | [in] | config | Pointer to the host initialization configuration structure sl_si91x_host_init_configuration_t (Currently unused). |
This function configures the necessary hardware and software components required for communication with the Si91x device over the SPI interface.
It sets up GPIO pins, SPI settings, DMA channels, and interrupt handlers.
Returns
sl_status_t. See Status Codes and WiSeConnect Status Codes for details.
Note
This function must be called before any communication with the Si91x device.
sl_si91x_host_deinit#
sl_status_t sl_si91x_host_deinit (void )
Deinitializes the SI91x host by releasing resources.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This function is responsible for cleaning up resources used by the SI91x host.
Returns
sl_status_t. See Status Codes and WiSeConnect Status Codes for details.
sl_si91x_host_enable_high_speed_bus#
void sl_si91x_host_enable_high_speed_bus ()
Enables the high-speed bus for the SI91x host interface.
This function configures and activates the high-speed bus interface for communication with the SI91x device.
sl_si91x_host_process_data_frame#
sl_status_t sl_si91x_host_process_data_frame (sl_wifi_interface_t interface, sl_wifi_buffer_t * buffer)
Processes a received data frame from the Wi-Fi interface.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_wifi_interface_t | [in] | interface | The Wi-Fi interface on which the data frame is received. Interfaces are defined in sl_wifi_interface_t. |
sl_wifi_buffer_t * | [in] | buffer | A pointer to an sl_wifi_buffer_t structure containing the data frame to be processed. |
This function retrieves the raw data frame from the provided buffer, extracts the packet information.
The received data packet can then be forwarded to an external network stack for further processing.
Returns
sl_status_t. See Status Codes and WiSeConnect Status Codes for details.
Note
This is a weak implementation, and by default, an implementation is provided by the SDK.
Users can choose to overwrite it with their own custom implementation if needed.
sl_si91x_host_enable_bus_interrupt#
void sl_si91x_host_enable_bus_interrupt (void )
Enables the bus interrupt for the SI91x host interface.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This function is used to enable the bus interrupt mechanism, allowing the host interface to handle interrupt-driven communication with the SI91x device.
It ensures that the host is notified of events or data availability through the configured interrupt line.
sl_si91x_host_disable_bus_interrupt#
void sl_si91x_host_disable_bus_interrupt (void )
Disables the bus interrupt for the host interface.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This function is used to disable the bus interrupt mechanism in the host interface, preventing the host from receiving further interrupt signals from the device.
sl_si91x_host_set_sleep_indicator#
void sl_si91x_host_set_sleep_indicator (void )
Sets the sleep indicator for the SI91x host.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This function sets the sleep confirmation pin to indicate that the host is ready to enter a low-power sleep state.
sl_si91x_host_clear_sleep_indicator#
void sl_si91x_host_clear_sleep_indicator (void )
Clears the sleep indicator signal for the host.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This function clears the sleep indicator pin, signaling that the host is no longer in a sleep state.
sl_si91x_host_get_wake_indicator#
uint32_t sl_si91x_host_get_wake_indicator (void )
Retrieves the current state of the wake indicator pin.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This function reads the state of the wake indicator pin using the HAL GPIO interface.
Returns
uint32_t The state of the wake indicator pin.
sl_si91x_host_spi_transfer#
sl_status_t sl_si91x_host_spi_transfer (const void * tx_buffer, void * rx_buffer, uint16_t buffer_length)
Perform an SPI transfer.
Type | Direction | Argument Name | Description |
---|---|---|---|
const void * | [in] | tx_buffer | Pointer to the transmit buffer. |
void * | [out] | rx_buffer | Pointer to the receive buffer. |
uint16_t | [in] | buffer_length | Length of the data to be transferred in bytes. |
This function handles SPI data transfer between a transmit buffer and a receive buffer.
Returns
sl_status_t. See Status Codes and WiSeConnect Status Codes for details.
sl_si91x_host_spi_cs_assert#
void sl_si91x_host_spi_cs_assert (void )
Asserts the SPI bus chip select.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Note
This is a weak implementation, and by default, an implementation is provided by the SDK. Users can choose to overwrite it with their own custom implementation if needed.
sl_si91x_host_spi_cs_deassert#
void sl_si91x_host_spi_cs_deassert (void )
De-asserts the SPI bus chip select.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Note
This is a weak implementation provided by default by the SDK. Users can choose to overwrite it with their own custom implementation if needed.
sl_si91x_host_uart_transfer#
sl_status_t sl_si91x_host_uart_transfer (const void * tx_buffer, void * rx_buffer, uint16_t buffer_length)
Transfers data over the UART interface.
Type | Direction | Argument Name | Description |
---|---|---|---|
const void * | [in] | tx_buffer | Pointer to the data buffer to be transmitted. |
void * | [out] | rx_buffer | Pointer to the buffer where received data will be stored. |
uint16_t | [in] | buffer_length | Length of the data buffer to be transmitted or received. |
This function performs UART data transfer for both transmission and reception.
It supports both direct byte-by-byte transfer and DMA-based transfer depending on the buffer length and initialization status of the NCP.
Returns
sl_status_t. See Status Codes and WiSeConnect Status Codes for details.
Note
If the buffer length is less than or equal to 16 bytes, or if the NCP is not initialized, the function performs a direct byte-by-byte transfer.
sl_si91x_host_flush_uart_rx#
void sl_si91x_host_flush_uart_rx (void )
Flushes the UART RX buffer by reading and discarding all incoming data.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This function continuously checks for data availability in the UART RX buffer and reads the data to clear the buffer.
It exits if no data is received within a timeout period of 2000 ticks.
sl_si91x_host_uart_enable_hardware_flow_control#
void sl_si91x_host_uart_enable_hardware_flow_control (void )
Enables hardware flow control for the UART interface on the host.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This function initializes the UART interface with hardware flow control enabled.
sl_si91x_host_is_in_irq_context#
bool sl_si91x_host_is_in_irq_context (void )
Checks if the host MCU is currently in an interrupt context.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This function determines whether the host MCU is executing within an ISR by checking the Interrupt Control and State Register (ICSR) of the System Control Block (SCB).
Returns
True if the MCU is in an interrupt context and false if the MCU is not in an interrupt context.