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 GetLEDPattern*</TITLE> 8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css"> 9</HEAD> 10<BODY> 11<H1 align="left">PM_GetLEDPattern* <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_GetLEDPattern( PMLEDPattern* patternBuf ); 17 18u32 PM_GetLEDPatternAsync( PMLEDStatus* patternBuf, PMCallback callback, void* arg ); 19 </CODE></PRE> 20</DL> 21<H2>Arguments</H2> 22<TABLE border="1" width="100%"> 23 <TBODY> 24 <TR> 25<TD width="13%"><SPAN class="argument">patternBuf</SPAN></TD> 26<TD width="87%">Buffer that stores the value of the LED pattern to be obtained.</TD> 27 </TR> 28 <TR> 29<TD><SPAN class="argument">callback</SPAN></TD> 30<TD>Callback that is called when the command finishes.</TD> 31 </TR> 32 <TR> 33<TD><SPAN class="argument">arg</SPAN></TD> 34<TD>Argument that is used when calling the callback.</TD> 35 </TR> 36 </TBODY> 37</TABLE> 38<H2>Return Values</H2> 39<P>If <code>PM_RESULT_SUCCESS</code>, the command execution has succeeded (for synchronous functions), or the command was successfully sent to the ARM7 processor (for asynchronous functions).</P> 40<P>If <CODE>PM_RESULT_BUSY</CODE>, the SPI was occupied by other processing and unable to process this function.</P> 41<H2>Description</H2> 42<P>Gets the LED state of the console.</P> 43<P>The <SPAN class="argument">patternBuf</SPAN> argument is a buffer that stores the <CODE>PMLEDPattern</CODE> list type values. It takes a value that indicates the state of the LED when it is not <CODE>NULL</CODE>. It will take one of the following values. 44</P> 45<TABLE border="1"> 46 <TBODY> 47 <TR> 48<TH><CODE>Value Stored in <SPAN class="argument">patternBuf</SPAN></CODE></TH> 49<TH>LED State</TH> 50 </TR> 51 <TR> 52<TD><CODE>PM_LED_PATTERN_ON</CODE></TD> 53<TD>The LED is illuminated.</TD> 54 </TR> 55 <TR> 56<TD><CODE>PM_LED_PATTERN_BLINK_LOW</CODE></TD> 57<TD>The LED is blinking at a high speed.</TD> 58 </TR> 59 <TR> 60<TD><CODE>PM_LED_PATTERN_BLINK_HIGH</CODE></TD> 61<TD>The LED is blinking at a low speed. </TD> 62 </TR> 63 <TR> 64<TD><CODE>PM_LED_PATTERN_BLINK1</CODE></TD> 65<TD>The LED is repeating a lit/unlit pattern every 1 frame. </TD> 66 </TR> 67 <TR> 68<TD><CODE>PM_LED_PATTERN_BLINK2</CODE></TD> 69<TD>The LED is repeating a lit/unlit pattern every 2 frames. </TD> 70 </TR> 71 <TR> 72<TD><CODE>PM_LED_PATTERN_BLINK3</CODE></TD> 73<TD>The LED is repeating a lit/unlit pattern every 3 frames. </TD> 74 </TR> 75 <TR> 76<TD><CODE>PM_LED_PATTERN_BLINK4</CODE></TD> 77<TD>The LED is repeating a lit/unlit pattern every 4 frames. </TD> 78 </TR> 79 <TR> 80<TD><CODE>PM_LED_PATTERN_BLINK5</CODE></TD> 81<TD>The LED is repeating a lit/unlit pattern every 5 frames. </TD> 82 </TR> 83 <TR> 84<TD><CODE>PM_LED_PATTERN_BLINK6</CODE></TD> 85<TD>The LED is repeating a lit/unlit pattern every 8 frames. </TD> 86 </TR> 87 <TR> 88<TD><CODE>PM_LED_PATTERN_BLINK8</CODE></TD> 89<TD>The LED is repeating a lit/unlit pattern every 8 frames. </TD> 90 </TR> 91 <TR> 92<TD><CODE>PM_LED_PATTERN_BLINK10</CODE></TD> 93<TD>The LED is repeating a lit/unlit pattern every 10 frames. </TD> 94 </TR> 95 <TR> 96<TD><CODE>PM_LED_PATTERN_PATTERN1</CODE></TD> 97<TD>The LED is blinking in a predetermined pattern. </TD> 98 </TR> 99 <TR> 100<TD><CODE>PM_LED_PATTERN_PATTERN2</CODE></TD> 101<TD>The LED is blinking in a predetermined pattern. </TD> 102 </TR> 103 <TR> 104<TD><CODE>PM_LED_PATTERN_PATTERN3</CODE></TD> 105<TD>The LED is blinking in a predetermined pattern. </TD> 106 </TR> 107 </TBODY> 108</TABLE> 109<P>The "high-speed blink" and "low-speed blink" are blink features that are implemented on the hardware. Although the term "high-speed" is used, the blinking speed is actually slower than the blinking speed that is caused by the software that repeats the lit/unlit pattern in a fixed number of frames.)</P> 110<P>This function uses PXI to send a command to execute the operation in question on the ARM7 processor. Once it receives that command, the ARM7 executes it by manipulating 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> 111<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> 112<BLOCKQUOTE> <CODE><code>typedef void ( *PMCallback )( u32 result, void* arg )</code>;</CODE></BLOCKQUOTE> 113<P> This callback is called from inside the PXI interrupt handler.</P> 114<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_ERROR</code>. The second argument in the callback returns the value <SPAN class="argument">arg</SPAN>.</P> 115<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> 116<P><FONT color="#ff0000">This function can be used from an interrupt handler. This function cannot be used in interrupt-prohibited states other than interrupt handlers.</FONT></P> 117<P><BR> <BR> <B>About <CODE>PM_RESULT_BUSY</CODE></B></P> 118<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> 119<P>Accordingly, if you want to ensure that this function succeeds, make it loop until it succeeds as shown below. (This example does not take into account mistakes such as wrong arguments.)</P> 120<BLOCKQUOTE style="background-color:#ffffcc"><B>Example</B><BR> <CODE>while( PM_GetLEDPattern( ... ) != PM_RESULT_SUCCESS )<BR> {<BR> }</CODE></BLOCKQUOTE> 121<H2>See Also</H2> 122<P><A href="PM_Init.html"><CODE>PM_Init</CODE></A></P> 123<H2>Revision History</H2> 124<P>2008/12/05 Added a note about use in interrupt-prohibited states.<BR> 2008/08/23 Quit using <CODE>PM_RESULT_ERROR</CODE> and 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 caller of the callback.<BR> 2004/08/26 Initial version.</P> 125<hr><p>CONFIDENTIAL</p></body> 126</HTML>