# MI_DmaFill*

## C Specification

      #include <nitro/mi.h>

      void MI_DmaFill32( u32 dmaNo, void* dest, u32 data, u32 size );
      void MI_DmaFill16( u32 dmaNo, void* dest, u32 data, u32 size );

      void MI_DmaFill32Async( u32 dmaNo, void* dest, u32 data, u32 size,
                         MIDmaCallback callback, void* arg );

      void MI_DmaFill16Async( u32 dmaNo, void* dest, u32 data, u32 size,
                         MIDmaCallback callback, void* arg );

## Description

This function uses DMA to fill memory with specified data.

- `MI_DmaFill16()` and `MI_DmaFill16Async()` fill memory with specified data in 16-bit units. The transfer destination address must be 2-byte aligned.

- `MI_DmaFill32()` and `MI_DmaFill32Async()` fill memory with 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 a callback function when DMA ends. The callback function is an `MIDmaCallback` type (a `void` type function with a `void*` type argument).

## Internal Operation

This function uses the following IO registers:

- DMAn source register (0x40000B0 + 12n)
- DMAn destination register (0x40000B4 + 12n)
- 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 taken by shared memory for the TEG board, but is mapped to the IO registers for TS.

## Arguments

`dmaNo` | DMA channel used
`dest` | Transfer destination address
`data` | Transfer data
`size` | Transfer size
`callback` | Callback when DMA ends
`arg` | Callback argument when DMA ends

## Return Values

None.

## See Also

`MI_DmaCopy*, MI_DmaClear*, MI_DmaSend*, MI_CpuFill*`

## Revision History

10/18/2004 Expanded Internal Op text, corrected C Spec.
12/01/2003 Initial version.