![]() |
no-OS
|
Source code of the LTM4700 driver. More...
#include <stdint.h>#include <stdbool.h>#include <stdlib.h>#include <limits.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 "ltm4700.h"Functions | |
| NO_OS_DECLARE_CRC8_TABLE (ltm4700_crc_table) | |
| int | ltm4700_verify_manufacturer_id (struct ltm4700_dev *dev) |
| Verify manufacturer ID. | |
| int | ltm4700_verify_manufacturer_model (struct ltm4700_dev *dev) |
| Verify manufacturer model. | |
| int | ltm4700_init (struct ltm4700_dev **device, struct ltm4700_init_param *init_param) |
| Initialize the device structure. | |
| int | ltm4700_remove (struct ltm4700_dev *dev) |
| Free or remove device instance. | |
| int | ltm4700_set_page (struct ltm4700_dev *dev, int page) |
| Set PMBus page. | |
| int | ltm4700_send_byte (struct ltm4700_dev *dev, int page, uint8_t cmd) |
| Send a PMBus command to the device. | |
| int | ltm4700_read_byte (struct ltm4700_dev *dev, int page, uint8_t cmd, uint8_t *data) |
| Perform a PMBus read_byte operation. | |
| int | ltm4700_write_byte (struct ltm4700_dev *dev, int page, uint8_t cmd, uint8_t value) |
| Perform a PMBus write_byte operation. | |
| int | ltm4700_read_word (struct ltm4700_dev *dev, int page, uint8_t cmd, uint16_t *word) |
| Perform a PMBus read_word operation. | |
| int | ltm4700_write_word (struct ltm4700_dev *dev, int page, uint8_t cmd, uint16_t word) |
| Perform a PMBus write_word operation. | |
| int | ltm4700_read_word_data (struct ltm4700_dev *dev, int page, uint8_t cmd, int *data) |
| Perform a PMBus read_word operation then perform conversion. | |
| int | ltm4700_write_word_data (struct ltm4700_dev *dev, int page, uint8_t cmd, int data) |
| Perform conversion then perform a PMBus write_word operation. | |
| int | ltm4700_read_block_data (struct ltm4700_dev *dev, int page, uint8_t cmd, uint8_t *data, size_t nbytes) |
| Read a block of bytes. | |
| int | ltm4700_read_value (struct ltm4700_dev *dev, uint8_t channel, enum ltm4700_value_type value_type, int *value) |
| Read specific value type. | |
| int | ltm4700_read_status (struct ltm4700_dev *dev, uint8_t channel, enum ltm4700_status_type status_type, struct ltm4700_status *status) |
| Read status. | |
| int | ltm4700_vout_value (struct ltm4700_dev *dev, uint8_t channel, int vout_command, int vout_max) |
| Set VOUT parameters. | |
| int | ltm4700_vout_margin (struct ltm4700_dev *dev, uint8_t channel, int margin_low, int margin_high) |
| Set VOUT margins. | |
| int | ltm4700_set_timing (struct ltm4700_dev *dev, uint8_t channel, enum ltm4700_timing_type timing_type, int time) |
| Set timing values. | |
| int | ltm4700_set_operation (struct ltm4700_dev *dev, uint8_t channel, enum ltm4700_operation_type operation) |
| Set operation mode. | |
| int | ltm4700_nvm_cmd (struct ltm4700_dev *dev, enum ltm4700_nvm_cmd_type cmd) |
| NVM/EEPROM user commands. | |
| int | ltm4700_software_reset (struct ltm4700_dev *dev) |
| Software reset. | |
| int | ltm4700_clear_peaks (struct ltm4700_dev *dev) |
| Clear peak values. | |
Source code of the LTM4700 driver.
Copyright 2026(c) Analog Devices, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| int ltm4700_clear_peaks | ( | struct ltm4700_dev * | dev | ) |
Clear peak values.
Clear all peak value tracking registers.
| dev | - The device structure |
| int ltm4700_init | ( | struct ltm4700_dev ** | device, |
| struct ltm4700_init_param * | init_param ) |
Initialize the device structure.
Initialize the LTM4700 device structure.
| device | - The device structure |
| init_param | - Initialization parameters |
| int ltm4700_nvm_cmd | ( | struct ltm4700_dev * | dev, |
| enum ltm4700_nvm_cmd_type | cmd ) |
NVM/EEPROM user commands.
Execute NVM/EEPROM user commands.
| dev | - The device structure |
| cmd | - NVM command type |
| int ltm4700_read_block_data | ( | struct ltm4700_dev * | dev, |
| int | page, | ||
| uint8_t | cmd, | ||
| uint8_t * | data, | ||
| size_t | nbytes ) |
Read a block of bytes.
Read a block of bytes from device.
| dev | - The device structure |
| page | - Page number for paged commands |
| cmd | - PMBus command |
| data | - Read data buffer |
| nbytes | - Number of bytes to read |
| int ltm4700_read_byte | ( | struct ltm4700_dev * | dev, |
| int | page, | ||
| uint8_t | cmd, | ||
| uint8_t * | data ) |
Perform a PMBus read_byte operation.
| dev | - The device structure |
| page | - Page number for paged commands |
| cmd | - PMBus command |
| data | - Read data |
| int ltm4700_read_status | ( | struct ltm4700_dev * | dev, |
| uint8_t | channel, | ||
| enum ltm4700_status_type | status_type, | ||
| struct ltm4700_status * | status ) |
Read status.
Read status information from device.
| dev | - The device structure |
| channel | - Channel number |
| status_type | - Type of status to read |
| status | - Status structure to fill |
| int ltm4700_read_value | ( | struct ltm4700_dev * | dev, |
| uint8_t | channel, | ||
| enum ltm4700_value_type | value_type, | ||
| int * | value ) |
Read specific value type.
Read specific value type (voltage, current, power, temperature)
| dev | - The device structure |
| channel | - Channel number |
| value_type | - Type of value to read |
| value | - Read value in milli-units (mV, mA, mW, m°C, etc.) |
| int ltm4700_read_word | ( | struct ltm4700_dev * | dev, |
| int | page, | ||
| uint8_t | cmd, | ||
| uint16_t * | word ) |
Perform a PMBus read_word operation.
| dev | - The device structure |
| page | - Page number for paged commands |
| cmd | - PMBus command |
| word | - Read word data |
| int ltm4700_read_word_data | ( | struct ltm4700_dev * | dev, |
| int | page, | ||
| uint8_t | cmd, | ||
| int * | data ) |
Perform a PMBus read_word operation then perform conversion.
| dev | - The device structure |
| page | - Page number for paged commands |
| cmd | - PMBus command |
| data | - Converted data in milli-units (mV, mA, mW, m°C, etc.) |
| int ltm4700_remove | ( | struct ltm4700_dev * | dev | ) |
Free or remove device instance.
| dev | - The device structure |
| int ltm4700_send_byte | ( | struct ltm4700_dev * | dev, |
| int | page, | ||
| uint8_t | cmd ) |
Send a PMBus command to the device.
| dev | - The device structure |
| page | - Page number for paged commands |
| cmd | - PMBus command |
| int ltm4700_set_operation | ( | struct ltm4700_dev * | dev, |
| uint8_t | channel, | ||
| enum ltm4700_operation_type | operation ) |
Set operation mode.
Set operation mode for specified channel.
| dev | - The device structure |
| channel | - Channel number (0, 1, or LTM4700_CHAN_ALL for broadcast) |
| operation | - Operation type |
| int ltm4700_set_page | ( | struct ltm4700_dev * | dev, |
| int | page ) |
Set PMBus page.
Set PMBus page and phase.
| dev | - The device structure |
| page | - Page number (0 or 1 for dual channel device, or 0xFF for broadcast) |
| int ltm4700_set_timing | ( | struct ltm4700_dev * | dev, |
| uint8_t | channel, | ||
| enum ltm4700_timing_type | timing_type, | ||
| int | time ) |
Set timing values.
Set timing values in microseconds.
| dev | - The device structure |
| channel | - Channel number |
| timing_type | - Type of timing to set |
| time | - Time value in microseconds |
| int ltm4700_software_reset | ( | struct ltm4700_dev * | dev | ) |
Software reset.
Perform software reset of the device.
| dev | - The device structure |
| int ltm4700_verify_manufacturer_id | ( | struct ltm4700_dev * | dev | ) |
Verify manufacturer ID.
| dev | - Device structure |
| int ltm4700_verify_manufacturer_model | ( | struct ltm4700_dev * | dev | ) |
Verify manufacturer model.
| dev | - Device structure |
| int ltm4700_vout_margin | ( | struct ltm4700_dev * | dev, |
| uint8_t | channel, | ||
| int | margin_low, | ||
| int | margin_high ) |
Set VOUT margins.
Set VOUT margins for overvoltage/undervoltage protection.
| dev | - The device structure |
| channel | - Channel number |
| margin_low | - Low margin value in microvolts |
| margin_high | - High margin value in microvolts |
| int ltm4700_vout_value | ( | struct ltm4700_dev * | dev, |
| uint8_t | channel, | ||
| int | vout_command, | ||
| int | vout_max ) |
Set VOUT parameters.
Set VOUT parameters: VOUT_COMMAND and VOUT_MAX.
| dev | - The device structure |
| channel | - Channel number |
| vout_command | - VOUT command value in microvolts |
| vout_max | - VOUT max value in microvolts |
| int ltm4700_write_byte | ( | struct ltm4700_dev * | dev, |
| int | page, | ||
| uint8_t | cmd, | ||
| uint8_t | value ) |
Perform a PMBus write_byte operation.
| dev | - The device structure |
| page | - Page number for paged commands |
| cmd | - PMBus command |
| value | - Data to write |
| int ltm4700_write_word | ( | struct ltm4700_dev * | dev, |
| int | page, | ||
| uint8_t | cmd, | ||
| uint16_t | word ) |
Perform a PMBus write_word operation.
| dev | - The device structure |
| page | - Page number for paged commands |
| cmd | - PMBus command |
| word | - Word data to write |
| int ltm4700_write_word_data | ( | struct ltm4700_dev * | dev, |
| int | page, | ||
| uint8_t | cmd, | ||
| int | data ) |
Perform conversion then perform a PMBus write_word operation.
| dev | - The device structure |
| page | - Page number for paged commands |
| cmd | - PMBus command |
| data | - Data in milli-units (mV, mA, mW, m°C, etc.) to convert and write |
| NO_OS_DECLARE_CRC8_TABLE | ( | ltm4700_crc_table | ) |