This driver for Atmel® | SMART ARM®-based microcontrollers provides an interface for the configuration and management of the the Peripheral Direct Memory Access (DMA) Controller (PDC) module.
The PDC transfers data between on-chip serial peripherals and the on and/or off-chip memories. The link between the PDC and a serial peripheral is operated by the AHB to ABP bridge.
This module:
Devices from the following series can use this module:
The outline of this documentation is as follows:
There are no prerequisites for this module.
The user interface of each PDC channel is integrated into the user interface of the peripheral it serves. The user interface of unidirectional channels (receive only or transmit only), contains two 32-bit memory pointers and two 16-bit counters, one set (pointer, counter) for current transfer and one set (pointer, counter) for next transfer. The bidirectional channel user interface contains four 32-bit memory pointers and four 16-bit counters. Each set (pointer, counter) is used by current transmit, next transmit, current receive and next receive. Using the PDC removes processor overhead by reducing its intervention during the transfer. This significantly reduces the number of clock cycles required for a data transfer, which improves microcontroller performance. To launch a transfer, the peripheral triggers its associated PDC channels by using transmit and receive signals. When the programmed data is transferred, an end of transfer interrupt is generated by the peripheral itself.
There are no special considerations for this module.
For extra information, see Extra Information for Peripheral DMA Controller. This includes:
For a list of examples related to this driver, see Examples for Peripheral DMA Controller.
Data Structures | |
struct | pdc_packet |
PDC data packet for transfer. More... | |
Typedefs | |
typedef struct pdc_packet | pdc_packet_t |
PDC data packet for transfer. More... | |
Functions | |
void | pdc_disable_transfer (Pdc *p_pdc, uint32_t ul_controls) |
Disable PDC transfers (TX and/or RX). More... | |
void | pdc_enable_transfer (Pdc *p_pdc, uint32_t ul_controls) |
Enable PDC transfers (TX and/or RX). More... | |
uint32_t | pdc_read_rx_counter (Pdc *p_pdc) |
Return Receive Counter Register (RCR) value. More... | |
uint32_t | pdc_read_rx_next_counter (Pdc *p_pdc) |
Return Receive Next Counter Register (RNCR) value. More... | |
uint32_t | pdc_read_rx_next_ptr (Pdc *p_pdc) |
Return Receive Next Pointer Register (RNPR) value. More... | |
uint32_t | pdc_read_rx_ptr (Pdc *p_pdc) |
Return Receive Pointer Register (RPR) value. More... | |
uint32_t | pdc_read_status (Pdc *p_pdc) |
Read PDC status. More... | |
uint32_t | pdc_read_tx_counter (Pdc *p_pdc) |
Return Transmit Counter Register (TCR) value. More... | |
uint32_t | pdc_read_tx_next_counter (Pdc *p_pdc) |
Return Transmit Next Counter Register (TNCR) value. More... | |
uint32_t | pdc_read_tx_next_ptr (Pdc *p_pdc) |
Return Transmit Next Pointer Register (TNPR) value. More... | |
uint32_t | pdc_read_tx_ptr (Pdc *p_pdc) |
Return Transmit Pointer Register (TPR) value. More... | |
void | pdc_rx_clear_cnt (Pdc *p_pdc) |
Clear PDC buffer receive counter. More... | |
void | pdc_rx_init (Pdc *p_pdc, pdc_packet_t *p_packet, pdc_packet_t *p_next_packet) |
Configure PDC for data receive. More... | |
void | pdc_tx_init (Pdc *p_pdc, pdc_packet_t *p_packet, pdc_packet_t *p_next_packet) |
Configure PDC for data transmit. More... | |
typedef struct pdc_packet pdc_packet_t |
PDC data packet for transfer.
void pdc_disable_transfer | ( | Pdc * | p_pdc, |
uint32_t | ul_controls | ||
) |
Disable PDC transfers (TX and/or RX).
[out] | p_pdc | Device structure pointer |
[in] | ul_controls | Transfer directions (bit PERIPH_PTCR_TXTDIS, bit PERIPH_PTCR_TXTDIS) |
References Assert.
Referenced by nm_bus_init().
void pdc_enable_transfer | ( | Pdc * | p_pdc, |
uint32_t | ul_controls | ||
) |
Enable PDC transfers (TX and/or RX).
[out] | p_pdc | Device structure pointer |
[in] | ul_controls | Transfer directions (bit PERIPH_PTCR_RXTEN and bit PERIPH_PTCR_TXTEN) |
References Assert.
uint32_t pdc_read_rx_counter | ( | Pdc * | p_pdc | ) |
Return Receive Counter Register (RCR) value.
[in] | p_pdc | Device structure pointer |
References Assert.
uint32_t pdc_read_rx_next_counter | ( | Pdc * | p_pdc | ) |
Return Receive Next Counter Register (RNCR) value.
[in] | p_pdc | Device structure pointer |
References Assert.
uint32_t pdc_read_rx_next_ptr | ( | Pdc * | p_pdc | ) |
Return Receive Next Pointer Register (RNPR) value.
[in] | p_pdc | Device structure pointer |
References Assert.
uint32_t pdc_read_rx_ptr | ( | Pdc * | p_pdc | ) |
Return Receive Pointer Register (RPR) value.
[in] | p_pdc | Device structure pointer |
References Assert.
uint32_t pdc_read_status | ( | Pdc * | p_pdc | ) |
Read PDC status.
[in] | p_pdc | Device structure pointer |
Name | Description | Bit |
---|---|---|
RXTEN | Receiver Transfer Enabled | 8 |
TXTEN | Transmitter Transfer Enabled | 1 |
References Assert.
uint32_t pdc_read_tx_counter | ( | Pdc * | p_pdc | ) |
Return Transmit Counter Register (TCR) value.
[in] | p_pdc | Device structure pointer |
References Assert.
uint32_t pdc_read_tx_next_counter | ( | Pdc * | p_pdc | ) |
Return Transmit Next Counter Register (TNCR) value.
[in] | p_pdc | Device structure pointer |
References Assert.
uint32_t pdc_read_tx_next_ptr | ( | Pdc * | p_pdc | ) |
Return Transmit Next Pointer Register (TNPR) value.
[in] | p_pdc | Device structure pointer |
References Assert.
uint32_t pdc_read_tx_ptr | ( | Pdc * | p_pdc | ) |
Return Transmit Pointer Register (TPR) value.
[in] | p_pdc | Device structure pointer |
References Assert.
void pdc_rx_clear_cnt | ( | Pdc * | p_pdc | ) |
void pdc_rx_init | ( | Pdc * | p_pdc, |
pdc_packet_t * | p_packet, | ||
pdc_packet_t * | p_next_packet | ||
) |
Configure PDC for data receive.
[out] | p_pdc | Device structure pointer |
[in] | p_packet | Pointer to packet information for current buffer register set. Use NULL to leave unaltered. |
[in] | p_next_packet | Pointer to packet information for next buffer register set. Use NULL to leave unaltered. |
References Assert, pdc_packet::ul_addr, and pdc_packet::ul_size.
Referenced by nm_spi_rw().
void pdc_tx_init | ( | Pdc * | p_pdc, |
pdc_packet_t * | p_packet, | ||
pdc_packet_t * | p_next_packet | ||
) |
Configure PDC for data transmit.
[out] | p_pdc | Device structure pointer |
[in] | p_packet | Pointer to packet information for current buffer register set. Use NULL to leave unaltered. |
[in] | p_next_packet | Pointer to packet information for next buffer register set. Use NULL to leave unaltered. |
References Assert, pdc_packet::ul_addr, and pdc_packet::ul_size.
Referenced by nm_spi_rw().