#include <nitro/spi.h>
u32 PM_SetAmpGain( PMAmpGain val );
u32 PM_SetAmpGainAsync(
PMAmpGain val ,
PMCallback callback ,
void* arg );
Sets the gain of the programmable gain amp
The val argument is a PMAmpGain enumerator type value that can contain either one of the following values:
PM_AMPGAIN_20 |
gain = 20 times |
PM_AMPGAIN_40 |
gain = 40 times |
PM_AMPGAIN_80 |
gain = 80 times |
PM_AMPGAIN_160 |
gain = 160 times |
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 command to ARM7, are provided. Use either of the functions depending on your operational requirements. (The asynchronous function includes Async in the function name.)
When an asynchronous function is called, the specified callback is called when the processing is completed on the ARM7 side. The callback type PMCallback is defined as:
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.
Before you use this function, initialize the PM library by using the PM_Init() function.
PM_Init() only has to be called once. Also, when you call OS_Init(), there is no need to call PM_Init() separately since it is called from within OS_Init().
This function operates PGA_GAIN of the PMIC register.
val |
Sets the value that determines the amp gain |
callback |
The callback that is called when the command finishes |
arg |
The argument that is used when the callback is called |
The PM_RESULT_SUCCESS return value indicates that the execution of the command has succeeded (for asynchronous functions) or that the command was successfully sent to the ARM7 processor (for asynchronous functions).
The PM_INVALID_COMMAND return value indicates that an invalid argument was passed.
The PM_RESULT_ERROR return value indicates that an error has occurred with ARM7 processor.
07/31/2004 Initial version