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.1.0 for Windows"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<TITLE>PM_ForceToPowerOff*</TITLE> 8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css"> 9</HEAD> 10<BODY> 11<H1 align="left">PM_ForceToPowerOff* <IMG src="../../image/NTR.gif" width="24" height="12" border="0" align="middle"><IMG src="../../image/TWL.gif" width="24" height="12" border="0" align="middle"></H1> 12<H2>Syntax</H2> 13<DL> 14 <DD> 15 <PRE><CODE>#include <nitro/spi.h></CODE></PRE> 16 <PRE><CODE>u32 PM_ForceToPowerOff( void ); 17 18u32 PM_ForceToPowerOffAsync( PMCallback callback, void* arg ); 19</CODE></PRE> 20</DL> 21<H2>Arguments</H2> 22<P><B><CODE>PM_ForceToPowerOff</CODE></B><BR> No arguments.</P> 23<P><CODE><B>PM_ForceToPowerOffAsync</B></CODE></P> 24<TABLE border="1" width="100%"> 25 <TBODY> 26 <TR> 27<TD><SPAN class="argument">callback</SPAN></TD> 28<TD>Callback that is called when the command finishes.</TD> 29 </TR> 30 <TR> 31<TD><SPAN class="argument">arg</SPAN></TD> 32<TD>Argument that is used when calling the callback.</TD> 33 </TR> 34 </TBODY> 35</TABLE> 36 37<H2>Return Values</H2> 38<P><CODE><B>PM_ForceToPowerOff</B></CODE><BR> For compatibility with past versions, this function has a <CODE>u32</CODE>-type return value. However, because this function internally retries until it succeeds and then enters a loop, control does not actually return from this function. Accordingly, there is no meaning in getting or comparing its return value with anything.</P> 39<P><CODE><B>PM_ForceToPowerOffAsync</B></CODE><BR> In asynchronous versions, this function returns <CODE>PM_RESULT_SUCCESS</CODE> to indicate that it successfully sent the command to the ARM7. However, because the power turns OFF, you cannot actually do anything with the <CODE>PM_RESULT_SUCCESS</CODE> return value after it is returned.</P> 40<P>A return value of <CODE>PM_RESULT_BUSY</CODE> indicates that the SPI was occupied by other processing and unable to process this function.</P> 41 42<H2>Description</H2> 43<P>Forces the power OFF.</P> 44<P>This function uses PXI to send the command that performs the corresponding operation in the ARM7 processor. The ARM7 side that receives that command is executed by operating the PMIC. Therefore, this function may not operate instantly after you call it. A synchronous function that waits for the operation to finish, as well as an asynchronous function that only sends commands to the ARM7, are provided. Use either of the functions depending on your operational requirements. (The asynchronous function has "Async" appended to the function name.)</P> 45<P><FONT color="#ff0000">The synchronous version of this function continues to retry internally until it succeeds. Once it has succeeded, it immediately enters a loop, so control does not return from the function.</FONT> Even though it does not return, this function has a <CODE>u32</CODE>-type return value. This is only for compatibility with past versions; the value itself has no meaning, and because this function does not return, it cannot actually be obtained.</P> 46<P>When an asynchronous function is called, the specified <SPAN class="argument">callback</SPAN> is called when processing on the ARM7 side finishes. The callback type <CODE>PMCallback</CODE> is defined by: </P> 47<BLOCKQUOTE> <CODE><code>typedef void ( *PMCallback )( u32 result, void* arg )</code>;</CODE></BLOCKQUOTE> 48<P> This callback is called from the PXI interrupt handler.</P> 49<P>The callback's first argument, <SPAN class="argument">result</SPAN>, indicates the result of the command. This is either <code>PM_RESULT_SUCCESS</code> or <code>PM_RESULT_BUSY</code>. The second argument in the callback returns the value <SPAN class="argument">arg</SPAN>.</P> 50<P>However, when processes with the power OFF in the ARM7 succeed, processes after that cannot be carried out. The callback function is executed only when the process fails.</P> 51<P>Before you use this function, initialize the PM library with the <A href="PM_Init.html"><CODE>PM_Init</CODE></A> function. (The <code>PM_Init</code> function has to be called only once. Also, when you call the <a href="../../os/init/OS_Init.html"><code>OS_Init</code></a> function, there is no need to call the <a href="PM_Init.html"><code>PM_Init</code></a> function separately because it is called from inside <code>OS_Init</code>.)</P> 52<P><FONT color="#ff0000">This function can be called from an interrupt handler. It can also be called from interrupt-prohibited states other than interrupt handlers.</FONT></P> 53<P> <B>About <CODE>PM_RESULT_BUSY</CODE></B></P> 54<P>The SPI is used for various other processes besides power management. If you call this function while another process is using it, this function sends a command to the ARM7; there, the SPI is determined to be BUSY, and <CODE>PM_RESULT_BUSY</CODE> is notified to the ARM9 without actually processing this function. Likewise, if you call this function while another PM process is running, that fact is determined on the ARM9 side and this function returns <CODE>PM_RESULT_BUSY</CODE>. (In this case, the determination is made before notification is sent to the ARM7.)</P> 55<P>The synchronous version of this function takes this into account by retrying internally until it succeeds, but the asynchronous version returns <CODE>PM_RESULT_BUSY</CODE>. Accordingly, if you want to make certain that the asynchronous version of this function succeeds, make it retry when it returns BUSY.</P> 56<H2>Internal Operation</H2> 57<P>Operates the <CODE>PMIC_CTL</CODE> value of the PMIC register.</P> 58<H2>See Also</H2> 59<P><A href="PM_Init.html"><CODE>PM_Init</CODE></A></P> 60<H2>Revision History</H2> 61<P>2008/08/23 Elaborated on <CODE>PM_RESULT_BUSY</CODE>.<BR> 2005/07/07 Elaborated on the return value <CODE>PM_RESULT_ERROR</CODE>.<BR> 2005/06/02 Clarified the origin of the call to the callback.<BR> 2004/07/31 Initial version.</P> 62<hr><p>CONFIDENTIAL</p></body> 63</HTML>