gossamer 0.0.1
a very lightweight app framework for SAMD and SAML chips
Loading...
Searching...
No Matches
Direct Memory Access Controller

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)
 

Detailed Description

WIP functions for configuring and using the Direct Memory Access controller.

Function Documentation

◆ dma_add_descriptor()

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.

Parameters
dmaJobA pointer to the DMA job. Must be previously configured with dma_configure().
srcThe source address for this descriptor.
dstThe destination address for this descriptor.
countThe number of beats to transfer.
sizeThe beat size. One of:
  • DMA_BEAT_SIZE_BYTE - One byte per beat
  • DMA_BEAT_SIZE_HWORD - One half word (two bytes) per beat
  • DMA_BEAT_SIZE_WORD - One word (four bytes) per beat
srcIncWhether to increment the source address after each beat.
dstIncWhether to increment the destination address after each beat.
stepSizeAddress increment step size. One of:
  • DMA_STEPSIZE_1 - Increment by 1 * beat size
  • DMA_STEPSIZE_2 - Increment by 2 * beat size
  • DMA_STEPSIZE_4 - Increment by 4 * beat size
  • DMA_STEPSIZE_8 - ...you get the idea
  • DMA_STEPSIZE_16
  • DMA_STEPSIZE_32
  • DMA_STEPSIZE_64
  • DMA_STEPSIZE_128
stepSelWhich address to increment by stepSize after each step. You can only have one:
  • DMA_STEPSEL_SOURCE - Increment the source address after each step
  • DMA_STEPSEL_DESTINATION - Increment the destination address after each step

◆ dma_configure()

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.

Parameters
dmaJobA pointer to the DMA job to configure. This will be modified in place.
peripheralTriggerThe 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"
triggerActionThe trigger action to use for this job. One of:
  • DMA_TRIGGER_ACTION_BLOCK
  • DMA_TRIGGER_ACTION_BEAT
  • DMA_TRIGGER_ACTION_TRANSACTION
flagsA OR'ed bitmask of flags to use for this job. Available flags are:
  • DMA_CONFIG_LOOP - Loop the job when it completes
  • DMA_CONFIG_RUNSTDBY - Keep the job running in standby mode

◆ dma_init()

void dma_init ( void  )

Initialize the DMA system.

Sets up peripheral clocks and points the DMA controller at an empty list of descriptors.