no-OS
|
Implementation file for the LTC4296 Driver. More...
#include <stdio.h>
#include <errno.h>
#include "ltc4296.h"
#include "no_os_alloc.h"
#include "no_os_delay.h"
#include "no_os_print_log.h"
#include "no_os_util.h"
Functions | |
int | ltc4296_reg_read (struct ltc4296_dev *dev, uint8_t reg, uint16_t *data) |
Register Read. More... | |
int | ltc4296_reg_write (struct ltc4296_dev *dev, uint8_t reg, uint16_t data) |
Register Write. More... | |
int | ltc4296_reset (struct ltc4296_dev *dev) |
Software reset. More... | |
int | ltc4296_get_port_addr (enum ltc4296_port port_no, enum ltc4296_port_reg_offset_e port_offset, uint8_t *port_addr) |
Get port address. More... | |
int | ltc4296_clear_global_faults (struct ltc4296_dev *dev) |
Clear global faults. More... | |
int | ltc4296_clear_ckt_breaker (struct ltc4296_dev *dev) |
Clear circuit break faults. More... | |
int | ltc4296_read_global_faults (struct ltc4296_dev *dev, uint16_t *g_events) |
Read global faults. More... | |
int | ltc4296_unlock (struct ltc4296_dev *dev) |
Device unlock. More... | |
int | ltc4296_is_locked (struct ltc4296_dev *dev, enum ltc4296_state *state) |
Check device state. More... | |
int | ltc4296_read_gadc (struct ltc4296_dev *dev, int *port_voltage_mv) |
Read global ADC. More... | |
int | ltc4296_set_gadc_vin (struct ltc4296_dev *dev) |
Set the global ADC to measure voltage. More... | |
int | ltc4296_is_vin_valid (struct ltc4296_dev *dev, int port_vin_mv, enum ltc4296_board_class ltcboard_class, bool *vin_valid) |
Check if input voltage is valid. More... | |
int | ltc4296_is_vout_valid (struct ltc4296_dev *dev, int port_vout_mv, enum ltc4296_board_class ltcboard_class, bool *vout_valid) |
Check if output voltage is valid. More... | |
int | ltc4296_disable_gadc (struct ltc4296_dev *dev) |
Disable the global ADC. More... | |
int | ltc4296_read_port_events (struct ltc4296_dev *dev, enum ltc4296_port port_no, uint16_t *port_events) |
Read Port Events. More... | |
int | ltc4296_clear_port_events (struct ltc4296_dev *dev, enum ltc4296_port port_no) |
Clear Port Events. More... | |
int | ltc4296_read_port_status (struct ltc4296_dev *dev, enum ltc4296_port port_no, uint16_t *port_status) |
Read Port Status. More... | |
int | ltc4296_is_port_disabled (struct ltc4296_dev *dev, enum ltc4296_port port_no, enum ltc4296_port_status *port_chk) |
Check if port is enabled/disabled. More... | |
int | ltc4296_port_disable (struct ltc4296_dev *dev, enum ltc4296_port port_no) |
Check if port is disabled. More... | |
int | ltc4296_is_port_deliver_pwr (struct ltc4296_dev *dev, enum ltc4296_port port_no, enum ltc4296_pse_status *pwr_status) |
Check if port delivers power. More... | |
int | ltc4296_is_port_pwr_stable (struct ltc4296_dev *dev, enum ltc4296_port port_no, bool *pwr_status) |
Check if port has stable power. More... | |
int | ltc4296_read_port_adc (struct ltc4296_dev *dev, enum ltc4296_port port_no, int *port_i_out_ma) |
Read port ADC. More... | |
int | ltc4296_port_prebias (struct ltc4296_dev *dev, enum ltc4296_port port_no, enum ltc4296_config mode) |
Stimulate valid wake-up signature for a port. More... | |
int | ltc4296_port_en (struct ltc4296_dev *dev, enum ltc4296_port port_no) |
Enable specific port. More... | |
int | ltc4296_port_en_and_classification (struct ltc4296_dev *dev, enum ltc4296_port port_no) |
Enable specific port and classify. More... | |
int | ltc4296_set_port_mfvs (struct ltc4296_dev *dev, enum ltc4296_port port_no) |
Set port to maintain full voltage signature. More... | |
int | ltc4296_set_port_pwr (struct ltc4296_dev *dev, enum ltc4296_port port_no) |
Set port to power mode. More... | |
int | ltc4296_force_port_pwr (struct ltc4296_dev *dev, enum ltc4296_port port_no) |
Force port to power mode. More... | |
int | ltc4296_port_pwr_available (struct ltc4296_dev *dev, enum ltc4296_port port_no) |
Set port is able to source power. More... | |
int | ltc4296_set_gadc_vout (struct ltc4296_dev *dev, enum ltc4296_port port_no) |
Configure Global ADC to read output voltage. More... | |
int | ltc4296_print_global_faults (uint16_t g_events) |
Print global faults. More... | |
int | ltc4296_print_port_events (enum ltc4296_port port_no, uint16_t port_events) |
Print port events. More... | |
int | ltc4296_chk_global_events (struct ltc4296_dev *dev) |
Check global events. More... | |
int | ltc4296_chk_port_events (struct ltc4296_dev *dev, enum ltc4296_port ltc4296_port) |
Check port events. More... | |
int | ltc4296_init (struct ltc4296_dev **device, struct ltc4296_init_param *init_param) |
Device initialization. More... | |
int | ltc4296_remove (struct ltc4296_dev *dev) |
Free allocated resources. More... | |
Variables | |
int | ltc4296_spoe_vol_range_mv [12][2] |
char * | ltc4296_class_str [12][25] |
Implementation file for the LTC4296 Driver.
Copyright 2024(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 ltc4296_chk_global_events | ( | struct ltc4296_dev * | dev | ) |
Check global events.
dev | - The device structure |
int ltc4296_chk_port_events | ( | struct ltc4296_dev * | dev, |
enum ltc4296_port | ltc4296_port | ||
) |
Check port events.
dev | - The device structure |
ltc4296_port | - The port number |
int ltc4296_clear_ckt_breaker | ( | struct ltc4296_dev * | dev | ) |
Clear circuit break faults.
dev | - The device structure |
int ltc4296_clear_global_faults | ( | struct ltc4296_dev * | dev | ) |
Clear global faults.
dev | - The device structure |
int ltc4296_clear_port_events | ( | struct ltc4296_dev * | dev, |
enum ltc4296_port | port_no | ||
) |
Clear Port Events.
dev | - The device structure |
port_no | - The port number |
int ltc4296_disable_gadc | ( | struct ltc4296_dev * | dev | ) |
Disable the global ADC.
dev | - The device structure |
int ltc4296_force_port_pwr | ( | struct ltc4296_dev * | dev, |
enum ltc4296_port | port_no | ||
) |
Force port to power mode.
dev | - The device structure |
port_no | - The port number |
int ltc4296_get_port_addr | ( | enum ltc4296_port | port_no, |
enum ltc4296_port_reg_offset_e | port_offset, | ||
uint8_t * | port_addr | ||
) |
Get port address.
port_no | - The port number |
port_offset | - The port offset |
port_addr | - The port address |
int ltc4296_init | ( | struct ltc4296_dev ** | device, |
struct ltc4296_init_param * | init_param | ||
) |
Device initialization.
device | - The device structure |
init_param | - The initialization parameters |
int ltc4296_is_locked | ( | struct ltc4296_dev * | dev, |
enum ltc4296_state * | state | ||
) |
Check device state.
dev | - The device structure |
state | - The state of the device |
int ltc4296_is_port_deliver_pwr | ( | struct ltc4296_dev * | dev, |
enum ltc4296_port | port_no, | ||
enum ltc4296_pse_status * | pwr_status | ||
) |
Check if port delivers power.
dev | - The device structure |
port_no | - The port number |
pwr_status | - The PSE Status of the port |
int ltc4296_is_port_disabled | ( | struct ltc4296_dev * | dev, |
enum ltc4296_port | port_no, | ||
enum ltc4296_port_status * | port_chk | ||
) |
Check if port is enabled/disabled.
dev | - The device structure |
port_no | - The port number |
port_chk | - The port is enabled/disabled |
int ltc4296_is_port_pwr_stable | ( | struct ltc4296_dev * | dev, |
enum ltc4296_port | port_no, | ||
bool * | pwr_status | ||
) |
Check if port has stable power.
dev | - The device structure |
port_no | - The port number |
pwr_status | - The power status |
int ltc4296_is_vin_valid | ( | struct ltc4296_dev * | dev, |
int | port_vin_mv, | ||
enum ltc4296_board_class | ltcboard_class, | ||
bool * | vin_valid | ||
) |
Check if input voltage is valid.
dev | - The device structure |
port_vin_mv | - The input voltage in mV |
ltcboard_class | - The board class |
vin_valid | - Valid input voltage |
int ltc4296_is_vout_valid | ( | struct ltc4296_dev * | dev, |
int | port_vout_mv, | ||
enum ltc4296_board_class | ltcboard_class, | ||
bool * | vout_valid | ||
) |
Check if output voltage is valid.
dev | - The device structure |
port_vout_mv | - The output voltage in mV |
ltcboard_class | - The board class |
vout_valid | - Valid input voltage |
int ltc4296_port_disable | ( | struct ltc4296_dev * | dev, |
enum ltc4296_port | port_no | ||
) |
Check if port is disabled.
dev | - The device structure |
port_no | - The port number |
int ltc4296_port_en | ( | struct ltc4296_dev * | dev, |
enum ltc4296_port | port_no | ||
) |
Enable specific port.
dev | - The device structure |
port_no | - The port number |
int ltc4296_port_en_and_classification | ( | struct ltc4296_dev * | dev, |
enum ltc4296_port | port_no | ||
) |
Enable specific port and classify.
dev | - The device structure |
port_no | - The port number |
int ltc4296_port_prebias | ( | struct ltc4296_dev * | dev, |
enum ltc4296_port | port_no, | ||
enum ltc4296_config | mode | ||
) |
Stimulate valid wake-up signature for a port.
dev | - The device structure |
port_no | - The port number |
mode | - The device configuration mode |
int ltc4296_port_pwr_available | ( | struct ltc4296_dev * | dev, |
enum ltc4296_port | port_no | ||
) |
Set port is able to source power.
dev | - The device structure |
port_no | - The port number |
int ltc4296_print_global_faults | ( | uint16_t | g_events | ) |
Print global faults.
g_events | - The global events data |
int ltc4296_print_port_events | ( | enum ltc4296_port | port_no, |
uint16_t | port_events | ||
) |
Print port events.
port_no | - The port number |
port_events | - The port events data |
int ltc4296_read_gadc | ( | struct ltc4296_dev * | dev, |
int * | port_voltage_mv | ||
) |
Read global ADC.
dev | - The device structure |
port_voltage_mv | - The port voltage in mV |
int ltc4296_read_global_faults | ( | struct ltc4296_dev * | dev, |
uint16_t * | g_events | ||
) |
Read global faults.
dev | - The device structure |
g_events | - The global events data read |
int ltc4296_read_port_adc | ( | struct ltc4296_dev * | dev, |
enum ltc4296_port | port_no, | ||
int * | port_i_out_ma | ||
) |
Read port ADC.
dev | - The device structure |
port_no | - The port number |
port_i_out_ma | - The port current in mA. |
int ltc4296_read_port_events | ( | struct ltc4296_dev * | dev, |
enum ltc4296_port | port_no, | ||
uint16_t * | port_events | ||
) |
Read Port Events.
dev | - The device structure |
port_no | - The port number |
port_events | - The port events read |
int ltc4296_read_port_status | ( | struct ltc4296_dev * | dev, |
enum ltc4296_port | port_no, | ||
uint16_t * | port_status | ||
) |
Read Port Status.
dev | - The device structure |
port_no | - The port number |
port_status | - The port status |
int ltc4296_reg_read | ( | struct ltc4296_dev * | dev, |
uint8_t | reg, | ||
uint16_t * | data | ||
) |
Register Read.
dev | - The device structure |
reg | - The register value |
data | - The data read from the device. |
int ltc4296_reg_write | ( | struct ltc4296_dev * | dev, |
uint8_t | reg, | ||
uint16_t | data | ||
) |
Register Write.
dev | - The device structure |
reg | - The register value |
data | - The data written to the device |
int ltc4296_remove | ( | struct ltc4296_dev * | dev | ) |
Free allocated resources.
dev | - The device structure |
int ltc4296_reset | ( | struct ltc4296_dev * | dev | ) |
Software reset.
dev | - The device structure |
int ltc4296_set_gadc_vin | ( | struct ltc4296_dev * | dev | ) |
Set the global ADC to measure voltage.
dev | - The device structure |
int ltc4296_set_gadc_vout | ( | struct ltc4296_dev * | dev, |
enum ltc4296_port | port_no | ||
) |
Configure Global ADC to read output voltage.
dev | - The device structure |
port_no | - The port number |
int ltc4296_set_port_mfvs | ( | struct ltc4296_dev * | dev, |
enum ltc4296_port | port_no | ||
) |
Set port to maintain full voltage signature.
dev | - The device structure |
port_no | - The port number |
int ltc4296_set_port_pwr | ( | struct ltc4296_dev * | dev, |
enum ltc4296_port | port_no | ||
) |
Set port to power mode.
dev | - The device structure |
port_no | - The port number |
int ltc4296_unlock | ( | struct ltc4296_dev * | dev | ) |
Device unlock.
dev | - The device structure |
char* ltc4296_class_str[12][25] |
int ltc4296_spoe_vol_range_mv[12][2] |