# MI_WriteDevice

## Syntax

  `#include <nitro/mi.h>
  int MI_WriteDevice(MIDevice *device, const void *buffer, u32 offset, u32 length);`

## Arguments

device | Pointer to the `MIDevice` structure to access. The device must have been initialized using `MI_InitDevice()`.
buffer | The transfer source memory where the data for writing is stored.
offset | The starting address in the device where data should be written.
length | The data write size.

## Return Values

If the function succeeds, it will return the actual amount of data that has been read. If it fails, it will return a negative value.

## Description

Writes the data to a device using the `MIDevice` structure.
Internally, this just calls the callback function for writes specified in `MI_InitDevice()`.

This is a utility feature designed to separate the device control component from the module design. For more information, see the reference for the `MIDevice` structure.

## See Also

`MI_InitDevice, MI_ReadDevice
MIDevice, MIDeviceReadFunction, MIDeviceWriteFunction
`

## Revision History

2007/05/09 Initial version.

CONFIDENTIAL