dma.h

Wrapper functions for direct memory access hardware. [詳細]

#include "nds/ndstypes.h"

ソースコードを見る。

マクロ定義

#define DMA0_SRC   (*(vuint32*)0x040000B0)
#define DMA0_DEST   (*(vuint32*)0x040000B4)
#define DMA0_CR   (*(vuint32*)0x040000B8)
#define DMA1_SRC   (*(vuint32*)0x040000BC)
#define DMA1_DEST   (*(vuint32*)0x040000C0)
#define DMA1_CR   (*(vuint32*)0x040000C4)
#define DMA2_SRC   (*(vuint32*)0x040000C8)
#define DMA2_DEST   (*(vuint32*)0x040000CC)
#define DMA2_CR   (*(vuint32*)0x040000D0)
#define DMA3_SRC   (*(vuint32*)0x040000D4)
#define DMA3_DEST   (*(vuint32*)0x040000D8)
#define DMA3_CR   (*(vuint32*)0x040000DC)
#define DMA_SRC(n)   (*(vuint32*)(0x040000B0+(n*12)))
#define DMA_DEST(n)   (*(vuint32*)(0x040000B4+(n*12)))
#define DMA_CR(n)   (*(vuint32*)(0x040000B8+(n*12)))
#define DMA_ENABLE   BIT(31)
#define DMA_BUSY   BIT(31)
#define DMA_IRQ_REQ   BIT(30)
#define DMA_START_NOW   0
#define DMA_START_CARD   (5<<27)
#define DMA_16_BIT   0
#define DMA_32_BIT   BIT(26)
#define DMA_REPEAT   BIT(25)
#define DMA_SRC_INC   (0)
#define DMA_SRC_DEC   BIT(23)
#define DMA_SRC_FIX   BIT(24)
#define DMA_DST_INC   (0)
#define DMA_DST_DEC   BIT(21)
#define DMA_DST_FIX   BIT(22)
#define DMA_DST_RESET   (3<<21)
#define DMA_COPY_WORDS   (DMA_ENABLE | DMA_32_BIT | DMA_START_NOW)
#define DMA_COPY_HALFWORDS   (DMA_ENABLE | DMA_16_BIT | DMA_START_NOW)
#define DMA_FIFO   (DMA_ENABLE | DMA_32_BIT | DMA_DST_FIX | DMA_START_FIFO)

関数

void dmaCopyWords (uint8 channel, const void *src, void *dest, uint32 size)
 copies from source to destination on one of the 4 available channels in words
void dmaCopyHalfWords (uint8 channel, const void *src, void *dest, uint32 size)
 copies from source to destination on one of the 4 available channels in half words
void dmaCopy (const void *source, void *dest, uint32 size)
 copies from source to destination using channel 3 of DMA available channels in half words
void dmaCopyWordsAsynch (uint8 channel, const void *src, void *dest, uint32 size)
 copies from source to destination on one of the 4 available channels in half words. This function returns immediately after starting the transfer.
void dmaCopyHalfWordsAsynch (uint8 channel, const void *src, void *dest, uint32 size)
 copies from source to destination on one of the 4 available channels in half words. This function returns immediately after starting the transfer.
void dmaCopyAsynch (const void *source, void *dest, uint32 size)
 copies from source to destination using channel 3 of DMA available channels in half words. This function returns immediately after starting the transfer.
void dmaFillWords (u32 value, void *dest, uint32 size)
 fills the source with the supplied value using DMA channel 3
void dmaFillHalfWords (u16 value, void *dest, uint32 size)
 fills the source with the supplied value using DMA channel 3
int dmaBusy (uint8 channel)
 determines if the specified channel is busy

説明

Wrapper functions for direct memory access hardware.

