no-OS
Functions | Variables
ltc4296.c File Reference

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"
Include dependency graph for ltc4296.c:

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]
 

Detailed Description

Implementation file for the LTC4296 Driver.

Author
Antoniu Miclaus (anton.nosp@m.iu.m.nosp@m.iclau.nosp@m.s@an.nosp@m.alog..nosp@m.com)

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:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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.

Function Documentation

◆ ltc4296_chk_global_events()

int ltc4296_chk_global_events ( struct ltc4296_dev dev)

Check global events.

Parameters
dev- The device structure
Returns
0 in case of success, negative code otherwise

◆ ltc4296_chk_port_events()

int ltc4296_chk_port_events ( struct ltc4296_dev dev,
enum ltc4296_port  ltc4296_port 
)

Check port events.

Parameters
dev- The device structure
ltc4296_port- The port number
Returns
0 in case of success, negative code otherwise

◆ ltc4296_clear_ckt_breaker()

int ltc4296_clear_ckt_breaker ( struct ltc4296_dev dev)

Clear circuit break faults.

Parameters
dev- The device structure
Returns
0 in case of success, negative code otherwise
Here is the caller graph for this function:

◆ ltc4296_clear_global_faults()

int ltc4296_clear_global_faults ( struct ltc4296_dev dev)

Clear global faults.

Parameters
dev- The device structure
Returns
0 in case of success, negative code otherwise
Here is the caller graph for this function:

◆ ltc4296_clear_port_events()

int ltc4296_clear_port_events ( struct ltc4296_dev dev,
enum ltc4296_port  port_no 
)

Clear Port Events.

Parameters
dev- The device structure
port_no- The port number
Returns
0 in case of success, negative code otherwise
Here is the caller graph for this function:

◆ ltc4296_disable_gadc()

int ltc4296_disable_gadc ( struct ltc4296_dev dev)

Disable the global ADC.

Parameters
dev- The device structure
Returns
0 in case of success, negative code otherwise

◆ ltc4296_force_port_pwr()

int ltc4296_force_port_pwr ( struct ltc4296_dev dev,
enum ltc4296_port  port_no 
)

Force port to power mode.

Parameters
dev- The device structure
port_no- The port number
Returns
0 in case of success, negative code otherwise

◆ ltc4296_get_port_addr()

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.

Parameters
port_no- The port number
port_offset- The port offset
port_addr- The port address
Returns
0 in case of success, negative code otherwise
Here is the caller graph for this function:

◆ ltc4296_init()

int ltc4296_init ( struct ltc4296_dev **  device,
struct ltc4296_init_param init_param 
)

Device initialization.

Parameters
device- The device structure
init_param- The initialization parameters
Returns
0 in case of success, negative code otherwise
Here is the caller graph for this function:

◆ ltc4296_is_locked()

int ltc4296_is_locked ( struct ltc4296_dev dev,
enum ltc4296_state state 
)

Check device state.

Parameters
dev- The device structure
state- The state of the device
Returns
0 in case of success, negative code otherwise
Here is the caller graph for this function:

◆ ltc4296_is_port_deliver_pwr()

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.

Parameters
dev- The device structure
port_no- The port number
pwr_status- The PSE Status of the port
Returns
0 in case of success, negative code otherwise

◆ ltc4296_is_port_disabled()

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.

Parameters
dev- The device structure
port_no- The port number
port_chk- The port is enabled/disabled
Returns
0 in case of success, negative code otherwise

◆ ltc4296_is_port_pwr_stable()

int ltc4296_is_port_pwr_stable ( struct ltc4296_dev dev,
enum ltc4296_port  port_no,
bool pwr_status 
)

Check if port has stable power.

Parameters
dev- The device structure
port_no- The port number
pwr_status- The power status
Returns
0 in case of success, negative code otherwise

◆ ltc4296_is_vin_valid()

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.

Parameters
dev- The device structure
port_vin_mv- The input voltage in mV
ltcboard_class- The board class
vin_valid- Valid input voltage
Returns
0 in case of success, negative code otherwise

◆ ltc4296_is_vout_valid()

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.

Parameters
dev- The device structure
port_vout_mv- The output voltage in mV
ltcboard_class- The board class
vout_valid- Valid input voltage
Returns
0 in case of success, negative code otherwise

◆ ltc4296_port_disable()

int ltc4296_port_disable ( struct ltc4296_dev dev,
enum ltc4296_port  port_no 
)

Check if port is disabled.

Parameters
dev- The device structure
port_no- The port number
Returns
0 in case of success, negative code otherwise

◆ ltc4296_port_en()

int ltc4296_port_en ( struct ltc4296_dev dev,
enum ltc4296_port  port_no 
)

Enable specific port.

Parameters
dev- The device structure
port_no- The port number
Returns
0 in case of success, negative code otherwise
Here is the caller graph for this function:

◆ ltc4296_port_en_and_classification()

int ltc4296_port_en_and_classification ( struct ltc4296_dev dev,
enum ltc4296_port  port_no 
)

Enable specific port and classify.

Parameters
dev- The device structure
port_no- The port number
Returns
0 in case of success, negative code otherwise

◆ ltc4296_port_prebias()

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.

Parameters
dev- The device structure
port_no- The port number
mode- The device configuration mode
Returns
0 in case of success, negative code otherwise
Here is the caller graph for this function:

◆ ltc4296_port_pwr_available()

int ltc4296_port_pwr_available ( struct ltc4296_dev dev,
enum ltc4296_port  port_no 
)

Set port is able to source power.

Parameters
dev- The device structure
port_no- The port number
Returns
0 in case of success, negative code otherwise

