* arch/arm/src/sama5/sam_dmac.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __ARCH_ARM_SRC_SAMA5_SAM_DMAC_H
#define __ARCH_ARM_SRC_SAMA5_SAM_DMAC_H
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include "chip.h"
* Pre-processor Definitions
****************************************************************************/
#ifndef CONFIG_DEBUG_FEATURES
# undef CONFIG_DEBUG_DMA
#endif
* one side is the peripheral and the other is memory (however, the interface
* could still be used if, for example, both sides were memory although the
* naming would be awkward)
*/
#if defined(ATSAMA5D3)
* .... .... .... .... .... .... .... ..FF Configurable properties of
* the channel
* .... .... .... ...P PPPP PPPP PPPP PP.. Peripheral endpoint
* characteristics
* MMMM MMMM MMMM MMM. .... .... .... .... Memory endpoint
* characteristics
*/
*
* .... .... .... .... .... .... .... ..FF Configurable properties of
* the channel
*/
# define DMACH_FLAG_BURST_LARGEST 0
# define DMACH_FLAG_BURST_HALF 1
# define DMACH_FLAG_BURST_SINGLE 2
# define DMACH_FLAG_FIFOCFG_SHIFT (0)
# define DMACH_FLAG_FIFOCFG_MASK (3 << DMACH_FLAG_FIFOCFG_SHIFT)
# define DMACH_FLAG_FIFOCFG_LARGEST (DMACH_FLAG_BURST_LARGEST << DMACH_FLAG_FIFOCFG_SHIFT)
# define DMACH_FLAG_FIFOCFG_HALF (DMACH_FLAG_BURST_HALF << DMACH_FLAG_FIFOCFG_SHIFT)
# define DMACH_FLAG_FIFOCFG_SINGLE (DMACH_FLAG_BURST_SINGLE << DMACH_FLAG_FIFOCFG_SHIFT)
*
* .... .... .... ...P PPPP PPPP PPPP PP.. Peripheral endpoint
* characteristics
* .... .... .... .... .... .... IIII II.. Peripheral ID, range 0-49
* .... .... .... .... .... ...H .... .... HW Handshaking
* .... .... .... .... .... ..P. .... .... 0=memory; 1=peripheral
* .... .... .... .... .... NN.. .... .... Peripheral ABH layer number
* .... .... .... .... ..WW .... .... .... Peripheral width
* .... .... .... .... .A.. .... .... .... Auto-increment peripheral
* address
* .... .... .... ...S S... .... .... .... Peripheral chunk size
*/
# define DMACH_FLAG_PERIPHPID_SHIFT (2)
# define DMACH_FLAG_PERIPHPID_MASK (0x3f << DMACH_FLAG_PERIPHPID_SHIFT)
# define DMACH_FLAG_PERIPHPID(n) ((uint32_t)(n) << DMACH_FLAG_PERIPHPID_SHIFT)
# define DMACH_FLAG_PERIPHPID_MAX DMACH_FLAG_PERIPHPID_MASK
# define DMACH_FLAG_PERIPHH2SEL (1 << 8)
# define DMACH_FLAG_PERIPHISPERIPH (1 << 9)
# define DMACH_FLAG_PERIPHAHB_SHIFT (10)
# define DMACH_FLAG_PERIPHAHB_MASK (3 << DMACH_FLAG_PERIPHAHB_SHIFT)
# define DMACH_FLAG_PERIPHAHB_AHB_IF0 (0 << DMACH_FLAG_PERIPHAHB_SHIFT)
# define DMACH_FLAG_PERIPHAHB_AHB_IF1 (1 << DMACH_FLAG_PERIPHAHB_SHIFT)
# define DMACH_FLAG_PERIPHAHB_AHB_IF2 (2 << DMACH_FLAG_PERIPHAHB_SHIFT)
# define DMACH_FLAG_PERIPHWIDTH_SHIFT (12)
# define DMACH_FLAG_PERIPHWIDTH_MASK (3 << DMACH_FLAG_PERIPHWIDTH_SHIFT)
# define DMACH_FLAG_PERIPHWIDTH_8BITS (0 << DMACH_FLAG_PERIPHWIDTH_SHIFT)
# define DMACH_FLAG_PERIPHWIDTH_16BITS (1 << DMACH_FLAG_PERIPHWIDTH_SHIFT)
# define DMACH_FLAG_PERIPHWIDTH_32BITS (2 << DMACH_FLAG_PERIPHWIDTH_SHIFT)
# define DMACH_FLAG_PERIPHWIDTH_64BITS (3 << DMACH_FLAG_PERIPHWIDTH_SHIFT)
# define DMACH_FLAG_PERIPHINCREMENT (1 << 14)
# define DMACH_FLAG_PERIPHCHUNKSIZE_SHIFT (15)
# define DMACH_FLAG_PERIPHCHUNKSIZE_MASK (3 << DMACH_FLAG_PERIPHCHUNKSIZE_SHIFT)
# define DMACH_FLAG_PERIPHCHUNKSIZE_1 (0 << DMACH_FLAG_PERIPHCHUNKSIZE_SHIFT)
# define DMACH_FLAG_PERIPHCHUNKSIZE_2 (0 << DMACH_FLAG_PERIPHCHUNKSIZE_SHIFT)
# define DMACH_FLAG_PERIPHCHUNKSIZE_4 (1 << DMACH_FLAG_PERIPHCHUNKSIZE_SHIFT)
# define DMACH_FLAG_PERIPHCHUNKSIZE_8 (2 << DMACH_FLAG_PERIPHCHUNKSIZE_SHIFT)
# define DMACH_FLAG_PERIPHCHUNKSIZE_16 (3 << DMACH_FLAG_PERIPHCHUNKSIZE_SHIFT)
*
* MMMM MMMM MMMM MMM. .... .... .... .... Memory endpoint
* characteristics
* .... .... .III III. .... .... .... .... Memory/peripheral ID,
* range 0-49
* .... .... H... .... .... .... .... .... HW Handshaking
* .... ...P .... .... .... .... .... .... 0=memory; 1=peripheral
* .... .NN. .... .... .... .... .... .... Peripheral ABH layer number
* ...W W... .... .... .... .... .... .... Peripheral width
* ..A. .... .... .... .... .... .... .... Auto-increment peripheral
* address
* SS.. .... .... .... .... .... .... .... Peripheral chunk size
*/
# define DMACH_FLAG_MEMPID_SHIFT (17)
# define DMACH_FLAG_MEMPID_MASK (0x3f << DMACH_FLAG_MEMPID_SHIFT)
# define DMACH_FLAG_MEMPID(n) ((uint32_t)(n) << DMACH_FLAG_MEMPID_SHIFT)
# define DMACH_FLAG_MEMPID_MAX DMACH_FLAG_MEMPID_MASK
# define DMACH_FLAG_MEMH2SEL (1 << 23)
# define DMACH_FLAG_MEMISPERIPH (1 << 24)
# define DMACH_FLAG_MEMAHB_SHIFT (25)
# define DMACH_FLAG_MEMAHB_MASK (3 << DMACH_FLAG_MEMAHB_SHIFT)
# define DMACH_FLAG_MEMAHB_AHB_IF0 (0 << DMACH_FLAG_MEMAHB_SHIFT)
# define DMACH_FLAG_MEMAHB_AHB_IF1 (1 << DMACH_FLAG_MEMAHB_SHIFT)
# define DMACH_FLAG_MEMAHB_AHB_IF2 (2 << DMACH_FLAG_MEMAHB_SHIFT)
# define DMACH_FLAG_MEMWIDTH_SHIFT (27)
# define DMACH_FLAG_MEMWIDTH_MASK (3 << DMACH_FLAG_MEMWIDTH_SHIFT)
# define DMACH_FLAG_MEMWIDTH_8BITS (0 << DMACH_FLAG_MEMWIDTH_SHIFT)
# define DMACH_FLAG_MEMWIDTH_16BITS (1 << DMACH_FLAG_MEMWIDTH_SHIFT)
# define DMACH_FLAG_MEMWIDTH_32BITS (2 << DMACH_FLAG_MEMWIDTH_SHIFT)
# define DMACH_FLAG_MEMWIDTH_64BITS (3 << DMACH_FLAG_MEMWIDTH_SHIFT)
# define DMACH_FLAG_MEMINCREMENT (1 << 29)
# define DMACH_FLAG_MEMCHUNKSIZE_SHIFT (30)
# define DMACH_FLAG_MEMCHUNKSIZE_MASK (3 << DMACH_FLAG_MEMCHUNKSIZE_SHIFT)
# define DMACH_FLAG_MEMCHUNKSIZE_1 (0 << DMACH_FLAG_MEMCHUNKSIZE_SHIFT)
# define DMACH_FLAG_MEMCHUNKSIZE_2 (0 << DMACH_FLAG_MEMCHUNKSIZE_SHIFT)
# define DMACH_FLAG_MEMCHUNKSIZE_4 (1 << DMACH_FLAG_MEMCHUNKSIZE_SHIFT)
# define DMACH_FLAG_MEMCHUNKSIZE_8 (2 << DMACH_FLAG_MEMCHUNKSIZE_SHIFT)
# define DMACH_FLAG_MEMCHUNKSIZE_16 (3 << DMACH_FLAG_MEMCHUNKSIZE_SHIFT)
# define DMACH_FLAG_MEMBURST_1 (0)
# define DMACH_FLAG_MEMBURST_4 (0)
# define DMACH_FLAG_MEMBURST_8 (0)
# define DMACH_FLAG_MEMBURST_16 (0)
#elif defined(ATSAMA5D4)
* .... .... .... .... .... .... .... .... Configurable properties of
* the channel
* .... .... .... .... .PPP PPPP PPPP PPPP Peripheral endpoint
* characteristics
* .... .... .... MMMM .... .... .... .... Memory endpoint
* characteristics
*/
*
* .... .... .... .... .... .... .... .... Configurable properties
* of the channel
*
* NOTE: Many "peripheral" attributes are really "channel" attributes for
* the SAMA5D4's XDMAC since it does not support peripheral-to-peripheral
* DMA.
*/
# define DMACH_FLAG_FIFOCFG_LARGEST (0)
# define DMACH_FLAG_FIFOCFG_HALF (0)
# define DMACH_FLAG_FIFOCFG_SINGLE (0)
*
* .... .... .... .... .PPP PPPP PPPP PPPP Peripheral endpoint
* characteristics
* .... .... .... .... .... .... .III IIII Peripheral ID, range 0-67
* .... .... .... .... .... .... .... .... No HW Handshaking
* .... .... .... .... .... .... P... .... 0=memory; 1=peripheral
* .... .... .... .... .... ...N .... .... Peripheral ABH layer number
* .... .... .... .... .... .WW. .... .... Peripheral width
* .... .... .... .... .... A... .... .... Auto-increment peripheral
* address
* .... .... .... .... .SSS .... .... .... Peripheral chunk size
*/
# define DMACH_FLAG_PERIPHPID_SHIFT (0)
# define DMACH_FLAG_PERIPHPID_MASK (0x7f << DMACH_FLAG_PERIPHPID_SHIFT)
# define DMACH_FLAG_PERIPHPID(n) ((uint32_t)(n) << DMACH_FLAG_PERIPHPID_SHIFT)
# define DMACH_FLAG_PERIPHPID_MAX DMACH_FLAG_PERIPHPID_MASK
# define DMACH_FLAG_PERIPHH2SEL (0)
# define DMACH_FLAG_PERIPHISPERIPH (1 << 7)
# define DMACH_FLAG_PERIPHAHB_MASK (1 << 8)
# define DMACH_FLAG_PERIPHAHB_AHB_IF0 (0)
# define DMACH_FLAG_PERIPHAHB_AHB_IF1 DMACH_FLAG_PERIPHAHB_MASK
# define DMACH_FLAG_PERIPHWIDTH_SHIFT (9)
# define DMACH_FLAG_PERIPHWIDTH_MASK (3 << DMACH_FLAG_PERIPHWIDTH_SHIFT)
# define DMACH_FLAG_PERIPHWIDTH_8BITS (0 << DMACH_FLAG_PERIPHWIDTH_SHIFT)
# define DMACH_FLAG_PERIPHWIDTH_16BITS (1 << DMACH_FLAG_PERIPHWIDTH_SHIFT)
# define DMACH_FLAG_PERIPHWIDTH_32BITS (2 << DMACH_FLAG_PERIPHWIDTH_SHIFT)
# define DMACH_FLAG_PERIPHWIDTH_64BITS (3 << DMACH_FLAG_PERIPHWIDTH_SHIFT)
# define DMACH_FLAG_PERIPHINCREMENT (1 << 11)
# define DMACH_FLAG_PERIPHCHUNKSIZE_SHIFT (12)
# define DMACH_FLAG_PERIPHCHUNKSIZE_MASK (7 << DMACH_FLAG_PERIPHCHUNKSIZE_SHIFT)
# define DMACH_FLAG_PERIPHCHUNKSIZE_1 (0 << DMACH_FLAG_PERIPHCHUNKSIZE_SHIFT)
# define DMACH_FLAG_PERIPHCHUNKSIZE_2 (1 << DMACH_FLAG_PERIPHCHUNKSIZE_SHIFT)
# define DMACH_FLAG_PERIPHCHUNKSIZE_4 (2 << DMACH_FLAG_PERIPHCHUNKSIZE_SHIFT)
# define DMACH_FLAG_PERIPHCHUNKSIZE_8 (3 << DMACH_FLAG_PERIPHCHUNKSIZE_SHIFT)
# define DMACH_FLAG_PERIPHCHUNKSIZE_16 (4 << DMACH_FLAG_PERIPHCHUNKSIZE_SHIFT)
*
* .... .... .... MMMM .... .... .... .... Memory endpoint
* characteristics
* .... .... .... .... .... .... .... .... No memory peripheral ID,
* range 0-49
* .... .... .... .... .... .... .... .... No HW Handshaking
* .... .... .... .... .... .... .... .... No peripheral-to-peripheral
* .... .... .... ...N .... .... .... .... Memory ABH layer number
* .... .... .... .... .... .... .... .... No memory width
* .... .... .... ..A. .... .... .... .... Auto-increment memory address
* .... .... .... .... .... .... .... .... No memory chunk size
* .... .... .... BB.. .... .... .... .... Memory burst size
*/
# define DMACH_FLAG_MEMPID(n) (0)
# define DMACH_FLAG_MEMPID_MAX (0)
# define DMACH_FLAG_MEMH2SEL (0)
# define DMACH_FLAG_MEMISPERIPH (0)
# define DMACH_FLAG_MEMAHB_MASK (1 << 16)
# define DMACH_FLAG_MEMAHB_AHB_IF0 (0)
# define DMACH_FLAG_MEMAHB_AHB_IF1 DMACH_FLAG_MEMAHB_MASK
# define DMACH_FLAG_MEMWIDTH_8BITS (0)
# define DMACH_FLAG_MEMWIDTH_16BITS (0)
# define DMACH_FLAG_MEMWIDTH_32BITS (0)
# define DMACH_FLAG_MEMWIDTH_64BITS (0)
# define DMACH_FLAG_MEMINCREMENT (1 << 17)
# define DMACH_FLAG_MEMCHUNKSIZE_1 (0)
# define DMACH_FLAG_MEMCHUNKSIZE_2 (0)
# define DMACH_FLAG_MEMCHUNKSIZE_4 (0)
# define DMACH_FLAG_MEMCHUNKSIZE_8 (0)
# define DMACH_FLAG_MEMCHUNKSIZE_16 (0)
# define DMACH_FLAG_MEMBURST_SHIFT (18)
# define DMACH_FLAG_MEMBURST_MASK (3 << DMACH_FLAG_MEMBURST_SHIFT)
# define DMACH_FLAG_MEMBURST_1 (0 << DMACH_FLAG_MEMBURST_SHIFT)
# define DMACH_FLAG_MEMBURST_4 (1 << DMACH_FLAG_MEMBURST_SHIFT)
# define DMACH_FLAG_MEMBURST_8 (2 << DMACH_FLAG_MEMBURST_SHIFT)
# define DMACH_FLAG_MEMBURST_16 (3 << DMACH_FLAG_MEMBURST_SHIFT)
#elif defined(ATSAMA5D2)
* .... .... .... .... .... .... .... .... Configurable properties of
* the channel
* .... .... .... .... .PPP PPPP PPPP PPPP Peripheral endpoint
* characteristics
* .... .... .... MMMM .... .... .... .... Memory endpoint
* characteristics
*/
*
* .... .... .... .... .... .... .... .... Configurable properties
* of the channel
*
* NOTE: Many "peripheral" attributes are really "channel" attributes for
* the SAMA5D4's XDMAC since it does not support peripheral-to-peripheral
* DMA.
*/
# define DMACH_FLAG_FIFOCFG_LARGEST (0)
# define DMACH_FLAG_FIFOCFG_HALF (0)
# define DMACH_FLAG_FIFOCFG_SINGLE (0)
*
* .... .... .... .... .PPP PPPP PPPP PPPP Peripheral endpoint
* characteristics
* .... .... .... .... .... .... .III IIII Peripheral ID, range 0-67
* .... .... .... .... .... .... .... .... No HW Handshaking
* .... .... .... .... .... .... P... .... 0=memory; 1=peripheral
* .... .... .... .... .... ...N .... .... Peripheral ABH layer number
* .... .... .... .... .... .WW. .... .... Peripheral width
* .... .... .... .... .... A... .... .... Auto-increment peripheral
* address
* .... .... .... .... .SSS .... .... .... Peripheral chunk size
*/
# define DMACH_FLAG_PERIPHPID_SHIFT (0)
# define DMACH_FLAG_PERIPHPID_MASK (0x7f << DMACH_FLAG_PERIPHPID_SHIFT)
# define DMACH_FLAG_PERIPHPID(n) ((uint32_t)(n) << DMACH_FLAG_PERIPHPID_SHIFT)
# define DMACH_FLAG_PERIPHPID_MAX DMACH_FLAG_PERIPHPID_MASK
# define DMACH_FLAG_PERIPHH2SEL (0)
# define DMACH_FLAG_PERIPHISPERIPH (1 << 7)
# define DMACH_FLAG_PERIPHISMEMORY (0 << 7)
# define DMACH_FLAG_PERIPHAHB_MASK (1 << 8)
# define DMACH_FLAG_PERIPHAHB_AHB_IF0 (0)
# define DMACH_FLAG_PERIPHAHB_AHB_IF1 DMACH_FLAG_PERIPHAHB_MASK
# define DMACH_FLAG_PERIPHWIDTH_SHIFT (9)
# define DMACH_FLAG_PERIPHWIDTH_MASK (3 << DMACH_FLAG_PERIPHWIDTH_SHIFT)
# define DMACH_FLAG_PERIPHWIDTH_8BITS (0 << DMACH_FLAG_PERIPHWIDTH_SHIFT)
# define DMACH_FLAG_PERIPHWIDTH_16BITS (1 << DMACH_FLAG_PERIPHWIDTH_SHIFT)
# define DMACH_FLAG_PERIPHWIDTH_32BITS (2 << DMACH_FLAG_PERIPHWIDTH_SHIFT)
# define DMACH_FLAG_PERIPHWIDTH_64BITS (3 << DMACH_FLAG_PERIPHWIDTH_SHIFT)
# define DMACH_FLAG_PERIPHINCREMENT (1 << 11)
# define DMACH_FLAG_PERIPHCHUNKSIZE_SHIFT (12)
# define DMACH_FLAG_PERIPHCHUNKSIZE_MASK (7 << DMACH_FLAG_PERIPHCHUNKSIZE_SHIFT)
# define DMACH_FLAG_PERIPHCHUNKSIZE_1 (0 << DMACH_FLAG_PERIPHCHUNKSIZE_SHIFT)
# define DMACH_FLAG_PERIPHCHUNKSIZE_2 (1 << DMACH_FLAG_PERIPHCHUNKSIZE_SHIFT)
# define DMACH_FLAG_PERIPHCHUNKSIZE_4 (2 << DMACH_FLAG_PERIPHCHUNKSIZE_SHIFT)
# define DMACH_FLAG_PERIPHCHUNKSIZE_8 (3 << DMACH_FLAG_PERIPHCHUNKSIZE_SHIFT)
# define DMACH_FLAG_PERIPHCHUNKSIZE_16 (4 << DMACH_FLAG_PERIPHCHUNKSIZE_SHIFT)
*
* .... .... .... MMMM .... .... .... .... Memory endpoint
* characteristics
* .... .... .... .... .... .... .... .... No memory peripheral ID,
* range 0-49
* .... .... .... .... .... .... .... .... No HW Handshaking
* .... .... .... .... .... .... .... .... No peripheral-to-peripheral
* .... .... .... ...N .... .... .... .... Memory ABH layer number
* .... .... .... .... .... .... .... .... No memory width
* .... .... .... ..A. .... .... .... .... Auto-increment memory address
* .... .... .... .... .... .... .... .... No memory chunk size
* .... .... .... BB.. .... .... .... .... Memory burst size
*/
# define DMACH_FLAG_MEMPID(n) (0)
# define DMACH_FLAG_MEMPID_MAX (0)
# define DMACH_FLAG_MEMH2SEL (0)
# define DMACH_FLAG_MEMISPERIPH (0)
# define DMACH_FLAG_MEMAHB_MASK (1 << 16)
# define DMACH_FLAG_MEMAHB_AHB_IF0 (0)
# define DMACH_FLAG_MEMAHB_AHB_IF1 DMACH_FLAG_MEMAHB_MASK
# define DMACH_FLAG_MEMWIDTH_8BITS (0)
# define DMACH_FLAG_MEMWIDTH_16BITS (0)
# define DMACH_FLAG_MEMWIDTH_32BITS (0)
# define DMACH_FLAG_MEMWIDTH_64BITS (0)
# define DMACH_FLAG_MEMINCREMENT (1 << 17)
# define DMACH_FLAG_MEMCHUNKSIZE_1 (0)
# define DMACH_FLAG_MEMCHUNKSIZE_2 (0)
# define DMACH_FLAG_MEMCHUNKSIZE_4 (0)
# define DMACH_FLAG_MEMCHUNKSIZE_8 (0)
# define DMACH_FLAG_MEMCHUNKSIZE_16 (0)
# define DMACH_FLAG_MEMBURST_SHIFT (18)
# define DMACH_FLAG_MEMBURST_MASK (3 << DMACH_FLAG_MEMBURST_SHIFT)
# define DMACH_FLAG_MEMBURST_1 (0 << DMACH_FLAG_MEMBURST_SHIFT)
# define DMACH_FLAG_MEMBURST_4 (1 << DMACH_FLAG_MEMBURST_SHIFT)
# define DMACH_FLAG_MEMBURST_8 (2 << DMACH_FLAG_MEMBURST_SHIFT)
# define DMACH_FLAG_MEMBURST_16 (3 << DMACH_FLAG_MEMBURST_SHIFT)
#endif
* Public Types
****************************************************************************/
typedef void *DMA_HANDLE;
typedef void (*dma_callback_t)(DMA_HANDLE handle, void *arg, int result);
* is selected
*/
#ifdef CONFIG_DEBUG_DMA
#if defined(CONFIG_SAMA5_DMAC0) || defined(CONFIG_SAMA5_DMAC1)
struct sam_dmaregs_s
{
uint32_t gcfg;
uint32_t en;
uint32_t sreq;
uint32_t creq;
uint32_t last;
uint32_t ebcimr;
uint32_t ebcisr;
uint32_t chsr;
uint32_t wpmr;
uint32_t wpsr;
uint32_t saddr;
uint32_t daddr;
uint32_t dscr;
uint32_t ctrla;
uint32_t ctrlb;
uint32_t cfg;
uint32_t spip;
uint32_t dpip;
};
#elif defined(CONFIG_SAMA5_XDMAC0) || defined(CONFIG_SAMA5_XDMAC1)
struct sam_dmaregs_s
{
uint32_t gtype;
uint32_t gcfg;
uint32_t gwac;
uint32_t gim;
uint32_t gis;
uint32_t gs;
uint32_t grs;
uint32_t gws;
uint32_t gsws;
uint32_t cim;
uint32_t cis;
uint32_t csa;
uint32_t cda;
uint32_t cnda;
uint32_t cndc;
uint32_t cubc;
uint32_t cbc;
uint32_t cc;
uint32_t cdsmsp;
uint32_t csus;
uint32_t cdus;
};
#endif
#endif
* Inline Functions
****************************************************************************/
#ifndef __ASSEMBLY__
* Public Data
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
* Public Function Prototypes
****************************************************************************/
* Name: sam_dmachannel
*
* Description:
* Allocate a DMA channel.
* This function sets aside a DMA channel then gives the
* caller exclusive access to the DMA channel.
*
* The naming convention in all of the DMA interfaces is that one side is
* the 'peripheral' and the other is 'memory'. However, the interface
* could still be used if, for example, both sides were memory although the
* naming would be awkward.
*
* Returned Value:
* If a DMA channel is available, this function returns a non-NULL, void*
* DMA channel handle. NULL is returned on any failure.
*
****************************************************************************/
DMA_HANDLE sam_dmachannel(uint8_t dmacno, uint32_t chflags);
* Name: sam_dmaconfig
*
* Description:
* There are two channel usage models:
* (1) The channel is allocated and configured in one step. This is the
* typical case where a DMA channel performs a constant role.
* The alternative is (2) where the DMA channel is reconfigured on the fly.
* In this case, the chflags provided to sam_dmachannel are not used and
* sam_dmaconfig() is called before each DMA to configure the DMA channel
* appropriately.
*
* Returned Value:
* None
*
****************************************************************************/
void sam_dmaconfig(DMA_HANDLE handle, uint32_t chflags);
* Name: sam_dmafree
*
* Description:
* Release a DMA channel.
* NOTE: The 'handle' used in this argument must NEVER be used again until
* sam_dmachannel() is called again to re-gain a valid handle.
*
* Returned Value:
* None
*
****************************************************************************/
void sam_dmafree(DMA_HANDLE handle);
* Name: sam_dmatxsetup
*
* Description:
* Configure DMA for transmit of one buffer (memory to peripheral). This
* function may be called multiple times to handle large and/or
* discontinuous transfers. Calls to sam_dmatxsetup() and sam_dmarxsetup()
* must not be intermixed on the same transfer, however.
*
****************************************************************************/
int sam_dmatxsetup(DMA_HANDLE handle,
uint32_t paddr, uint32_t maddr, size_t nbytes);
* Name: sam_dmarxsetup
*
* Description:
* Configure DMA for receipt of one buffer (peripheral to memory). This
* function may be called multiple times to handle large and/or
* discontinuous transfers. Calls to sam_dmatxsetup() and sam_dmarxsetup()
* must not be intermixed on the same transfer, however.
*
****************************************************************************/
int sam_dmarxsetup(DMA_HANDLE handle,
uint32_t paddr, uint32_t maddr, size_t nbytes);
* Name: sam_dmastart
*
* Description:
* Start the DMA transfer
*
****************************************************************************/
int sam_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg);
* Name: sam_dmastop
*
* Description:
* Cancel the DMA.
* After sam_dmastop() is called, the DMA channel is reset and
* sam_dmarx/txsetup() must be called before sam_dmastart() can be called
* again
*
****************************************************************************/
void sam_dmastop(DMA_HANDLE handle);
* Name: sam_dmasample
*
* Description:
* Sample DMA register contents
*
****************************************************************************/
#ifdef CONFIG_DEBUG_DMA
void sam_dmasample(DMA_HANDLE handle, struct sam_dmaregs_s *regs);
#else
# define sam_dmasample(handle,regs)
#endif
* Name: sam_dmadump
*
* Description:
* Dump previously sampled DMA register contents
*
****************************************************************************/
#ifdef CONFIG_DEBUG_DMA
void sam_dmadump(DMA_HANDLE handle,
const struct sam_dmaregs_s *regs, const char *msg);
#else
# define sam_dmadump(handle,regs,msg)
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif
#endif