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>MI_ReadCache</title>
8<link rel="stylesheet" href="../../css/nitro.css" type="text/css" />
9</head>
10<body>
11<h1>MI_ReadCache <IMG src="../../image/NTR.gif" align="middle"><IMG src="../../image/TWL.gif" align="middle"></h1>
12<h2>Syntax</h2>
13<dl>
14  <dd>
15<code>#include &lt;nitro/mi.h&gt;<br />
16  <br />
17  BOOL MI_ReadCache(<A href="MICache.html">MICache</A> *cache, void *buffer, u32 offset, u32 length);</code></dd>
18</dl>
19
20<h2>Arguments</h2>
21<table border="1" width="100%">
22  <tbody>
23    <tr>
24      <td width="13%"><em><strong>cache</strong></em></td>
25      <td width="87%">Pointer to the <A href="MICache.html"><CODE>MICache</CODE></A> structure to access.<br />
26      The cache must have been initialized using <A href="MI_InitCache.html"><CODE>MI_InitCache()</CODE></A>.</td>
27    </tr>
28    <tr>
29      <td width="13%"><em><strong>buffer</strong></em></td>
30      <td width="87%">The destination memory to store the loaded data.
31      Specifying NULL indicates cache preloading for the specified area.<br />
32      For more details, see the Description section below.</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>Returns TRUE if the cache is hit and the read succeeds; otherwise, returns FALSE. </p>
47
48<h2>Description</h2>
49<p>Reads data from the cache page list of the <A href="MICache.html"><CODE>MICache</CODE></A> structure.</p>
50<p>If the data in the specified range has already been loaded with <a href="MI_LoadCache.html"><CODE>MI_LoadCache()</CODE></a>, it will copy data from the cache page list and return TRUE.</p>
51<p>If part or all of the specified range does not exist in the cache page list, it will destroy the least-used page within the cache page list, set it to the &quot;waiting to load&quot; state, and return FALSE.</p>
52<p>Pages that enter the &quot;waiting to load&quot; state will actually be loaded during the subsequent call to <a href="MI_LoadCache.html"><CODE>MI_LoadCache()</CODE></a>.
53</p>
54<p>If NULL is specified for <em><strong>buffer</strong></em> (the destination memory for the transfer), nothing will happen if there is a hit in the cache, but the same processing will apply for putting pages in areas that didn't have hits into the &quot;waiting to load&quot; state. Therefore, this function can be used to instruct <I>to prepare for prefetch</I> the specified range.</p>
55<p>
56This function is thread-safe. This function can be used even while <a href="MI_LoadCache.html"><CODE>MI_LoadCache()</CODE></a> or other such functions are being called in other threads.
57</p>
58<p>
59This feature is a utility that enables efficient read access to devices. For more information, see the reference for the <a href="MICache.html"><CODE>MICache</CODE></a> structure.
60</p>
61
62<h2>See Also</h2>
63<p><code><a href="MI_InitCache.html">MI_InitCache</a>, <a href="MI_LoadCache.html">MI_LoadCache</a>, <a href="MI_IsCacheLoading.html">MI_IsCacheLoading</a><br /> <a href="MICache.html">MICache</a></code></p>
64<h2>Revision History</h2>
65<p>2007/05/16 Initial version.</p>
66<hr><p>CONFIDENTIAL</p></body>
67</html>
68