# MIDeviceReadFunction

## Definition

      #include <nitro/mi.h>

      typedef int (*MIDeviceReadFunction)(void *userdata, void *buffer, u32 offset, u32 length);

## Arguments

userdata | An arbitrary user-defined value specified with `MI_InitDevice()`. This is provided for the sake of convenience in implementing callback functions.
buffer | The destination memory to store the loaded data.
offset | The start address of the device to which data should be read.
length | Data size to load.

## Return Values

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

## Description

This is the function prototype indicating the callback format for reading data from the device.
Use this format to implement a device-reading operation and to specify your implementation in `MI_InitDevice()`.

## See Also

`MI_InitDevice, MI_ReadDevice MI_WriteDevice
MIDevice, MIDeviceReadFunction, MIDeviceWriteFunction
`

## Revision History

2007/05/09 Initial version.

CONFIDENTIAL