no-OS
Functions
ltp8800.c File Reference
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <errno.h>
#include "no_os_units.h"
#include "no_os_util.h"
#include "no_os_delay.h"
#include "no_os_alloc.h"
#include "no_os_pwm.h"
#include "no_os_i2c.h"
#include "no_os_gpio.h"
#include "no_os_crc8.h"
#include "ltp8800.h"
Include dependency graph for ltp8800.c:

Functions

 NO_OS_DECLARE_CRC8_TABLE (ltp8800_crc_table)
 
int ltp8800_init (struct ltp8800_dev **device, struct ltp8800_init_param *init_param)
 Initialize the device structure. More...
 
int ltp8800_remove (struct ltp8800_dev *dev)
 Free or remove device instance. More...
 
int ltp8800_send_byte (struct ltp8800_dev *dev, uint16_t cmd)
 Send a PMBus command to the device. More...
 
int ltp8800_read_byte (struct ltp8800_dev *dev, uint16_t cmd, uint8_t *data)
 Perform a raw PMBus read byte operation. More...
 
int ltp8800_write_byte (struct ltp8800_dev *dev, uint16_t cmd, uint8_t value)
 Perform a raw PMBus write byte operation. More...
 
int ltp8800_read_word (struct ltp8800_dev *dev, uint16_t cmd, uint16_t *word)
 Perform a raw PMBus read word operation. More...
 
int ltp8800_write_word (struct ltp8800_dev *dev, uint16_t cmd, uint16_t word)
 Perform a raw PMBus write word operation. More...
 
int ltp8800_read_word_data (struct ltp8800_dev *dev, uint16_t cmd, int *data)
 Perform a PMBus read word operation and converts to actual value. More...
 
int ltp8800_write_word_data (struct ltp8800_dev *dev, uint16_t cmd, int data)
 Converts value to register data and do PMBus write word operation. More...
 
int ltp8800_read_block_data (struct ltp8800_dev *dev, uint16_t cmd, uint8_t *data, size_t nbytes)
 Perform a PMBus read block operation. More...
 
int ltp8800_read_value (struct ltp8800_dev *dev, enum ltp8800_value_type value_type, int *value)
 Read a value. More...
 
int ltp8800_read_status (struct ltp8800_dev *dev, enum ltp8800_status_type status_type, struct ltp8800_status *status)
 Read statuses. More...
 
int ltp8800_vout_value (struct ltp8800_dev *dev, int vout_command)
 Set output voltage command. More...
 
int ltp8800_vout_settings (struct ltp8800_dev *dev, enum ltp8800_vout_settings settings)
 Set output voltage and its upper limit. More...
 
int ltp8800_set_vin (struct ltp8800_dev *dev, int vin_on, int vin_off)
 Set input voltage window at which power conversion will proceed. More...
 
int ltp8800_set_fault_limit (struct ltp8800_dev *dev, enum ltp8800_limit_type limit, int limit_val)
 Set overvalue and undervalue limits. More...
 
int ltp8800_sync_config (struct ltp8800_dev *dev, bool enable)
 Enable or disable sync pin. More...
 
int ltp8800_interleave_order (struct ltp8800_dev *dev, uint8_t order)
 Set phase order for polyphase application. More...
 
int ltp8800_loop_compensation (struct ltp8800_dev *dev, uint8_t pole, uint8_t zero, uint8_t hf_gain, uint8_t lf_gain)
 Program loop compensation for regulator transient response. More...
 
int ltp8800_set_device_state (struct ltp8800_dev *dev, bool state)
 Set device state. More...
 
int ltp8800_store_user_settings (struct ltp8800_dev *dev)
 Store user settings to EEPROM. More...
 
int ltp8800_restore_user_settings (struct ltp8800_dev *dev)
 Restore user settings. More...
 

Function Documentation

◆ ltp8800_init()

int ltp8800_init ( struct ltp8800_dev **  device,
struct ltp8800_init_param init_param 
)

Initialize the device structure.

Parameters
device- Device structure
init_param- Initialization parameters
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltp8800_interleave_order()

int ltp8800_interleave_order ( struct ltp8800_dev dev,
uint8_t  order 
)

Set phase order for polyphase application.

Parameters
dev- Device structure
order- Order number. The resulting phase offset of the device is equivalent to this value multiplied by 22.5 degrees.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltp8800_loop_compensation()

int ltp8800_loop_compensation ( struct ltp8800_dev dev,
uint8_t  pole,
uint8_t  zero,
uint8_t  hf_gain,
uint8_t  lf_gain 
)

Program loop compensation for regulator transient response.

Parameters
dev- Device structure
pole- Pole setting
zero- Zero setting
hf_gain- High frequency gain setting
lf_gain- Low frequence gain setting
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltp8800_read_block_data()

int ltp8800_read_block_data ( struct ltp8800_dev dev,
uint16_t  cmd,
uint8_t *  data,
size_t  nbytes 
)

Perform a PMBus read block operation.

Parameters
dev- Device structure
cmd- PMBus command
data- Address of the read block
nbytes- Size of the block in bytes
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltp8800_read_byte()

int ltp8800_read_byte ( struct ltp8800_dev dev,
uint16_t  cmd,
uint8_t *  data 
)

Perform a raw PMBus read byte operation.

