PMi_WriteRegister*

C Specification

#include <nitro/spi.h>
u32 PMi_WriteRegister( u16 registerAddr, u16 data );

u32 PMi_ReadRegisterAsync( u16 registerAddr,
u16 data,
PMCallback callback,
void*           arg );
  

Arguments

registerAddr The register address.
data The write value.
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 that the execution of the command has succeeded (for synchronous functions) or that the command was successfully sent to the ARM7 processor (for asynchronous functions). The PM_INVALID_COMMAND return value indicates that the argument that was passed is invalid. The PM_RESULT_ERROR return value indicates that an error has occurred with the ARM7 processor.

Description

This function writes the value in the PMIC register.

Caution: In general, avoid the direct operation of the PMIC register. Perform necessary operations using another PM function that corresponds to that register operation.

The registerAddr argument contains the PMIC register address. You can specify the following values for register addresses:

REG_PMIC_CTL_ADDR
REG_PMIC_STAT_ADDR
REG_PMIC_OP_CTL_ADDR
REG_PMIC_PGA_GAIN

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 promptly 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" as part of 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 as: The callback type PMCallback is defined by:

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

This callback is called from within the PXI interrupt handler.

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.

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. Also, when you call OS_Init(), there is no need to call PM_Init() separately since it is called from within OS_Init().)

Internal Operation

This function writes the value in the PMIC register.

See Also

PM_Init, PMi_WriteRegister*

Revision History

06/02/2005 Specified the call origin of the callback.
07/31/2004 Initial version.