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 http-equiv="Content-Style-Type" content="text/css"> 7<LINK rel="stylesheet" type="text/css" href="../../CSS/revolution.css"> 8<title>Reset and Shutdown Functions</title> 9</head> 10 11<body> 12 13<h1>Reset Functions and Shutdown Functions</h1> 14 15<h2>Introduction</h2> 16 17<P>The Revolution SDK provides several functions for executing operations related to system state transitions such as reset and shutdown. An application needs to call these functions as appropriate when it detects that the Reset Button or Power Button has been pressed or when it wants to terminate the execution.</P> 18 19<h2>Functions</h2> 20<dl><dd><pre class="construction">void OSRebootSystem(void); 21void OSShutdownSystem(void); 22void OSRestart(u32 resetCode); 23void OSReturnToMenu(void); 24</pre></dd></dl> 25 26<h2>Description</h2> 27<P>The four functions listed above are provided as functions for implementing reset/shutdown processing. <A HREF="OSRebootSystem.html"><CODE>OSRebootSystem</CODE></A> restarts the system, <A HREF="OSShutdownSystem.html"><CODE>OSShutdownSystem</CODE></A> shuts down the system, <A HREF="OSRestart.html"><CODE>OSRestart</CODE></A> restarts the current application, and <A HREF="../WiiMenu/OSReturnToMenu.html"><CODE>OSReturnToMenu</CODE></A> executes processes necessary to return to the system menu. For more information about these functions, see individual function descriptions.</P> 28 29<P>When called, these reset/shutdown functions internally execute processes that terminate each sub-system.</P> 30 31<h2>Caution</h2> 32<P>Note the following before calling a reset/shutdown function.</P> 33<BLOCKQUOTE>[Required] Something that can result in a fatal error such as a system hang-up.</BLOCKQUOTE> 34<BLOCKQUOTE> 35<BLOCKQUOTE><STRONG>Callbacks: </STRONG>An error may occur when a reset/shutdown function is called if a user callback/handler is present that might call any of the following functions.</BLOCKQUOTE> 36</BLOCKQUOTE> 37 38<BLOCKQUOTE><BLOCKQUOTE><BLOCKQUOTE> 39<UL> 40<li>Initialization functions for audio related libraries (for example, <CODE>AXInit</CODE>, <CODE>AIInit</CODE>, and <CODE>ARInit</CODE>)</li> 41<li>GX Function</li> 42</UL> 43</BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE> 44<BLOCKQUOTE> 45<BLOCKQUOTE>These reset/shutdown functions shut down all subsystems before all interrupts are disabled and all user alarms are canceled. This means that if there's a unfinished asynchronous function or a valid alarm when this function is called, the associated callback/handler can be called after these subsystems are shut down from inside this function. If the callback/handler attempts to use any subsystem after shutdown, it fails and may cause a critical, subsystem-dependent problem like a hang up. The above is a list of functions that can cause problems. If the system hangs after calling Reset/Shutdown functions, be sure to check if any of the callbacks or handlers are using one of the above functions.</BLOCKQUOTE> 46</BLOCKQUOTE> 47<BLOCKQUOTE>[Recommended] A recommended item is one that is recommended, but not fatal so that reset may be delayed if not implemented.</BLOCKQUOTE> 48<BLOCKQUOTE> 49<BLOCKQUOTE><STRONG>Audio: </STRONG>We <B>strongly recommend</B> terminating all audio subsystems before calling a reset/shutdown function. This caution is taken for two reasons. First, it may take time to shut down the audio subsystem from within the function if they are not terminated before the Reset/Shutdown function is called. Second, there is no guarantee that the reset/shutdown function will stop the audio without generating noise.</BLOCKQUOTE> 50</BLOCKQUOTE> 51<BLOCKQUOTE> 52<BLOCKQUOTE><STRONG>NAND Flash, SD Memory Card, and GC Memory Card: </strong></em>We <b>strongly recommend</b> that reset/shutdown functions not be called until all NAND flash and Memory Card operations are complete. Otherwise, it may take a relatively long time for a hot reset to be issued. This is because the reset/shutdown functions unmount any currently mounted Memory Cards.</BLOCKQUOTE> 53</BLOCKQUOTE> 54<BLOCKQUOTE> 55<BLOCKQUOTE><STRONG>VI: </STRONG> Since it is not guaranteed that frame buffers are kept unchanged during reset/shutdown procedures, it is recommended that the application call <A href="../../vi/VISetBlack.html"><CODE>VISetBlack(TRUE)</CODE></A> (then call the <A href="../../vi/VIFlush.html"><CODE>VIFlush</CODE></A> and <A href="../../vi/VIWaitForRetrace.html"><CODE>VIWaitForRetrace</CODE></A> functions to wait until the screen blacks out.) Note that reset/shutdown functions do not call <A href="../../vi/VISetBlack.html"><code>VISetBlack(TRUE)</code></a> inside the function. 56</BLOCKQUOTE> 57</BLOCKQUOTE> 58<BLOCKQUOTE> 59<BLOCKQUOTE><STRONG>Optical Disc Drive: </STRONG>We recommend that you do not call any DVD functions before calling a reset/shutdown function. Functions such as <A href="../../dvd/DVDCancel.html"><code>DVDCancel</code></A> need not be called. The reset/shutdown functions act internally to cancel all optical disc drive requests. If you were to make the call to <A href="../../dvd/DVDCancel.html"><code>DVDCancel</code></A>, the drive could end up resetting twice (depending on the timing of the reset). 60</BLOCKQUOTE> 61</BLOCKQUOTE> 62<BLOCKQUOTE>[Other Notes]</BLOCKQUOTE> 63<BLOCKQUOTE> 64<BLOCKQUOTE>Reset/shutdown functions suspend the thread scheduler inside the function. Once this function is called, user threads will never be executed.</BLOCKQUOTE> 65</BLOCKQUOTE> 66<BLOCKQUOTE> 67<BLOCKQUOTE>The Revolution SDK does not use the Broadway's segmented address translation mechanism by MMU or access any related registers including SDR1 and SR<i>n</i>. If the application manually activates the segmented address translation mechanism, the register must be reverted to the original state before the restart via <code>OS_RESET_RESTART</code>. Otherwise, unexpected program behavior could occur.</BLOCKQUOTE> 68<BLOCKQUOTE>The contents of all data in memory are not guaranteed if the system is rebooted.</BLOCKQUOTE> 69</BLOCKQUOTE> 70 71<P><strong>Note:</strong> These functions must not be called from inside a callback. Predictable behavior in a callback is not guaranteed.</P> 72 73<h2>See Also</h2> 74<P class="reference"> 75<a target="contents" href="../toc.html#Reset">Reset and Shutdown Functions</a> 76</P> 77 78<H2>Revision History</H2> 79<P> 802008/05/22 Updated the link to <CODE>OSReturnToMenu</CODE> because this function's page has been moved.<br>2006/08/10 Initial version. 81</P> 82 83<hr><p>CONFIDENTIAL</p></body> 84</html>