The DS has 4 hardware direct memory access devices per CPU which can be used to transfer or fill chunks of memeory without CPU intervention. Utilizing DMA is generaly faster than CPU copies (memcpy, swiCopy, for loops, etc..).
DMA has no access to data caches on the DS and as such will give unexpected results when DMAing data from main memory. The cache must be flushed as follows when using DMA to ensure proper opertion on the arm9:
DC_FlushRange(source, sizeof(dataToCopy));
dmaCopy(source, destination, sizeof(dataToCopy));

関数

static dmaBusy ( uint8  channel  )  [inline]

determines if the specified channel is busy

引数:
channel the dma channel to check (0 - 3).
戻り値:
non zero if busy, 0 if channel is free
static void dmaCopy ( const void *  source,
void *  dest,
uint32  size 
) [inline]

copies from source to destination using channel 3 of DMA available channels in half words

引数:
source the source to copy from
dest the destination to copy to
size the size in bytes of the data to copy. Will be truncated to the nearest half word (2 bytes)
例:
audio/micrecord/source/micrecord.c, Graphics/Backgrounds/all_in_one/source/advanced.cpp, Graphics/Backgrounds/all_in_one/source/basic.cpp, Graphics/Backgrounds/all_in_one/source/handmade.cpp, Graphics/Backgrounds/all_in_one/source/scrolling.cpp, と Graphics/Sprites/animate_simple/source/template.c.
static void dmaCopyAsynch ( const void *  src,
void *  dest,
uint32  size 
) [inline]

copies from source to destination using channel 3 of DMA available channels in half words. This function returns immediately after starting the transfer.

引数:
src the source to copy from
dest the destination to copy to
size the size in bytes of the data to copy. Will be truncated to the nearest half word (2 bytes)
static void dmaCopyHalfWords ( uint8  channel,
const void *  src,
void *  dest,
uint32  size 
) [inline]

copies from source to destination on one of the 4 available channels in half words

引数:
channel the dma channel to use (0 - 3).
src the source to copy from
dest the destination to copy to
size the size in bytes of the data to copy. Will be truncated to the nearest half word (2 bytes)
static void dmaCopyHalfWordsAsynch ( uint8  channel,
const void *  src,
void *  dest,
uint32  size 
) [inline]

copies from source to destination on one of the 4 available channels in half words. This function returns immediately after starting the transfer.

引数:
channel the dma channel to use (0 - 3).
src the source to copy from
dest the destination to copy to
size the size in bytes of the data to copy. Will be truncated to the nearest half word (2 bytes)
static void dmaCopyWords ( uint8  channel,
const void *  src,
void *  dest,
uint32  size 
) [inline]

copies from source to destination on one of the 4 available channels in words

引数:
channel the dma channel to use (0 - 3).
src the source to copy from
dest the destination to copy to
size the size in bytes of the data to copy. Will be truncated to the nearest word (4 bytes)
static void dmaCopyWordsAsynch ( uint8  channel,
const void *  src,
void *  dest,
uint32  size 
) [inline]

copies from source to destination on one of the 4 available channels in half words. This function returns immediately after starting the transfer.

引数:
channel the dma channel to use (0 - 3).
src the source to copy from
dest the destination to copy to
size the size in bytes of the data to copy. Will be truncated to the nearest word (4 bytes)
static void dmaFillHalfWords ( u16  value,
void *  dest,
uint32  size 
) [inline]

fills the source with the supplied value using DMA channel 3

引数:
value the 16 byte value to fill memory with
dest the destination to copy to
size the size in bytes of the area to fill. Will be truncated to the nearest half word (2 bytes)
例:
Graphics/Sprites/bitmap_sprites/source/main.cpp.
static void dmaFillWords ( u32  value,
void *  dest,
uint32  size 
) [inline]

fills the source with the supplied value using DMA channel 3

引数:
value the 32 byte value to fill memory with
dest the destination to copy to
size the size in bytes of the area to fill. Will be truncated to the nearest word (4 bytes)
 全て クラス ファイル 関数 変数 型定義 列挙型 列挙型の値 マクロ定義
libndsに対してMon Apr 26 23:39:50 2010に生成されました。  doxygen 1.6.3