HPM SDK
HPMicro Software Development Kit
hpm_opamp_drv.h File Reference
#include "hpm_common.h"
#include "hpm_opamp_regs.h"
#include "hpm_soc_feature.h"

Go to the source code of this file.

Data Structures

union  opamp_cfg_preset0
 opamp configuration preset0 More...
 
union  opamp_cfg_preset1
 opamp configuration preset1 More...
 
struct  opamp_cfg
 

Macros

#define OPAMP_MODE_FOLLOW_KEY   (0x06)
 
#define OPAMP_MODE_INVERT_INDEX0_KEY   (0x08)
 
#define OPAMP_MODE_INVERT_INDEX1_KEY   (0x18)
 
#define OPAMP_MODE_NON_INVERT_INDEX0_KEY   (0x01)
 
#define OPAMP_MODE_NON_INVERT_INDEX1_KEY   (0x09)
 
#define OPAMP_MODE_NON_INVERT_INDEX2_KEY   (0x11)
 
#define OPAMP_MODE_NON_INVERT_INDEX3_KEY   (0x19)
 
#define OPAMP_MODE_NON_INVERT_INDEX4_KEY   (0x09)
 
#define OPAMP_MODE_USER_DEFINE_KEY   (0x04)
 

Typedefs

typedef union opamp_cfg_preset0 opamp_ctrl_cfg_preset0_t
 opamp configuration preset0 More...
 
typedef union opamp_cfg_preset1 opamp_ctrl_cfg_preset1_t
 opamp configuration preset1 More...
 
typedef struct opamp_cfg opamp_cfg_t
 

Enumerations

enum  opamp_inm_pad_t {
  inm_pad_vim0 = 0 , inm_pad_vim1 = 1 , inm_pad_vim2 = 2 , inm_pad_dac = 3 ,
  inm_pad_floating = 4
}
 Reverse Input Pin Selection. More...
 
enum  opamp_gain_t {
  gain_x_2 = 0 , gain_x_4 = 1 , gain_x_8 = 2 , gain_x_16 = 3 ,
  gain_x_32 = 4 , gain_x_64 = 5 , gain_x_128 = 6
}
 Gain multiplier selection. More...
 
enum  opamp_miller_cap_t {
  miller_cap_x_7 = 0 , miller_cap_x_8 = 1 , miller_cap_x_10 = 2 , miller_cap_x_13 = 3 ,
  miller_cap_x_15 = 4 , miller_cap_x_18 = 5 , miller_cap_x_5 = 6 , miller_cap_x_6 = 7
}
 Miller Capacitor Selection. More...
 
enum  opamp_inp_pad_t {
  inp_pad_vip0 = 0 , inp_pad_vip1 = 1 , inp_pad_vip2 = 2 , inp_pad_dac = 3 ,
  inp_pad_vsupply_x_0_25 = 4 , inp_pad_vsupply_x_0_5 = 5 , inp_pad_vsupply_x_0_75 = 6 , inp_pad_floating = 7
}
 Positive Input Pin Selection. More...
 
enum  opamp_cfg_preset_chn_t {
  cfg_preset_0 = OPAMP_CFG_PRESET0 , cfg_preset_1 = OPAMP_CFG_PRESET1 , cfg_preset_2 = OPAMP_CFG_PRESET2 , cfg_preset_3 = OPAMP_CFG_PRESET3 ,
  cfg_preset_4 = OPAMP_CFG_PRESET4 , cfg_preset_5 = OPAMP_CFG_PRESET5 , cfg_preset_6 = OPAMP_CFG_PRESET6 , cfg_preset_7 = OPAMP_CFG_PRESET7
}
 opamp preset channel More...
 
enum  opamp_mode_t {
  mode_follow = 0 , mode_invert_intern_vol = 1 , mode_invert_extern_vol = 2 , mode_invert_dac_vol = 3 ,
  mode_non_invert_gnd_vol = 4 , mode_non_invert_extern_vol = 5 , mode_non_invert_dac_vol = 6 , mode_user = 7
}
 operational amplifier More...
 

Functions

hpm_stat_t opamp_init (OPAMP_Type *opamp, opamp_cfg_t *cfg)
 opamp initialisation functions Use this function to initialise the op-amp to different modes More...
 
static void opamp_enable (OPAMP_Type *opamp)
 enable opamp function More...
 
static void opamp_preset_opamp_enable (OPAMP_Type *opamp, uint8_t preset_chn)
 preset enable opamp function More...
 
