# MI_NDmaSend*

## Syntax

  `#include <twl/mi.h>`
  `void MI_NDmaSend( u32 ndmaNo,`
`const void* src,`
`volatile void* dest,`
`u32 size );`

  `void MI_NDmaSend_SetUp( u32 ndmaNo,`
`const void* src,`
`volatile void* dest,`
`u32 size );`

  `void MI_NDmaSendAsync( u32 dmaNo,`
`const void* src,`
`volatile void* dest,`
`u32 size,`
`MINDmaCallback callback,`
`void* arg );`

  `void MI_NDmaSendAsync_SetUp( u32 dmaNo,`
`const void* src,`
`volatile void* dest,`
`u32 size,`
`MINDmaCallback callback,`
`void* arg );`

  `void MI_NDmaSendEx( u32 ndmaNo,`
`const void* src,`
`volatile void* dest,`
`u32 size,`
`MINDmaConfig *config );`

  `void MI_NDmaSendEx_SetUp( u32 ndmaNo,`
`const void* src,`
`volatile void* dest,`
`u32 size,`
`MINDmaConfig *config );`

  `void MI_NDmaSendExAsync( u32 ndmaNo,`
`const void* src,`
`volatile void* dest,`
`u32 size,`
`MINDmaCallback callback,`
`void* arg ,`
`MINDmaConfig *config``);`

  `void MI_NDmaSendExAsync_SetUp( u32 ndmaNo,`
`const void* src,`
`volatile void* dest,`
`u32 size,`
`MINDmaCallback callback,`
`void* arg,`
`MINDmaConfig *config``);`

  `void MI_NDmaSend_Dev( u32 ndmaNo,`
`const void* src,`
`volatile void* dest,`
`u32 size,`
`MINDmaDevice dev );`

  `void MI_NDmaSend_Dev_SetUp( u32 ndmaNo,`
`const void* src,`
`volatile void* dest,`
`u32 size,`
`MINDmaDevice dev );`

  `void MI_NDmaSendAsync_Dev( u32 ndmaNo,`
`const void* src,`
`volatile void* dest,`
`u32 size,`
`MINDmaCallback callback,`
`void* arg,`
`MINDmaDevice dev );`

  `void MI_NDmaSendAsync_Dev_SetUp( u32 ndmaNo,`
`const void* src,`
`volatile void* dest,`
`u32 size,`
`MINDmaCallback callback,`
`void* arg,`
`MINDmaDevice dev );`

  `void MI_NDmaSendEx_Dev( u32 ndmaNo,`
`const void* src,`
`volatile void* dest,`
`u32 size,`
`MINDmaConfig *config,`
`MINDmaDevice dev );`

  `void MI_NDmaSendEx_Dev_SetUp( u32 ndmaNo,`
`const void* src,`
`volatile void* dest,`
`u32 size,`
`MINDmaConfig *config,`
`MINDmaDevice dev );`

  `void MI_NDmaSendExAsync_Dev( u32 ndmaNo,`
`const void* src,`
`volatile void* dest,`
`u32 size,`
`MINDmaCallback callback,`
`void* arg,`
`MINDmaConfig *config,`
`MINDmaDevice dev );`

  `void MI_NDmaSendExAsync_Dev_SetUp( u32 ndmaNo,`
`const void* src,`
`volatile void* dest,`
`u32 size,`
`MINDmaCallback callback,`
`void* arg,`
`MINDmaConfig *config,`
`MINDmaDevice dev );`

## Arguments

ndmaNo | DMA channel to use (0-3 within the new DMA)
src | Transfer source address
dest | Transfer destination address
size | Transfer size
callback | Callback when DMA ends
arg | Callback argument when DMA ends
config | DMA configuration
dev | Device (if starting a device)

## Return Values

None.

## Description

Uses the new DMA to continually send data to the same transfer destination address.
(The `*_SetUp` functions configure the DMA settings but do not transfer data.)

The `MI_NDmaSend*` functions use the TWL's new DMA to repeatedly send data in word (4-byte) units. Both the transfer source address (src) and the transfer destination address (dest) must be 4-byte aligned. The transfer size (size) needs to be a multiple of 4.

Specify the new DMA to use as a number between 0 and 3, in ndmaNo.

The `MI_NDmaSend*` functions include functions for the separate operations given below.

-Whether to wait for DMA shutdown inside the function
-Whether to use defaults for advanced DMA settings or user specifications
-Whether to start DMA immediately, or start it based on an interrupt from a peripheral device

In addition, the `*_SetUp` functions only configure the given settings without starting DMA. To start DMA, call the `MI_NDmaRestart` function.

Functions | Wait for DMA Completion in the Function | Detailed DMA Settings | Start DMA
--- | --- | --- | ---
`MI_NDmaSend` | Yes | Default | Immediately
`MI_NDmaSendAsync` | No (Async) | Default | Immediately
`MI_NDmaSendEx` | Yes | User-defined | Immediately
`MI_NDmaSendExAsync` | No (Async) | User-defined | Immediately
`MI_NDmaSend_Dev` | Yes | Default | Interrupt from peripheral device
`MI_NDmaSendAsync_Dev` | No (Async) | Default | Interrupt from peripheral device
`MI_NDmaSendEx_Dev` | Yes | User-defined | Interrupt from peripheral device
`MI_NDmaSendExAsync_Dev` | No (Async) | User-defined | Interrupt from peripheral device

The `Async-type functions` calls the callback specified in callback upon DMA completion. The callback is of type `MINDmaCallback` (a `void`-type function that takes one of the `void*` arguments). The callback argument is called from the system DMA interrupt handler and therefore is called even if interrupts are prohibited.

To achieve maximum functionality, it is necessary to understand how to use Async-type functions.
For more information, see the `MI_DmaCopy` function.

The config argument is a pointer to the structure that determines the details of the DMA behavior.

The dev argument indicates the device when performing DMA upon startup of a peripheral device. For the values that can be set, see "DMA Start Timing" in New DMA: Overview

## Internal Operation

Uses the new I/O DMA registers.

## See Also

`MI_NDmaFill*`
`MI_NDmaClear*`
`MI_NDmaRecv*` `MI_DmaSend*`
`MI_CpuSend*`
`MI_NDmaRestart`
New DMA: Overview

## Revision History

2008/11/19 Added the link for `MINDmaDevice`.
2007/10/31 Added `_SetUp`.
2007/09/06 Initial version.

CONFIDENTIAL