gossamer 0.0.1
a very lightweight app framework for SAMD and SAML chips
|
WIP functions for configuring and using the Direct Memory Access controller. More...
Data Structures | |
struct | gossamer_dma_job_t |
Functions | |
void | dma_init (void) |
Initialize the DMA system. | |
bool | dma_configure (gossamer_dma_job_t *dmaJob, uint8_t peripheralTrigger, dma_trigger_action_t triggerAction, dma_configuration_flags_t flags) |
Configures a DMA job. | |
DmacDescriptor * | dma_add_descriptor (gossamer_dma_job_t *dmaJob, void *src, void *dst, uint32_t count, dma_beat_size_t size, dma_address_increment_t addressIncrement, dma_stepsize_t stepSize, dma_stepsel_t stepSel) |
Adds a descriptor to a DMA job. | |
bool | dma_start_job (gossamer_dma_job_t *dmaJob) |
WIP functions for configuring and using the Direct Memory Access controller.
DmacDescriptor * dma_add_descriptor | ( | gossamer_dma_job_t * | dmaJob, |
void * | src, | ||
void * | dst, | ||
uint32_t | count, | ||
dma_beat_size_t | size, | ||
dma_address_increment_t | addressIncrement, | ||
dma_stepsize_t | stepSize, | ||
dma_stepsel_t | stepSel | ||
) |
Adds a descriptor to a DMA job.
Adds a descriptor to a DMA job. You must configure the job before adding descriptors to it.
dmaJob | A pointer to the DMA job. Must be previously configured with dma_configure(). |
src | The source address for this descriptor. |
dst | The destination address for this descriptor. |
count | The number of beats to transfer. |
size | The beat size. One of:
|
srcInc | Whether to increment the source address after each beat. |
dstInc | Whether to increment the destination address after each beat. |
stepSize | Address increment step size. One of:
|
stepSel | Which address to increment by stepSize after each step. You can only have one:
|
bool dma_configure | ( | gossamer_dma_job_t * | dmaJob, |
uint8_t | peripheralTrigger, | ||
dma_trigger_action_t | triggerAction, | ||
dma_configuration_flags_t | flags | ||
) |
Configures a DMA job.
Configures a DMA job with the given peripheral trigger and trigger action. You must configure the job before adding descriptors to it.
dmaJob | A pointer to the DMA job to configure. This will be modified in place. |
peripheralTrigger | The peripheral trigger to use for this job. These are defined in your microcontroller's data sheet, in the DMAC's register details section, under a headling like "Trigger Source" |
triggerAction | The trigger action to use for this job. One of:
|
flags | A OR'ed bitmask of flags to use for this job. Available flags are:
|
void dma_init | ( | void | ) |
Initialize the DMA system.
Sets up peripheral clocks and points the DMA controller at an empty list of descriptors.