static void opamp_disable (OPAMP_Type *opamp)
 disable opamp function More...
 
static void opamp_preset_opamp_disable (OPAMP_Type *opamp, uint8_t preset_chn)
 preset disable opamp function More...
 
static void opamp_miller_cap_select (OPAMP_Type *opamp, opamp_miller_cap_t select)
 opamp miller cap selection More...
 
static void opamp_preset_miller_cap_select (OPAMP_Type *opamp, uint8_t preset_chn, opamp_miller_cap_t select)
 opamp miller cap selection preset More...
 
static void opamp_phase_margin_cap_enable (OPAMP_Type *opamp)
 enable phase margin compensation cap More...
 
static void opamp_preset_phase_margin_cap_enable (OPAMP_Type *opamp, uint8_t preset_chn)
 enable phase margin compensation cap preset More...
 
static void opamp_phase_margin_cap_disable (OPAMP_Type *opamp)
 disable phase margin compensation cap More...
 
static void opamp_preset_phase_margin_cap_disable (OPAMP_Type *opamp, uint8_t preset_chn)
 disable phase margin compensation cap preset More...
 
static void opamp_inn_pad_select (OPAMP_Type *opamp, opamp_inm_pad_t select)
 opamp core inm connect pad More...
 
static void opamp_preset_inn_pad_select (OPAMP_Type *opamp, uint8_t preset_chn, opamp_inm_pad_t select)
 opamp core inm connect pad preset More...
 
static void opamp_gain_select (OPAMP_Type *opamp, opamp_gain_t select)
 main string resistor selection More...
 
static void opamp_preset_gain_select (OPAMP_Type *opamp, uint8_t preset_chn, opamp_gain_t select)
 main string resistor selection preset More...
 
static void opamp_disconnect_vssa (OPAMP_Type *opamp)
 disconnect the main series resistor and VSSA More...
 
static void opamp_preset_disconnect_vssa (OPAMP_Type *opamp, uint8_t preset_chn)
 disconnect the main series resistor and VSSA preset More...
 
static void opamp_connect_vssa (OPAMP_Type *opamp)
 connect the main series resistor and VSSA More...
 
static void opamp_preset_connect_vssa (OPAMP_Type *opamp, uint8_t preset_chn)
 connect the main series resistor and VSSA preset More...
 
static void opamp_inp_pad_select (OPAMP_Type *opamp, opamp_inp_pad_t select)
 opamp inp select More...
 
static void opamp_preset_inp_pad_select (OPAMP_Type *opamp, uint8_t preset_chn, opamp_inp_pad_t select)
 opamp inp select preset More...
 
static uint8_t opamp_get_cur_preset (OPAMP_Type *opamp)
 opamp get current preset More...
 
static bool opamp_get_is_preset (OPAMP_Type *opamp)
 get the current preset value More...
 
static uint8_t opamp_get_trig_conflict_status (OPAMP_Type *opamp)
 Get the trigger conflict status. More...
 
static void opamp_clear_conflict_status (OPAMP_Type *opamp)
 Clear the trigger conflict status. More...
 
static void opamp_set_sw_preset_val (OPAMP_Type *opamp, opamp_cfg_preset_chn_t val)
 Set opamp preset value. More...
 
static void opamp_enable_sw_preset (OPAMP_Type *opamp)
 Enable software preset. More...
 
static void opamp_disable_sw_preset (OPAMP_Type *opamp)
 Disable software preset. More...
 
static void opamp_set_preset_x_chn (OPAMP_Type *opamp, uint8_t preset_chn, uint8_t chn)
 Set preset x channel value. More...
 
hpm_stat_t opamp_set_preset_cfg (OPAMP_Type *opamp, uint8_t preset_chn, opamp_cfg_t *cfg)
 Set preset cfg. More...
 
static void opamp_preset_enable_hw_trig (OPAMP_Type *opamp, uint8_t preset_chn)
 opamp enable preset hardware trig More...
 
static void opamp_preset_disable_hw_trig (OPAMP_Type *opamp, uint8_t preset_chn)
 opamp disable preset hardware trig More...
 
static void opamp_mode_set (OPAMP_Type *opamp, uint8_t mode)
 opamp set mode More...
 
static void opamp_preset_mode_set (OPAMP_Type *opamp, uint8_t preset_chn, uint8_t mode)
 opamp preset set mode More...