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_GetACAdapter</TITLE> 8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css"> 9</HEAD> 10<BODY> 11<H1 align="left">PM_GetACAdapter <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 <twl/spi.h></CODE></PRE> 16 <PRE><CODE>u32 PM_GetACAdapter( BOOL *isConnectedBuf ); 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>isConnectedBuf</STRONG></EM></TD> 24<TD width="87%">Region that stores whether power is being supplied through the AC adapter.</TD> 25 </TR> 26 </TBODY> 27</TABLE> 28<H2>Return Values</H2> 29<P>If <CODE>PM_RESULT_SUCCESS</CODE>, the command was run successfully.</P> 30<P>If <CODE>PM_RESULT_BUSY</CODE>, the SPI was occupied by other processing and unable to process this function.</P> 31<P>If <CODE>PM_RESULT_ERROR</CODE>, this function could not be used. This error means that this function was called during operation in NITRO mode. It will not be returned in any other situation.</P> 32<P>On success, this function will store in the address indicated by <SPAN class="argument">isConnectedBuf</SPAN> whether the AC adapter is connected and electricity is flowing to the DC connector. This is a Boolean value that is <CODE>TRUE</CODE> when they are connected and <CODE>FALSE</CODE> otherwise.</P> 33<H2>Description</H2> 34<P>Determines whether the AC adapter is plugged into the DC connector and electricity is flowing.</P> 35<P>The <SPAN class="argument">isConnectedBuf</SPAN> argument is a pointer to a <CODE>BOOL</CODE>-type value that contains the results. If <CODE>TRUE</CODE>, the AC adapter is connected and current is flowing through it, but <FONT color="#ff0000">you cannot determine that the battery is recharging simply by knowing that there is current flowing through the connected AC adapter</FONT>. This is <CODE>TRUE</CODE> even if there is a connection and the battery is not being charged because it is already at full capacity. This is <CODE>FALSE</CODE> if the AC adapter has been connected but there is no current flowing through it (such as when it has not been plugged into an outlet).</P> 36<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.</P> 37<P><FONT color="#ff0000">This function only operates on TWL hardware running in TWL mode. </FONT>It cannot be used on NITRO hardware or TWL hardware running in NITRO mode. In such cases it will return <CODE>PM_RESULT_ERROR</CODE>.</P> 38<P><B><BR> <BR> About <CODE>PM_RESULT_BUSY</CODE></B></P> 39<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> 40<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> 41<BLOCKQUOTE style="background-color:#ffffcc"><B>Example</B><BR> <CODE>while( PM_GetACAdapter( ... ) != PM_RESULT_SUCCESS )<BR> {<BR> }</CODE></BLOCKQUOTE> 42<H2>See Also</H2> 43<P><A href="PM_Init.html"><CODE>PM_Init</CODE></A><BR> <A href="PM_GetBattery.html"><CODE>PM_GetBattery</CODE></A><BR> <A href="PM_GetBatteryLevel.html"><CODE>PM_GetBatteryLevel</CODE></A></P> 44<H2>Revision History</H2> 45<P>2009/06/03 Removed a description of the <CODE>PM_Init</CODE> function (because <CODE>OS_Init</CODE> is now required). <BR>2008/08/23 Added information on <CODE>PM_RESULT_BUSY</CODE>. <BR>2008/01/24 Initial version.</P> 46<hr><p>CONFIDENTIAL</p></body> 47</HTML>