# PM_GetAmpGain

## C Specification

      #include <nitro/spi.h>

      u32 PM_GetAmpGain( PMAmpGain* gainBuf );

## Description

This function gets the current setting for the gain of the programmable gain amp.

The value of the `PMAmpGain` enumerator type is saved in the `gainBuf` argument and 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, when you call the function, it may not operate promptly.

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

Reads the value of the PMIC register PGA_GAIN.

## Arguments

`gainBuf` | buffer that stores the results of settings that determine the amp gain

## Return Values

The `PM_RESULT_SUCCESS` return value indicates that the execution of the command has succeeded.

The `PM_RESULT_ERROR` return value indicates that an error has occurred with the ARM7 processor.

## See Also

`PM_Init`, `PM_SetAmpGain*`

## Revision History

08/09/2004 Initial version