mikroSDK Reference Manual
|
DMA Driver API Reference. More...
Functions list | |
void | dma_configure_default (dma_config_t *config) |
Configure DMA Driver configuration structure. More... | |
err_t | dma_open (dma_t *obj, dma_config_t *config) |
Open the DMA Driver object. More... | |
void | dma_get_channels (dma_channel_t *channels) |
Get DMA modules/streams/channels. More... | |
err_t | dma_set_mode (dma_t *obj, dma_mode_t mode) |
Set the DMA mode. More... | |
err_t | dma_set_direction (dma_t *obj, dma_direction_t direction) |
Set the DMA direction. More... | |
err_t | dma_set_priority (dma_t *obj, dma_priority_t priority) |
Set the DMA priority. More... | |
err_t | dma_set_transfer_config (dma_t *obj, uint32_t addr_src, uint32_t addr_dst, size_t transfer_size, dma_source_memory_region_t src_mem_type) |
Configure the DMA transfer. More... | |
err_t | dma_transfer_start (dma_t *obj) |
Initializes the DMA transfer. More... | |
err_t | dma_transfer_stop (dma_t *obj) |
Stops the DMA transfer. More... | |
err_t | dma_transfer_abort (dma_t *obj) |
Aborts a DMA transfer. More... | |
err_t | dma_close (dma_t *obj) |
Close DMA Driver object. More... | |
DMA DRV API layer header. Contains all enums, structures and function declarations available for DMA module.
void dma_configure_default | ( | dma_config_t * | config | ) |
Configures dma_config_t structure to default initialization values. Take into consideration that this is just structure variable initial values setting. Values need to be redefined by user.
[in,out] | config | configure DMA driver configuration structure. See dma_config_t structure definition for detailed explanation. |
Default values:
Function | Default value |
---|---|
Module | 0xFF |
Stream | 0xFF |
Channel | 0xFF |
Direction | DMA_DIRECTION_DEFAULT |
Mode | DMA_MODE_DEFAULT |
Priority | DMA_PRIORITY_DEFAULT |
Memory increment | false |
Memory data alignment | DMA_DATA_ALIGN_DEFAULT |
Memory burst size | DMA_BURST_SIZE_INCREMENT_DEFAULT |
Peripheral increment | false |
Peripheral data alignment | DMA_DATA_ALIGN_DEFAULT |
Peripheral burst size | DMA_BURST_SIZE_INCREMENT_DEFAULT |
Source address | 0 |
Destination address | 0 |
Transfer length | 0 |
Example
err_t dma_open | ( | dma_t * | obj, |
dma_config_t * | config | ||
) |
Opens the DMA driver object on selected module, stream and channel. Allocates memory for specified object. Additionally, initializes the DMA module.
[in,out] | obj | DMA driver object. See dma_t structure definition for detailed explanation. |
[in] | config | configure DMA driver configuration settings. See dma_config_t structure definition for detailed explanation. |
configuration
structure has been adequately populated beforehand. See dma_configure_default definition for detailed explanation. Example
void dma_get_channels | ( | dma_channel_t * | channels | ) |
Checks current MCU for available number of modules, streams and channels.
[in,out] | channels | DMA channel context array. See dma_channel_t definition for detailed explanation. |
channels
array has been adequately instantiated before calling this API. Example
err_t dma_set_mode | ( | dma_t * | obj, |
dma_mode_t | mode | ||
) |
Sets DMA mode to be used by the DMA driver.
[in,out] | obj | DMA driver object. See dma_t structure definition for detailed explanation. |
[in] | mode | DMA mode. See dma_mode_t for valid values. |
Example
err_t dma_set_direction | ( | dma_t * | obj, |
dma_direction_t | direction | ||
) |
Sets DMA direction to be used by the DMA driver.
[in,out] | obj | DMA driver object. See dma_t structure definition for detailed explanation. |
[in] | direction | DMA direction. See dma_direction_t for valid values. |
Example
err_t dma_set_priority | ( | dma_t * | obj, |
dma_priority_t | priority | ||
) |
Sets DMA priority level to be used by the DMA driver.
[in,out] | obj | DMA driver object. See dma_t structure definition for detailed explanation. |
[in] | priority | DMA priority level. See dma_priority_t for valid values. |
Example
err_t dma_set_transfer_config | ( | dma_t * | obj, |
uint32_t | addr_src, | ||
uint32_t | addr_dst, | ||
size_t | transfer_size, | ||
dma_source_memory_region_t | src_mem_type | ||
) |
Configures initialized DMA stream for transfer.
[in,out] | obj | DMA driver object. See dma_t structure definition for detailed explanation. |
[in] | addr_src | Source address for transfer. |
[in] | addr_dst | Destination address for transfer. |
[in] | transfer_size | Number of bytes to transfer. |
[in] | src_mem_type | Source address memory region. |
Example
Starts previously configured DMA transfer by enabling stream.
[in,out] | obj | DMA driver object. See dma_t structure definition for detailed explanation. |
Example
Stops an active DMA transfer by disabling stream.
[in,out] | obj | DMA driver object. See dma_t structure definition for detailed explanation. |
Example
Aborts any ongoing DMA transfers and disables stream.
[in,out] | obj | DMA driver object. See dma_t structure definition for detailed explanation. |
Example
Closes DMA driver object, aborts any ongoing transfers, disables the stream, deinitializes the module, clears all buffers used by object and disables module clock for lower power consumption.
[in,out] | obj | DMA driver object. See dma_t structure definition for detailed explanation. |
Example