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>CTRDG_SetPulledOutCallback</TITLE>
8<LINK rel="stylesheet" href="../css/nitro.css" type="text/css">
9</HEAD>
10<BODY>
11<H1 align="left">CTRDG_SetPulledOutCallback <IMG src="../image/NTR.gif" align="middle"></H1>
12<H2>Syntax</H2>
13<DL>
14  <DD>
15  <PRE><CODE>#include &lt;nitro/ctrdg.h&gt;</CODE></PRE>
16  <PRE><CODE>void CTRDG_SetPulledOutCallback( CTRDGPulledOutCallback callback );
17  </CODE></PRE>
18</DL>
19<H2>Arguments</H2>
20<TABLE border="1" width="100%">
21  <TBODY>
22    <TR>
23<TD width="13%"><EM><STRONG>callback</STRONG></EM></TD>
24<TD width="87%">Callback function that is called when Game Pak removal is detected.</TD>
25    </TR>
26  </TBODY>
27</TABLE>
28<H2>Return Values</H2>
29<P>None.</P>
30<H2>Description</H2>
31<P>Sets the callback function that is called when a Game Pak removal is detected.</P>
32<P><CODE>CTRDGPulledOutCallback</CODE> is defined below:</P>
33<BLOCKQUOTE><CODE>typedef BOOL ( *CTRDGPulledOutCallback )( void );</CODE></BLOCKQUOTE>
34<P>This defines the type of the callback function <SPAN class="argument">callback</SPAN>.</P>
35<P>If <CODE>NULL</CODE> is specified in <SPAN class="argument">callback</SPAN>, no callback will be called.</P>
36<H3><BR> <BR> <BR> <B>About Callbacks</B></H3>
37<P>If a value of <CODE>TRUE</CODE> is specified in the callback return value, the program stops after it exits from the callback. If a value of <CODE>FALSE</CODE> is specified in the callback return value, the function does not stop after it exits from the callback. When you stop the function after necessary processing, call the <A href="CTRDG_TerminateForPulledOut.html"><code>CTRDG_TerminateForPulledOut</code></A> afterward. However, the stop process notifies the ARM7 processor using PXI. You cannot call this function from inside the callback while interrupts are disabled.</P>
38<P>For example, enter the following statements to display the &quot;DON'T PULL OUT CARTRIDGE&quot; message and to stop the function when a Game Pak removal is detected. (Many lines, such as init processing, are abridged.)</P>
39<BLOCKQUOTE><B>Example:</B><BR> <CODE><BR> BOOL isPulledOut = FALSE;<BR> <BR> void NitroMain( void )<BR> {<BR> initializeRoutine();<BR> <FONT color="#ff0000">CTRDG_Init();</FONT> <FONT color="#0066ff">// maybe called in OS_Init()</FONT><BR> <FONT color="#ff0000">CTRDG_SetPulledOutCallback( myCallback );</FONT> <FONT color="#0066ff">// set callback</FONT><BR> <BR> while(1)<BR> {<BR> usualGameProcedure();<BR> if ( isPulledOut == TRUE ) <FONT color="#0066ff">// check if cartridge is pulled out</FONT><BR> {<BR> drawMessageRoutine( &quot;DON'T PULL OUT CARTRIDGE&quot; );<BR> <FONT color="#ff0000">CTRDG_TerminateForPulledOut();</FONT> <FONT color="#0066ff">// termination</FONT><BR> <FONT color="#0066ff">// program halted. never reached.</FONT><BR> }<BR> }<BR> }<BR> <BR> <FONT color="#0066ff">//---- callback for cartridge pulled out</FONT><BR> BOOL myCallback( void )<BR> {<BR> isPulledOut = TRUE; <FONT color="#0066ff">// remember that cartridge is pulled out</FONT><BR> return FALSE; <FONT color="#0066ff">// means not to terminate</FONT><BR> }<BR> <BR></CODE></BLOCKQUOTE>
40<H2>See Also</H2>
41<P><A href="CTRDG_Init.html"><CODE>CTRDG_Init</CODE></A><BR> <A href="CTRDG_TerminateForPulledOut.html"><CODE>CTRDG_TerminateForPulledOut</CODE></A></P>
42<H2>Revision History</H2>
43<P>2004/09/15 Initial version.</P>
44<hr><p>CONFIDENTIAL</p></body>
45</HTML>
46