Zephyr API Documentation 4.0.0-rc3
A Scalable Open Source RTOS
|
Helper functions to use by the TCPCI-compliant drivers. More...
Go to the source code of this file.
Data Structures | |
struct | tcpci_reg_dump_map |
Structure used to bind the register address to name in registers dump. More... | |
Macros | |
#define | TCPCI_STD_REGS_SIZE 38 |
Size of the array containing the standard registers used by tcpci dump command. | |
Functions | |
int | tcpci_read_reg8 (const struct i2c_dt_spec *bus, uint8_t reg, uint8_t *value) |
Function to read the 8-bit register of TCPCI device. | |
int | tcpci_write_reg8 (const struct i2c_dt_spec *bus, uint8_t reg, uint8_t value) |
Function to write a value to the 8-bit register of TCPCI device. | |
int | tcpci_update_reg8 (const struct i2c_dt_spec *bus, uint8_t reg, uint8_t mask, uint8_t value) |
Function to read and update part of the 8-bit register of TCPCI device The function is NOT performing this operation atomically. | |
int | tcpci_read_reg16 (const struct i2c_dt_spec *bus, uint8_t reg, uint16_t *value) |
Function to read the 16-bit register of TCPCI device. | |
int | tcpci_write_reg16 (const struct i2c_dt_spec *bus, uint8_t reg, uint16_t value) |
Function to write a value to the 16-bit register of TCPCI device. | |
enum tcpc_alert | tcpci_alert_reg_to_enum (uint16_t reg) |
Function that converts the TCPCI alert register to the tcpc_alert enum The hard reset value takes priority, where the rest are returned in the bit order from least significant to most significant. | |
int | tcpci_tcpm_get_cc (const struct i2c_dt_spec *bus, enum tc_cc_voltage_state *cc1, enum tc_cc_voltage_state *cc2) |
Function that reads the CC status registers and converts read values to enums representing voltages state and partner detection status. | |
Variables | |
const struct tcpci_reg_dump_map | tcpci_std_regs [38] |
Array containing the standard TCPCI registers list. | |
Helper functions to use by the TCPCI-compliant drivers.
This file contains generic TCPCI functions that may be used by the drivers to TCPCI-compliant devices that want to implement vendor-specific functionality without the need to reimplement the TCPCI generic functionality and register operations.
#define TCPCI_STD_REGS_SIZE 38 |
Size of the array containing the standard registers used by tcpci dump command.
enum tcpc_alert tcpci_alert_reg_to_enum | ( | uint16_t | reg | ) |
Function that converts the TCPCI alert register to the tcpc_alert enum The hard reset value takes priority, where the rest are returned in the bit order from least significant to most significant.
reg | Value of the TCPCI alert register. This parameter must have value other than zero. |
int tcpci_read_reg16 | ( | const struct i2c_dt_spec * | bus, |
uint8_t | reg, | ||
uint16_t * | value ) |
Function to read the 16-bit register of TCPCI device.
bus | I2C bus |
reg | Address of TCPCI register |
value | Pointer to variable that will store the register value |
int tcpci_read_reg8 | ( | const struct i2c_dt_spec * | bus, |
uint8_t | reg, | ||
uint8_t * | value ) |
Function to read the 8-bit register of TCPCI device.
bus | I2C bus |
reg | Address of TCPCI register |
value | Pointer to variable that will store the register value |
int tcpci_tcpm_get_cc | ( | const struct i2c_dt_spec * | bus, |
enum tc_cc_voltage_state * | cc1, | ||
enum tc_cc_voltage_state * | cc2 ) |
Function that reads the CC status registers and converts read values to enums representing voltages state and partner detection status.
bus | I2C bus |
cc1 | pointer to variable where detected CC1 voltage state will be stored |
cc2 | pointer to variable where detected CC2 voltage state will be stored |
int tcpci_update_reg8 | ( | const struct i2c_dt_spec * | bus, |
uint8_t | reg, | ||
uint8_t | mask, | ||
uint8_t | value ) |
Function to read and update part of the 8-bit register of TCPCI device The function is NOT performing this operation atomically.
bus | I2C bus |
reg | Address of TCPCI register |
mask | Bitmask specifying which bits of the device register will be modified |
value | Value that will be written to the device register after being ANDed with mask |
int tcpci_write_reg16 | ( | const struct i2c_dt_spec * | bus, |
uint8_t | reg, | ||
uint16_t | value ) |
Function to write a value to the 16-bit register of TCPCI device.
bus | I2C bus |
reg | Address of TCPCI register |
value | Value that will be written to the device register |
int tcpci_write_reg8 | ( | const struct i2c_dt_spec * | bus, |
uint8_t | reg, | ||
uint8_t | value ) |
Function to write a value to the 8-bit register of TCPCI device.
bus | I2C bus |
reg | Address of TCPCI register |
value | Value that will be written to the device register |
|
extern |
Array containing the standard TCPCI registers list.
If the TCPC driver contain any vendor-specific registers, it may override the TCPCI dump_std_reg function tp dump them and should also dump the standard registers using this array.