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>CARD_SetPulledOutCallback</TITLE> 8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css"> 9</HEAD> 10<BODY> 11<H1 align="left">CARD_SetPulledOutCallback <img src="../../image/NTR.gif"align="middle"><img src="../../image/TWL.gif" align="middle"></H1> 12<H2>Syntax</H2> 13<DL> 14 <DD> 15 <PRE><CODE>#include <nitro/card.h></CODE></PRE> 16 <PRE><CODE>void CARD_SetPulledOutCallback( CARDPulledOutCallback 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 invoked when a Game Card removal is detected. It is called from within either the interrupt handler or the <A href="CARD_CheckPulledOut.html"><CODE>CARD_CheckPulledOut</CODE></A> function.</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 Card removal is detected.</P> 32<P>To use this function, you must first call the <a href="../common/CARD_Init.html"><code>CARD_Init</code></a> function.</P> 33<P><CODE>CARDPulledOutCallback</CODE> is the type of callback function <B><I>callback</I></B>, and is defined as</P> 34<BLOCKQUOTE><CODE>typedef BOOL ( *CARDPulledOutCallback )( void );</CODE></BLOCKQUOTE> 35<P> </P> 36<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> 37<H3><BR> 38<BR> 39<BR> 40<B>About Callbacks</B></H3> 41<P>Specify TRUE in the callback return value if the program will stop after it exits from the callback (or when the power is turned off when the cover is closed). 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 <A href="CARD_TerminateForPulledOut.html"><code>CARD_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> 42<P>For example, use the following statements to display the "DON'T PULL OUT CARD" message and to stop the program when a Game Card removal is detected.</P> 43 44<BLOCKQUOTE><B>Example:</B><BR> 45<PRE><BR> 46void NitroMain( void )<BR> 47{ 48 initializeRoutine(); 49 <FONT color="#ff0000">CARD_SetPulledOutCallback( myCallback );</FONT> <FONT color="#0066ff">// set callback</FONT> 50 51 while(1) 52 { 53 usualGameProcedure(); 54 if ( <FONT color="#ff0033">CARD_IsPulledOut()</FONT> ) <FONT color="#0066ff">// check whether card is pulled out</FONT> 55 { 56 drawMessageRoutine( "DON'T PULL OUT CARD" ); 57 <FONT color="#ff0000">CARD_TerminateForPulledOut();</FONT> <FONT color="#0066ff">// terminate</FONT> 58 <FONT color="#0066ff">// program halted.</FONT> 59 } 60 } 61} 62 63<FONT color="#0066ff">//---- callback for pulled-out card</FONT> 64BOOL myCallback( void ) 65{ 66return FALSE; <FONT color="#0066ff">// does not terminate</FONT> 67} 68</PRE></BLOCKQUOTE> 69 70<H2>See Also</H2> 71<P><CODE><A href="../common/CARD_Init.html">CARD_Init</A>, <A href="CARD_TerminateForPulledOut.html">CARD_TerminateForPulledOut</A>, <A href="CARD_IsPulledOut.html">CARD_IsPulledOut</A>, <A href="CARD_CheckPulledOut.html">CARD_CheckPulledOut</A></CODE></P> 72<H2>Revision History</H2> 73<P> 742005/06/01 Added information stating the callback is called from the interrupt handler.<br>2004/12/16 Fixed so the sample code uses <CODE>CARD_IsPulledOut()</CODE> .<BR>2004/11/10 Added statement about the power being off if the cover is closed with the stop processing after returning from the callback.<BR> 752004/09/16 Initial version.</P> 76<hr><p>CONFIDENTIAL</p></body> 77</HTML> 78