@web-font-path: "roboto-debian.css";
v2.2.0 (RP2040)
Loading...
Searching...
No Matches
dma.h File Reference
`#include "pico.h"`
`#include "hardware/structs/dma.h"`
`#include "hardware/regs/dreq.h"`
`#include "pico/assert.h"`
`#include "hardware/regs/intctrl.h"`
Include dependency graph for dma.h:

Go to the source code of this file.

## Data Structures

struct | dma_channel_config_t
| Opaque representation of a DMA channel configuration that can be later applied to a hardware DMA channel. More...

## Macros

#define | PARAM_ASSERTIONS_ENABLED_HARDWARE_DMA 0
#define | DMA_IRQ_NUM(irq_index)
| Returns the irq_num_t for the nth DMA interrupt.
#define | DMA_ADDRESS_UPDATE_TYPE_TO_DMA_CH_CTRL_READ_BITS(u)
#define | DMA_ADDRESS_UPDATE_TYPE_TO_DMA_CH_CTRL_WRITE_BITS(u)
#define | DMA_CH_CTRL_ALL_ADDRESS_UPDATE_READ_BITS DMA_CH0_CTRL_TRIG_INCR_READ_BITS
#define | DMA_CH_CTRL_ALL_ADDRESS_UPDATE_WRITE_BITS DMA_CH0_CTRL_TRIG_INCR_WRITE_BITS

## Typedefs

typedef enum dma_channel_transfer_size | dma_channel_transfer_size_t
| Enumeration of available DMA channel transfer sizes.
typedef enum dma_address_update_type | dma_address_update_type_t
| Enumeration of types of updates that can be made to the DMA read or write address after each transfer.
typedef dma_channel_config_t | dma_channel_config

## Enumerations

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...
enum | dma_address_update_type { DMA_ADDRESS_UPDATE_NONE = 0 , DMA_ADDRESS_UPDATE_INCREMENT = 1 }
| Enumeration of types of updates that can be made to the DMA read or write address after each transfer. More...

## Functions

