Direct Memory Access (DMA) support.
Contents
DMA register map type.
Note that DMA controller 2 (register map base pointer DMA2_BASE) only supports channels 1–5.
Public Members
- __io uint32 ISR
Interrupt status register.
- __io uint32 IFCR
Interrupt flag clear register.
- __io uint32 CCR1
Channel 1 configuration register.
- __io uint32 CNDTR1
Channel 1 number of data register.
- __io uint32 CPAR1
Channel 1 peripheral address register.
- __io uint32 CMAR1
Channel 1 memory address register.
- const uint32 RESERVED1
Reserved.
- __io uint32 CCR2
Channel 2 configuration register.
- __io uint32 CNDTR2
Channel 2 number of data register.
- __io uint32 CPAR2
Channel 2 peripheral address register.
- __io uint32 CMAR2
Channel 2 memory address register.
- const uint32 RESERVED2
Reserved.
- __io uint32 CCR3
Channel 3 configuration register.
- __io uint32 CNDTR3
Channel 3 number of data register.
- __io uint32 CPAR3
Channel 3 peripheral address register.
- __io uint32 CMAR3
Channel 3 memory address register.
- const uint32 RESERVED3
Reserved.
- __io uint32 CCR4
Channel 4 configuration register.
- __io uint32 CNDTR4
Channel 4 number of data register.
- __io uint32 CPAR4
Channel 4 peripheral address register.
- __io uint32 CMAR4
Channel 4 memory address register.
- const uint32 RESERVED4
Reserved.
- __io uint32 CCR5
Channel 5 configuration register.
- __io uint32 CNDTR5
Channel 5 number of data register.
- __io uint32 CPAR5
Channel 5 peripheral address register.
- __io uint32 CMAR5
Channel 5 memory address register.
- const uint32 RESERVED5
Reserved.
- __io uint32 CCR6
Channel 6 configuration register.
- __io uint32 CNDTR6
Channel 6 number of data register.
- __io uint32 CPAR6
Channel 6 peripheral address register.
- __io uint32 CMAR6
Channel 6 memory address register.
- const uint32 RESERVED6
Reserved.
- __io uint32 CCR7
Channel 7 configuration register.
- __io uint32 CNDTR7
Channel 7 number of data register.
- __io uint32 CPAR7
Channel 7 peripheral address register.
- __io uint32 CMAR7
Channel 7 memory address register.
- const uint32 RESERVED7
Reserved.
DMA device type.
Public Members
- dma_reg_map * regs
Register map.
- rcc_clk_id clk_id
Clock ID.
- dma_handler_config handlers[]
IRQ handlers and NVIC numbers.
See:
Encapsulates state related to a DMA channel interrupt.
Public Members
- void(* handler)(void)
User-specified channel interrupt handler.
- nvic_irq_num irq_line
Channel’s NVIC interrupt number.
Flags for DMA transfer configuration.
Values:
Memory to memory mode.
Auto-increment memory address.
Auto-increment peripheral address.
Circular mode.
Read from memory to peripheral.
Interrupt on transfer error.
Interrupt on half-transfer.
Interrupt on transfer completion.
Source and destination transfer sizes.
Values:
8-bit transfers
16-bit transfers
32-bit transfers
DMA channel.
Values:
Channel 1.
Channel 2.
Channel 3.
Channel 4.
Channel 5.
Channel 6.
Channel 7.
DMA transfer priority.
Values:
Low priority.
Medium priority.
High priority.
Very high priority.
Encodes the reason why a DMA interrupt was called.
See: | dma_get_irq_cause() |
---|
Values:
Transfer is complete.
Transfer is half complete.
Error occurred during transfer.
DMA channel register map type.
Provides access to an individual channel’s registers.
Public Members
- __io uint32 CCR
Channel configuration register.
- __io uint32 CNDTR
Channel number of data register.
- __io uint32 CPAR
Channel peripheral address register.
- __io uint32 CMAR
Channel memory address register.
Initialize a DMA device.
Parameters: |
|
---|
Set up a DMA transfer.
The channel will be disabled before being reconfigured. The transfer will have low priority by default. You may choose another priority before the transfer begins using dma_set_priority(), as well as performing any other configuration you desire. When the channel is configured to your liking, enable it using dma_enable().
Parameters: |
|
---|---|
Side Effects:: | Disables the given DMA channel. |
See: |
Set the number of data to be transferred on a DMA channel.
You may not call this function while the channel is enabled.
Parameters: |
|
---|
Set the priority of a DMA transfer.
You may not call this function while the channel is enabled.
Parameters: |
|
---|
Attach an interrupt to a DMA transfer.
Interrupts are enabled using appropriate mode flags in dma_setup_transfer().
Parameters: |
|
---|---|
See: |
Detach a DMA transfer interrupt handler.
After calling this function, the given channel’s interrupts will be disabled.
Parameters: |
|
---|---|
Side Effects:: | Clears interrupt enable bits in the channel’s CCR register. |
See: |
Discover the reason why a DMA interrupt was called.
You may only call this function within an attached interrupt handler for the given channel.
This function resets the internal DMA register state which encodes the cause of the interrupt; consequently, it can only be called once per interrupt handler invocation.
Parameters: |
|
---|---|
Return: | Reason why the interrupt fired. |
Side Effects:: | Clears channel status flags in dev->regs->ISR. |
See: |
Enable a DMA channel.
Parameters: |
|
---|
Disable a DMA channel.
Parameters: |
|
---|
Set the base memory address where data will be read from or written to.
You must not call this function while the channel is enabled.
If the DMA memory size is 16 bits, the address is automatically aligned to a half-word. If the DMA memory size is 32 bits, the address is aligned to a word.
Parameters: |
|
---|
Set the base peripheral address where data will be read from or written to.
You must not call this function while the channel is enabled.
If the DMA peripheral size is 16 bits, the address is automatically aligned to a half-word. If the DMA peripheral size is 32 bits, the address is aligned to a word.
Parameters: |
|
---|
Obtain a pointer to an individual DMA channel’s registers.
For example, dma_channel_regs(DMA1, DMA_CH1)->CCR is DMA1_BASE->CCR1.
Parameters: |
|
---|
Check if a DMA channel is enabled.
Parameters: |
|
---|
Get the ISR status bits for a DMA channel.
The bits are returned right-aligned, in the following order: transfer error flag, half-transfer flag, transfer complete flag, global interrupt flag.
If you’re attempting to figure out why a DMA interrupt fired; you may find dma_get_irq_cause() more convenient.
Parameters: |
|
---|---|
See: |
Clear the ISR status bits for a given DMA channel.
If you’re attempting to clean up after yourself in a DMA interrupt, you may find dma_get_irq_cause() more convenient.
Parameters: |
|
---|---|
See: |
DMA controller 1 register map base pointer.
DMA controller 2 register map base pointer.