![]() |
no-OS
|
Source file of the MAX17616 Driver. More...
#include <stdint.h>#include <stdbool.h>#include <stdlib.h>#include <errno.h>#include <stdio.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_crc8.h"#include "max17616.h"Classes | |
| struct | max17616_direct_coeffs |
Macros | |
| #define | MAX17616_PMBUS_REVISION_VALUE 0x33 /* PMBus Part I and II Rev1.3 */ |
| #define | MAX17616_MFR_ID_STR "MAXIM" |
| #define | MAX17616_MFR_ID_SIZE 5 |
| #define | MAX17616_MFR_REV_SIZE 2 |
Functions | |
| int | max17616_send_byte (struct max17616_dev *dev, uint8_t cmd) |
| Send a PMBus command to the device. | |
| int | max17616_read_byte (struct max17616_dev *dev, uint8_t cmd, uint8_t *data) |
| Perform a raw PMBus read byte operation. | |
| int | max17616_read_word (struct max17616_dev *dev, uint8_t cmd, uint16_t *word) |
| Perform a raw PMBus read word operation. | |
| int | max17616_read_block_data (struct max17616_dev *dev, uint8_t cmd, uint8_t *data, size_t nbytes) |
| Perform a PMBus read block operation. | |
| int | max17616_write_byte (struct max17616_dev *dev, uint8_t cmd, uint8_t value) |
| Perform a raw PMBus write byte operation. | |
| int | max17616_read_status_byte (struct max17616_dev *dev, uint8_t *status_byte) |
| Read STATUS_BYTE register. | |
| int | max17616_read_status_vout (struct max17616_dev *dev, uint8_t *status_vout) |
| Read STATUS_VOUT register. | |
| int | max17616_read_status_iout (struct max17616_dev *dev, uint8_t *status_iout) |
| Read STATUS_IOUT register. | |
| int | max17616_read_status_input (struct max17616_dev *dev, uint8_t *status_input) |
| Read STATUS_INPUT register. | |
| int | max17616_read_status_temperature (struct max17616_dev *dev, uint8_t *status_temperature) |
| Read STATUS_TEMPERATURE register. | |
| int | max17616_read_status_cml (struct max17616_dev *dev, uint8_t *status_cml) |
| Read STATUS_CML register. | |
| int | max17616_read_status_mfr_specific (struct max17616_dev *dev, uint8_t *status_mfr) |
| Read STATUS_MFR_SPECIFIC register. | |
| int | max17616_read_capability (struct max17616_dev *dev, uint8_t *capability) |
| Read device capability register. | |
| int | max17616_verify_manufacturer_id (struct max17616_dev *dev) |
| Read and verify manufacturer ID. | |
| int | max17616_identify_chip_variant (struct max17616_dev *dev) |
| Read device ID and identify chip variant. | |
| int | max17616_verify_pmbus_revision (struct max17616_dev *dev) |
| Verify PMBus revision. | |
| int | max17616_clear_faults (struct max17616_dev *dev) |
| Clear all asserted faults. | |
| int | max17616_set_mfg_specific_config (struct max17616_dev *dev) |
| Set manufacturer-specific configuration. | |
| int | max17616_read_value (struct max17616_dev *dev, enum max17616_value_type value_type, int32_t *value_milliunit) |
| Read a specific value with automatic data conversion. | |
| int | max17616_set_operation_state (struct max17616_dev *dev, bool enable) |
| Set device operation state. | |
| int | max17616_get_operation_state (struct max17616_dev *dev, bool *enabled) |
| Get device operation state. | |
| int | max17616_get_current_limit_mode (struct max17616_dev *dev, enum max17616_current_limit_mode *clmode) |
| Get current limit mode. | |
| int | max17616_set_current_limit_mode (struct max17616_dev *dev, enum max17616_current_limit_mode clmode) |
| Set current limit mode. | |
| int | max17616_get_istart_ratio (struct max17616_dev *dev, enum max17616_istart_ratio *istart_ratio) |
| Get current start ratio. | |
| int | max17616_set_istart_ratio (struct max17616_dev *dev, enum max17616_istart_ratio istart_ratio) |
| Set current start ratio. | |
| int | max17616_get_overcurrent_timeout (struct max17616_dev *dev, enum max17616_overcurrent_timeout *timeout) |
| Get short-term overcurrent duration. | |
| int | max17616_set_overcurrent_timeout (struct max17616_dev *dev, enum max17616_overcurrent_timeout timeout) |
| Set short-term overcurrent duration. | |
| int | max17616_get_overcurrent_limit (struct max17616_dev *dev, enum max17616_overcurrent_limit *istlim) |
| Get the short-term overcurrent limit ratio. | |
| int | max17616_set_overcurrent_limit (struct max17616_dev *dev, enum max17616_overcurrent_limit istlimit) |
| Set the short-term overcurrent limit ratio. | |
| int | max17616_set_vout_uv_fault_limit_config (struct max17616_dev *dev, enum max17616_nominal_voltage voltage, enum max17616_pgood_threshold threshold) |
| Set VOUT UV fault limit configuration using enums. | |
| int | max17616_get_vout_uv_fault_limit_config (struct max17616_dev *dev, enum max17616_nominal_voltage *voltage, enum max17616_pgood_threshold *threshold) |
| Get VOUT UV fault limit configuration using enums. | |
| int | max17616_read_status (struct max17616_dev *dev, struct max17616_status *status) |
| Read MAX17616 device status. | |
| int | max17616_read_telemetry_all (struct max17616_dev *dev, struct max17616_telemetry *telemetry) |
| Read comprehensive telemetry data. | |
| int | max17616_init (struct max17616_dev **device, struct max17616_init_param *init_param) |
| Initialize the device structure. | |
| int | max17616_remove (struct max17616_dev *dev) |
| Free or remove device instance. | |
| const char * | max17616_get_fault_description (uint16_t group, uint8_t bit) |
| Get human-readable description for a specific fault. | |
Source file of the MAX17616 Driver.
Copyright 2025(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.
| #define MAX17616_MFR_ID_SIZE 5 |
| #define MAX17616_MFR_ID_STR "MAXIM" |
| #define MAX17616_MFR_REV_SIZE 2 |
| #define MAX17616_PMBUS_REVISION_VALUE 0x33 /* PMBus Part I and II Rev1.3 */ |
| int max17616_clear_faults | ( | struct max17616_dev * | dev | ) |
Clear all asserted faults.
| dev | - Device structure |
| int max17616_get_current_limit_mode | ( | struct max17616_dev * | dev, |
| enum max17616_current_limit_mode * | clmode ) |
Get current limit mode.
| dev | - Device structure |
| clmode | - Pointer to the current limit mode setting |
| const char * max17616_get_fault_description | ( | uint16_t | group, |
| uint8_t | bit ) |
Get human-readable description for a specific fault.
| group | - Fault group identifier |
| bit | - Fault bit position |
| int max17616_get_istart_ratio | ( | struct max17616_dev * | dev, |
| enum max17616_istart_ratio * | istart_ratio ) |
Get current start ratio.
| dev | - Device structure |
| istart_ratio | - Pointer to the current start ratio setting |
| int max17616_get_operation_state | ( | struct max17616_dev * | dev, |
| bool * | enabled ) |
Get device operation state.
| dev | - Device structure |
| enabled | - Pointer to store operation state |
| int max17616_get_overcurrent_limit | ( | struct max17616_dev * | dev, |
| enum max17616_overcurrent_limit * | istlim ) |
Get the short-term overcurrent limit ratio.
| dev | - Device structure |
| istlim | - Pointer to store ISTLIM setting |
| int max17616_get_overcurrent_timeout | ( | struct max17616_dev * | dev, |
| enum max17616_overcurrent_timeout * | timeout ) |
Get short-term overcurrent duration.
| dev | - Device structure |
| timeout | - Pointer to store short-term overcurrent duration setting |
| int max17616_get_vout_uv_fault_limit_config | ( | struct max17616_dev * | dev, |
| enum max17616_nominal_voltage * | voltage, | ||
| enum max17616_pgood_threshold * | threshold ) |
Get VOUT UV fault limit configuration using enums.
| dev | - Device structure |
| voltage | - Pointer to store nominal voltage selection |
| threshold | - Pointer to store PGOOD rising threshold |
| int max17616_identify_chip_variant | ( | struct max17616_dev * | dev | ) |
Read device ID and identify chip variant.
| dev | - Device structure |
| int max17616_init | ( | struct max17616_dev ** | device, |
| struct max17616_init_param * | init_param ) |
Initialize the device structure.
| device | - Device structure |
| init_param | - Initialization parameters |
| int max17616_read_block_data | ( | struct max17616_dev * | dev, |
| uint8_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 | - Expected size of the block in bytes (excluding byte count) |
| int max17616_read_byte | ( | struct max17616_dev * | dev, |
| uint8_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 max17616_read_capability | ( | struct max17616_dev * | dev, |
| uint8_t * | capability ) |
Read device capability register.
| dev | - Device structure |
| capability | - Pointer to store capability byte |
| int max17616_read_status | ( | struct max17616_dev * | dev, |
| struct max17616_status * | status ) |
Read MAX17616 device status.
| dev | - Device structure |
| status | - Pointer to store status |
| int max17616_read_status_byte | ( | struct max17616_dev * | dev, |
| uint8_t * | status_byte ) |
Read STATUS_BYTE register.
| dev | - Device structure |
| status_byte | - Pointer to store status byte |
| int max17616_read_status_cml | ( | struct max17616_dev * | dev, |
| uint8_t * | status_cml ) |
Read STATUS_CML register.
| dev | - Device structure |
| status_cml | - Pointer to store status CML byte |
| int max17616_read_status_input | ( | struct max17616_dev * | dev, |
| uint8_t * | status_input ) |
Read STATUS_INPUT register.
| dev | - Device structure |
| status_input | - Pointer to store status INPUT byte |
| int max17616_read_status_iout | ( | struct max17616_dev * | dev, |
| uint8_t * | status_iout ) |
Read STATUS_IOUT register.
| dev | - Device structure |
| status_iout | - Pointer to store status IOUT byte |
| int max17616_read_status_mfr_specific | ( | struct max17616_dev * | dev, |
| uint8_t * | status_mfr ) |
Read STATUS_MFR_SPECIFIC register.
| dev | - Device structure |
| status_mfr | - Pointer to store status MFR SPECIFIC byte |
| int max17616_read_status_temperature | ( | struct max17616_dev * | dev, |
| uint8_t * | status_temperature ) |
Read STATUS_TEMPERATURE register.
| dev | - Device structure |
| status_temperature | - Pointer to store status TEMPERATURE byte |
| int max17616_read_status_vout | ( | struct max17616_dev * | dev, |
| uint8_t * | status_vout ) |
Read STATUS_VOUT register.
| dev | - Device structure |
| status_vout | - Pointer to store status VOUT byte |
| int max17616_read_telemetry_all | ( | struct max17616_dev * | dev, |
| struct max17616_telemetry * | telemetry ) |
Read comprehensive telemetry data.
| dev | - Device structure |
| telemetry | - Telemetry structure to populate |
| int max17616_read_value | ( | struct max17616_dev * | dev, |
| enum max17616_value_type | value_type, | ||
| int32_t * | value_milliunit ) |
Read a specific value with automatic data conversion.
| dev | - Device structure |
| value_type | - Type of value to read |
| value_milliunit | - Pointer to store the converted value (mV/mA/mW/mC) |
| int max17616_read_word | ( | struct max17616_dev * | dev, |
| uint8_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 max17616_remove | ( | struct max17616_dev * | dev | ) |
Free or remove device instance.
| dev | - The device structure |
| int max17616_send_byte | ( | struct max17616_dev * | dev, |
| uint8_t | cmd ) |
Send a PMBus command to the device.
| dev | - Device structure |
| cmd | - PMBus command |
| int max17616_set_current_limit_mode | ( | struct max17616_dev * | dev, |
| enum max17616_current_limit_mode | clmode ) |
Set current limit mode.
| dev | - Device structure |
| clmode | - Current limit mode setting |
| int max17616_set_istart_ratio | ( | struct max17616_dev * | dev, |
| enum max17616_istart_ratio | istart_ratio ) |
Set current start ratio.
| dev | - Device structure |
| istart_ratio | - Current start ratio setting |
| int max17616_set_mfg_specific_config | ( | struct max17616_dev * | dev | ) |
Set manufacturer-specific configuration.
| dev | - Device structure |
| int max17616_set_operation_state | ( | struct max17616_dev * | dev, |
| bool | enable ) |
Set device operation state.
| dev | - Device structure |
| enable | - true to enable, false to disable |
| int max17616_set_overcurrent_limit | ( | struct max17616_dev * | dev, |
| enum max17616_overcurrent_limit | istlimit ) |
Set the short-term overcurrent limit ratio.
| dev | - Device structure |
| istlimit | - Short-term overcurrent limit ratio setting |
| int max17616_set_overcurrent_timeout | ( | struct max17616_dev * | dev, |
| enum max17616_overcurrent_timeout | timeout ) |
Set short-term overcurrent duration.
| dev | - Device structure |
| timeout | - Short-term overcurrent duration setting |
| int max17616_set_vout_uv_fault_limit_config | ( | struct max17616_dev * | dev, |
| enum max17616_nominal_voltage | voltage, | ||
| enum max17616_pgood_threshold | threshold ) |
Set VOUT UV fault limit configuration using enums.
| dev | - Device structure |
| voltage | - Nominal voltage selection (bits 4:2) |
| threshold | - PGOOD rising threshold (bits 1:0) |
| int max17616_verify_manufacturer_id | ( | struct max17616_dev * | dev | ) |
Read and verify manufacturer ID.
| dev | - Device structure |
| int max17616_verify_pmbus_revision | ( | struct max17616_dev * | dev | ) |
Verify PMBus revision.
| dev | - Device structure |
| int max17616_write_byte | ( | struct max17616_dev * | dev, |
| uint8_t | cmd, | ||
| uint8_t | value ) |
Perform a raw PMBus write byte operation.
| dev | - Device structure |
| cmd | - PMBus command |
| value | - Byte to be written |