Data Structures | |
struct | _dma_module |
Macros | |
#define | DMA_CHANNEL_MASK (0x1f) |
DMA channel mask. More... | |
#define | MAX_JOB_RESUME_COUNT 10000 |
Maximum retry counter for resuming a job transfer. More... | |
Functions | |
static uint8_t | _dma_find_first_free_channel_and_allocate (void) |
Find a free channel for a DMA resource. More... | |
static void | _dma_release_channel (uint8_t channel) |
Release an allocated DMA channel. More... | |
static void | _dma_set_config (struct dma_resource *resource, struct dma_resource_config *resource_config) |
Configure the DMA resource. More... | |
void | dma_abort_job (struct dma_resource *resource) |
Abort a DMA transfer. More... | |
enum status_code | dma_add_descriptor (struct dma_resource *resource, DmacDescriptor *descriptor) |
Add a DMA transfer descriptor to a DMA resource. More... | |
enum status_code | dma_allocate (struct dma_resource *resource, struct dma_resource_config *config) |
Allocate a DMA with configurations. More... | |
void | dma_descriptor_create (DmacDescriptor *descriptor, struct dma_descriptor_config *config) |
Create a DMA transfer descriptor with configurations. More... | |
enum status_code | dma_free (struct dma_resource *resource) |
Free an allocated DMA resource. More... | |
void | dma_get_config_defaults (struct dma_resource_config *config) |
Initializes config with predefined default values. More... | |
void | dma_resume_job (struct dma_resource *resource) |
Resume a suspended DMA transfer. More... | |
enum status_code | dma_start_transfer_job (struct dma_resource *resource) |
Start a DMA transfer. More... | |
void | dma_suspend_job (struct dma_resource *resource) |
Suspend a DMA transfer. More... | |
void | DMAC_Handler (void) |
DMA interrupt service routine. More... | |
Variables | |
static struct dma_resource * | _dma_active_resource [CONF_MAX_USED_CHANNEL_NUM] |
Internal DMA resource pool. More... | |
struct _dma_module | _dma_inst |
uint8_t | g_chan_interrupt_flag [CONF_MAX_USED_CHANNEL_NUM] ={0} |
DmacDescriptor descriptor_section[CONF_MAX_USED_CHANNEL_NUM] | SECTION_DMAC_DESCRIPTOR |
Initial write back memory section. More... | |
#define DMA_CHANNEL_MASK (0x1f) |
DMA channel mask.
#define MAX_JOB_RESUME_COUNT 10000 |
Maximum retry counter for resuming a job transfer.
Referenced by dma_resume_job().
|
static |
Find a free channel for a DMA resource.
Find a channel for the requested DMA resource.
DMA_INVALID_CHANNEL | No channel available |
count | Allocated channel for the DMA resource |
References _dma_module::allocated_channels, count, DMA_INVALID_CHANNEL, _dma_module::free_channels, system_interrupt_enter_critical_section(), and system_interrupt_leave_critical_section().
Referenced by dma_allocate().
|
static |
Release an allocated DMA channel.
[in] | channel | Channel id to be released |
References _dma_module::allocated_channels, and _dma_module::free_channels.
Referenced by dma_free().
|
static |
Configure the DMA resource.
[in] | dma_resource | Pointer to a DMA resource instance |
[out] | resource_config | Configurations of the DMA resource |
Select the DMA channel and clear software trigger
Enable event output, the event output selection is configured in each transfer descriptor
References Assert, dma_resource::channel_id, dma_resource_config::event_config, dma_events_config::event_output_enable, dma_events_config::input_action, dma_resource_config::peripheral_trigger, dma_resource_config::priority, system_interrupt_enter_critical_section(), system_interrupt_leave_critical_section(), and dma_resource_config::trigger_action.
Referenced by dma_allocate().
void DMAC_Handler | ( | void | ) |
DMA interrupt service routine.
References _dma_active_resource, Assert, dma_resource::callback, dma_resource::callback_enable, dma_resource::channel_id, descriptor_section, DMA_CALLBACK_CHANNEL_SUSPEND, DMA_CALLBACK_TRANSFER_DONE, DMA_CALLBACK_TRANSFER_ERROR, isr(), dma_resource::job_status, STATUS_ERR_IO, STATUS_OK, STATUS_SUSPEND, system_interrupt_enter_critical_section(), system_interrupt_leave_critical_section(), total_size, and dma_resource::transfered_size.
|
static |
Internal DMA resource pool.
Referenced by dma_allocate(), dma_free(), and DMAC_Handler().
struct _dma_module _dma_inst |
DmacDescriptor _write_back_section [CONF_MAX_USED_CHANNEL_NUM] SECTION_DMAC_DESCRIPTOR |
Initial write back memory section.