SDIO Secondary#
Introduction#
Secure Digital Input/Output (SDIO) is an extension of the SD (Secure Digital) card standard that adds support for input and output functions.
SDIO demonstrates the SDIO Secondary transmitting and receiving data to and from the external SDIO primary.
The following figure illustrates the framework for reading data in Multi-Block SDIO :
The following figure illustrates the framework for writing data in Multi-Block SDIO :
Command Initiation: A command (CMD) is received or generated to start.
Data Acquisition: Data is taken from different inputs (DATA0, DATA1, DATA2, DATA3).
Data Processing: The collected data undergoes various operations involving functions like Calla, CNC, Dala, Det, and E.
Output Generation: The processed data is potentially converted into a specific format (4-bit mode) and outputted.
Note
In Non-block mode, the Block Mode bit is set to zero in CMD53. The size of the data payload is in the range of 1-256 bytes (due to FIFO size restriction in SDIO Secondary) in non-block mode. The byte count for this transfer is set in the command (CMD53), rather than the fixed block size.
Configuration#
Most SDIO configurations take place on the primary side, where it enables read, write, and read-write operations.
For more information on configuring available parameters, see the respective peripheral example readme document.
Usage#
The initialization and configuration of the SDIO Secondary will be completed, transitioning it to a waiting state. It will remain in this state until an interrupt is triggered from the primary. Subsequently, the send and receive APIs will configure all GPDMA descriptors and initiate the GPDMA to transmit and receive data. Continuous data reception will commence after two seconds.
The SDIO can be initialized by multiple functions:
sl_si91x_sdio_secondary_init : To initialize the SDIO secondary.
sl_si91x_sdio_secondary_register_event_callback : To register the SDIO secondary user callback function.
sl_si91x_sdio_secondary_send : To trigger the sequence to send data from the SDIO secondary in non-blocking mode to the host/primary device.
sl_si91x_sdio_secondary_receive : To receive data on the SDIO secondary in non-blocking mode from the host/primary device using GPDMA.
Modules#
Enumerations#
Enumeration for SDIO slave receive interrupt status.
Typedefs#
Callback function for SDIO secondary interface events.
Callback function for SDIO secondary interface GPDMA transfers.
Functions#
To initialize the SDIO secondary.
To trigger the sequence to send data from the SDIO secondary in non-blocking mode to the host/primary device.
To receive data on the SDIO secondary in non-blocking mode from the host/primary device using GPDMA.
To register the SDIO secondary user callback function.
To unregister the SDIO secondary user callback function.
To register the SDIO secondary GPDMA user callback function.
To unregister the SDIO secondary GPDMA user callback function.
To get the SDIO Secondary Driver version.
To initialize the SDIO Secondary at peripheral layer.
To enable the SDIO interrupts.
To disable the SDIO interrupts.
To set the interrupts i.e., unmask according to the flags passed in the parameter.
To clear the interrupts i.e., mask according to the flags passed in the parameter.
To get the pending function interrupt.
To get all the enabled interrupts in function1.
To get all the enabled interrupts in function1 and pending interrupts.
To get block count for the last received CMD53.
To get the length of each for the last received CMD53.
To set no of blocks to be transferred.
Macros#
Number of GPDMA Descriptors.
Events for HIF irq handler.
SDIO Base Address.
HIF1 interrrupt handler.
GPDMA interrupt handler.
SDIO Write FIFO Data Register.
SDIO Read FIFO Data Register.
SDIO Mode Select.
MASK Host Interrupt.
SDIO MISC Configuration.
SDIO BASE Address.
This bit is used to enable CMD53 write interrupt.
This bit is used to enable CMD53 read interrupt.
This bit is used to enable CMD53 CSA interrupt.
This bit is used to enable CMD52 interrupt.
This bit is used to enable power level change interrupt.
This bit is used to enable CRC error interrupt.
This bit is used to enable abort interrupt.
This bit is used to enable "read FIFO wait time over" interrupt.
This bit is used to mask CMD53 write interrupt.
This bit is used to mask CMD53 read interrupt.
This bit is used to mask CMD53 CSA interrupt.
This bit is used to mask CMD52 interrupt.
This bit is used to mask power level change interrupt.
This bit is used to mask CRC error interrupt.
This bit is used to mask abort interrupt.
This bit is used to mask "read FIFO wait time over" interrupt.
This bit is used to unmask CMD53 write interrupt.
This bit is used to unmask CMD53 read interrupt.
This bit is used to unmask CMD53 CSA interrupt.
This bit is used to unmask CMD52 interrupt.
This bit is used to unmask power level change interrupt.
This bit is used to unmask CRC error interrupt.
This bit is used to unmask abort interrupt.
This bit is used to unmask "read FIFO wait time over" interrupt.
Enumeration Documentation#
sl_sdio_slave_rx_intr_status_t#
sl_sdio_slave_rx_intr_status_t
Enumeration for SDIO slave receive interrupt status.
This enumeration defines the possible statuses for SDIO secondary receive interrupts, indicating whether an interrupt from the host has been received or not.
Enumerator | |
---|---|
HOST_INTR_NOT_RECEIVED | Host interrupt not received. |
HOST_INTR_RECEIVED | Host interrupt received. |
HOST_INTR_NOT_RECEIVED | Host interrupt not received. |
HOST_INTR_RECEIVED | Host interrupt received. |
Typedef Documentation#
sl_sdio_secondary_callback_t#
typedef void(* sl_sdio_secondary_callback_t) (uint8_t events) )(uint8_t events)
Callback function for SDIO secondary interface events.
Type | Direction | Argument Name | Description |
---|---|---|---|
[in] | events | The SDIO secondary interface events that triggered the callback. This parameter is a bitmask representing one or more events. |
This function pointer defines the prototype for a callback function that will be invoked when SDIO secondary interface events occur.
sl_sdio_secondary_gpdma_callback_t#
typedef void(* sl_sdio_secondary_gpdma_callback_t) (uint8_t dma_ch) )(uint8_t dma_ch)
Callback function for SDIO secondary interface GPDMA transfers.
Type | Direction | Argument Name | Description |
---|---|---|---|
[in] | dma_ch | The GPDMA channel used for the transfer. |
This function pointer defines the prototype for a callback function that will be invoked when SDIO secondary interface GPDMA transfer completes.
Function Documentation#
sl_si91x_sdio_secondary_init#
sl_status_t sl_si91x_sdio_secondary_init (void )
To initialize the SDIO secondary.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This API initializes the SDIO secondary interface. By default, the SDIO pin access is with NWP. This API gives the pin access to M4, selects the SDIO mode, and enables the SDIO primary interrupts.
Returns
sl_status_t Initialization status:
SL_STATUS_OK - Initialization successful.
SL_STATUS_FAIL - Initialization failed.
For more information on status codes, see SL STATUS DOCUMENTATION.
sl_si91x_sdio_secondary_send#
void sl_si91x_sdio_secondary_send (uint8_t num_of_blocks, uint8_t * data_buf)
To trigger the sequence to send data from the SDIO secondary in non-blocking mode to the host/primary device.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | num_of_blocks | Number of blocks to be sent. |
uint8_t * | [in] | data_buf | Reference to the source buffer. |
This API accepts the number of blocks, where one block will have a block length (1 to 1024) bytes, and a pointer to the data buffer to be transferred.
sl_si91x_sdio_secondary_receive#
void sl_si91x_sdio_secondary_receive (uint8_t * data_buf)
To receive data on the SDIO secondary in non-blocking mode from the host/primary device using GPDMA.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t * | [in] | data_buf | Reference to the destination buffer where the received data will be stored. |
This API receives data from the host/primary device and stores it in the provided destination buffer. The transfer is done in non-blocking mode using GPDMA.
sl_si91x_sdio_secondary_register_event_callback#
sl_status_t sl_si91x_sdio_secondary_register_event_callback (sl_sdio_secondary_callback_t callback_event, uint32_t flag)
To register the SDIO secondary user callback function.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_sdio_secondary_callback_t | [in] | callback_event | Pointer to the function which needs to be called at the time of interrupt. |
uint32_t | [in] | flag | Interrupt flag to be registered. |
This API registers a user-defined callback function for the SDIO secondary interface. The callback function will be called when an interrupt occurs, based on the specified interrupt flag.
Pre-condition:
sl_si91x_sdio_secondary_init must be called prior.
Returns
sl_status_t Registration status:
SL_STATUS_OK - Success.
SL_STATUS_BUSY - Driver is busy.
SL_STATUS_NULL_POINTER - The parameter is a null pointer.
For more information on status codes, see SL STATUS DOCUMENTATION.
sl_si91x_sdio_secondary_unregister_event_callback#
void sl_si91x_sdio_secondary_unregister_event_callback (uint32_t flag)
To unregister the SDIO secondary user callback function.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | flag | Interrupt flag to be unregistered. |
This API unregisters a user-defined callback function for the SDIO secondary interface. The callback function will no longer be called when an interrupt occurs for the specified interrupt flag.
Pre-condition:
sl_si91x_sdio_secondary_init must be called prior.
sl_si91x_sdio_secondary_register_event_callback must be called prior.
sl_si91x_sdio_secondary_gpdma_register_event_callback#
sl_status_t sl_si91x_sdio_secondary_gpdma_register_event_callback (sl_sdio_secondary_gpdma_callback_t callback_event)
To register the SDIO secondary GPDMA user callback function.
Type | Direction | Argument Name | Description |
---|---|---|---|
sl_sdio_secondary_gpdma_callback_t | [in] | callback_event | Pointer to the function which needs to be called at the time of interrupt. |
This API registers a user-defined callback function for the SDIO secondary interface. The callback function will be called when a GPDMA interrupt occurs.
Pre-conditions:
sl_si91x_sdio_secondary_init must be called prior.
Returns
sl_status_t Registration status:
SL_STATUS_OK - Success.
SL_STATUS_BUSY - Driver is busy.
SL_STATUS_NULL_POINTER - The parameter is a null pointer.
For more information on status codes, see SL STATUS DOCUMENTATION.
sl_si91x_sdio_secondary_gpdma_unregister_event_callback#
void sl_si91x_sdio_secondary_gpdma_unregister_event_callback (void )
To unregister the SDIO secondary GPDMA user callback function.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This API unregisters a user-defined callback function for the SDIO secondary interface. The callback function will no longer be called when a GPDMA interrupt occurs.
sl_si91x_sdio_secondary_get_version#
sl_sdio_secondary_version_t sl_si91x_sdio_secondary_get_version (void )
To get the SDIO Secondary Driver version.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This function retrieves the version of the SDIO Secondary Driver. It can be used to verify compatibility and ensure the correct version of the driver is being used.
Returns
sl_sdio_secondary_version_t Driver version.
sl_si91x_sdio_secondary_peripheral_init#
void sl_si91x_sdio_secondary_peripheral_init (void )
To initialize the SDIO Secondary at peripheral layer.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
This API initializes the SDIO secondary, by default SDIO pin access with NWP this API gives the pin access to M4, selects the SDIO mode and enable the sdio primary interrupts
sl_si91x_sdio_secondary_enable_interrupts#
__STATIC_INLINE void sl_si91x_sdio_secondary_enable_interrupts (uint32_t flags)
To enable the SDIO interrupts.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | flags | Interrupt Flag which needs to be enabled. Different interrupts flag which can be enabled are: SL_SDIO_WR_INT_EN |
sl_si91x_sdio_secondary_disable_interrupts#
__STATIC_INLINE void sl_si91x_sdio_secondary_disable_interrupts (uint32_t flags)
To disable the SDIO interrupts.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | flags | Interrupt Flag which needs to be disabled. Different interrupts flags which can be disabled are: SL_SDIO_WR_INT_EN |
sl_si91x_sdio_secondary_set_interrupts#
__INLINE void sl_si91x_sdio_secondary_set_interrupts (uint32_t flags)
To set the interrupts i.e., unmask according to the flags passed in the parameter.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | flags | Interrupt flags which needs to be set. Different interrupts flags which needs to be set: SL_SDIO_WR_INT_UNMSK |
sl_si91x_sdio_secondary_clear_interrupts#
__INLINE void sl_si91x_sdio_secondary_clear_interrupts (uint32_t flags)
To clear the interrupts i.e., mask according to the flags passed in the parameter.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint32_t | [in] | flags | Interrupt flags which needs to be masked. SL_SDIO_WR_INT_MSK |
sl_si91x_sdio_secondary_get_pending_interrupts#
__INLINE uint32_t sl_si91x_sdio_secondary_get_pending_interrupts (void )
To get the pending function interrupt.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Returns
Return the pending interrupt status.
sl_si91x_sdio_secondary_get_enabled_interrupts#
__INLINE uint32_t sl_si91x_sdio_secondary_get_enabled_interrupts (void )
To get all the enabled interrupts in function1.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Returns
No of interrupts enabled.
sl_si91x_sdio_secondary_get_enabled_pending_interrupts#
__INLINE uint32_t sl_si91x_sdio_secondary_get_enabled_pending_interrupts (void )
To get all the enabled interrupts in function1 and pending interrupts.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Returns
No of interrupts enabled.
sl_si91x_sdio_secondary_get_block_cnt#
__INLINE uint32_t sl_si91x_sdio_secondary_get_block_cnt (void )
To get block count for the last received CMD53.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Returns
No of block counts.
sl_si91x_sdio_secondary_get_block_len#
__INLINE uint32_t sl_si91x_sdio_secondary_get_block_len (void )
To get the length of each for the last received CMD53.
Type | Direction | Argument Name | Description |
---|---|---|---|
void | N/A |
Returns
Length of each block.
sl_si91x_sdio_secondary_set_tx_blocks#
__INLINE void sl_si91x_sdio_secondary_set_tx_blocks (uint8_t no_of_blocks)
To set no of blocks to be transferred.
Type | Direction | Argument Name | Description |
---|---|---|---|
uint8_t | [in] | no_of_blocks | no of blocks to be transfered. |
This API is used when transferring the data from secondary to primary in block mode.