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 <nitro/ctrdg.h></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> 37 <BR> 38 <BR> 39 <B>About Callbacks</B></H3> 40<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> 41<P>For example, enter the following statements to display the "DON'T PULL OUT CARTRIDGE" message and to stop the function when a Game Pak removal is detected. (Many lines, such as init processing, are abridged.)</P> 42<BLOCKQUOTE><B>Example:</B><BR> 43<PRE> 44BOOL isPulledOut = FALSE; 45 46void NitroMain( void ) 47{ 48 initializeRoutine(); 49 <FONT color="#ff0000">CTRDG_Init();</FONT> <FONT color="#0066ff">// maybe called in OS_Init()</FONT> 50 <FONT color="#ff0000">CTRDG_SetPulledOutCallback( myCallback );</FONT> <FONT color="#0066ff">// set callback</FONT> 51 52 while(1) 53 { 54 usualGameProcedure(); 55 if ( isPulledOut == TRUE ) <FONT color="#0066ff">// check if cartridge is pulled out</FONT> 56 { 57 drawMessageRoutine( "DON'T PULL OUT CARTRIDGE" ); 58 <FONT color="#ff0000">CTRDG_TerminateForPulledOut();</FONT> <FONT color="#0066ff">// termination</FONT> 59 <FONT color="#0066ff">// program halted. never reached.</FONT> 60 } 61 } 62} 63 64<FONT color="#0066ff">//---- callback for cartridge pulled out</FONT> 65BOOL myCallback( void ) 66{ 67 isPulledOut = TRUE; <FONT color="#0066ff">// remember that cartridge is pulled out</FONT> 68 return FALSE; <FONT color="#0066ff">// means not to terminate</FONT> 69} 70 71</PRE></BLOCKQUOTE> 72<H2>See Also</H2> 73<P><A href="CTRDG_Init.html"><CODE>CTRDG_Init</CODE></A><BR> 74 <A href="CTRDG_TerminateForPulledOut.html"><CODE>CTRDG_TerminateForPulledOut</CODE></A></P> 75<H2>Revision History</H2> 76<P>2004/09/15 Initial version.</P> 77<hr><p>CONFIDENTIAL</p></body> 78</HTML> 79