PM_ForceToPowerOff*

Syntax

#include <nitro/spi.h>
u32 PM_ForceToPowerOff( void );

u32 PM_ForceToPowerOffAsync( PMCallback callback, void* arg );

Arguments

PM_ForceToPowerOff
No arguments.

PM_ForceToPowerOffAsync

callback Callback that is called when the command finishes.
arg Argument that is used when calling the callback.

Return Values

PM_ForceToPowerOff
For compatibility with past versions, this function has a u32-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.

PM_ForceToPowerOffAsync
In asynchronous versions, this function returns PM_RESULT_SUCCESS to indicate that it successfully sent the command to the ARM7. However, because the power turns OFF, you cannot actually do anything with the PM_RESULT_SUCCESS return value after it is returned.

A return value of PM_RESULT_BUSY indicates that the SPI was occupied by other processing and unable to process this function.

Description

Forces the power OFF.

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.)

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. Even though it does not return, this function has a u32-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.

When an asynchronous function is called, the specified callback is called when processing on the ARM7 side finishes. The callback type PMCallback is defined by:

typedef void ( *PMCallback )( u32 result, void* arg );

This callback is called from the PXI interrupt handler.

The callback's first argument, result, indicates the result of the command. This is either PM_RESULT_SUCCESS or PM_RESULT_BUSY. The second argument in the callback returns the value arg.

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.

This function can be called from an interrupt handler. It can also be called from interrupt-prohibited states other than interrupt handlers.



About PM_RESULT_BUSY

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 PM_RESULT_BUSY 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 PM_RESULT_BUSY. (In this case, the determination is made before notification is sent to the ARM7.)

The synchronous version of this function takes this into account by retrying internally until it succeeds, but the asynchronous version returns PM_RESULT_BUSY. Accordingly, if you want to make certain that the asynchronous version of this function succeeds, make it retry when it returns BUSY.

Internal Operation

Controls the PMIC_CTL value of the PMIC register.

See Also

PM_Init

Revision History

2009/06/03 Removed a description of the PM_Init function (because OS_Init is now required).
2008/08/23 Mentioned PM_RESULT_BUSY.
2005/07/07 Mentioned the PM_RESULT_ERROR return value.
2005/06/02 Explicitly stated where the callback is invoked.
2004/07/31 Initial version.


CONFIDENTIAL