|
enum | dreq_num_rp2350 {
DREQ_PIO0_TX0 = 0
, DREQ_PIO0_TX1 = 1
, DREQ_PIO0_TX2 = 2
, DREQ_PIO0_TX3 = 3
,
DREQ_PIO0_RX0 = 4
, DREQ_PIO0_RX1 = 5
, DREQ_PIO0_RX2 = 6
, DREQ_PIO0_RX3 = 7
,
DREQ_PIO1_TX0 = 8
, DREQ_PIO1_TX1 = 9
, DREQ_PIO1_TX2 = 10
, DREQ_PIO1_TX3 = 11
,
DREQ_PIO1_RX0 = 12
, DREQ_PIO1_RX1 = 13
, DREQ_PIO1_RX2 = 14
, DREQ_PIO1_RX3 = 15
,
DREQ_PIO2_TX0 = 16
, DREQ_PIO2_TX1 = 17
, DREQ_PIO2_TX2 = 18
, DREQ_PIO2_TX3 = 19
,
DREQ_PIO2_RX0 = 20
, DREQ_PIO2_RX1 = 21
, DREQ_PIO2_RX2 = 22
, DREQ_PIO2_RX3 = 23
,
DREQ_SPI0_TX = 24
, DREQ_SPI0_RX = 25
, DREQ_SPI1_TX = 26
, DREQ_SPI1_RX = 27
,
DREQ_UART0_TX = 28
, DREQ_UART0_RX = 29
, DREQ_UART1_TX = 30
, DREQ_UART1_RX = 31
,
DREQ_PWM_WRAP0 = 32
, DREQ_PWM_WRAP1 = 33
, DREQ_PWM_WRAP2 = 34
, DREQ_PWM_WRAP3 = 35
,
DREQ_PWM_WRAP4 = 36
, DREQ_PWM_WRAP5 = 37
, DREQ_PWM_WRAP6 = 38
, DREQ_PWM_WRAP7 = 39
,
DREQ_PWM_WRAP8 = 40
, DREQ_PWM_WRAP9 = 41
, DREQ_PWM_WRAP10 = 42
, DREQ_PWM_WRAP11 = 43
,
DREQ_I2C0_TX = 44
, DREQ_I2C0_RX = 45
, DREQ_I2C1_TX = 46
, DREQ_I2C1_RX = 47
,
DREQ_ADC = 48
, DREQ_XIP_STREAM = 49
, DREQ_XIP_QMITX = 50
, DREQ_XIP_QMIRX = 51
,
DREQ_HSTX = 52
, DREQ_CORESIGHT = 53
, DREQ_SHA256 = 54
, DREQ_DMA_TIMER0 = 59
,
DREQ_DMA_TIMER1 = 60
, DREQ_DMA_TIMER2 = 61
, DREQ_DMA_TIMER3 = 62
, DREQ_FORCE = 63
,
DREQ_COUNT
} |
| DREQ numbers for DMA pacing on RP2350 (used as typedef dreq_num_t) More...
|
|
enum | dreq_num_rp2040 {
DREQ_PIO0_TX0 = 0
, DREQ_PIO0_TX1 = 1
, DREQ_PIO0_TX2 = 2
, DREQ_PIO0_TX3 = 3
,
DREQ_PIO0_RX0 = 4
, DREQ_PIO0_RX1 = 5
, DREQ_PIO0_RX2 = 6
, DREQ_PIO0_RX3 = 7
,
DREQ_PIO1_TX0 = 8
, DREQ_PIO1_TX1 = 9
, DREQ_PIO1_TX2 = 10
, DREQ_PIO1_TX3 = 11
,
DREQ_PIO1_RX0 = 12
, DREQ_PIO1_RX1 = 13
, DREQ_PIO1_RX2 = 14
, DREQ_PIO1_RX3 = 15
,
DREQ_SPI0_TX = 16
, DREQ_SPI0_RX = 17
, DREQ_SPI1_TX = 18
, DREQ_SPI1_RX = 19
,
DREQ_UART0_TX = 20
, DREQ_UART0_RX = 21
, DREQ_UART1_TX = 22
, DREQ_UART1_RX = 23
,
DREQ_PWM_WRAP0 = 24
, DREQ_PWM_WRAP1 = 25
, DREQ_PWM_WRAP2 = 26
, DREQ_PWM_WRAP3 = 27
,
DREQ_PWM_WRAP4 = 28
, DREQ_PWM_WRAP5 = 29
, DREQ_PWM_WRAP6 = 30
, DREQ_PWM_WRAP7 = 31
,
DREQ_I2C0_TX = 32
, DREQ_I2C0_RX = 33
, DREQ_I2C1_TX = 34
, DREQ_I2C1_RX = 35
,
DREQ_ADC = 36
, DREQ_XIP_STREAM = 37
, DREQ_XIP_SSITX = 38
, DREQ_XIP_SSIRX = 39
,
DREQ_DMA_TIMER0 = 59
, DREQ_DMA_TIMER1 = 60
, DREQ_DMA_TIMER2 = 61
, DREQ_DMA_TIMER3 = 62
,
DREQ_FORCE = 63
, DREQ_COUNT
} |
| DREQ numbers for DMA pacing on RP2040 (used as typedef dreq_num_t) More...
|
|
enum | dma_channel_transfer_size { DMA_SIZE_8 = 0
, DMA_SIZE_16 = 1
, DMA_SIZE_32 = 2
} |
| Enumeration of available DMA channel transfer sizes. More...
|
|
|
void | dma_channel_claim (uint channel) |
| Mark a dma channel as used. More...
|
|
void | dma_claim_mask (uint32_t channel_mask) |
| Mark multiple dma channels as used. More...
|
|
void | dma_channel_unclaim (uint channel) |
| Mark a dma channel as no longer used. More...
|
|
void | dma_unclaim_mask (uint32_t channel_mask) |
| Mark multiple dma channels as no longer used. More...
|
|
int | dma_claim_unused_channel (bool required) |
| Claim a free dma channel. More...
|
|
bool | dma_channel_is_claimed (uint channel) |
| Determine if a dma channel is claimed. More...
|
|
static void | dma_channel_set_config (uint channel, const dma_channel_config *config, bool trigger) |
| Set a channel configuration. More...
|
|
static void | dma_channel_set_read_addr (uint channel, const volatile void *read_addr, bool trigger) |
| Set the DMA initial read address. More...
|
|
static void | dma_channel_set_write_addr (uint channel, volatile void *write_addr, bool trigger) |
| Set the DMA initial write address. More...
|
|
static void | dma_channel_set_trans_count (uint channel, uint32_t trans_count, bool trigger) |
| Set the number of bus transfers the channel will do. More...
|
|
static void | dma_channel_configure (uint channel, const dma_channel_config *config, volatile void *write_addr, const volatile void *read_addr, uint transfer_count, bool trigger) |
| Configure all DMA parameters and optionally start transfer. More...
|
|
static void | dma_channel_transfer_from_buffer_now (uint channel, const volatile void *read_addr, uint32_t transfer_count) |
| Start a DMA transfer from a buffer immediately. More...
|
|
static void | dma_channel_transfer_to_buffer_now (uint channel, volatile void *write_addr, uint32_t transfer_count) |
| Start a DMA transfer to a buffer immediately. More...
|
|
static void | dma_start_channel_mask (uint32_t chan_mask) |
| Start one or more channels simultaneously. More...
|
|
static void | dma_channel_start (uint channel) |
| Start a single DMA channel. More...
|
|
static void | dma_channel_abort (uint channel) |
| Stop a DMA transfer. More...
|
|
static void | dma_channel_set_irq0_enabled (uint channel, bool enabled) |
| Enable single DMA channel's interrupt via DMA_IRQ_0. More...
|
|
static void | dma_set_irq0_channel_mask_enabled (uint32_t channel_mask, bool enabled) |
| Enable multiple DMA channels' interrupts via DMA_IRQ_0. More...
|
|
static void | dma_channel_set_irq1_enabled (uint channel, bool enabled) |
| Enable single DMA channel's interrupt via DMA_IRQ_1. More...
|
|
static void | dma_set_irq1_channel_mask_enabled (uint32_t channel_mask, bool enabled) |
| Enable multiple DMA channels' interrupts via DMA_IRQ_1. More...
|
|
static void | dma_irqn_set_channel_enabled (uint irq_index, uint channel, bool enabled) |
| Enable single DMA channel interrupt on either DMA_IRQ_0 or DMA_IRQ_1. More...
|
|
static void | dma_irqn_set_channel_mask_enabled (uint irq_index, uint32_t channel_mask, bool enabled) |
| Enable multiple DMA channels' interrupt via either DMA_IRQ_0 or DMA_IRQ_1. More...
|
|
static bool | dma_channel_get_irq0_status (uint channel) |
| Determine if a particular channel is a cause of DMA_IRQ_0. More...
|
|
static bool | dma_channel_get_irq1_status (uint channel) |
| Determine if a particular channel is a cause of DMA_IRQ_1. More...
|
|
static bool | dma_irqn_get_channel_status (uint irq_index, uint channel) |
| Determine if a particular channel is a cause of DMA_IRQ_N. More...
|
|
static void | dma_channel_acknowledge_irq0 (uint channel) |
| Acknowledge a channel IRQ, resetting it as the cause of DMA_IRQ_0. More...
|
|
static void | dma_channel_acknowledge_irq1 (uint channel) |
| Acknowledge a channel IRQ, resetting it as the cause of DMA_IRQ_1. More...
|
|
static void | dma_irqn_acknowledge_channel (uint irq_index, uint channel) |
| Acknowledge a channel IRQ, resetting it as the cause of DMA_IRQ_N. More...
|
|
static bool | dma_channel_is_busy (uint channel) |
| Check if DMA channel is busy. More...
|
|
static void | dma_channel_wait_for_finish_blocking (uint channel) |
| Wait for a DMA channel transfer to complete. More...
|
|
static void | dma_sniffer_enable (uint channel, uint mode, bool force_channel_enable) |
| Enable the DMA sniffing targeting the specified channel. More...
|
|
static void | dma_sniffer_set_byte_swap_enabled (bool swap) |
| Enable the Sniffer byte swap function. More...
|
|
static void | dma_sniffer_set_output_invert_enabled (bool invert) |
| Enable the Sniffer output invert function. More...
|
|
static void | dma_sniffer_set_output_reverse_enabled (bool reverse) |
| Enable the Sniffer output bit reversal function. More...
|
|
static void | dma_sniffer_disable (void) |
| Disable the DMA sniffer.
|
|
static void | dma_sniffer_set_data_accumulator (uint32_t seed_value) |
| Set the sniffer's data accumulator with initial value. More...
|
|
static uint32_t | dma_sniffer_get_data_accumulator (void) |
| Get the sniffer's data accumulator value. More...
|
|
void | dma_timer_claim (uint timer) |
| Mark a dma timer as used. More...
|
|
void | dma_timer_unclaim (uint timer) |
| Mark a dma timer as no longer used. More...
|
|
int | dma_claim_unused_timer (bool required) |
| Claim a free dma timer. More...
|
|
bool | dma_timer_is_claimed (uint timer) |
| Determine if a dma timer is claimed. More...
|
|
static void | dma_timer_set_fraction (uint timer, uint16_t numerator, uint16_t denominator) |
| Set the multiplier for the given DMA timer. More...
|
|
static uint | dma_get_timer_dreq (uint timer_num) |
| Return the DREQ number for a given DMA timer. More...
|
|
static int | dma_get_irq_num (uint irq_index) |
| Return DMA_IRQ_<irqn> More...
|
|
void | dma_channel_cleanup (uint channel) |
| Performs DMA channel cleanup after use. More...
|
|
DMA Controller API.
The RP-series microcontroller Direct Memory Access (DMA) master performs bulk data transfers on a processor’s behalf. This leaves processors free to attend to other tasks, or enter low-power sleep states. The data throughput of the DMA is also significantly higher than one of RP-series microcontroller’s processors.
The DMA can perform one read access and one write access, up to 32 bits in size, every clock cycle. There are 12 independent channels, which each supervise a sequence of bus transfers, usually in one of the following scenarios:
static void dma_channel_abort |
( |
uint |
channel | ) |
|
|
inlinestatic |
Stop a DMA transfer.
Function will only return once the DMA has stopped.
RP2040 only: Note that due to errata RP2040-E13, aborting a channel which has transfers in-flight (i.e. an individual read has taken place but the corresponding write has not), the ABORT status bit will clear prematurely, and subsequently the in-flight transfers will trigger a completion interrupt once they complete.
The effect of this is that you may see a spurious completion interrupt on the channel as a result of calling this method.
The calling code should be sure to ignore a completion IRQ as a result of this method. This may not require any additional work, as aborting a channel which may be about to complete, when you have a completion IRQ handler registered, is inherently race-prone, and so code is likely needed to disambiguate the two occurrences.
If that is not the case, but you do have a channel completion IRQ handler registered, you can simply disable/re-enable the IRQ around the call to this method as shown by this code fragment (using DMA IRQ0).
static void dma_channel_abort(uint channel)
Stop a DMA transfer.
Definition: dma.h:544
static void dma_channel_set_irq0_enabled(uint channel, bool enabled)
Enable single DMA channel's interrupt via DMA_IRQ_0.
Definition: dma.h:558
static void dma_channel_acknowledge_irq0(uint channel)
Acknowledge a channel IRQ, resetting it as the cause of DMA_IRQ_0.
Definition: dma.h:682
RP2350 only: Due to errata RP12350-E5 (see the RP2350 datasheet for further detail), it is necessary to clear the enable bit of the aborted channel and any chained channels prior to the abort to prevent re-triggering.
- Parameters
-