Implementation of LTC6953 Driver. More...
Go to the source code of this file.
Classes | |
struct | ltc6953_channel_spec |
Output channel configuration. More... | |
struct | ltc6953_init_param |
LTC6953 Initialization Parameters structure. More... | |
struct | ltc6953_dev |
LTC6953 Device Descriptor. More... | |
Functions | |
int | ltc6953_init (struct ltc6953_dev **dev, struct ltc6953_init_param *init_param) |
Initializes the SPI communication with LTC6953. | |
int | ltc6953_remove (struct ltc6953_dev *dev) |
Free resources allocated for LTC6953. | |
int | ltc6953_reset (struct ltc6953_dev *dev) |
Software reset of the device. | |
int | ltc6953_write (struct ltc6953_dev *dev, uint8_t addr, uint16_t data) |
Writes data to LTC6953 over SPI. | |
int | ltc6953_read (struct ltc6953_dev *dev, uint8_t addr, uint8_t *data) |
Read device register. | |
int | ltc6953_update (struct ltc6953_dev *dev, uint8_t reg_addr, uint8_t mask, uint8_t data) |
Update LTC6953 register. | |
int | ltc6953_power_down_all (struct ltc6953_dev *dev, bool is_pwdn) |
Powers down all LTC6953 output channels. | |
int | ltc6953_enable_filter (struct ltc6953_dev *dev, bool is_en) |
Enable LTC6953 VCO Input filter. | |
int | ltc6953_power_down_vco (struct ltc6953_dev *dev, bool is_pwdn) |
Powers down LTC6953 VCO Input channel. | |
int | ltc6953_set_output_divider (struct ltc6953_dev *dev, uint32_t channel, uint32_t divider) |
Set output divider for LTC6953 output channel. | |
int | ltc6953_power_mode (struct ltc6953_dev *dev, uint32_t channel, int32_t mode) |
Set LTC6953 Channel Power Mode. | |
int | ltc6953_enable_sync (struct ltc6953_dev *dev, uint32_t channel, bool enable) |
Set LTC6953 Channel Sync mode. | |
int | ltc6953_set_digital_delay (struct ltc6953_dev *dev, uint32_t channel, uint16_t delay) |
Set digital delay/phase of LTC6953 output channel. | |
int | ltc6953_set_analog_delay (struct ltc6953_dev *dev, uint32_t channel, uint16_t delay) |
Set analog delay/phase of LTC6953 output channel. | |
int | ltc6953_set_mode (struct ltc6953_dev *dev, uint32_t channel, uint8_t mode) |
Set LTC6953 output channel mode. | |
int | ltc6953_invert_output (struct ltc6953_dev *dev, uint32_t channel, bool is_invert) |
Set LTC6953 output channel inversion. | |
int | ltc6953_ezsync_mode (struct ltc6953_dev *dev, bool is_en) |
Set LTC6953 EZSYNC mode. | |
int | ltc6953_sync_mode (struct ltc6953_dev *dev, bool is_en) |
Set LTC6953 SRQ mode. | |
int | ltc6953_ssrq_mode (struct ltc6953_dev *dev, bool is_en) |
Set LTC6953 SSRQ mode. | |
int | ltc6953_num_pulse (struct ltc6953_dev *dev, uint8_t num_pulse) |
Set LTC6953 SYSCT/Num pulse value. | |
int | ltc6953_enable_temp_stat (struct ltc6953_dev *dev, bool is_en) |
Set LTC6953 TEMPO value. | |
int | ltc6953_vco_status (struct ltc6953_dev *dev, bool *is_ok) |
Read LTC6953 Check VCO Input stats. | |
int | ltc6953_get_invstat (struct ltc6953_dev *dev, bool *status) |
Read LTC6953 INVSTAT bit. | |
int | ltc6953_set_invstat (struct ltc6953_dev *dev, bool status) |
Write LTC6953 INVSTAT bit. | |
int | ltc6953_set_x (struct ltc6953_dev *dev, uint8_t x) |
Set LTC6953 x bitfield status. | |
int | ltc6953_get_x (struct ltc6953_dev *dev, uint8_t *x) |
Set LTC6953 x bitfield status. | |
int | ltc6953_read_rev (struct ltc6953_dev *dev, uint8_t *rev) |
Read LTC6953 Part number. | |
int | ltc6953_read_part (struct ltc6953_dev *dev, uint8_t *part) |
Read LTC6953 Part number. | |
Implementation of LTC6953 Driver.
Copyright 2023-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.
#define LTC6953_ADDRX 0 |
#define LTC6953_ADEL_MSK NO_OS_GENMASK(5, 0) |
#define LTC6953_BUFF_SIZE_BYTES 2 |
#define LTC6953_DDEL_HIGH_MSK NO_OS_GENMASK(3, 0) |
#define LTC6953_DDEL_LOW_MSK NO_OS_GENMASK(7, 0) |
#define LTC6953_DUMMY_BYTES 0x00 |
#define LTC6953_DXMSB 1 |
#define LTC6953_EZMD_MSK NO_OS_BIT(4) |
#define LTC6953_FILTV_MSK NO_OS_BIT(1) |
#define LTC6953_INVSTAT_MSK NO_OS_BIT(7) |
#define LTC6953_MD_MSK NO_OS_GENMASK(2, 0) |
#define LTC6953_MODE_MSK NO_OS_GENMASK(6, 5) |
#define LTC6953_MP_MSK NO_OS_GENMASK(7, 3) |
#define LTC6953_NUM_CHAN 11 |
#define LTC6953_NUM_REGADDR 57 |
#define LTC6953_NUMBITS 2 |
#define LTC6953_NVCOOK_MSK NO_OS_BIT(3) |
#define LTC6953_OINV_MSK NO_OS_BIT(4) |
#define LTC6953_OUT_DIV_MAX 1048576 |
#define LTC6953_OUT_DIV_MIN 1 |
#define LTC6953_PART_MSK NO_OS_GENMASK(3, 0) |
#define LTC6953_PD | ( | ch, | |
x ) |
#define LTC6953_PD_MSK | ( | ch | ) |
#define LTC6953_PDALL_MSK NO_OS_BIT(7) |
#define LTC6953_PDVCOPK_MSK NO_OS_BIT(5) |
#define LTC6953_POR_MSK NO_OS_BIT(0) |
#define LTC6953_R_ONLY 3 |
#define LTC6953_REG_ADEL | ( | x | ) |
#define LTC6953_REG_CHAN_POWER_DOWN | ( | x | ) |
#define LTC6953_REG_CHIP_INFO 0x38 |
#define LTC6953_REG_DDEL_HIGH | ( | x | ) |
#define LTC6953_REG_DDEL_LOW | ( | x | ) |
#define LTC6953_REG_OUTPUT_CONFIG | ( | x | ) |
#define LTC6953_REG_OUTPUT_DIVIDER | ( | x | ) |
#define LTC6953_REG_PD_CTL 0x02 |
#define LTC6953_REG_STAT 0x01 |
#define LTC6953_REG_SYNC_CONFIG 0x0B |
#define LTC6953_REG_TEMP 0x05 |
#define LTC6953_REG_VCO_STATUS 0x00 |
#define LTC6953_REV_MSK NO_OS_GENMASK(7, 4) |
#define LTC6953_SPI_ADDR_CMD | ( | x | ) |
#define LTC6953_SPI_READ_CMD 0x01 |
#define LTC6953_SPI_WRITE_CMD 0x00 |
#define LTC6953_SRQEN_MSK NO_OS_BIT(7) |
#define LTC6953_SRQMD_MSK NO_OS_BIT(3) |
#define LTC6953_SSRQ_MSK NO_OS_BIT(0) |
#define LTC6953_STAT_OUT_MSK NO_OS_GENMASK(6, 0) |
#define LTC6953_SYSCT_MSK NO_OS_GENMASK(2, 1) |
#define LTC6953_TEMPO_MSK NO_OS_BIT(7) |
#define LTC6953_VCOOK_MSK NO_OS_BIT(2) |
#define LTC6953_X_MAX 127 |
int ltc6953_enable_filter | ( | struct ltc6953_dev * | dev, |
bool | is_en ) |
Enable LTC6953 VCO Input filter.
LTC6953 Enable input filter
dev | - The device structure. |
is_en | - Set to True to enable input filter. |
int ltc6953_enable_sync | ( | struct ltc6953_dev * | dev, |
uint32_t | channel, | ||
bool | enable ) |
Set LTC6953 Channel Sync mode.
LTC6953 Enable single channel sync
dev | - The device structure. |
channel | - Output channel [0-10] |
enable | - Set to True to enable synchronization mode [SRQMD] |
int ltc6953_enable_temp_stat | ( | struct ltc6953_dev * | dev, |
bool | is_en ) |
Set LTC6953 TEMPO value.
LTC6953 Enable Temperature Measurement from STAT pin
dev | - The device structure. |
is_en | - TEMPO setting. |
int ltc6953_ezsync_mode | ( | struct ltc6953_dev * | dev, |
bool | is_en ) |
Set LTC6953 EZSYNC mode.
LTC6953 Set EZSYNC mode
dev | - The device structure. |
is_en | - Synchronization setting. |
int ltc6953_get_invstat | ( | struct ltc6953_dev * | dev, |
bool * | status ) |
Read LTC6953 INVSTAT bit.
LTC6953 Get INVSTAT bit
dev | - The device structure. |
status | - Container variable for INVSTAT pin. |
int ltc6953_get_x | ( | struct ltc6953_dev * | dev, |
uint8_t * | x ) |
Set LTC6953 x bitfield status.
LTC6953 Get X
dev | - The device structure. |
x | - Container value for x bitfield. |
int ltc6953_init | ( | struct ltc6953_dev ** | device, |
struct ltc6953_init_param * | init_param ) |
Initializes the SPI communication with LTC6953.
LTC6953 SPI Initialization
device | - the device structure. |
init_param | - the initialization parameters. |
int ltc6953_invert_output | ( | struct ltc6953_dev * | dev, |
uint32_t | channel, | ||
bool | is_invert ) |
Set LTC6953 output channel inversion.
LTC6953 Enable single channel output inversion
dev | - The device structure. |
channel | - Output channel [0-10]. |
is_invert | - Inversion setting. |
int ltc6953_num_pulse | ( | struct ltc6953_dev * | dev, |
uint8_t | num_pulse ) |
Set LTC6953 SYSCT/Num pulse value.
LTC6953 Set SYSCT
dev | - The device structure. |
num_pulse | - Number of pulses. |
int ltc6953_power_down_all | ( | struct ltc6953_dev * | dev, |
bool | is_pwdn ) |
Powers down all LTC6953 output channels.
LTC6953 Power down all channels
dev | - The device structure. |
is_pwdn | - Set to True to power down all channels. |
int ltc6953_power_down_vco | ( | struct ltc6953_dev * | dev, |
bool | is_pwdn ) |
Powers down LTC6953 VCO Input channel.
LTC6953 Power Down VCO input
dev | - The device structure. |
is_pwdn | - Set to True to power down input channel. |
int ltc6953_power_mode | ( | struct ltc6953_dev * | dev, |
uint32_t | channel, | ||
int32_t | mode ) |
Set LTC6953 Channel Power Mode.
LTC6953 Set single channel power mode
dev | - The device structure. |
channel | - Output channel [0-10] |
mode | - Power mode [0-3] |
int ltc6953_read | ( | struct ltc6953_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t * | data ) |
Read device register.
LTC6953 SPI Single byte Read register
dev | - The device structure. |
reg_addr | - The register address. |
data | - The data read from the register. |
int ltc6953_read_part | ( | struct ltc6953_dev * | dev, |
uint8_t * | part ) |
Read LTC6953 Part number.
LTC6953 Get Part Number
dev | - The device structure. |
part | - container variable for Part number. |
int ltc6953_read_rev | ( | struct ltc6953_dev * | dev, |
uint8_t * | rev ) |
Read LTC6953 Part number.
LTC6953 Get Revision Number
dev | - The device structure. |
rev | - container variable for Revision number. |
int ltc6953_remove | ( | struct ltc6953_dev * | dev | ) |
Free resources allocated for LTC6953.
LTC6953 Resource deallocation
dev | - The device structure. |
int ltc6953_reset | ( | struct ltc6953_dev * | device | ) |
Software reset of the device.
LTC6953 Power-on reset
device | - The device structure. |
int ltc6953_set_analog_delay | ( | struct ltc6953_dev * | dev, |
uint32_t | channel, | ||
uint16_t | delay ) |
Set analog delay/phase of LTC6953 output channel.
LTC6953 Set single channel analog delay
dev | - The device structure. |
channel | - Output channel [0-10] |
delay | - 16-bit word for delay value |
int ltc6953_set_digital_delay | ( | struct ltc6953_dev * | dev, |
uint32_t | channel, | ||
uint16_t | delay ) |
Set digital delay/phase of LTC6953 output channel.
LTC6953 Set single channel digital delay
dev | - The device structure. |
channel | - Output channel [0-10] |
delay | - 16-bit word for delay value |
int ltc6953_set_invstat | ( | struct ltc6953_dev * | dev, |
bool | status ) |
Write LTC6953 INVSTAT bit.
LTC6953 Set INVSTAT bit
dev | - The device structure. |
status | - Container for INVSTAT value |
int ltc6953_set_mode | ( | struct ltc6953_dev * | dev, |
uint32_t | channel, | ||
uint8_t | mode ) |
Set LTC6953 output channel mode.
LTC6953 Set single channel mode
dev | - The device structure. |
channel | - Output channel [0-10] |
mode | - Output channel mode [0-3] |
int ltc6953_set_output_divider | ( | struct ltc6953_dev * | dev, |
uint32_t | channel, | ||
uint32_t | divider ) |
Set output divider for LTC6953 output channel.
LTC6953 Set single channel output divider
dev | - The device structure. |
channel | - Output channel [0-10] |
divider | - Divider setting |
int ltc6953_set_x | ( | struct ltc6953_dev * | dev, |
uint8_t | x ) |
Set LTC6953 x bitfield status.
LTC6953 Set X
dev | - The device structure. |
x | - Value for x bitfield |
int ltc6953_ssrq_mode | ( | struct ltc6953_dev * | dev, |
bool | is_en ) |
Set LTC6953 SSRQ mode.
LTC6953 Set SSRQ
dev | - The device structure. |
is_en | - Synchronization setting. |
int ltc6953_sync_mode | ( | struct ltc6953_dev * | dev, |
bool | is_en ) |
Set LTC6953 SRQ mode.
LTC6953 Set SRQ mode
dev | - The device structure. |
is_en | - Synchronization setting. |
int ltc6953_update | ( | struct ltc6953_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t | mask, | ||
uint8_t | data ) |
Update LTC6953 register.
LTC6953 SPI Single byte Update register
dev | - The device structure. |
reg_addr | - The register address. |
mask | - Mask for specific register bits to be updated. |
data | - Data read from the device. |
int ltc6953_vco_status | ( | struct ltc6953_dev * | dev, |
bool * | is_ok ) |
Read LTC6953 Check VCO Input stats.
LTC6953 Check VCO Input status
dev | - The device structure. |
is_ok | - True if VCOOK bit is 1, False if VCOOK bit is 0 |
int ltc6953_write | ( | struct ltc6953_dev * | dev, |
uint8_t | reg_addr, | ||
uint16_t | data ) |
Writes data to LTC6953 over SPI.
LTC6953 SPI Single byte Write register
dev | - The device structure. |
reg_addr | - The register address. |
data | - Data value to write. |