static void | check_dma_channel_param (__unused uint channel)
static void | check_dma_timer_param (__unused uint timer_num)
static dma_channel_hw_t * | dma_channel_hw_addr (uint channel)
void | dma_channel_claim (uint channel)
| Mark a dma channel as used.
void | dma_claim_mask (uint32_t channel_mask)
| Mark multiple dma channels as used.
void | dma_channel_unclaim (uint channel)
| Mark a dma channel as no longer used.
void | dma_unclaim_mask (uint32_t channel_mask)
| Mark multiple dma channels as no longer used.
int | dma_claim_unused_channel (bool required)
| Claim a free dma channel.
bool | dma_channel_is_claimed (uint channel)
| Determine if a dma channel is claimed.
static void | channel_config_set_read_address_update_type (dma_channel_config_t *c, dma_address_update_type_t update_type)
| Set DMA channel read address update type in a channel configuration object.
static void | channel_config_set_write_address_update_type (dma_channel_config_t *c, dma_address_update_type_t update_type)
| Set DMA channel write address update type in a channel configuration object.
static void | channel_config_set_read_increment (dma_channel_config_t *c, bool incr)
| Set DMA channel read increment in a channel configuration object.
static void | channel_config_set_write_increment (dma_channel_config_t *c, bool incr)
| Set DMA channel write increment in a channel configuration object.
static void | channel_config_set_dreq (dma_channel_config_t *c, uint dreq)
| Select a transfer request signal in a channel configuration object.
static void | channel_config_set_chain_to (dma_channel_config_t *c, uint chain_to)
| Set DMA channel chain_to channel in a channel configuration object.
static void | channel_config_set_transfer_data_size (dma_channel_config_t *c, dma_channel_transfer_size_t size)
| Set the size of each DMA bus transfer in a channel configuration object.
static void | channel_config_set_ring (dma_channel_config_t *c, bool write, uint size_bits)
| Set address wrapping parameters in a channel configuration object.
static void | channel_config_set_bswap (dma_channel_config_t *c, bool bswap)
| Set DMA byte swapping config in a channel configuration object.
static void | channel_config_set_irq_quiet (dma_channel_config_t *c, bool irq_quiet)
| Set IRQ quiet mode in a channel configuration object.
static void | channel_config_set_high_priority (dma_channel_config_t *c, bool high_priority)
| Set the channel priority in a channel configuration object.
static void | channel_config_set_enable (dma_channel_config_t *c, bool enable)
| Enable/Disable the DMA channel in a channel configuration object.
static void | channel_config_set_sniff_enable (dma_channel_config_t *c, bool sniff_enable)
| Enable access to channel by sniff hardware in a channel configuration object.
static dma_channel_config_t | dma_channel_get_default_config (uint channel)
| Get the default channel configuration for a given channel.
static dma_channel_config_t | dma_get_channel_config (uint channel)
| Get the current configuration for the specified channel.
static uint32_t | channel_config_get_ctrl_value (const dma_channel_config_t *config)
| Get the raw configuration register from a channel configuration.
static void | dma_channel_set_config (uint channel, const dma_channel_config_t *config, bool trigger)
| Set a channel configuration.
static void | dma_channel_set_read_addr (uint channel, const volatile void *read_addr, bool trigger)
| Set the DMA initial read address.
static void | dma_channel_set_write_addr (uint channel, volatile void *write_addr, bool trigger)
| Set the DMA initial write address.
static uint32_t | dma_encode_transfer_count (uint transfer_count)
| Encode the specified transfer length into an "encoded_transfer_length" value suitable for the referenced methods.
static uint32_t | dma_encode_transfer_count_with_self_trigger (uint transfer_count)
| Encode the specified transfer length, along with a flag to indicate the DMA transfer should be self-triggering, into an "encoded_transfer_length" value suitable for the referenced methods.
static uint32_t | dma_encode_endless_transfer_count (void)
| Return an endless transfer as an "encoded_transfer_length" value suitable for the referenced methods.
static void | dma_channel_set_transfer_count (uint channel, uint32_t encoded_transfer_count, bool trigger)
| Set the number of bus transfers the channel will do.
static void | dma_channel_set_trans_count (uint channel, uint32_t trans_count, bool trigger)
static void | dma_channel_configure (uint channel, const dma_channel_config_t *config, volatile void *write_addr, const volatile void *read_addr, uint32_t encoded_transfer_count, bool trigger)
| Configure all DMA parameters and optionally start transfer.
static void | dma_channel_transfer_from_buffer_now (uint channel, const volatile void *read_addr, uint32_t encoded_transfer_count)
| Start a DMA transfer from a buffer immediately.
static void | dma_channel_transfer_to_buffer_now (uint channel, volatile void *write_addr, uint32_t encoded_transfer_count)
| Start a DMA transfer to a buffer immediately.
static void | dma_start_channel_mask (uint32_t chan_mask)
| Start one or more channels simultaneously.
static void | dma_channel_start (uint channel)
| Start a single DMA channel.
static void | dma_channel_abort (uint channel)
| Stop a DMA transfer.
static void | dma_channel_set_irq0_enabled (uint channel, bool enabled)
| Enable single DMA channel's interrupt via DMA_IRQ_0.
static void | dma_set_irq0_channel_mask_enabled (uint32_t channel_mask, bool enabled)
| Enable multiple DMA channels' interrupts via DMA_IRQ_0.
static void | dma_channel_set_irq1_enabled (uint channel, bool enabled)
| Enable single DMA channel's interrupt via DMA_IRQ_1.
static void | dma_set_irq1_channel_mask_enabled (uint32_t channel_mask, bool enabled)
| Enable multiple DMA channels' interrupts via DMA_IRQ_1.
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.
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.
static bool | dma_channel_get_irq0_status (uint channel)
| Determine if a particular channel is a cause of DMA_IRQ_0.
static bool | dma_channel_get_irq1_status (uint channel)
| Determine if a particular channel is a cause of DMA_IRQ_1.
static bool | dma_irqn_get_channel_status (uint irq_index, uint channel)
| Determine if a particular channel is a cause of DMA_IRQ_N.
static void | dma_channel_acknowledge_irq0 (uint channel)
| Acknowledge a channel IRQ, resetting it as the cause of DMA_IRQ_0.
static void | dma_channel_acknowledge_irq1 (uint channel)
| Acknowledge a channel IRQ, resetting it as the cause of DMA_IRQ_1.
static void | dma_irqn_acknowledge_channel (uint irq_index, uint channel)
| Acknowledge a channel IRQ, resetting it as the cause of DMA_IRQ_N.
static bool | dma_channel_is_busy (uint channel)
| Check if DMA channel is busy.
static void | dma_channel_wait_for_finish_blocking (uint channel)
| Wait for a DMA channel transfer to complete.
static void | dma_sniffer_enable (uint channel, uint mode, bool force_channel_enable)
| Enable the DMA sniffing targeting the specified channel.
static void | dma_sniffer_set_byte_swap_enabled (bool swap)
| Enable the Sniffer byte swap function.
static void | dma_sniffer_set_output_invert_enabled (bool invert)
| Enable the Sniffer output invert function.
static void | dma_sniffer_set_output_reverse_enabled (bool reverse)
| Enable the Sniffer output bit reversal function.
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.
static uint32_t | dma_sniffer_get_data_accumulator (void)
| Get the sniffer's data accumulator value.
void | dma_timer_claim (uint timer)
| Mark a dma timer as used.
void | dma_timer_unclaim (uint timer)
| Mark a dma timer as no longer used.
int | dma_claim_unused_timer (bool required)
| Claim a free dma timer.
bool | dma_timer_is_claimed (uint timer)
| Determine if a dma timer is claimed.
static void | dma_timer_set_fraction (uint timer, uint16_t numerator, uint16_t denominator)
| Set the multiplier for the given DMA timer.
static uint | dma_get_timer_dreq (uint timer_num)
| Return the DREQ number for a given DMA timer.
static int | dma_get_irq_num (uint irq_index)
| Return DMA_IRQ_<irqn>.
void | dma_channel_cleanup (uint channel)
| Performs DMA channel cleanup after use.
void | print_dma_ctrl (dma_channel_hw_t *channel)

## Macro Definition Documentation

## DMA_ADDRESS_UPDATE_TYPE_TO_DMA_CH_CTRL_READ_BITS

#define DMA_ADDRESS_UPDATE_TYPE_TO_DMA_CH_CTRL_READ_BITS | ( |  | u | ) |

Value:
(((u)&1) << DMA_CH0_CTRL_TRIG_INCR_READ_LSB)

## DMA_ADDRESS_UPDATE_TYPE_TO_DMA_CH_CTRL_WRITE_BITS

#define DMA_ADDRESS_UPDATE_TYPE_TO_DMA_CH_CTRL_WRITE_BITS | ( |  | u | ) |

Value:
(((u)&1) << DMA_CH0_CTRL_TRIG_INCR_WRITE_LSB)