dnx RTOS 2.2.0 "Eagle"
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
DMA Driver

Detailed Description


Driver handles Direct Memory Access controller. Driver provide ioctl() request that start DMA memory-to-memory transaction. Beside that driver provide internal interface for drivers purpose called DDI (Direct Driver Interface). This interface depends on selected CPU architecture.

The stm32f4 microcontroller accepts memory-to-memory transfers only on DMA2. This is a hardware limitation.

Supported architectures


Meaning of major and minor numbers

The major number select DMA peripheral. The minor number is not used. Some manufactures enumerate devices starting from 1 instead of 0 (e.g. ST). In this case major number starts from 0 and is connected to the first device e.g. DMA1.

Numeration restrictions

The number of peripherals determines how big the major number can be. If there is only one DMA peripheral then the major number is always 0. The minor number is not used at all and only 0 is accepted.

Driver initialization

To initialize driver the following code can be used:

driver_init("DMA", 0, 0, "/dev/DMA1");
driver_init("DMA", 1, 0, "/dev/DMA2");

Driver release

Once initialized driver is protected and release is not supported.

Driver configuration

Driver is not configurable.

Data write

Write is not supported. To start transfer use ioctl() request.

Data read

Read is not supported. To start transfer use ioctl() request.

Starting DMA transfer

The DMA transfer starts when DMA_transfer_t structure is filled correctly and ioctl() request is used. Example:

// ...
FILE *f = fopen("/dev/DMA2", "r+");
if (f) {
.src = SOURCE_PTR,
if (ioctl(fileno(f), IOCTL_DMA__TRANSFER, &t) == 0) {
// success ...
} else {
// error ...
} else {
// ...

Data Structures

struct  DMA_transfer_t


#define IOCTL_DMA__TRANSFER   _IOWR(DMA, 0x00, const DMA_transfer_t*)
 Request copy selected memory by using DMA. More...

Data Structure Documentation

struct DMA_transfer_t
Data Fields
u8_t * dst

Destination address.

size_t size

Transfer size in bytes.

u8_t * src

Source address.

Macro Definition Documentation

#define IOCTL_DMA__TRANSFER   _IOWR(DMA, 0x00, const DMA_transfer_t*)
[WR,RD]DMA_transfer_t* DMA transfer descriptor
On success 0 is returned, otherwise -1.