Parameters
dev- Device structure
cmd- PMBus command
data- Address of the byte read
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltp8800_read_status()

int ltp8800_read_status ( struct ltp8800_dev dev,
enum ltp8800_status_type  status_type,
struct ltp8800_status status 
)

Read statuses.

Parameters
dev- Device structure
status_type- Status type. Example values: LTP8800_STATUS_BYTE_TYPE LTP8800_STATUS_VOUT_TYPE LTP8800_STATUS_IOUT_TYPE LTP8800_STATUS_INPUT_TYPE LTP8800_STATUS_CML_TYPE
status- Address of the status structure
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltp8800_read_value()

int ltp8800_read_value ( struct ltp8800_dev dev,
enum ltp8800_value_type  value_type,
int *  value 
)

Read a value.

Parameters
dev- Device structure
value_type- Value type. Example values: LTP8800_VIN LTP8800_VOUT LTP8800_IIN LTP8800_IOUT LTP8800_TEMP LTP8800_FREQUENCY
value- Address of the read value
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltp8800_read_word()

int ltp8800_read_word ( struct ltp8800_dev dev,
uint16_t  cmd,
uint16_t *  word 
)

Perform a raw PMBus read word operation.

Parameters
dev- Device structure
cmd- PMBus command
word- Address of the read word
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltp8800_read_word_data()

int ltp8800_read_word_data ( struct ltp8800_dev dev,
uint16_t  cmd,
int *  data 
)

Perform a PMBus read word operation and converts to actual value.

Parameters
dev- Device structure
cmd- PMBus command
data- Address of data read
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltp8800_remove()

int ltp8800_remove ( struct ltp8800_dev dev)

Free or remove device instance.

Parameters
dev- The device structure
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltp8800_restore_user_settings()

int ltp8800_restore_user_settings ( struct ltp8800_dev dev)

Restore user settings.

Parameters
dev- Device structure
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltp8800_send_byte()

int ltp8800_send_byte ( struct ltp8800_dev dev,
uint16_t  cmd 
)

Send a PMBus command to the device.

Parameters
dev- Device structure
cmd- PMBus command
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltp8800_set_device_state()

int ltp8800_set_device_state ( struct ltp8800_dev dev,
bool  state 
)

Set device state.

Parameters
dev- Device structure
state- Set to true to enable device, false to disable
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltp8800_set_fault_limit()

int ltp8800_set_fault_limit ( struct ltp8800_dev dev,
enum ltp8800_limit_type  limit,
int  limit_val 
)

Set overvalue and undervalue limits.

Parameters
dev- Device structure
limit- Limit value type. Example: LTP8800_VIN_OV_FAULT_LIMIT_TYPE LTP8800_VIN_UV_FAULT_LIMIT_TYPE LTP8800_IIN_OC_FAULT_LIMIT_TYPE LTP8800_POUT_OP_FAULT_LIMIT_TYPE
limit_val- Limit value in milli-units for voltage and current, and microseconds for timing.
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltp8800_set_vin()

int ltp8800_set_vin ( struct ltp8800_dev dev,
int  vin_on,
int  vin_off 
)

Set input voltage window at which power conversion will proceed.

Parameters
dev- Device structure
vin_on- Input voltage in millivolts at which conversion will start
vin_off- Input voltage in millivolts at which conversion will stop
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltp8800_store_user_settings()

int ltp8800_store_user_settings ( struct ltp8800_dev dev)

Store user settings to EEPROM.

Parameters
dev- Device structure
Returns
0 in case of success, negative error code otherwise

◆ ltp8800_sync_config()

int ltp8800_sync_config ( struct ltp8800_dev dev,
bool  enable 
)

Enable or disable sync pin.

Parameters
dev- Device structure
enable- Set to true to enable, or false to disable
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltp8800_vout_settings()

int ltp8800_vout_settings ( struct ltp8800_dev dev,
enum ltp8800_vout_settings  settings 
)

Set output voltage and its upper limit.

Parameters
dev- Device structure
settings- Gain settings
Returns
0 in case of success, negative error code otherwise

◆ ltp8800_vout_value()

int ltp8800_vout_value ( struct ltp8800_dev dev,
int  vout_command 
)

Set output voltage command.

Parameters
dev- Device structure
vout_command- Output voltage in millivolts
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltp8800_write_byte()

int ltp8800_write_byte ( struct ltp8800_dev dev,
uint16_t  cmd,
uint8_t  value 
)

Perform a raw PMBus write byte operation.

Parameters
dev- Device structure
cmd- PMBus command
value- Byte to be written
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltp8800_write_word()

int ltp8800_write_word ( struct ltp8800_dev dev,
uint16_t  cmd,
uint16_t  word 
)

Perform a raw PMBus write word operation.

Parameters
dev- Device structure
cmd- PMBus command
word- Word to write
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltp8800_write_word_data()

int ltp8800_write_word_data ( struct ltp8800_dev dev,
uint16_t  cmd,
int  data 
)

Converts value to register data and do PMBus write word operation.

Parameters
dev- Device structure
cmd- PMBus command
data- Value to write
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ NO_OS_DECLARE_CRC8_TABLE()

NO_OS_DECLARE_CRC8_TABLE ( ltp8800_crc_table  )