Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

DMA - Direct Memory Access


Files

file  otDMA.h
 Direct Memory Access Library for BF51x.

Modules

 Version History
 DMA - Code example

Enumerations

enum  dmaChannels { DMA_CH_0, DMA_CH_1 }
enum  dmaData { DMA_BYTE, DMA_WORD, DMA_DWORD }

Functions

void DmaSetInterruptService (U8 chan, void(*pCallback)(void))
 Set callback for specified MDMA channel.
void DmaEnableInterrupt (U8 chan, bool ena)
 Enable or disable the interrupt on end of trasfer for the specified MDMA channel.
void DmaMove (U8 chan, void *src, void *dest, U32 len, U8 dataType)
 Move an amount of memory from src to dst.
void DmaMoveToPort (U8 chan, void *src, void *port, U32 len, U8 dataType)
 Move an amount of memory from src to a memory mapped peripheral.
void DmaMoveFromPort (U8 chan, void *port, void *dest, U32 len, U8 dataType)
 Move an amount of memory from a memory mapped peripheral to a buffer.

Detailed Description

Direct memory access (DMA) is a feature of computer systems that allows certain hardware subsystems to access main system memory (random-access memory), independent of the central processing unit (CPU).
Without DMA, when the CPU is using programmed input/output, it is typically fully occupied for the entire duration of the read or write operation, and is thus unavailable to perform other work. With DMA, the CPU first initiates the transfer, then it does other operations while the transfer is in progress, and it finally receives an interrupt from the DMA controller (DMAC) when the operation is done.
This feature is useful at any time that the CPU cannot keep up with the rate of data transfer, or when the CPU needs to perform work while waiting for a relatively slow I/O data transfer.
Many hardware systems use DMA, including disk drive controllers, graphics cards, network cards and sound cards.
DMA is also used for intra-chip data transfer in multi-core processors.
Computers that have DMA channels can transfer data to and from devices with much less CPU overhead than computers without DMA channels.
Similarly, a processing element inside a multi-core processor can transfer data to and from its local memory without occupying its processor time,
allowing computation and data transfer to proceed in parallel.
DMA can also be used for "memory to memory" copying or moving of data within memory. From wikipedia: https://en.wikipedia.org/wiki/Direct_memory_access

Enumeration Type Documentation

enum dmaChannels
 

Enumeration values:
DMA_CH_0  MDMA channel 0.
DMA_CH_1  MDMA channel 1.

enum dmaData
 

Enumeration values:
DMA_BYTE  MDMA transfer byte.
DMA_WORD  MDMA transfer word (16bit).
DMA_DWORD  MDMA transfer double word (32bit).


Function Documentation

void DmaEnableInterrupt U8  chan,
bool  ena
 

Parameters:
chan MDMA channel see dmaChannels
ena If true enable the interrupt

void DmaMove U8  chan,
void *  src,
void *  dest,
U32  len,
U8  dataType
 

Parameters:
chan MDMA channel see dmaChannels
src Pointer to a source buffer
dest Pointer to a destination buffer where data will be copied
len Lenght of data
dataType Data type, see dmaData

void DmaMoveFromPort U8  chan,
void *  port,
void *  dest,
U32  len,
U8  dataType
 

Parameters:
chan MDMA channel see dmaChannels
port Pointer to a memory mapped peripheral
dest Pointer to a destination buffer where data will be copied
len Lenght of data
dataType Data type, see dmaData

void DmaMoveToPort U8  chan,
void *  src,
void *  port,
U32  len,
U8  dataType
 

Parameters:
chan MDMA channel see dmaChannels
src Pointer to a source buffer
port Pointer to a memory mapped peripheral
len Lenght of data
dataType Data type, see dmaData

void DmaSetInterruptService U8  chan,
void(*)(void)  pCallback
 

Parameters:
chan MDMA channel see dmaChannels
pCallback Pointer to a function executed at the end of DMA transfer
footer

otStudio - Library Reference - (C) 2020-25 Officina Turini, All Rights Reserved
Document built with Doxygen 1.4.0