1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<html>
3
4<head>
5<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
6<META name="GENERATOR" content="Microsoft FrontPage 5.0">
7<META http-equiv="Content-Style-Type" content="text/css">
8<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css">
9<title>GXSetCPUFifo</title>
10</head>
11
12<body>
13
14<h1 align="left">GXSetCPUFifo</h1>
15
16
17<h2>C Specification</h2>
18
19<dl>
20<dd><PRE><CODE>#include &lt;revolution/gx.h&gt;</CODE></PRE>
21  </dd>
22<dd><pre><CODE>void GXSetCPUFifo( const <a href="../Structures/GXFifoObj.html">GXFifoObj</a>* fifo );</CODE></pre>
23  </dd>
24</dl>
25
26<h2>Arguments</h2>
27<div align="left">
28<TABLE border="1" cellpadding="3" cellspacing="0.1">
29  <tr>
30<TD width="120" bgcolor="#ffffe8"><code><strong><em>fifo</em></strong></code></TD>
31<TD width="520">A pointer to the FIFO structure</TD>
32    </tr>
33</TABLE>
34</div>
35
36<h2>Return Values</h2>
37
38<p>None.</p>
39<H2>Description</H2>
40<P>This function attaches a FIFO to the CPU.&nbsp;The CPU will use a write-gather buffer to write graphics commands into the FIFO. If the same FIFO is also attached to GP using the <a href="GXSetGPFifo.html"><code>GXSetGPFifo</code></a> function, the FIFO provides an immediate-mode interface for drawing graphics. Conversely, separating the FIFO used to connect to the CPU from the FIFO used to connect to the GP allows a frame's worth of graphics commands to be accumulated for use. </P>
41<P>The <A href="../Management/GXInit.html"><CODE>GXInit</CODE></A> function initializes the default FIFO and sets it up as an immediate mode graphics interface. </P>
42<P>The <em><strong><code>fifo</code></strong></em> structure must be initialized before calling <code>GXSetCPUFifo</code> by using <a href="GXInitFifoBase.html"><code>GXInitFifoBase</code></a>, <code><a href="GXInitFifoLimits.html">GXInitFifoLimits</a></code>, and <a href="GXInitFifoPtrs.html"><code>GXInitFifoPtrs</code></a>. After configuration by calling <CODE>GXSetCPUFifo</CODE>, there is no need to keep the contents of the <EM><STRONG><CODE>fifo</CODE></STRONG></EM> structure.</P>
43
44<P>The FIFO region must be allocated in internal memory (MEM1 region) of the system.<BR><BR><B>Note: The external memory (MEM2 region) cannot be allocated.</B></P>
45
46<H3>Immediate Mode</H3>
47<P>When a FIFO is attached to both the CPU and GP, the FIFO acts as a true FIFO buffer. In this mode, the high and low watermarks function and flow control is enabled between the CPU and GP. The CPU stops writing graphics commands to the FIFO if the volume of commands accumulating in the FIFO exceeds the high watermark. The CPU resumes sending graphics commands to the FIFO after the GP catches up and the command volume accumulating in the FIFO falls below the low water mark. The watermark settings can be established using <A href="GXInitFifoLimits.html"><CODE>GXInitFifoLimits</CODE></A>. The high watermark is set to <CODE>[(FIFO size) - GX_FIFO_HI_WATERMARK_BUFFER]</CODE> at the point where the FIFO structure is initialized using <A href="GXInitFifoBase.html"><CODE>GXInitFifoBase</CODE></A>. <CODE>GX_FIFO_HI_WATERMARK_BUFFER</CODE> is defined as 16KB. The low watermark is set to be half of the FIFO size.&nbsp;
48</P>
49<P>The state where the high watermark has been exceeded during processing can be detected using the <EM><STRONG><CODE>overhi</CODE></STRONG></EM> flag of the <A href="GXGetGPStatus.html"><CODE>GXGetGPStatus</CODE></A> function. The <em><strong><code>underlow</code></strong></em> flag indicates that the amount of data in the FIFO is less than the low watermark.</P>
50<H3>Multi-Buffered FIFOs</H3>
51<P>When a FIFO is connected only to the CPU, it acts like a buffer.&nbsp;If you write more data than the FIFO can hold, the write pointer will wrap from the last address back to the first address in the FIFO.&nbsp;Although this ensures that data is not written beyond the FIFO memory range, it results in overwriting graphics commands that have previously been written. A state like this can be detected using the <A href="GXGetFifoWrap.html"><CODE>GXGetFifoWrap</CODE></A> function.
52
53
54
55<h2>See Also</h2>
56<P><A href="GXSetGPFifo.html"><CODE>GXSetGPFifo</CODE></A></P>
57<H2>Revision History</H2>
58<P>2006/03/01 Initial version.</P>
59<hr>
60<P>CONFIDENTIAL</p>
61</BODY>
62</HTML>