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_InitCache</title> 8<link rel="stylesheet" href="../../css/nitro.css" type="text/css" /> 9</head> 10<body> 11<h1>MI_InitCache <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 <nitro/mi.h><br /> 16 <br /> 17 void MI_InitCache(<A href="MICache.html">MICache</A> *cache, u32 page, void *buffer, 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">MICache</A> structure to be initialized.</td> 26 </tr> 27 <tr> 28 <td width="13%"><em><strong>page</strong></em></td> 29 <td width="87%">Size of each cache page.<br /> 30 This size must be 4 bytes or greater, and must be a power of 2.</td> 31 </tr> 32 <tr> 33 <td width="13%"><em><strong>buffer</strong></em></td> 34 <td width="87%">Buffer used for cache page management information.</td> 35 </tr> 36 <tr> 37 <td width="13%"><em><strong>length</strong></em></td> 38 <td width="87%">Byte size of <EM><STRONG>buffer</STRONG></EM>. 39 The library creates as many cache pages as possible of the specified size.<br /> 40 For more details, see the Description section below.</td> 41 </tr> 42 </TBODY> 43</table> 44 45<h2>Return Values</h2> 46<p>None.</p> 47 48<h2>Description</h2> 49<p>Specifies the buffer and page size for the management information, and initializes the <A href="MICache.html">MICache</A> structure.<br />This structure uses the buffer internally to prepare a cache page list.<br />This structure can be used to call <CODE><A href="MI_ReadCache.html">MI_ReadCache()</A></CODE> and <A href="MI_LoadCache.html"><CODE>MI_LoadCache()</CODE></A>. 50</p> 51<p> 52The size of the buffer for management information can be specified to whatever size meets the application.<BR>The library uses the values specified for <B><CODE>page</CODE></B> and <B><CODE>length</CODE></B> to automatically calculate the number of pages using the expression: 53</p> 54<p style="background-color:#FFFFF8;padding:2px;margin:1px"> <CODE>length / ( sizeof(MICachePage) + page )</CODE></p> 55<p> 56It also internally manages the computation as a list structure. Conversely, if you want to compute the requisite byte size from the page size and the total number of pages, you can use the macro: 57</p> 58<p style="background-color:#FFFFF8;padding:2px;margin:1px"> <CODE>MI_CACHE_BUFFER_WORKSIZE(page, total)</CODE></p> 59<p> 60 61</p> 62<p> 63This 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. 64</p> 65 66<h2>See Also</h2> 67<p><code><a href="MI_ReadCache.html">MI_ReadCache</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> 68<h2>Revision History</h2> 69<p> 702007/05/16 Initial version. 71</p> 72<hr><p>CONFIDENTIAL</p></body> 73</html> 74