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%">The 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>This function sets the callback function that is called when a Game Pak removal is detected.</P>
32<P><CODE>CTRDGPulledOutCallback</CODE> is callback function.</P>
33<BLOCKQUOTE><CODE>The <em><strong><code>callback</code></strong></em> type is defined as:</CODE></BLOCKQUOTE>
34<P>typedef BOOL ( *CTRDGPulledOutCallback )( void );</P>
35<P>This function does not call the callback if a NULL value is specified in the <em><strong><code>callback</code></strong></em> argument.</P>
36<H3><BR> <BR> <BR> <B>About Callbacks</B></H3>
37<P>If a value of TRUE is specified in the callback return value, the program will stop after it exits from the callback. If a value of FALSE is specified in the callback return value, the function will 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 process, are abridged.)</P>
39<BLOCKQUOTE><B>Example:</B><BR> <CODE><BR> BOOL isPulledOut = FALSE;<BR> <BR> void NitroMain( void )<BR> {<BR> &nbsp;initializeRoutine();<BR> &nbsp;<FONT color="#ff0000">CTRDG_Init();</FONT> <FONT color="#0066ff">// maybe called in OS_Init()</FONT><BR> &nbsp;<FONT color="#ff0000">CTRDG_SetPulledOutCallback( myCallback );</FONT> <FONT color="#0066ff">// set callback</FONT><BR> <BR> &nbsp;while(1)<BR> &nbsp;{<BR> &nbsp;&nbsp;&nbsp;usualGameProcedure();<BR> &nbsp;&nbsp;&nbsp;if ( isPulledOut == TRUE ) <FONT color="#0066ff">// check if cartridge is pulled out</FONT><BR> &nbsp;&nbsp;&nbsp;{<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;drawMessageRoutine( &quot;DON'T PULL OUT CARTRIDGE&quot; );<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT color="#ff0000">CTRDG_TerminateForPulledOut();</FONT> <FONT color="#0066ff">// termination</FONT><BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<FONT color="#0066ff">// program halted. never reached.</FONT><BR> <BR> &nbsp;}<BR> }<BR> <BR> <FONT color="#0066ff">//---- callback for cartridge pulled out</FONT><BR> BOOL myCallback( void )<BR> {<BR> &nbsp;isPulledOut = TRUE; <FONT color="#0066ff">// remember that cartridge is pulled out</FONT><BR> &nbsp;return FALSE; <FONT color="#0066ff">// means not to terminate</FONT><BR> }<BR> <BR></CODE></BLOCKQUOTE>
40<H2>See Also</H2>
41<P><CODE><A href="CTRDG_Init.html">CTRDG_Init</A>, <A href="CTRDG_TerminateForPulledOut.html">CTRDG_TerminateForPulledOut</A></CODE></P>
42<H2>Revision History</H2>
43<P>2004/09/15 Initial version.</P>
44<hr><p>CONFIDENTIAL</p></body>
45</HTML>
46