1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3<head> 4<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 5<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.0.0 for Windows"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<title>MIDeviceReadFunction</title> 8<link rel="stylesheet" href="../../css/nitro.css" type="text/css" /> 9</head> 10<body> 11<h1>MIDeviceReadFunction <IMG src="../../image/NTR.gif" align="middle"><IMG src="../../image/TWL.gif" align="middle"></h1> 12<h2>Definition</h2> 13 14<dl> 15 <dd> 16 <pre><code>#include <nitro/mi.h><br /> 17typedef int (*MIDeviceReadFunction)(void *userdata, void *buffer, u32 offset, u32 length); 18</code></pre> 19 </dd> 20</dl> 21 22<h2>Arguments</h2> 23<table border="1" width="100%"> 24 <tbody> 25 <tr> 26 <td width="13%"><em><strong>userdata</strong></em></td> 27 <td width="87%">An arbitrary user-defined value specified with <A href="MI_InitDevice.html"><CODE>MI_InitDevice()</CODE></A>.<br /> 28 This is provided for the sake of convenience in implementing callback functions.</td> 29 </tr> 30 <tr> 31 <td width="13%"><em><strong>buffer</strong></em></td> 32 <td width="87%">The destination memory to store the loaded data.</td> 33 </tr> 34 <tr> 35 <td width="13%"><em><strong>offset</strong></em></td> 36 <td width="87%">The start address of the device to which data should be read.</td> 37 </tr> 38 <tr> 39 <td width="13%"><em><strong>length</strong></em></td> 40 <td width="87%">Data size to load.</td> 41 </tr> 42 </TBODY> 43</table> 44 45<h2>Return Values</h2> 46<p>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.</p> 47 48<h2>Description</h2> 49<p> 50This is the function prototype indicating the callback format for reading data from the device.<br />Use this format to implement a device-reading operation and to specify your implementation in <a href="MI_InitDevice.html"><CODE>MI_InitDevice()</CODE></a>. 51</p> 52 53<h2>See Also</h2> 54<p><code><a href="MI_InitDevice.html">MI_InitDevice</a>, <a href="MI_ReadDevice.html">MI_ReadDevice</a> <a href="MI_WriteDevice.html">MI_WriteDevice</a><br /> <a href="MIDevice.html">MIDevice</a>, <a href="MIDeviceReadFunction.html">MIDeviceReadFunction</a>, <a href="MIDeviceWriteFunction.html">MIDeviceWriteFunction</a><br /></code></p> 55<h2>Revision History</h2> 56<p> 572007/05/09 Initial version. 58</p> 59<hr><p>CONFIDENTIAL</p></body> 60</html> 61