![]() |
no-OS
|
Source code of the LTM4686 driver. More...
#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_i2c.h"#include "no_os_gpio.h"#include "no_os_crc8.h"#include "ltm4686.h"Functions | |
| NO_OS_DECLARE_CRC8_TABLE (ltm4686_crc_table) | |
| int | ltm4686_init (struct ltm4686_dev **device, struct ltm4686_init_param *init_param) |
| Initialize the device structure. | |
| int | ltm4686_remove (struct ltm4686_dev *dev) |
| Free or remove device instance. | |
| int | ltm4686_set_page (struct ltm4686_dev *dev, int page) |
| Set page of the device. Page 0x0 - Channel 0 Page 0x1 - Channel 1 Page 0x2 - Channel 2 Page 0x3 - Channel 3 Page 0xff - All channels. | |
| int | ltm4686_send_byte (struct ltm4686_dev *dev, int page, uint8_t cmd) |
| Send a PMBus command to the device. | |
| int | ltm4686_read_byte (struct ltm4686_dev *dev, int page, uint8_t cmd, uint8_t *data) |
| Perform a raw PMBus read byte operation. | |
| int | ltm4686_write_byte (struct ltm4686_dev *dev, int page, uint8_t cmd, uint8_t value) |
| Perform a raw PMBus write byte operation. | |
| int | ltm4686_read_word (struct ltm4686_dev *dev, int page, uint8_t cmd, uint16_t *word) |
| Perform a raw PMBus read word operation. | |
| int | ltm4686_write_word (struct ltm4686_dev *dev, int page, uint8_t cmd, uint16_t word) |
| Perform a raw PMBus write word operation. | |
| int | ltm4686_read_word_data (struct ltm4686_dev *dev, int page, uint8_t cmd, int *data) |
| Perform a PMBus read word operation and converts to actual value. | |
| int | ltm4686_write_word_data (struct ltm4686_dev *dev, int page, uint8_t cmd, int data) |
| Converts value to register data and do PMBus write word operation. | |
| int | ltm4686_read_block_data (struct ltm4686_dev *dev, int page, uint8_t cmd, uint8_t *data, size_t nbytes) |
| Perform a PMBus read block operation. | |
| int | ltm4686_read_value (struct ltm4686_dev *dev, uint8_t channel, enum ltm4686_value_type value_type, int *value) |
| Read a value. | |
| int | ltm4686_read_status (struct ltm4686_dev *dev, uint8_t channel, enum ltm4686_status_type status_type, struct ltm4686_status *status) |
| Read statuses. | |
| int | ltm4686_vout_value (struct ltm4686_dev *dev, uint8_t channel, int vout_command, int vout_max) |
| Set output voltage and its upper limit. | |
| int | ltm4686_vout_tr (struct ltm4686_dev *dev, uint8_t channel, int tr) |
| Set output voltage transition rate. | |
| int | ltm4686_vout_margin (struct ltm4686_dev *dev, uint8_t channel, int margin_low, int margin_high) |
| Set output voltage margin. | |
| int | ltm4686_set_vin (struct ltm4686_dev *dev, int vin_on, int vin_off) |
| Set input voltage window at which power conversion will proceed. | |
| int | ltm4686_set_timing (struct ltm4686_dev *dev, uint8_t channel, enum ltm4686_timing_type timing_type, int time) |
| Set timing values. | |
| int | ltm4686_switch_freq (struct ltm4686_dev *dev, enum ltm4686_freq freq) |
| Set switching frequency. | |
| int | ltm4686_pwm_mode (struct ltm4686_dev *dev, uint8_t channel, enum ltm4686_pwm_mode pwm_mode) |
| Sets the PWM mode for a specific channel of the LTM4686 device. | |
| int | ltm4686_set_operation (struct ltm4686_dev *dev, uint8_t channel, enum ltm4686_operation_type operation) |
| Set channel operation. | |
| int | ltm4686_nvm_cmd (struct ltm4686_dev *dev, enum ltm4686_nvm_cmd_type cmd) |
| Perform commands for non-volatile memory/EEPROM. | |
| int | ltm4686_software_reset (struct ltm4686_dev *dev) |
| Perform a device software reset. | |
Variables | |
| const struct ltm4686_chip_info | ltm4686_info [] |
Source code of the LTM4686 driver.
Copyright 2024(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
| int ltm4686_init | ( | struct ltm4686_dev ** | device, |
| struct ltm4686_init_param * | init_param ) |
Initialize the device structure.
| device | - Device structure |
| init_param | - Initialization parameters |
| int ltm4686_nvm_cmd | ( | struct ltm4686_dev * | dev, |
| enum ltm4686_nvm_cmd_type | cmd ) |
Perform commands for non-volatile memory/EEPROM.
| dev | - Device structure |
| cmd | - NVM commands. Example: LTM4686_STORE_USER LTM4686_COMPARE_USER LTM4686_RESTORE_USER |
| int ltm4686_pwm_mode | ( | struct ltm4686_dev * | dev, |
| uint8_t | channel, | ||
| enum ltm4686_pwm_mode | pwm_mode ) |
Sets the PWM mode for a specific channel of the LTM4686 device.
| dev | The LTM4686 device structure. |
| channel | The channel number. |
| pwm_mode | The PWM mode to be set. |
| int ltm4686_read_block_data | ( | struct ltm4686_dev * | dev, |
| int | page, | ||
| uint8_t | cmd, | ||
| uint8_t * | data, | ||
| size_t | nbytes ) |
Perform a PMBus read block operation.
| dev | - Device structure |
| page | - Page/channel of the command |
| cmd | - PMBus command |
| data | - Address of the read block |
| nbytes | - Size of the block in bytes |
| int ltm4686_read_byte | ( | struct ltm4686_dev * | dev, |
| int | page, | ||
| uint8_t | cmd, | ||
| uint8_t * | data ) |
Perform a raw PMBus read byte operation.
| dev | - Device structure |
| page | - Page or channel of the command |
| cmd | - PMBus command |
| data | - Address of the byte read |
| int ltm4686_read_status | ( | struct ltm4686_dev * | dev, |
| uint8_t | channel, | ||
| enum ltm4686_status_type | status_type, | ||
| struct ltm4686_status * | status ) |
Read statuses.
| dev | - Device structure |
| channel | - Channel of the status to read |
| status_type | - Status type. Example values: LTM4686_STATUS_BYTE_TYPE LTM4686_STATUS_VOUT_TYPE LTM4686_STATUS_IOUT_TYPE LTM4686_STATUS_INPUT_TYPE LTM4686_STATUS_CML_TYPE |
| status | - Address of the status structure |
| int ltm4686_read_value | ( | struct ltm4686_dev * | dev, |
| uint8_t | channel, | ||
| enum ltm4686_value_type | value_type, | ||
| int * | value ) |
Read a value.
| dev | - Device structure |
| channel | - Channel selected |
| value_type | - Value type. Example values: LTM4686_VIN LTM4686_VOUT LTM4686_IIN LTM4686_IOUT LTM4686_TEMP |
| value | - Address of the read value |
| int ltm4686_read_word | ( | struct ltm4686_dev * | dev, |
| int | page, | ||
| uint8_t | cmd, | ||
| uint16_t * | word ) |
Perform a raw PMBus read word operation.
| dev | - Device structure |
| page | - Page/channel of the command |
| cmd | - PMBus command |
| word | - Address of the read word |
| int ltm4686_read_word_data | ( | struct ltm4686_dev * | dev, |
| int | page, | ||
| uint8_t | cmd, | ||
| int * | data ) |
Perform a PMBus read word operation and converts to actual value.
| dev | - Device structure |
| page | - Page/channel of the command |
| cmd | - PMBus command |
| data | - Address of data read |
| int ltm4686_remove | ( | struct ltm4686_dev * | dev | ) |
Free or remove device instance.
| dev | - The device structure |
| int ltm4686_send_byte | ( | struct ltm4686_dev * | dev, |
| int | page, | ||
| uint8_t | cmd ) |
Send a PMBus command to the device.
| dev | - Device structure |
| page | - Page or channel of the command |
| cmd | - PMBus command |
| int ltm4686_set_operation | ( | struct ltm4686_dev * | dev, |
| uint8_t | channel, | ||
| enum ltm4686_operation_type | operation ) |
Set channel operation.
| dev | - Device structure |
| channel | - Channel |
| operation | - Operation. Accepted values are: LTM4686_OPERATION_OFF LTM4686_OPERATION_ON LTM4686_OPERATION_MARGIN_HIGH LTM4686_OPERATION_MARGIN_LOW LTM4686_OPERATION_SEQ_OFF |
| int ltm4686_set_page | ( | struct ltm4686_dev * | dev, |
| int | page ) |
Set page of the device. Page 0x0 - Channel 0 Page 0x1 - Channel 1 Page 0x2 - Channel 2 Page 0x3 - Channel 3 Page 0xff - All channels.
| dev | - Device structure |
| page | - Page to set |
| int ltm4686_set_timing | ( | struct ltm4686_dev * | dev, |
| uint8_t | channel, | ||
| enum ltm4686_timing_type | timing_type, | ||
| int | time ) |
Set timing values.
| dev | - Device structure |
| channel | - Channel |
| timing_type | - Timing value type. Example: LTM4686_TON_DELAY_TYPE LTM4686_TON_RISE_TYPE LTM4686_TOFF_DELAY_TYPE LTM4686_RETRY_DELAY_TYPE |
| time | - Time value in microseconds |
| int ltm4686_set_vin | ( | struct ltm4686_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 ltm4686_software_reset | ( | struct ltm4686_dev * | dev | ) |
Perform a device software reset.
| dev | - Device structure |
| int ltm4686_switch_freq | ( | struct ltm4686_dev * | dev, |
| enum ltm4686_freq | freq ) |
Set switching frequency.
| dev | - Device structure |
| freq | - Frequency to set. |
| int ltm4686_vout_margin | ( | struct ltm4686_dev * | dev, |
| uint8_t | channel, | ||
| int | margin_low, | ||
| int | margin_high ) |
Set output voltage margin.
| dev | - Device structure |
| channel | - Channel |
| margin_high | - Upper margin in millivolts |
| margin_low | - Lower margin in millivolts |
| int ltm4686_vout_tr | ( | struct ltm4686_dev * | dev, |
| uint8_t | channel, | ||
| int | tr ) |
Set output voltage transition rate.
| dev | - Device structure |
| channel | - Channel |
| tr | - Transition rate in microV/ms |
| int ltm4686_vout_value | ( | struct ltm4686_dev * | dev, |
| uint8_t | channel, | ||
| int | vout_command, | ||
| int | vout_max ) |
Set output voltage and its upper limit.
| dev | - Device structure |
| channel | - Channel |
| vout_command | - Output voltage in millivolts |
| vout_max | - Output voltage upper limit in millivolts |
| int ltm4686_write_byte | ( | struct ltm4686_dev * | dev, |
| int | page, | ||
| uint8_t | cmd, | ||
| uint8_t | value ) |
Perform a raw PMBus write byte operation.
| dev | - Device structure |
| page | - Page/channel of the command |
| cmd | - PMBus command |
| value | - Byte to be written |
| int ltm4686_write_word | ( | struct ltm4686_dev * | dev, |
| int | page, | ||
| uint8_t | cmd, | ||
| uint16_t | word ) |
Perform a raw PMBus write word operation.
| dev | - Device structure |
| page | - Page/channel of the command |
| cmd | - PMBus command |
| word | - Word to write |
| int ltm4686_write_word_data | ( | struct ltm4686_dev * | dev, |
| int | page, | ||
| uint8_t | cmd, | ||
| int | data ) |
Converts value to register data and do PMBus write word operation.
| dev | - Device structure |
| page | - Page/channel of the command |
| cmd | - PMBus command |
| data | - Value to write |
| NO_OS_DECLARE_CRC8_TABLE | ( | ltm4686_crc_table | ) |
| const struct ltm4686_chip_info ltm4686_info[] |