EFP Driver
Detailed Description
EFP (Energy Friendly PMIC) driver.
EFP (Energy Friendly PMIC) driver documentation
Introduction
The EFP is a flexible, highly efficient, multi-output power management IC. This driver provides an API to configure and control EFP ICs. The EFP is controlled by the host SoC using an I2C bus. The driver support systems with multipple EFP ICs.
Configuring the EFP driver
Your application must provide a header file named efp_ instance _config.h . instance can be freely selected and could for example be EFP0 and EFP1 in a system with two EFP devices. Configuration file templates are found in the driver config folder.
Configuration options:
- Energy mode transition mode. Host SoC can use several methods for changing EFP energy mode. Methods are either direct mode or I2C mode. I2C mode change EFP energy mode with I2C commands, direct mode use level transitions on I2C SDA and SCL lines. This provides fast energy mode transitions. Direct mode is achieved by host SoC using GPIO bit-banging or automatically by EMU hardware on SoCs with builtin EFP support (check EMU section of reference manual for EFP support).
- EFP interrupt. The EFP has an interrupt line that can be useful for a host SoC. Set this option to have the EFP driver configure a GPIO for this use.
- EFP powers host SoC. Set if the EFP IC power the host SoC, there can only be one EFP with this option in a system.
- I2C instance: Select which I2C peripheral to use.
- GPIO definitions for I2C SDA/SCL and IRQ pins.
Here is an example configuration file:
#ifndef EFP_INSTANCE_CONFIG_H #define EFP_INSTANCE_CONFIG_H #include "sl_efp.h" #ifdef __cplusplus extern "C" { #endif // <<< Use Configuration Wizard in Context Menu >>> // <h>EFP driver configuration // <o EFP_INSTANCE_EM_CTRL_MODE> Selects method of controlling EFP Energy Mode (EM) transitions. // <efp_em_transition_mode_gpio_bitbang=> GPIO driven direct mode EM transitions // <efp_em_transition_mode_i2c=> I2C transfers control EM transitions // <efp_em_transition_mode_emu=> Builtin EMU controlled direct mode EM transitions // <i> Default: efp_em_transition_mode_gpio_bitbang #define EFP_INSTANCE_EM_CTRL_MODE efp_em_transition_mode_gpio_bitbang // <q EFP_INSTANCE_ENABLE_IRQ> Enable GPIO as interrupt input line from EFP. // <i> Default: 1 #define EFP_INSTANCE_ENABLE_IRQ 1 // <q EFP_INSTANCE_POWERS_HOST> This EFP powers host SoC. // <i> Default: 1 #define EFP_INSTANCE_POWERS_HOST 1 // </h> end EFP configuration // <<< end of configuration section >>> // <<< sl:start pin_tool >>> // <gpio optional> EFP_INSTANCE_IRQ // $[GPIO_EFP_INSTANCE_IRQ] #define EFP_INSTANCE_IRQ_PORT gpioPortC #define EFP_INSTANCE_IRQ_PIN 9 // [GPIO_EFP_INSTANCE_IRQ]$ // <i2c signal=SDA,SCL> EFP_INSTANCE_I2C // $[I2C_EFP_INSTANCE_I2C] #define EFP_INSTANCE_I2C_PERIPHERAL I2C0 #define EFP_INSTANCE_I2C_SDA_PORT gpioPortC #define EFP_INSTANCE_I2C_SDA_PIN 11 #define EFP_INSTANCE_I2C_SDA_LOC 16 #define EFP_INSTANCE_I2C_SCL_PORT gpioPortC #define EFP_INSTANCE_I2C_SCL_PIN 10 #define EFP_INSTANCE_I2C_SCL_LOC 14 // [I2C_EFP_INSTANCE_I2C]$ // <<< sl:end pin_tool >>> #define SL_EFP_INSTANCE_INIT { \ .config_size = 0, // No initial config \ .config_data = NULL, // No config data \ .is_host_efp = EFP_INSTANCE_POWERS_HOST, // This EFP powers host SOC \ .em_transition_mode = EFP_INSTANCE_EM_CTRL_MODE, // EFP EM transition mode \ .enable_irq_pin = EFP_INSTANCE_ENABLE_IRQ, // Init GPIO as EFP IRQ \ .irq_port = EFP_INSTANCE_IRQ_PORT, // EFP IRQ port \ .irq_pin = EFP_INSTANCE_IRQ_PIN, // EFP IRQ pin \ .i2c_peripheral = EFP_INSTANCE_I2C_PERIPHERAL, // I2C port instance \ .i2c_scl_port = EFP_INSTANCE_I2C_SCL_PORT, // SCL port \ .i2c_scl_pin = EFP_INSTANCE_I2C_SCL_PIN, // SCL pin \ .i2c_sda_port = EFP_INSTANCE_I2C_SDA_PORT, // SDA port \ .i2c_sda_pin = EFP_INSTANCE_I2C_SDA_PIN, // SDA pin \ .i2c_scl_port_location = EFP_INSTANCE_I2C_SCL_LOC, // SCL port location \ .i2c_sda_port_location = EFP_INSTANCE_I2C_SDA_LOC, // SDA port location \ } #ifdef __cplusplus } #endif #endif // EFP_INSTANCE_CONFIG_H
EFP driver example code
Basic example:
#include "efp_instance_config.h" sl_efp_handle_data_t efp_handle_data; // EFP instance data structure sl_efp_handle_t efp = &efp_handle_data; // EFP instance pointer int main( void ) { ... // Initialize EFP. // Load all configurations into an init structure, and pass it to the // driver initialization function. sl_efp_init_data_t init = SL_EFP_INSTANCE_INIT; sl_efp_init(efp, &init); // Set voltage regulator B (VOB) output voltage and peak currents. sl_efp_set_vob_em01_voltage(efp, 1100); sl_efp_set_vob_em23_voltage(efp, 1100); sl_efp_set_vob_em01_peak_current(efp, 108, 3300, 1100, 3300); sl_efp_set_vob_em23_peak_current(efp, 108, 3300, 1100, 3300); // Enable VOB in buck mode. sl_efp_set_vob_mode(efp, efp_vob_mode_buck); ... }
Code for preparing for EFP interrupts:
#include "efp_instance_config.h" int main( void ) { ... // Prepare for EFP IRQ from Coulomb counter (CC) full flag. sl_efp_write_register(efp, EFP01_STATUS_GM, 0xFF); // Unmask all G flags sl_efp_write_register(efp, EFP01_CC_CAL, 0x28); // Enable CC A // Setup GPIO interrupt. NVIC_ClearPendingIRQ(GPIO_ODD_IRQn); NVIC_EnableIRQ(GPIO_ODD_IRQn); GPIO_IntConfig(init.irq_port, init.irq_pin, false, true, true); ... // Force CC full flag interrupt. This will trigger an IRQ. sl_efp_write_register(efp, EFP01_CMD, 0x10); // Start CC Calibration ... } void GPIO_ODD_IRQHandler(void) { // Make sure any ongoing EFP I2C transfer is completed before writing to EFP. // Clear EFP IRQ flag. sl_efp_write_register(efp, EFP01_STATUS_G, 0x40); // Clear GPIO interrupt flag. GPIO_IntClear(1 << init.irq_pin); }
Example with custom EFP configuration data. The
sl_efp_init()
function can perform EFP configuration by passing an array of EFP {address,value} pairs. This array can be generated by the EFP calculator tool in Simplicity Studio.
#include "efp_instance_config.h" #define SL_EFP_INSTANCE_GEN_SIZE 10 // Array of 10 {address,data} pairs. #define SL_EFP_INSTANCE_GEN { \ { EFP01_VOA_V, 4 }, \ { EFP01_BB_IPK, 146 }, \ { EFP01_BB_CTRL6, 0 }, \ { EFP01_LDOC_BB_CTRL, 0 }, \ { EFP01_BB_CTRL3, 181 }, \ { EFP01_VOB_EM0_V, 13 }, \ { EFP01_VOB_EM2_V, 13 }, \ { EFP01_BK_IPK, 38 }, \ { EFP01_BK_CTRL2, 80 }, \ { EFP01_BK_CTRL1, 24 }, \ } uint8_t efp_settings[SL_EFP_INSTANCE_GEN_SIZE][2] = SL_EFP_INSTANCE_GEN; int main( void ) { ... // Initialize EFP, pass array of custom settings to init function. sl_efp_init_data_t init = SL_EFP_INSTANCE_INIT; init.config_size = SL_EFP_INSTANCE_GEN_SIZE; init.config_data = efp_settings[0]; sl_efp_init(efp, &init); ... }
Data Structures |
|
struct | sl_efp_handle_data_t |
struct | sl_efp_init_data_t |
EFP driver initialization structure.
|
|
Typedefs |
|
typedef sl_efp_handle_data_t * | sl_efp_handle_t |
An EFP driver instance handle.
|
|
Enumerations |
|
enum |
sl_efp_em_transition_mode_t
{
efp_em_transition_mode_gpio_bitbang , efp_em_transition_mode_i2c , efp_em_transition_mode_emu } |
Method for controlling EFP Energy Mode (EM) transitions.
|
|
enum |
sl_efp_voa_mode_t
{
efp_voa_mode_disabled = _EFP01_BB_CTRL3_BB_MODE_DISABLED, efp_voa_mode_wired_buck = _EFP01_BB_CTRL3_BB_MODE_WIREDBUCK, efp_voa_mode_wired_boost = _EFP01_BB_CTRL3_BB_MODE_WIREDBOOST, efp_voa_mode_wired_buck_ldo = _EFP01_BB_CTRL3_BB_MODE_WIREDBUCKLDO, efp_voa_mode_buck_boost_autonomous = _EFP01_BB_CTRL3_BB_MODE_AUTONOMOUS, efp_voa_mode_buck_boost_forced_buck = _EFP01_BB_CTRL3_BB_MODE_FORCEBUCK, efp_voa_mode_buck_boost_forced_ntm = _EFP01_BB_CTRL3_BB_MODE_FORCENTM, efp_voa_mode_buck_boost_forced_boost = _EFP01_BB_CTRL3_BB_MODE_FORCEBOOST } |
VOA regulator modes.
|
|
enum |
sl_efp_voa_sw_mode_t
{
efp_voa_sw_mode_off = _EFP01_BIAS_SW_VOA_SW_CON_OFF, efp_voa_sw_mode_on = _EFP01_BIAS_SW_VOA_SW_CON_ON, efp_voa_sw_mode_on_in_em0 = _EFP01_BIAS_SW_VOA_SW_CON_ONINEM0, efp_voa_sw_mode_on_in_em02 = _EFP01_BIAS_SW_VOA_SW_CON_ONINEM02 } |
VOA SW (switched output) modes.
|
|
enum |
sl_efp_vob_mode_t
{
efp_vob_mode_disabled = _EFP01_BK_CTRL1_BK_MODE_DISABLED, efp_vob_mode_buck = _EFP01_BK_CTRL1_BK_MODE_BUCKONLY, efp_vob_mode_ldo = _EFP01_BK_CTRL1_BK_MODE_LDOONLY, efp_vob_mode_buck_ldo = _EFP01_BK_CTRL1_BK_MODE_BUCKLDO } |
VOB regulator modes.
|
|
Functions |
|
void | EMU_EM23PostsleepHook (void) |
Reimplementation of EMU function with same name.
|
|
void | EMU_EM23PresleepHook (void) |
Reimplementation of EMU function with same name.
|
|
sl_status_t | sl_efp_deinit ( sl_efp_handle_t handle) |
Deinitialize EFP driver and underlying EFP hardware.
|
|
sl_status_t | sl_efp_emu_ldo_enable ( sl_efp_handle_t handle, bool enable) |
Turn the internal EMU LDO regulator that supplies DECOUPLE pin on or off.
|
|
sl_status_t | sl_efp_enable_direct_mode ( sl_efp_handle_t handle) |
Configure I2C GPIO pins for "direct mode" EM transfer mode.
|
|
sl_status_t | sl_efp_enter_em0 ( sl_efp_handle_t handle) |
Set EFP in EM0 energy mode.
|
|
sl_status_t | sl_efp_enter_em2 ( sl_efp_handle_t handle) |
Set EFP in EM2 energy mode.
|
|
sl_status_t | sl_efp_get_vdd_avg ( sl_efp_handle_t handle, uint16_t *voltage_mv) |
Measure average VDD.
|
|
sl_status_t | sl_efp_get_vdd_max ( sl_efp_handle_t handle, uint16_t *voltage_mv) |
Measure maximum VDD.
|
|
sl_status_t | sl_efp_get_vdd_min ( sl_efp_handle_t handle, uint16_t *voltage_mv) |
Measure minimum VDD.
|
|
sl_status_t | sl_efp_init ( sl_efp_handle_t handle, const sl_efp_init_data_t *init) |
Initialize EFP driver and configure underlying EFP hardware.
|
|
sl_status_t | sl_efp_read_otp ( sl_efp_handle_t handle, uint8_t addr, uint8_t *data) |
Read EFP OTP register.
|
|
sl_status_t | sl_efp_read_register ( sl_efp_handle_t handle, uint8_t addr, uint8_t *data) |
Read EFP control register.
|
|
sl_status_t | sl_efp_read_register_field ( sl_efp_handle_t handle, uint8_t addr, uint8_t *data, uint8_t mask, uint8_t pos) |
Read EFP control register field.
|
|
sl_status_t | sl_efp_reset ( sl_efp_handle_t handle) |
Reset EFP. Perform a full reset of the EFP, this is eqvivalent to a power on reset.
|
|
sl_status_t | sl_efp_set_em_transition_mode ( sl_efp_handle_t handle, sl_efp_em_transition_mode_t mode) |
Set EM transition mode.
|
|
sl_status_t | sl_efp_set_voa_em01_peak_current ( sl_efp_handle_t handle, unsigned int current_ma, unsigned int vddb_mv, unsigned int voa_mv, unsigned int inductor_nh) |
Set regulator VOA EM01 peak output current.
|
|
sl_status_t | sl_efp_set_voa_em23_peak_current ( sl_efp_handle_t handle, unsigned int current_ma, unsigned int vddb_mv, unsigned int voa_mv, unsigned int inductor_nh) |
Set regulator VOA EM23 peak output current.
|
|
sl_status_t | sl_efp_set_voa_mode ( sl_efp_handle_t handle, sl_efp_voa_mode_t mode) |
Set regulator VOA mode.
|
|
sl_status_t | sl_efp_set_voa_sw_mode ( sl_efp_handle_t handle, sl_efp_voa_sw_mode_t mode) |
Set VOA SW (switched output) mode.
|
|
sl_status_t | sl_efp_set_voa_voltage ( sl_efp_handle_t handle, unsigned int voltage_mv) |
Set regulator VOA output voltage.
|
|
sl_status_t | sl_efp_set_vob_em01_peak_current ( sl_efp_handle_t handle, unsigned int current_ma, unsigned int vddb_mv, unsigned int vob_mv, unsigned int inductor_nh) |
Set regulator VOB EM01 peak output current.
|
|
sl_status_t | sl_efp_set_vob_em01_voltage ( sl_efp_handle_t handle, unsigned int voltage_mv) |
Set regulator VOB EM01 output voltage.
|
|
sl_status_t | sl_efp_set_vob_em23_peak_current ( sl_efp_handle_t handle, unsigned int current_ma, unsigned int vddb_mv, unsigned int vob_mv, unsigned int inductor_nh) |
Set regulator VOB EM23 peak output current.
|
|
sl_status_t | sl_efp_set_vob_em23_voltage ( sl_efp_handle_t handle, unsigned int voltage_mv) |
Set regulator VOB EM23 output voltage.
|
|
sl_status_t | sl_efp_set_vob_mode ( sl_efp_handle_t handle, sl_efp_vob_mode_t mode) |
Set regulator VOB mode.
|
|
sl_status_t | sl_efp_set_voc_voltage ( sl_efp_handle_t handle, unsigned int voltage_mv) |
Set regulator VOC output voltage.
|
|
sl_status_t | sl_efp_write_register ( sl_efp_handle_t handle, uint8_t addr, uint8_t data) |
Write EFP control register.
|
|
sl_status_t | sl_efp_write_register_field ( sl_efp_handle_t handle, uint8_t addr, uint8_t data, uint8_t mask, uint8_t pos) |
Write EFP control register field.
|
|
Enumeration Type Documentation
Method for controlling EFP Energy Mode (EM) transitions.
Definition at line
276
of file
sl_efp.h
.
enum sl_efp_voa_mode_t |
VOA regulator modes.
Definition at line
283
of file
sl_efp.h
.
enum sl_efp_voa_sw_mode_t |
enum sl_efp_vob_mode_t |
Function Documentation
void EMU_EM23PostsleepHook | ( | void |
|
) |
Reimplementation of EMU function with same name.
This function will be called upon wakeup from the _WFI() instruction in EMU_EnterEM2/3() functions, and will set the EFP in EM0 mode. A critical section is used to get predictable EFP energy mode sequence timing.
Definition at line
182
of file
sl_efp.c
.
References CORE_EXIT_CRITICAL , efp_em_transition_mode_gpio_bitbang , efp_em_transition_mode_i2c , and sl_efp_enter_em0() .
void EMU_EM23PresleepHook | ( | void |
|
) |
Reimplementation of EMU function with same name.
This function will be called prior to the _WFI() instruction in EMU_EnterEM2/3() functions, and will set the EFP in EM2 mode. A critical section is used to get predictable EFP energy mode sequence timing.
Definition at line
203
of file
sl_efp.c
.
References CORE_ENTER_CRITICAL , efp_em_transition_mode_gpio_bitbang , efp_em_transition_mode_i2c , and sl_efp_enter_em2() .
sl_status_t sl_efp_deinit | ( | sl_efp_handle_t |
handle
|
) |
Deinitialize EFP driver and underlying EFP hardware.
- Parameters
-
[in] handle
EFP instance handle.
- Returns
- SL_STATUS_OK.
Definition at line
320
of file
sl_efp.c
.
References SL_STATUS_OK .
sl_status_t sl_efp_emu_ldo_enable | ( | sl_efp_handle_t |
handle,
|
bool |
enable
|
||
) |
Turn the internal EMU LDO regulator that supplies DECOUPLE pin on or off.
- Note
- Make sure that an external source supply the DECOUPLE pin turning the LDO off.
- Parameters
-
[in] handle
EFP instance handle. [in] enable
True to turn LDO on, false to turn off.
- Returns
- SL_STATUS_OK or SL_STATUS_NOT_SUPPORTED, or SL_STATUS_FAIL if not a host EFP instance.
Definition at line
333
of file
sl_efp.c
.
References SL_STATUS_FAIL , SL_STATUS_NOT_SUPPORTED , and SL_STATUS_OK .
sl_status_t sl_efp_enable_direct_mode | ( | sl_efp_handle_t |
handle
|
) |
Configure I2C GPIO pins for "direct mode" EM transfer mode.
- Parameters
-
[in] handle
EFP instance handle.
- Note
- This must be the last EFP driver function called prior to entering EM2/3 via EMU_EnterEMx() calls. Any EFP API call that involves an I2C transfer will leave the I2C GPIO pins in I2C mode.
- Returns
- SL_STATUS_OK on success. SL_STATUS_INVALID_MODE if current EM transfer mode is I2C. SL_STATUS_IO on I2C transfer errors.
Definition at line
219
of file
sl_efp.c
.
References efp_em_transition_mode_i2c , sl_efp_enter_em0() , SL_STATUS_INVALID_MODE , and SL_STATUS_OK .
Referenced by sl_efp_init() .
sl_status_t sl_efp_enter_em0 | ( | sl_efp_handle_t |
handle
|
) |
Set EFP in EM0 energy mode.
- Parameters
-
[in] handle
EFP instance handle.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
234
of file
sl_efp.c
.
References efp_em_transition_mode_gpio_bitbang , efp_em_transition_mode_i2c , GPIO_PinOutSet() , sl_efp_write_register() , sl_efp_write_register_field() , and SL_STATUS_OK .
Referenced by EMU_EM23PostsleepHook() , and sl_efp_enable_direct_mode() .
sl_status_t sl_efp_enter_em2 | ( | sl_efp_handle_t |
handle
|
) |
Set EFP in EM2 energy mode.
- Parameters
-
[in] handle
EFP instance handle.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
258
of file
sl_efp.c
.
References efp_em_transition_mode_gpio_bitbang , efp_em_transition_mode_i2c , GPIO_PinOutClear() , sl_efp_read_register() , sl_efp_write_register() , sl_efp_write_register_field() , and SL_STATUS_OK .
Referenced by EMU_EM23PresleepHook() .
sl_status_t sl_efp_get_vdd_avg | ( | sl_efp_handle_t |
handle,
|
uint16_t * |
voltage_mv
|
||
) |
Measure average VDD.
- Note
- This function will measure VDDA or VDDB depending of the voltage on the VDDA pin after power on. If VDDA is powered this function returns a VDDA reading, otherwise a VDDB reading is returned.
- Parameters
-
[in] handle
EFP instance handle. [out] voltage_mv
Average VDD voltage expressed in miilivolts.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
293
of file
sl_efp.c
.
sl_status_t sl_efp_get_vdd_max | ( | sl_efp_handle_t |
handle,
|
uint16_t * |
voltage_mv
|
||
) |
Measure maximum VDD.
- Note
- This function will measure VDDA or VDDB depending of the voltage on the VDDA pin after power on. If VDDA is powered this function returns a VDDA reading, otherwise a VDDB reading is returned.
- Parameters
-
[in] handle
EFP instance handle. [out] voltage_mv
Maximum VDD voltage expressed in miilivolts.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
302
of file
sl_efp.c
.
sl_status_t sl_efp_get_vdd_min | ( | sl_efp_handle_t |
handle,
|
uint16_t * |
voltage_mv
|
||
) |
Measure minimum VDD.
- Note
- This function will measure VDDA or VDDB depending of the voltage on the VDDA pin after power on. If VDDA is powered this function returns a VDDA reading, otherwise a VDDB reading is returned.
- Parameters
-
[in] handle
EFP instance handle. [out] voltage_mv
Minimum VDD voltage expressed in miilivolts.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
311
of file
sl_efp.c
.
sl_status_t sl_efp_init | ( | sl_efp_handle_t |
handle,
|
const sl_efp_init_data_t * |
init
|
||
) |
Initialize EFP driver and configure underlying EFP hardware.
- Note
- This function must not be called from interrupt context.
- Parameters
-
[in] handle
EFP instance handle. [in] init
Initialization data structure.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors, or SL_STATUS_FAIL on illegal initialization.
Definition at line
377
of file
sl_efp.c
.
References cmuClock_I2C0 , cmuClock_I2C1 , sl_efp_init_data_t::config_data , sl_efp_init_data_t::config_size , efp_em_transition_mode_gpio_bitbang , sl_efp_init_data_t::em_transition_mode , sl_efp_init_data_t::enable_irq_pin , GPIO_PinModeSet() , gpioModeInputPull , I2C_FREQ_FASTPLUS_MAX , sl_efp_init_data_t::i2c_peripheral , sl_efp_init_data_t::i2c_scl_pin , sl_efp_init_data_t::i2c_scl_port , sl_efp_init_data_t::i2c_scl_port_location , sl_efp_init_data_t::i2c_sda_pin , sl_efp_init_data_t::i2c_sda_port , sl_efp_init_data_t::i2c_sda_port_location , i2cClockHLRStandard , I2CSPM_Init() , sl_efp_init_data_t::irq_pin , sl_efp_init_data_t::irq_port , sl_efp_init_data_t::is_host_efp , I2CSPM_Init_TypeDef::port , sl_efp_enable_direct_mode() , sl_efp_read_register() , sl_efp_write_register() , SL_STATUS_FAIL , and SL_STATUS_OK .
sl_status_t sl_efp_read_otp | ( | sl_efp_handle_t |
handle,
|
uint8_t |
addr,
|
||
uint8_t * |
data
|
||
) |
Read EFP OTP register.
- Parameters
-
[in] handle
EFP instance handle. [in] addr
Register address. [out] data
The value read from the OTP register.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
488
of file
sl_efp.c
.
References sl_efp_read_register() , sl_efp_write_register() , sl_efp_write_register_field() , and SL_STATUS_OK .
sl_status_t sl_efp_read_register | ( | sl_efp_handle_t |
handle,
|
uint8_t |
addr,
|
||
uint8_t * |
data
|
||
) |
Read EFP control register.
- Parameters
-
[in] handle
EFP instance handle. [in] addr
Register address. [out] data
The value read from the register.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
531
of file
sl_efp.c
.
References I2C_TransferSeq_TypeDef::addr , I2C_FLAG_WRITE_READ , I2CSPM_Transfer() , i2cTransferDone , SL_STATUS_IO , and SL_STATUS_OK .
Referenced by sl_efp_enter_em2() , sl_efp_init() , sl_efp_read_otp() , sl_efp_read_register_field() , and sl_efp_write_register_field() .
sl_status_t sl_efp_read_register_field | ( | sl_efp_handle_t |
handle,
|
uint8_t |
addr,
|
||
uint8_t * |
data,
|
||
uint8_t |
mask,
|
||
uint8_t |
pos
|
||
) |
Read EFP control register field.
- Parameters
-
[in] handle
EFP instance handle. [in] addr
Register address. [out] data
The value read from the register field. [in] mask
Bit mask corresponding to target bit field. [in] pos
Bit number of least significant bit of target bit field.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
558
of file
sl_efp.c
.
References sl_efp_read_register() , and SL_STATUS_OK .
sl_status_t sl_efp_reset | ( | sl_efp_handle_t |
handle
|
) |
Reset EFP. Perform a full reset of the EFP, this is eqvivalent to a power on reset.
- Parameters
-
[in] handle
EFP instance handle.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
579
of file
sl_efp.c
.
References sl_efp_write_register() .
sl_status_t sl_efp_set_em_transition_mode | ( | sl_efp_handle_t |
handle,
|
sl_efp_em_transition_mode_t |
mode
|
||
) |
Set EM transition mode.
- Parameters
-
[in] handle
EFP instance handle. [in] mode
New EFP Energy Mode (EM) transition mode. See sl_efp_em_transition_mode_t for valid modes.
- Returns
- SL_STATUS_OK.
Definition at line
588
of file
sl_efp.c
.
References SL_STATUS_OK .
sl_status_t sl_efp_set_voa_em01_peak_current | ( | sl_efp_handle_t |
handle,
|
unsigned int |
current_ma,
|
||
unsigned int |
vddb_mv,
|
||
unsigned int |
voa_mv,
|
||
unsigned int |
inductor_nh
|
||
) |
Set regulator VOA EM01 peak output current.
- Parameters
-
[in] handle
EFP instance handle. [in] current_ma
Target peak current expressed in milliamperes. [in] vddb_mv
VDDB expressed in millivolt. [in] voa_mv
VOA expressed in millivolt. [in] inductor_nh
Inductor size expressed in nanohenry.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
599
of file
sl_efp.c
.
References sl_efp_write_register_field() , SL_MAX , and SL_MIN .
sl_status_t sl_efp_set_voa_em23_peak_current | ( | sl_efp_handle_t |
handle,
|
unsigned int |
current_ma,
|
||
unsigned int |
vddb_mv,
|
||
unsigned int |
voa_mv,
|
||
unsigned int |
inductor_nh
|
||
) |
Set regulator VOA EM23 peak output current.
- Parameters
-
[in] handle
EFP instance handle. [in] current_ma
Target peak current expressed in milliamperes. [in] vddb_mv
VDDB expressed in millivolt. [in] voa_mv
VOA expressed in millivolt. [in] inductor_nh
Inductor size expressed in nanohenry.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
622
of file
sl_efp.c
.
References sl_efp_write_register_field() , SL_MAX , and SL_MIN .
sl_status_t sl_efp_set_voa_mode | ( | sl_efp_handle_t |
handle,
|
sl_efp_voa_mode_t |
mode
|
||
) |
Set regulator VOA mode.
- Parameters
-
[in] handle
EFP instance handle. [in] mode
Regulator mode.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
645
of file
sl_efp.c
.
References sl_efp_write_register_field() .
sl_status_t sl_efp_set_voa_sw_mode | ( | sl_efp_handle_t |
handle,
|
sl_efp_voa_sw_mode_t |
mode
|
||
) |
Set VOA SW (switched output) mode.
- Parameters
-
[in] handle
EFP instance handle. [in] mode
VOA SW mode.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
656
of file
sl_efp.c
.
References sl_efp_write_register_field() .
sl_status_t sl_efp_set_voa_voltage | ( | sl_efp_handle_t |
handle,
|
unsigned int |
voltage_mv
|
||
) |
Set regulator VOA output voltage.
- Parameters
-
[in] handle
EFP instance handle. [in] voltage_mv
Voltage in millivolt.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
667
of file
sl_efp.c
.
References sl_efp_write_register() , SL_MAX , and SL_MIN .
sl_status_t sl_efp_set_vob_em01_peak_current | ( | sl_efp_handle_t |
handle,
|
unsigned int |
current_ma,
|
||
unsigned int |
vddb_mv,
|
||
unsigned int |
vob_mv,
|
||
unsigned int |
inductor_nh
|
||
) |
Set regulator VOB EM01 peak output current.
- Parameters
-
[in] handle
EFP instance handle. [in] current_ma
Target peak current expressed in milliamperes. [in] vddb_mv
VDDB expressed in millivolt. [in] vob_mv
VOB expressed in millivolt. [in] inductor_nh
Inductor size expressed in nanohenry.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
682
of file
sl_efp.c
.
References sl_efp_write_register_field() , SL_MAX , and SL_MIN .
sl_status_t sl_efp_set_vob_em01_voltage | ( | sl_efp_handle_t |
handle,
|
unsigned int |
voltage_mv
|
||
) |
Set regulator VOB EM01 output voltage.
- Parameters
-
[in] handle
EFP instance handle. [in] voltage_mv
Voltage in millivolt.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
705
of file
sl_efp.c
.
References sl_efp_write_register_field() , SL_MAX , and SL_MIN .
sl_status_t sl_efp_set_vob_em23_peak_current | ( | sl_efp_handle_t |
handle,
|
unsigned int |
current_ma,
|
||
unsigned int |
vddb_mv,
|
||
unsigned int |
vob_mv,
|
||
unsigned int |
inductor_nh
|
||
) |
Set regulator VOB EM23 peak output current.
- Parameters
-
[in] handle
EFP instance handle. [in] current_ma
Target peak current expressed in milliamperes. [in] vddb_mv
VDDB expressed in millivolt. [in] vob_mv
VOB expressed in millivolt. [in] inductor_nh
Inductor size expressed in nanohenry.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
722
of file
sl_efp.c
.
References sl_efp_write_register_field() , SL_MAX , and SL_MIN .
sl_status_t sl_efp_set_vob_em23_voltage | ( | sl_efp_handle_t |
handle,
|
unsigned int |
voltage_mv
|
||
) |
Set regulator VOB EM23 output voltage.
- Parameters
-
[in] handle
EFP instance handle. [in] voltage_mv
Voltage in millivolt.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
745
of file
sl_efp.c
.
References sl_efp_write_register() , SL_MAX , and SL_MIN .
sl_status_t sl_efp_set_vob_mode | ( | sl_efp_handle_t |
handle,
|
sl_efp_vob_mode_t |
mode
|
||
) |
Set regulator VOB mode.
- Parameters
-
[in] handle
EFP instance handle. [in] mode
Regulator mode.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
760
of file
sl_efp.c
.
References sl_efp_write_register_field() .
sl_status_t sl_efp_set_voc_voltage | ( | sl_efp_handle_t |
handle,
|
unsigned int |
voltage_mv
|
||
) |
Set regulator VOC output voltage.
- Parameters
-
[in] handle
EFP instance handle. [in] voltage_mv
Voltage in millivolt.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
771
of file
sl_efp.c
.
References sl_efp_write_register_field() , SL_MAX , and SL_MIN .
sl_status_t sl_efp_write_register | ( | sl_efp_handle_t |
handle,
|
uint8_t |
addr,
|
||
uint8_t |
data
|
||
) |
Write EFP control register.
- Parameters
-
[in] handle
EFP instance handle. [in] addr
Register address. [in] data
The value to write to the register.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
788
of file
sl_efp.c
.
References I2C_TransferSeq_TypeDef::addr , I2C_FLAG_WRITE_WRITE , I2CSPM_Transfer() , i2cTransferDone , SL_STATUS_IO , and SL_STATUS_OK .
Referenced by sl_efp_enter_em0() , sl_efp_enter_em2() , sl_efp_init() , sl_efp_read_otp() , sl_efp_reset() , sl_efp_set_voa_voltage() , sl_efp_set_vob_em23_voltage() , and sl_efp_write_register_field() .
sl_status_t sl_efp_write_register_field | ( | sl_efp_handle_t |
handle,
|
uint8_t |
addr,
|
||
uint8_t |
data,
|
||
uint8_t |
mask,
|
||
uint8_t |
pos
|
||
) |
Write EFP control register field.
- Note
- This function performs a read-modify-write of a EFP register.
- Parameters
-
[in] handle
EFP instance handle. [in] addr
Register address. [in] data
The value to write to the register field. [in] mask
Bit mask corresponding to target bit field. [in] pos
Bit number of least significant bit of target bit field.
- Returns
- SL_STATUS_OK or SL_STATUS_IO on I2C transfer errors.
Definition at line
812
of file
sl_efp.c
.
References sl_efp_read_register() , sl_efp_write_register() , and SL_STATUS_OK .
Referenced by sl_efp_enter_em0() , sl_efp_enter_em2() , sl_efp_read_otp() , sl_efp_set_voa_em01_peak_current() , sl_efp_set_voa_em23_peak_current() , sl_efp_set_voa_mode() , sl_efp_set_voa_sw_mode() , sl_efp_set_vob_em01_peak_current() , sl_efp_set_vob_em01_voltage() , sl_efp_set_vob_em23_peak_current() , sl_efp_set_vob_mode() , and sl_efp_set_voc_voltage() .