mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-20 01:58:32 -04:00
Add new demo files.
This commit is contained in:
parent
b5ab3cd823
commit
151c72ab7c
125 changed files with 40038 additions and 0 deletions
355
Demo/CORTEX_AT91SAM3U256_IAR/AT91Lib/peripherals/dma/dma.c
Normal file
355
Demo/CORTEX_AT91SAM3U256_IAR/AT91Lib/peripherals/dma/dma.c
Normal file
|
@ -0,0 +1,355 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2008, Atmel Corporation
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the disclaimer below.
|
||||
*
|
||||
* Atmel's name may not be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Headers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#include "dma.h"
|
||||
#include <utility/assert.h>
|
||||
#include <utility/trace.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Global functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Configure a DMAC peripheral
|
||||
//------------------------------------------------------------------------------
|
||||
void DMA_Config(unsigned int flag)
|
||||
{
|
||||
AT91C_BASE_HDMA->HDMA_GCFG = flag;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Enables a DMAC peripheral
|
||||
//------------------------------------------------------------------------------
|
||||
void DMA_Enable(void)
|
||||
{
|
||||
AT91C_BASE_HDMA->HDMA_EN = AT91C_HDMA_ENABLE;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Disables DMAC peripheral
|
||||
//------------------------------------------------------------------------------
|
||||
void DMA_Disable(void)
|
||||
{
|
||||
AT91C_BASE_HDMA->HDMA_EN = ~(AT91C_HDMA_ENABLE);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Enable DMA interrupt
|
||||
/// \param flag IT to be enabled
|
||||
//-----------------------------------------------------------------------------
|
||||
void DMA_EnableIt (unsigned int flag)
|
||||
{
|
||||
AT91C_BASE_HDMA->HDMA_EBCIER = flag;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Disable DMA interrupt
|
||||
/// \param flag IT to be enabled
|
||||
//-----------------------------------------------------------------------------
|
||||
void DMA_DisableIt (unsigned int flag)
|
||||
{
|
||||
AT91C_BASE_HDMA->HDMA_EBCIDR = flag;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Return DMA Interrupt Status
|
||||
//-----------------------------------------------------------------------------
|
||||
unsigned int DMA_GetStatus(void)
|
||||
{
|
||||
return (AT91C_BASE_HDMA->HDMA_EBCISR);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Return DMA Interrupt Mask Status
|
||||
//-----------------------------------------------------------------------------
|
||||
unsigned int DMA_GetInterruptMask(void)
|
||||
{
|
||||
return (AT91C_BASE_HDMA->HDMA_EBCIMR);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Returns the current status register of the given DMA peripheral, but
|
||||
/// masking interrupt sources which are not currently enabled.
|
||||
//-----------------------------------------------------------------------------
|
||||
unsigned int DMA_GetMaskedStatus(void)
|
||||
{
|
||||
unsigned int status;
|
||||
status = AT91C_BASE_HDMA->HDMA_EBCISR;
|
||||
status &= AT91C_BASE_HDMA->HDMA_EBCIMR;
|
||||
return status;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Enables DMAC channel
|
||||
/// \param channel Particular channel number.
|
||||
//------------------------------------------------------------------------------
|
||||
void DMA_EnableChannel(unsigned int channel)
|
||||
{
|
||||
ASSERT(channel < DMA_CHANNEL_NUM, "this channel does not exist");
|
||||
AT91C_BASE_HDMA->HDMA_CHER |= DMA_ENA << channel;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Disables a DMAC channel
|
||||
/// \param channel Particular channel number.
|
||||
//------------------------------------------------------------------------------
|
||||
void DMA_DisableChannel(unsigned int channel)
|
||||
{
|
||||
ASSERT(channel < DMA_CHANNEL_NUM, "this channel does not exist");
|
||||
AT91C_BASE_HDMA->HDMA_CHDR |= DMA_DIS << channel;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Resume DMAC channel from an stall state.
|
||||
/// \param channel Particular channel number.
|
||||
//------------------------------------------------------------------------------
|
||||
void DMA_KeeponChannel(unsigned int channel)
|
||||
{
|
||||
ASSERT(channel < DMA_CHANNEL_NUM, "this channel does not exist");
|
||||
AT91C_BASE_HDMA->HDMA_CHER |= DMA_KEEPON << channel;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Clear automatic mode for multi-buffer transfer.
|
||||
/// \param channel Particular channel number.
|
||||
//------------------------------------------------------------------------------
|
||||
void DMA_ClearAutoMode(unsigned int channel)
|
||||
{
|
||||
ASSERT(channel < DMA_CHANNEL_NUM, "this channel does not exist");
|
||||
AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CTRLB &= 0x7FFFFFFF;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Return DMAC channel status
|
||||
//------------------------------------------------------------------------------
|
||||
unsigned int DMA_GetChannelStatus(void)
|
||||
{
|
||||
return( AT91C_BASE_HDMA->HDMA_CHSR);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Set DMA source address used by a HDMA channel.
|
||||
/// \param channel Particular channel number.
|
||||
/// \param sources sources address.
|
||||
//-----------------------------------------------------------------------------
|
||||
void DMA_SetSourceAddr(unsigned char channel, unsigned int address)
|
||||
{
|
||||
ASSERT(channel < DMA_CHANNEL_NUM, "this channel does not exist");
|
||||
AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_SADDR = address;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Set DMA destination address used by a HDMA channel.
|
||||
/// \param channel Particular channel number.
|
||||
/// \param sources destination address.
|
||||
//-----------------------------------------------------------------------------
|
||||
void DMA_SetDestinationAddr(unsigned char channel, unsigned int address)
|
||||
{
|
||||
ASSERT(channel < DMA_CHANNEL_NUM, "this channel does not exist");
|
||||
AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_DADDR = address;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Set DMA descriptor address used by a HDMA channel.
|
||||
/// \param channel Particular channel number.
|
||||
/// \param sources destination address.
|
||||
//-----------------------------------------------------------------------------
|
||||
void DMA_SetDescriptorAddr(unsigned char channel, unsigned int address)
|
||||
{
|
||||
ASSERT(channel < DMA_CHANNEL_NUM, "this channel does not exist");
|
||||
AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_DSCR = address ;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Set DMA control A register used by a HDMA channel.
|
||||
/// \param channel Particular channel number.
|
||||
/// \param size Dma transfer size in byte.
|
||||
/// \param sourceWidth Single transfer width for source.
|
||||
/// \param destWidth Single transfer width for destination.
|
||||
/// \param done Transfer done field.
|
||||
//-----------------------------------------------------------------------------
|
||||
void DMA_SetSourceBufferSize(unsigned char channel,
|
||||
unsigned int size,
|
||||
unsigned char sourceWidth,
|
||||
unsigned char destWidth,
|
||||
unsigned char done)
|
||||
{
|
||||
ASSERT(channel < DMA_CHANNEL_NUM, "this channel does not exist");
|
||||
ASSERT(sourceWidth < 4, "width does not support");
|
||||
ASSERT(destWidth < 4, "width does not support");
|
||||
AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CTRLA = (size |
|
||||
sourceWidth << 24 |
|
||||
destWidth << 28 |
|
||||
done << 31);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Set DMA transfer mode for source used by a HDMA channel.
|
||||
/// \param channel Particular channel number.
|
||||
/// \param transferMode Transfer buffer mode (single, LLI, reload or contiguous)
|
||||
/// \param addressingType Type of addrassing mode
|
||||
/// 0 : incrementing, 1: decrementing, 2: fixed.
|
||||
//-----------------------------------------------------------------------------
|
||||
void DMA_SetSourceBufferMode(unsigned char channel,
|
||||
unsigned char transferMode,
|
||||
unsigned char addressingType)
|
||||
{
|
||||
unsigned int value;
|
||||
|
||||
ASSERT(channel < DMA_CHANNEL_NUM, "this channel does not exist");
|
||||
|
||||
value = AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CTRLB;
|
||||
value &= ~ (AT91C_SRC_DSCR | AT91C_SRC_INCR | 1<<31);
|
||||
switch(transferMode){
|
||||
case DMA_TRANSFER_SINGLE:
|
||||
value |= AT91C_SRC_DSCR | addressingType << 24;
|
||||
break;
|
||||
case DMA_TRANSFER_LLI:
|
||||
value |= addressingType << 24;
|
||||
break;
|
||||
case DMA_TRANSFER_RELOAD:
|
||||
case DMA_TRANSFER_CONTIGUOUS:
|
||||
value |= AT91C_SRC_DSCR | addressingType << 24 | 1<<31;
|
||||
break;
|
||||
}
|
||||
AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CTRLB = value;
|
||||
|
||||
if(transferMode == DMA_TRANSFER_RELOAD || transferMode == DMA_TRANSFER_CONTIGUOUS){
|
||||
value = AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CFG;
|
||||
value &= ~ (AT91C_SRC_REP);
|
||||
// When automatic mode is activated, the source address and the control register are reloaded from previous transfer.
|
||||
if(transferMode == DMA_TRANSFER_RELOAD) {
|
||||
value |= AT91C_SRC_REP;
|
||||
}
|
||||
AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CFG = value;
|
||||
}
|
||||
else {
|
||||
AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CFG = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/// Set DMA transfer mode for destination used by a HDMA channel.
|
||||
/// \param channel Particular channel number.
|
||||
/// \param transferMode Transfer buffer mode (single, LLI, reload or contiguous)
|
||||
/// \param addressingType Type of addrassing mode
|
||||
/// 0 : incrementing, 1: decrementing, 2: fixed.
|
||||
//-----------------------------------------------------------------------------
|
||||
void DMA_SetDestBufferMode(unsigned char channel,
|
||||
unsigned char transferMode,
|
||||
unsigned char addressingType)
|
||||
{
|
||||
unsigned int value;
|
||||
|
||||
ASSERT(channel < DMA_CHANNEL_NUM, "this channel does not exist");
|
||||
|
||||
value = AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CTRLB;
|
||||
value &= ~ (AT91C_DST_DSCR | AT91C_DST_INCR);
|
||||
|
||||
switch(transferMode){
|
||||
case DMA_TRANSFER_SINGLE:
|
||||
case DMA_TRANSFER_RELOAD:
|
||||
case DMA_TRANSFER_CONTIGUOUS:
|
||||
value |= AT91C_DST_DSCR | addressingType << 24;
|
||||
break;
|
||||
case DMA_TRANSFER_LLI:
|
||||
value |= addressingType << 24;
|
||||
break;
|
||||
}
|
||||
AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CTRLB = value;
|
||||
if(transferMode == DMA_TRANSFER_RELOAD || transferMode == DMA_TRANSFER_CONTIGUOUS){
|
||||
value = AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CFG;
|
||||
value &= ~ (AT91C_DST_REP);
|
||||
// When automatic mode is activated, the source address and the control register are reloaded from previous transfer.
|
||||
if(transferMode == DMA_TRANSFER_RELOAD) {
|
||||
value |= AT91C_DST_REP;
|
||||
}
|
||||
AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CFG = value;
|
||||
}
|
||||
else {
|
||||
AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CFG = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Set DMA configuration registe used by a HDMA channel.
|
||||
/// \param channel Particular channel number.
|
||||
/// \param value configuration value.
|
||||
//------------------------------------------------------------------------------
|
||||
void DMA_SetConfiguration(unsigned char channel, unsigned int value)
|
||||
{
|
||||
ASSERT(channel < DMA_CHANNEL_NUM, "this channel does not exist");
|
||||
AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CFG = value;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Set DMA source PIP configuration used by a HDMA channel.
|
||||
/// \param channel Particular channel number.
|
||||
/// \param pipHole stop on done mode.
|
||||
/// \param pipBoundary lock mode.
|
||||
//------------------------------------------------------------------------------
|
||||
void DMA_SPIPconfiguration(unsigned char channel,
|
||||
unsigned int pipHole,
|
||||
unsigned int pipBoundary)
|
||||
|
||||
{
|
||||
unsigned int value;
|
||||
ASSERT(channel < DMA_CHANNEL_NUM, "this channel does not exist");
|
||||
value = AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CTRLB;
|
||||
value &= ~ (AT91C_SRC_PIP);
|
||||
value |= AT91C_SRC_PIP;
|
||||
AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CTRLB = value;
|
||||
AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_SPIP = (pipHole + 1) | pipBoundary <<16;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// Set DMA destination PIP configuration used by a HDMA channel.
|
||||
/// \param channel Particular channel number.
|
||||
/// \param pipHole stop on done mode.
|
||||
/// \param pipBoundary lock mode.
|
||||
//------------------------------------------------------------------------------
|
||||
void DMA_DPIPconfiguration(unsigned char channel,
|
||||
unsigned int pipHole,
|
||||
unsigned int pipBoundary)
|
||||
|
||||
{
|
||||
unsigned int value;
|
||||
ASSERT(channel < DMA_CHANNEL_NUM, "this channel does not exist");
|
||||
value = AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CTRLB;
|
||||
value &= ~ (AT91C_DST_PIP);
|
||||
value |= AT91C_DST_PIP;
|
||||
AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_CTRLB = value;
|
||||
AT91C_BASE_HDMA->HDMA_CH[channel].HDMA_DPIP = (pipHole + 1) | pipBoundary <<16;
|
||||
}
|
||||
|
171
Demo/CORTEX_AT91SAM3U256_IAR/AT91Lib/peripherals/dma/dma.h
Normal file
171
Demo/CORTEX_AT91SAM3U256_IAR/AT91Lib/peripherals/dma/dma.h
Normal file
|
@ -0,0 +1,171 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
* ATMEL Microcontroller Software Support - ROUSSET -
|
||||
* ----------------------------------------------------------------------------
|
||||
* Copyright (c) 2006, Atmel Corporation
|
||||
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the disclaiimer below.
|
||||
*
|
||||
* - Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the disclaimer below in the documentation and/or
|
||||
* other materials provided with the distribution.
|
||||
*
|
||||
* Atmel's name may not be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
||||
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ----------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
/// \dir
|
||||
/// !Purpose
|
||||
///
|
||||
/// Interface for configuration the %DMA controller(DMAC).
|
||||
///
|
||||
/// !Usage
|
||||
///
|
||||
/// -# Enable or disable the a DMAC controller with
|
||||
/// DMA_Enable() and or DMA_Disable().
|
||||
/// -# Enable or disable %Dma interrupt using DMA_EnableIt()
|
||||
/// or DMA_DisableIt().
|
||||
/// -# Get %Dma interrupt status by DMA_GetStatus().
|
||||
/// -# Enable or disable specified %Dma channel with
|
||||
/// DMA_EnableChannel() or DMA_DisableChannel().
|
||||
/// -# Get %Dma channel status by DMA_GetChannelStatus().
|
||||
/// -# Configure source and/or destination start address with
|
||||
/// DMA_SetSourceAddr() and/or DMA_SetDestAddr().
|
||||
/// -# Set %Dma descriptor address using DMA_SetDescriptorAddr().
|
||||
/// -# Set source transfer buffer size with DMA_SetSourceBufferSize().
|
||||
/// -# Configure source and/or destination transfer mode with
|
||||
/// DMA_SetSourceBufferMode() and/or DMA_SetDestBufferMode().
|
||||
/// -# Configure source and/or destination Picture-In-Picutre
|
||||
/// mode with DMA_SPIPconfiguration() and/or DMA_DPIPconfiguration().
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef DMA_H
|
||||
#define DMA_H
|
||||
|
||||
#include <board.h>
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Definitions
|
||||
//------------------------------------------------------------------------------
|
||||
#define DMA_CHANNEL_0 0
|
||||
#define DMA_CHANNEL_1 1
|
||||
#define DMA_CHANNEL_2 2
|
||||
#define DMA_CHANNEL_3 3
|
||||
#define DMA_CHANNEL_4 4
|
||||
#define DMA_CHANNEL_5 5
|
||||
#define DMA_CHANNEL_6 6
|
||||
#define DMA_CHANNEL_7 7
|
||||
|
||||
#if defined(CHIP_DMA_CHANNEL_NUM)
|
||||
#define DMA_CHANNEL_NUM CHIP_DMA_CHANNEL_NUM
|
||||
#endif
|
||||
|
||||
#define DMA_TRANSFER_SINGLE 0
|
||||
#define DMA_TRANSFER_LLI 1
|
||||
#define DMA_TRANSFER_RELOAD 2
|
||||
#define DMA_TRANSFER_CONTIGUOUS 3
|
||||
|
||||
|
||||
#define DMA_ENA (1 << 0)
|
||||
#define DMA_DIS (1 << 0)
|
||||
#define DMA_SUSP (1 << 8)
|
||||
#define DMA_KEEPON (1 << 24)
|
||||
|
||||
#define DMA_BTC (1 << 0)
|
||||
#define DMA_CBTC (1 << 8)
|
||||
#define DMA_ERR (1 << 16)
|
||||
|
||||
#if defined(at91sam9m10) || defined(at91sam9m11) || defined(at91sam3u4)
|
||||
#define AT91C_SRC_DSCR AT91C_HDMA_SRC_DSCR
|
||||
#define AT91C_DST_DSCR AT91C_HDMA_DST_DSCR
|
||||
#define AT91C_SRC_INCR AT91C_HDMA_SRC_ADDRESS_MODE
|
||||
#define AT91C_DST_INCR AT91C_HDMA_DST_ADDRESS_MODE
|
||||
#define AT91C_SRC_PER AT91C_HDMA_SRC_PER
|
||||
#define AT91C_DST_PER AT91C_HDMA_DST_PER
|
||||
#define AT91C_SRC_REP AT91C_HDMA_SRC_REP
|
||||
#define AT91C_DST_REP AT91C_HDMA_DST_REP
|
||||
#define AT91C_SRC_PIP AT91C_HDMA_SRC_PIP
|
||||
#define AT91C_DST_PIP AT91C_HDMA_DST_PIP
|
||||
|
||||
#define AT91C_BTC (0xFF << 0)
|
||||
#define AT91C_CBTC (0xFF << 8)
|
||||
#define AT91C_ERR (0xFF << 16)
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Exported functions
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
extern void DMA_Config(unsigned int flag);
|
||||
|
||||
extern void DMA_Enable(void);
|
||||
|
||||
extern void DMA_Disable(void);
|
||||
|
||||
extern void DMA_EnableChannel(unsigned int channel);
|
||||
|
||||
extern void DMA_DisableChannel(unsigned int channel);
|
||||
|
||||
extern void DMA_KeeponChannel(unsigned int channel);
|
||||
|
||||
extern void DMA_ClearAutoMode(unsigned int channel);
|
||||
|
||||
extern unsigned int DMA_GetChannelStatus(void);
|
||||
|
||||
extern unsigned int DMA_GetStatus(void);
|
||||
|
||||
extern unsigned int DMA_GetInterruptMask(void);
|
||||
|
||||
extern unsigned int DMA_GetMaskedStatus(void);
|
||||
|
||||
extern void DMA_EnableIt (unsigned int flag);
|
||||
|
||||
extern void DMA_DisableIt (unsigned int flag);
|
||||
|
||||
extern void DMA_SetSourceAddr(unsigned char channel, unsigned int address);
|
||||
|
||||
extern void DMA_SetDestinationAddr(unsigned char channel, unsigned int address);
|
||||
|
||||
extern void DMA_SetDescriptorAddr(unsigned char channel, unsigned int address);
|
||||
|
||||
extern void DMA_SetSourceBufferSize(unsigned char channel,
|
||||
unsigned int size,
|
||||
unsigned char sourceWidth,
|
||||
unsigned char desDMAdth,
|
||||
unsigned char done);
|
||||
|
||||
extern void DMA_SetSourceBufferMode(unsigned char channel,
|
||||
unsigned char transferMode,
|
||||
unsigned char addressingType);
|
||||
|
||||
extern void DMA_SetDestBufferMode(unsigned char channel,
|
||||
unsigned char transferMode,
|
||||
unsigned char addressingType);
|
||||
|
||||
extern void DMA_SetConfiguration(unsigned char channel, unsigned int value);
|
||||
|
||||
extern void DMA_SPIPconfiguration(unsigned char channel,
|
||||
unsigned int pipHole, unsigned int pipBoundary);
|
||||
|
||||
extern void DMA_DPIPconfiguration(unsigned char channel,
|
||||
unsigned int pipHole, unsigned int pipBoundary);
|
||||
|
||||
#endif //#ifndef DMA_H
|
Loading…
Add table
Add a link
Reference in a new issue