Direct Memory Access#
Modules#
Enumerations#
Enumeration holds transfer types of DMA.
Enumeration holds transfer modes of DMA.
Enumeration holds peripheral ACK signals to DMA.
Enumeration holds DMA transfer sizes.
Enumeration holds DMA transfer address increment for source and destination.
Enumeration holds 8-bit codes which are used by callback_type in sl_si91x_dma_unregister_callbacks function.
Typedefs#
Typedef for user supplied callback function which is called when a DMA transfer completes.
Typedef for user supplied callback function which is called when a DMA error occurs.
Variables#
DMA driver channel allocator.
Functions#
Initialize DMA peripheral by enabling DMA clock and clearing DMA interrupts.
Deinitialize the DMA module by disabling peripheral clock and interrupts, if there is no ongoing DMA transfer.
Check the available DMA channel and allocate the channel.
Deallocate the DMA channel if there is no ongoing transfer on channel.
Register DMA callbacks (transfer complete & error).
Unregister DMA callbacks (transfer complete & error).
Configure the DMA channel descriptor and initiate DMA transfer.
Configure the DMA channel descriptor and initiate simple memory to memory DMA transfer.
Stop any active transfer on a channel.
Return the channel status i.e., whether the channel is allocated/busy/idle.
Macros#
Enumeration Documentation#
sl_dma_transfer_type_t#
sl_dma_transfer_type_t
Enumeration holds transfer types of DMA.
Enumerator | |
---|---|
SL_DMA_MEMORY_TO_MEMORY | Memory to Memory transfer type. |
SL_DMA_MEMORY_TO_PERIPHERAL | Memory to Peripheral transfer type. |
SL_PERIPHERAL_TO_MEMORY | Peripheral to Memory transfer type. |
103
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
sl_dma_transfer_mode_t#
sl_dma_transfer_mode_t
Enumeration holds transfer modes of DMA.
Enumerator | |
---|---|
SL_DMA_BASIC_MODE | Basic DMA mode. |
SL_DMA_PINGPONG_MODE | Ping pong mode. |
110
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
sl_dma_peripheral_ack_t#
sl_dma_peripheral_ack_t
Enumeration holds peripheral ACK signals to DMA.
Enumerator | |
---|---|
SL_USART0_ACK | ACK code for USART0. |
SL_UART1_ACK | ACK code for UART1. |
SL_UART3_ACK | ACK code for UART3. |
SL_SSI_SLAVE_ACK | ACK code for SSI slave. |
SL_SSI_MASTER_ACK | ACK code for SSI master. |
SL_SSI1_SLAVE_ACK | ACK code for SSI1. |
SL_I2C_ACK | ACK code for I2C. |
116
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
sl_dma_transfer_size_t#
sl_dma_transfer_size_t
Enumeration holds DMA transfer sizes.
Enumerator | |
---|---|
SL_TRANSFER_SIZE_32 | 4 bytes transfer size |
SL_TRANSFER_SIZE_16 | 2 bytes transfer size |
SL_TRANSFER_SIZE_8 | 1 bytes transfer size |
127
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
sl_dma_transfer_inc_t#
sl_dma_transfer_inc_t
Enumeration holds DMA transfer address increment for source and destination.
Enumerator | |
---|---|
SL_TRANSFER_SRC_INC_32 | 4 bytes source address increment |
SL_TRANSFER_SRC_INC_16 | 2 bytes source address increment |
SL_TRANSFER_SRC_INC_8 | 1 byte source address increment |
SL_TRANSFER_SRC_INC_NONE | No source address increment. |
SL_TRANSFER_DST_INC_32 | 4 bytes destination address increment |
SL_TRANSFER_DST_INC_16 | 2 bytes destination address increment |
SL_TRANSFER_DST_INC_8 | 1 byte destination address increment |
SL_TRANSFER_DST_INC_NONE | No destination address increment. |
134
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
sl_dma_callback_code_t#
sl_dma_callback_code_t
Enumeration holds 8-bit codes which are used by callback_type in sl_si91x_dma_unregister_callbacks function.
Enumerator | |
---|---|
SL_DMA_TRANSFER_DONE_CB | 8-bit code for transfer complete callback |
SL_DMA_ERROR_CB | 8-bit code for error callback |
147
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
Typedef Documentation#
sl_dma_transfer_complete#
typedef void(* sl_dma_transfer_complete) (uint32_t channel, void *data) )(uint32_t channel, void *data)
Typedef for user supplied callback function which is called when a DMA transfer completes.
[in] | channel_no | DMA channel number |
[in] | *data | An extra parameter for user application |
91
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
sl_dma_error#
typedef void(* sl_dma_error) (uint32_t channel, void *data) )(uint32_t channel, void *data)
Typedef for user supplied callback function which is called when a DMA error occurs.
[in] | channel_no | DMA channel number |
[in] | *data | An extra parameter for user application |
100
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
Variable Documentation#
sl_channel_allocation_data_t#
sl_channel_data_t sl_channel_allocation_data_t[2][SL_CHANNEL_COUNT]
DMA driver channel allocator.
185
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
Function Documentation#
sl_si91x_dma_init#
sl_status_t sl_si91x_dma_init (sl_dma_init_t * dma_init)
Initialize DMA peripheral by enabling DMA clock and clearing DMA interrupts.
[in] | dma_init | dma initialization structure, dma_init->dma_number - 0->UDMA0, 1->UDMA1 dma_init->dma_channel_count - Number of channels used by DMA driver (0-32) |
Returns
Initialization status SL_STATUS_OK - Initialization success SL_STATUS_NOT_INITIALIZED - Initialization fail
206
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
sl_si91x_dma_deinit#
sl_status_t sl_si91x_dma_deinit (uint32_t dma_number)
Deinitialize the DMA module by disabling peripheral clock and interrupts, if there is no ongoing DMA transfer.
[in] | dma_number | 0->UDMA0, 1->UDMA1 |
Returns
deinitialization status SL_STATUS_OK - Deinit success SL_STATUS_BUSY - Cannot deinit the peripheral due to an ongoing transfer SL_STATUS_NOT_INITIALIZED - DMA peripheral not initialized
219
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
sl_si91x_dma_allocate_channel#
sl_status_t sl_si91x_dma_allocate_channel (uint32_t dma_number, uint32_t * channel_no, uint32_t priority)
Check the available DMA channel and allocate the channel.
[in] | dma_number | dma_number 0->UDMA0, 1->UDMA1 |
[in] | channel_no | Address of channel number. |
[in] | priority | channel priority. |
This function also sets the priority of allocated channel and assign the channel number to *channel_no variable. If no channel is available, it will return SL_DMA_NO_CHANNEL_AVAILABLE. note: Users can also initialize the desired channel number and this API checks whether the desired channel is available and allocates the channel if available. To allocate the available channel, channel_no should be initialized to 0.
This function should be called after initializing DMA using sl_si91x_dma_init
Returns
channel allocation status SL_STATUS_OK - Channel allocated SL_STATUS_DMA_NO_CHANNEL_AVAILABLE - All DMA channels are allocated SL_STATUS_DMA_CHANNEL_ALLOCATED - Desired channel is already allocated SL_STATUS_NOT_INITIALIZED - DMA peripheral not initialized SL_STATUS_INVALID_PARAMETER - Channel no is invalid
239
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
sl_si91x_dma_deallocate_channel#
sl_status_t sl_si91x_dma_deallocate_channel (uint32_t dma_number, uint32_t channel_no)
Deallocate the DMA channel if there is no ongoing transfer on channel.
[in] | dma_number | dma_number 0->UDMA0, 1->UDMA1 |
[in] | channel_no | channel number. |
Returns
channel deallocation status SL_STATUS_OK - Channel deallocated SL_STATUS_BUSY - Cannot deallocate channel due to an ongoing transfer SL_STATUS_NOT_INITIALIZED - DMA peripheral not initialized SL_STATUS_INVALID_PARAMETER - Channel no is invalid
254
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
sl_si91x_dma_register_callbacks#
sl_status_t sl_si91x_dma_register_callbacks (uint32_t dma_number, uint32_t channel_no, sl_dma_callback_t * callback_t)
Register DMA callbacks (transfer complete & error).
[in] | dma_number | dma_number 0->UDMA0, 1->UDMA1 |
[in] | channel_no | channel number. |
[in] | callback_t | structure containing callback functions. |
Users must update the sl_dma_callback_t structure and pass its address to this function. Users can have separate callbacks for transfer complete and error for each channel.
This function should be called after sl_si91x_dma_init and sl_si91x_dma_allocate_channel
Returns
channel deallocation status SL_STATUS_OK - Callback registered successfully SL_STATUS_INVALID_PARAMETER - Invalid channel number SL_STATUS_NOT_INITIALIZED - DMA peripheral not initialized
273
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
sl_si91x_dma_unregister_callbacks#
sl_status_t sl_si91x_dma_unregister_callbacks (uint32_t dma_number, uint32_t channel_no, uint8_t callback_type)
Unregister DMA callbacks (transfer complete & error).
[in] | dma_number | dma_number 0->UDMA0, 1->UDMA1 |
[in] | channel_no | channel number. |
[in] | callback_type | Unregister the DMA callbacks based on the callback type (bit mapped to callbacks), (SL_DMA_TRANSFER_DONE_CB) - unregister transfer complete callback (SL_DMA_ERROR_CB) - unregister error callback (SL_DMA_TRANSFER_DONE_CB | SL_DMA_ERROR_CB) - unregister both transfer complete and error callback |
Update the 8-bit variable callback_type and pass to the function. Each bit is mapped to a specific callback.
Returns
channel deallocation status SL_STATUS_OK - Callback unregistered successfully SL_STATUS_INVALID_PARAMETER - Invalid channel number SL_STATUS_NOT_INITIALIZED - DMA peripheral not initialized
293
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
sl_si91x_dma_transfer#
sl_status_t sl_si91x_dma_transfer (uint32_t dma_number, uint32_t channel_no, sl_dma_xfer_t * dma_transfer_t)
Configure the DMA channel descriptor and initiate DMA transfer.
[in] | dma_number | dma_number 0->UDMA0, 1->UDMA1 |
[in] | channel_no | channel number. |
[in] | dma_transfer_t | channel transfer data structure containing channel descriptor and other basic DMA parameters. |
DMA primary descriptor is updated in this function and based on transfer mode the alternate descriptor is also updated (only for ping pong mode). Additionally, other DMA parameters such as peripheral ACK signal (for peripheral memory transfers), DMA priority etc. are also updated.
This function should be called after sl_si91x_dma_init and sl_si91x_dma_allocate_channel
Returns
DMA transfer status SL_STATUS_OK - Transfer started successfully SL_STATUS_SUSPENDED - Transfer initialization fail SL_STATUS_NOT_INITIALIZED - DMA peripheral not initialized SL_STATUS_INVALID_PARAMETER - Channel no is invalid
314
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
sl_si91x_dma_simple_transfer#
sl_status_t sl_si91x_dma_simple_transfer (uint32_t dma_number, uint32_t channel_no, void * src_addr, void * dst_addr, uint32_t data_size)
Configure the DMA channel descriptor and initiate simple memory to memory DMA transfer.
[in] | dma_number | dma_number 0->UDMA0, 1->UDMA1 |
[in] | channel_no | channel no |
[in] | src_addr | source address. |
[in] | dst_addr | destination address. |
[in] | data_size | transfer size in bytes |
Pass the source address and destination address of transfer along with transfer length in bytes.
This function should be called after sl_si91x_dma_init and sl_si91x_dma_allocate_channel
Returns
DMA transfer status SL_STATUS_OK - Transfer success SL_STATUS_SUSPENDED - Transfer initialization fail SL_STATUS_NOT_INITIALIZED - DMA peripheral not initialized SL_STATUS_INVALID_PARAMETER - Channel no is invalid
336
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
sl_si91x_dma_stop_transfer#
sl_status_t sl_si91x_dma_stop_transfer (uint32_t dma_number, uint32_t channel_no)
Stop any active transfer on a channel.
[in] | dma_number | dma_number 0->UDMA0, 1->UDMA1 |
[in] | channel_no | channel number. |
If there is no active transfer on the channel, this function returns SL_DMA_CHANNEL_IDLE.
This function should be called after sl_si91x_dma_init and sl_si91x_dma_allocate_channel
Returns
DMA transfer status SL_STATUS_OK - Transfer stopped successfully SL_STATUS_IDLE - There is no active transfer on channel SL_STATUS_INVALID_PARAMETER - Invalid channel number SL_STATUS_NOT_INITIALIZED - DMA peripheral not initialized
357
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
sl_si91x_dma_channel_status_get#
sl_status_t sl_si91x_dma_channel_status_get (uint32_t dma_number, uint32_t channel_no)
Return the channel status i.e., whether the channel is allocated/busy/idle.
[in] | dma_number | dma_number 0->UDMA0, 1->UDMA1 |
[in] | channel_no | channel number. |
This function should be called after sl_si91x_dma_init
Returns
channel status SL_STATUS_IDLE - Channel is not allocated SL_STATUS_DMA_CHANNEL_ALREADY_ALLOCATED - Channel is already allocated and idle SL_STATUS_BUSY - Channel is allocated and busy SL_STATUS_NOT_INITIALIZED - DMA peripheral not initialized SL_STATUS_INVALID_PARAMETER - Channel no is invalid
374
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
Macro Definition Documentation#
SL_STATUS_DMA_CHANNEL_ALLOCATED#
#define SL_STATUS_DMA_CHANNEL_ALLOCATEDValue:
(sl_status_t)0x45
50
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
SL_STATUS_DMA_NO_CHANNEL_AVAILABLE#
#define SL_STATUS_DMA_NO_CHANNEL_AVAILABLEValue:
(sl_status_t)0x46
52
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
SL_STATUS_DMA_CHANNEL_ALREADY_UNALLOCATED#
#define SL_STATUS_DMA_CHANNEL_ALREADY_UNALLOCATEDValue:
(sl_status_t)0X47
54
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
SL_STATUS_DMA_CHANNEL_UNALLOCATED#
#define SL_STATUS_DMA_CHANNEL_UNALLOCATEDValue:
(sl_status_t)0X48
56
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
SL_CHANNEL_COUNT#
#define SL_CHANNEL_COUNTValue:
32
58
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
ALTERNATE_DESCRIPTOR_DISABLE#
#define ALTERNATE_DESCRIPTOR_DISABLEValue:
0
60
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
ALTERNATE_DESCRIPTOR_ENABLE#
#define ALTERNATE_DESCRIPTOR_ENABLEValue:
1
61
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
BURST_REQUEST_ENABLE#
#define BURST_REQUEST_ENABLEValue:
1
62
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
BURST_REQUEST_DISABLE#
#define BURST_REQUEST_DISABLEValue:
0
63
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
CHANNEL_PRIO_DISABLE#
#define CHANNEL_PRIO_DISABLEValue:
0
64
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
CHANNEL_PRIO_ENABLE#
#define CHANNEL_PRIO_ENABLEValue:
1
65
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
PERIPHERAL_ACK_DISABLE#
#define PERIPHERAL_ACK_DISABLEValue:
0
66
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
PERIPHERAL_REQUEST_DISABLE#
#define PERIPHERAL_REQUEST_DISABLEValue:
0
67
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
PERIPHERAL_REQUEST_ENABLE#
#define PERIPHERAL_REQUEST_ENABLEValue:
1
68
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
REQUEST_MASK_DISABLE#
#define REQUEST_MASK_DISABLEValue:
0
69
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
NEXT_BURST_ENABLE#
#define NEXT_BURST_ENABLEValue:
1
70
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
NEXT_BURST_DISABLE#
#define NEXT_BURST_DISABLEValue:
0
73
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
SOURCE_PROTECT_CONTROL_DISABLE#
#define SOURCE_PROTECT_CONTROL_DISABLEValue:
0x000
74
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h
DESTINATION_PROTECT_CONTROL_DISABLE#
#define DESTINATION_PROTECT_CONTROL_DISABLEValue:
0x000
75
of file components/siwx917_soc/drivers/unified_api/inc/sl_si91x_dma.h