◆ ltc4296_print_global_faults()

int ltc4296_print_global_faults ( uint16_t  g_events)

Print global faults.

Parameters
g_events- The global events data
Returns
0 in case of success, negative code otherwise
Here is the caller graph for this function:

◆ ltc4296_print_port_events()

int ltc4296_print_port_events ( enum ltc4296_port  port_no,
uint16_t  port_events 
)

Print port events.

Parameters
port_no- The port number
port_events- The port events data
Returns
0 in case of success, negative code otherwise
Here is the caller graph for this function:

◆ ltc4296_read_gadc()

int ltc4296_read_gadc ( struct ltc4296_dev dev,
int *  port_voltage_mv 
)

Read global ADC.

Parameters
dev- The device structure
port_voltage_mv- The port voltage in mV
Returns
0 in case of success, negative code otherwise

◆ ltc4296_read_global_faults()

int ltc4296_read_global_faults ( struct ltc4296_dev dev,
uint16_t *  g_events 
)

Read global faults.

Parameters
dev- The device structure
g_events- The global events data read
Returns
0 in case of success, negative code otherwise
Here is the caller graph for this function:

◆ ltc4296_read_port_adc()

int ltc4296_read_port_adc ( struct ltc4296_dev dev,
enum ltc4296_port  port_no,
int *  port_i_out_ma 
)

Read port ADC.

Parameters
dev- The device structure
port_no- The port number
port_i_out_ma- The port current in mA.
Returns
0 in case of success, negative code otherwise

◆ ltc4296_read_port_events()

int ltc4296_read_port_events ( struct ltc4296_dev dev,
enum ltc4296_port  port_no,
uint16_t *  port_events 
)

Read Port Events.

Parameters
dev- The device structure
port_no- The port number
port_events- The port events read
Returns
0 in case of success, negative code otherwise
Here is the caller graph for this function:

◆ ltc4296_read_port_status()

int ltc4296_read_port_status ( struct ltc4296_dev dev,
enum ltc4296_port  port_no,
uint16_t *  port_status 
)

Read Port Status.

Parameters
dev- The device structure
port_no- The port number
port_status- The port status
Returns
0 in case of success, negative code otherwise

◆ ltc4296_reg_read()

int ltc4296_reg_read ( struct ltc4296_dev dev,
uint8_t  reg,
uint16_t *  data 
)

Register Read.

Parameters
dev- The device structure
reg- The register value
data- The data read from the device.
Returns
0 in case of success, negative code otherwise
Here is the caller graph for this function:

◆ ltc4296_reg_write()

int ltc4296_reg_write ( struct ltc4296_dev dev,
uint8_t  reg,
uint16_t  data 
)

Register Write.

Parameters
dev- The device structure
reg- The register value
data- The data written to the device
Returns
0 in case of success, negative code otherwise
Here is the caller graph for this function:

◆ ltc4296_remove()

int ltc4296_remove ( struct ltc4296_dev dev)

Free allocated resources.

Parameters
dev- The device structure
Returns
0 in case of success, negative code otherwise
Here is the caller graph for this function:

◆ ltc4296_reset()

int ltc4296_reset ( struct ltc4296_dev dev)

Software reset.

Parameters
dev- The device structure
Returns
0 in case of success, negative code otherwise
Here is the caller graph for this function:

◆ ltc4296_set_gadc_vin()

int ltc4296_set_gadc_vin ( struct ltc4296_dev dev)

Set the global ADC to measure voltage.

Parameters
dev- The device structure
Returns
0 in case of success, negative code otherwise

◆ ltc4296_set_gadc_vout()

int ltc4296_set_gadc_vout ( struct ltc4296_dev dev,
enum ltc4296_port  port_no 
)

Configure Global ADC to read output voltage.

Parameters
dev- The device structure
port_no- The port number
Returns
0 in case of success, negative code otherwise

◆ ltc4296_set_port_mfvs()

int ltc4296_set_port_mfvs ( struct ltc4296_dev dev,
enum ltc4296_port  port_no 
)

Set port to maintain full voltage signature.

Parameters
dev- The device structure
port_no- The port number
Returns
0 in case of success, negative code otherwise

◆ ltc4296_set_port_pwr()

int ltc4296_set_port_pwr ( struct ltc4296_dev dev,
enum ltc4296_port  port_no 
)

Set port to power mode.

Parameters
dev- The device structure
port_no- The port number
Returns
0 in case of success, negative code otherwise

◆ ltc4296_unlock()

int ltc4296_unlock ( struct ltc4296_dev dev)

Device unlock.

Parameters
dev- The device structure
Returns
0 in case of success, negative code otherwise
Here is the caller graph for this function:

Variable Documentation

◆ ltc4296_class_str

char* ltc4296_class_str[12][25]
Initial value:
= { {"SPOE CLASS 10"},
{"SPOE CLASS 11"},
{"SPOE CLASS 12"},
{"SPOE CLASS 13"},
{"SPOE CLASS 14"},
{"SPOE CLASS 15"},
{"APL CLASS A"},
{"APL CLASS A"},
{"APL CLASS C"},
{"APL CLASS 3"},
{"BOARD PRODUCTION TEST"},
{"APL CLASS A"}
}

◆ ltc4296_spoe_vol_range_mv

int ltc4296_spoe_vol_range_mv[12][2]
Initial value:
= { {20000, 30000},
{20000, 30000},
{20000, 30000},
{50000, 58000},
{50000, 58000},
{50000, 58000},
{9600, 15000},
{9600, 15000},
{9600, 15000},
{46000, 50000},
{9600, 15000},
{9600, 15000}
}