# MI_DmaFill*

## Syntax

  `#include <nitro/mi.h>`
  `void MI_DmaFill32( u32 dmaNo,
  void* dest,
  u32 data,
  u32 size );`
  `void MI_DmaFill32_SetUp( u32 dmaNo,
  void* dest,
  u32 data,
  u32 size );`
  `void MI_DmaFill16( u32 dmaNo,
  void* dest,
  u16 data,
  u32 size );`
  `void MI_DmaFill16_SetUp( u32 dmaNo,
  void* dest,
  u16 data,
  u32 size );`
  `void MI_DmaFill32Async( u32 dmaNo,
  void* dest,
  u32 data,
  u32 size,
  MIDmaCallback callback,
  void* arg );`
  `void MI_DmaFill32Async_SetUp( u32 dmaNo,
  void* dest,
  u32 data,
  u32 size,
  MIDmaCallback callback,
  void* arg );`
  `void MI_DmaFill16Async( u32 dmaNo,
  void* dest,
  u16 data,
  u32 size,
  MIDmaCallback callback,
  void* arg );`
  `void MI_DmaFill16Async_SetUp( u32 dmaNo,
  void* dest,
  u16 data,
  u32 size,
  MIDmaCallback callback,
  void* arg );`

## Arguments

dmaNo | DMA channel used.
dest | The transfer destination address.
data | The data that will be transferred
size | Transfer size.
callback | Callback when DMA ends.
arg | Callback argument when DMA ends.

## Return Values

None.

## Description

Uses DMA to fill memory with the specified data.

The `*_SetUp` functions only configure the given settings without actually performing DMA. To actually start DMA, call the `MI_DmaRestart` function.

The `MI_DmaFill16*` functions fill memory with the specified data in 16-bit units. You must 2-byte align the transfer destination address. The `MI_DmaFill32*` functions fill memory with the specified data in 32-bit units. The transfer destination address must be 4-byte aligned.

`MI_DmaFill16()` and `MI_DmaFill32()` wait within the function until DMA completes. `MI_DmaFill16Async*()` and `MI_DmaFill32Async*()` call the callback function when DMA ends. The callback, `callback`, is a `MIDmaCallback` type (a `void` type function that takes one `void*` argument). `callback` is called from the system DMA interrupt handler and therefore is called while interrupts are prohibited.

###
DMA Controller Bugs

See the section titled "DMA Controller Bugs" in the reference for the `MI_DmaCopy` function.

## Internal Operation

Uses the following IO registers: DMAn source register (0x40000B0 + 12n), DMAn destination register (0x40000B4 + 12n), and DMAn control register (0x40000B8 + 12n). (n is the DMA channel used.))In addition, the `HW_DMA_CLEAR_DATA_BUF` region is used for fill. This region is occupied by shared memory for the TEG board but is mapped to the IO registers for TS.

## See Also

`MI_DmaCopy*
MI_DmaClear*
MI_DmaSend*
MI_CpuFill*
MI_DmaRestart
`

## Revision History

2009/11/30 Changed the data argument used with functions for handling 16-bit data from u32 to u16.
2009/11/20 Added a description of bugs in the DMA controller.
2007/10/31 Added `_SetUp()`.
2005/03/08 Standardized the notation used for the term "interrupt" in Japanese.
2004/12/22 Added a description of calling the callback.
2003/12/01 Initial version.

CONFIDENTIAL