no-OS
|
#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"
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... | |
int ltp8800_init | ( | struct ltp8800_dev ** | device, |
struct ltp8800_init_param * | init_param | ||
) |
Initialize the device structure.
device | - Device structure |
init_param | - Initialization parameters |
int ltp8800_interleave_order | ( | struct ltp8800_dev * | dev, |
uint8_t | order | ||
) |
Set phase order for polyphase application.
dev | - Device structure |
order | - Order number. The resulting phase offset of the device is equivalent to this value multiplied by 22.5 degrees. |
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.
dev | - Device structure |
pole | - Pole setting |
zero | - Zero setting |
hf_gain | - High frequency gain setting |
lf_gain | - Low frequence gain setting |
int ltp8800_read_block_data | ( | struct ltp8800_dev * | dev, |
uint16_t | cmd, | ||
uint8_t * | data, | ||
size_t | nbytes | ||
) |
Perform a PMBus read block operation.
dev | - Device structure |
cmd | - PMBus command |
data | - Address of the read block |
nbytes | - Size of the block in bytes |
int ltp8800_read_byte | ( | struct ltp8800_dev * | dev, |
uint16_t | cmd, | ||
uint8_t * | data | ||
) |
Perform a raw PMBus read byte operation.
dev | - Device structure |
cmd | - PMBus command |
data | - Address of the byte read |
int ltp8800_read_status | ( | struct ltp8800_dev * | dev, |
enum ltp8800_status_type | status_type, | ||
struct ltp8800_status * | status | ||
) |
Read statuses.
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 |
int ltp8800_read_value | ( | struct ltp8800_dev * | dev, |
enum ltp8800_value_type | value_type, | ||
int * | value | ||
) |
Read a value.
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 |
int ltp8800_read_word | ( | struct ltp8800_dev * | dev, |
uint16_t | cmd, | ||
uint16_t * | word | ||
) |
Perform a raw PMBus read word operation.
dev | - Device structure |
cmd | - PMBus command |
word | - Address of the read word |
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.
dev | - Device structure |
cmd | - PMBus command |
data | - Address of data read |
int ltp8800_remove | ( | struct ltp8800_dev * | dev | ) |
Free or remove device instance.
dev | - The device structure |
int ltp8800_restore_user_settings | ( | struct ltp8800_dev * | dev | ) |
Restore user settings.
dev | - Device structure |
int ltp8800_send_byte | ( | struct ltp8800_dev * | dev, |
uint16_t | cmd | ||
) |
Send a PMBus command to the device.
dev | - Device structure |
cmd | - PMBus command |
int ltp8800_set_device_state | ( | struct ltp8800_dev * | dev, |
bool | state | ||
) |
Set device state.
dev | - Device structure |
state | - Set to true to enable device, false to disable |
int ltp8800_set_fault_limit | ( | struct ltp8800_dev * | dev, |
enum ltp8800_limit_type | limit, | ||
int | limit_val | ||
) |
Set overvalue and undervalue limits.
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. |
int ltp8800_set_vin | ( | struct ltp8800_dev * | dev, |
int | vin_on, | ||
int | vin_off | ||
) |
Set input voltage window at which power conversion will proceed.
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 |
int ltp8800_store_user_settings | ( | struct ltp8800_dev * | dev | ) |
Store user settings to EEPROM.
dev | - Device structure |
int ltp8800_sync_config | ( | struct ltp8800_dev * | dev, |
bool | enable | ||
) |
Enable or disable sync pin.
dev | - Device structure |
enable | - Set to true to enable, or false to disable |
int ltp8800_vout_settings | ( | struct ltp8800_dev * | dev, |
enum ltp8800_vout_settings | settings | ||
) |
Set output voltage and its upper limit.
dev | - Device structure |
settings | - Gain settings |
int ltp8800_vout_value | ( | struct ltp8800_dev * | dev, |
int | vout_command | ||
) |
Set output voltage command.
dev | - Device structure |
vout_command | - Output voltage in millivolts |
int ltp8800_write_byte | ( | struct ltp8800_dev * | dev, |
uint16_t | cmd, | ||
uint8_t | value | ||
) |
Perform a raw PMBus write byte operation.
dev | - Device structure |
cmd | - PMBus command |
value | - Byte to be written |
int ltp8800_write_word | ( | struct ltp8800_dev * | dev, |
uint16_t | cmd, | ||
uint16_t | word | ||
) |
Perform a raw PMBus write word operation.
dev | - Device structure |
cmd | - PMBus command |
word | - Word to write |
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.
dev | - Device structure |
cmd | - PMBus command |
data | - Value to write |
NO_OS_DECLARE_CRC8_TABLE | ( | ltp8800_crc_table | ) |