# MI_NDmaFill*

## Syntax

  `#include <twl/mi.h>`
  `void MI_NDmaFill( u32 ndmaNo,`
`void* dest, u32 data, u32 size );`

  `void MI_NDmaFill_SetUp( u32 ndmaNo,`
`void* dest, u32 data, u32 size );`

  `void MI_NDmaFillAsync( u32 dmaNo,`
`void* dest, u32 data, u32 size,`
`MINDmaCallback callback, void* arg );`

  `void MI_NDmaFillAsync_SetUp( u32 dmaNo,`
`void* dest, u32 data, u32 size,`
`MINDmaCallback callback, void* arg );`

  `void MI_NDmaFillEx( u32 ndmaNo,`
`void* dest, u32 data, u32 size,`
`MINDmaConfig *config );`

  `void MI_NDmaFillEx_SetUp( u32 ndmaNo,`
`void* dest, u32 data, u32 size,`
`MINDmaConfig *config );`

  `void MI_NDmaFillExAsync( u32 ndmaNo,`
`void* dest, u32 data, u32 size,`
`MINDmaCallback callback, void* arg,`
  `MINDmaConfig *config``);`

  `void MI_NDmaFillExAsync_SetUp( u32 ndmaNo,`
`void* dest, u32 data, u32 size,`
`MINDmaCallback callback, void* arg,`
  `MINDmaConfig *config``);`

  `void MI_NDmaFill_Dev( u32 ndmaNo,`
`void* dest, u32 data, u32 size,`
`MINDmaDevice dev );`

  `void MI_NDmaFill_Dev_SetUp( u32 ndmaNo,`
`void* dest, u32 data, u32 size,`
`MINDmaDevice dev );`

  `void MI_NDmaFillAsync_Dev( u32 ndmaNo,`
`void* dest, u32 data, u32 size,`
`MINDmaCallback callback, void* arg,`
`MINDmaDevice dev );`

  `void MI_NDmaFillAsync_Dev_SetUp( u32 ndmaNo,`
`void* dest, u32 data, u32 size,`
`MINDmaCallback callback, void* arg,`
`MINDmaDevice dev );`

  `void MI_NDmaFillEx_Dev( u32 ndmaNo,`
`void* dest, u32 data, u32 size,`
`MINDmaConfig *config,`
`MINDmaDevice dev );`

  `void MI_NDmaFillEx_Dev_SetUp( u32 ndmaNo,`
`void* dest, u32 data, u32 size,`
`MINDmaConfig *config,`
`MINDmaDevice dev );`

  `void MI_NDmaFillExAsync_Dev( u32 ndmaNo,`
`void* dest, u32 data, u32 size,`
`MINDmaCallback callback, void* arg,`
  `MINDmaConfig *config,`
`MINDmaDevice dev );`

  `void MI_NDmaFillExAsync_Dev_SetUp( u32 ndmaNo,`
`void* dest, u32 data, u32 size,`
`MINDmaCallback callback, void* arg,`
  `MINDmaConfig *config,`
`MINDmaDevice dev );`

## Arguments

ndmaNo | DMA channel to use (0-3 within the new DMA)
dest | Transfer destination address
data | Fill data
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 fill data.
(The `*_SetUp` functions configure the DMA settings but do not transfer data.)

The `MI_NDmaFill*` functions use the TWL's new DMA to fill data in word (4-byte) units. 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 data argument is the data to fill in the specified region.

The `MI_NDmaFill*` 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

Note that the `*_SetUp` functions configure the DMA settings but do not transfer data. To start DMA, call the `MI_NDmaRestart` function.

Functions | Wait for DMA Completion in the Function | Detailed DMA Settings | Start DMA
--- | --- | --- | ---
`MI_NDmaFill` | Yes | Default | Immediately
`MI_NDmaFillAsync` | No (Async) | Default | Immediately
`MI_NDmaFill` | Yes | User-defined | Immediately
`MI_NDmaFillExAsync` | No (Async) | User-defined | Immediately
`MI_NDmaFill_Dev` | Yes | Default | Interrupt from peripheral device
`MI_NDmaFillAsync_Dev` | No (Async) | Default | Interrupt from peripheral device
`MI_NDmaFill_Dev` | Yes | User-defined | Interrupt from peripheral device
`MI_NDmaFillExAsync_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_NDmaCopy*`
`MI_NDmaClear*`
`MI_DmaFill*`
`MI_CpuFill*`
`MI_NDmaRestart`
New NDMA: Overview

## Revision History

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

CONFIDENTIAL