# PM_ForceToPowerOff*

## C Specification

      #include <nitro/spi.h>

      u32 PM_ForceToPowerOff( void );

      u32 PM_ForceToPowerOffAsync( PMCallback callback, void* arg );

## Description

This function 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, when you call the function, it may not operate promptly.

A synchronous function that waits for the operation to finish, as well as an asynchronous function that sends the command to the ARM7, are both provided. Use these functions according to your operational requirements. (The asynchronous function has Async attached to the function name.)

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

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

The `result` argument is the first argument in the callback. The `result` argument shows the results of the command as either `PM_RESULT_SUCCESS` or `PM_RESULT_ERROR`. 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.

Before you use this function, initialize the PM library by using the `PM_Init()` function. The `PM_Init()` function has to be called only once.

The `OS_Init()` function is called from within the `PM_Init()` function. If you need to call the `OS_Init()` function, you have to call the `PM_Init()` function only once. There is no need for the `OS_Init()` function to be called separately.

## Internal Operation

Operates the PMIC register `PMIC_CTL`

## Arguments

`callback` | the callback that is called when the command finishes
`arg` | the argument that is used when calling the callback

## Return Values

The `PM_RESULT_SUCCESS` return value indicates that the command execution has succeeded (when synchronous functions) or that the command was successfully sent to the ARM7 processor (for asynchronous functions).

However, after the power turns OFF, you cannot actually do anything after the `PM_RESULT_SUCCESS` return value is returned. The `PM_RESULT_ERROR` return value indicates that an error has occurred in the ARM7 processor.

## See Also

`PM_Init`

## Revision History

07/31/2004 Initial version