no-OS
Loading...
Searching...
No Matches
iio_ltc7871.c File Reference

Source file for the LTC7871 IIO Driver. More...

#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "no_os_alloc.h"
#include "no_os_error.h"
#include "no_os_units.h"
#include "no_os_util.h"
#include "ltc7871.h"
#include "iio_ltc7871.h"
Include dependency graph for iio_ltc7871.c:

Enumerations

enum  ltc7871_iio_mfr_fault_attrs {
  LTC7871_VLOW_OV ,
  LTC7871_VHIGH_OV ,
  LTC7871_VHIGH_UV ,
  LTC7871_DRVCC_UV ,
  LTC7871_V5_UV ,
  LTC7871_VREF_BAD ,
  LTC7871_OVER_TEMP
}
 
enum  ltc7871_iio_mfr_oc_fault_attrs {
  LTC7871_OC_FAULT_6 ,
  LTC7871_OC_FAULT_5 ,
  LTC7871_OC_FAULT_4 ,
  LTC7871_OC_FAULT_3 ,
  LTC7871_OC_FAULT_2 ,
  LTC7871_OC_FAULT_1 ,
  LTC7871_OC_FAULT_0
}
 
enum  ltc7871_iio_mfr_noc_fault_attrs {
  LTC7871_NOC_FAULT_6 ,
  LTC7871_NOC_FAULT_5 ,
  LTC7871_NOC_FAULT_4 ,
  LTC7871_NOC_FAULT_3 ,
  LTC7871_NOC_FAULT_2 ,
  LTC7871_NOC_FAULT_1 ,
  LTC7871_NOC_FAULT_0
}
 
enum  ltc7871_iio_mfr_status_attrs {
  LTC7871_PGOOD ,
  LTC7871_MAX_CURRENT ,
  LTC7871_SS_DONE
}
 
enum  ltc7871_iio_mfr_config1_attrs {
  LTC7871_SERCUR_WARNING ,
  LTC7871_DRVCC_SET ,
  LTC7871_ILIM_SET
}
 
enum  ltc7871_iio_mfr_config2_attrs {
  LTC7871_BURST ,
  LTC7871_DCM ,
  LTC7871_HIZ ,
  LTC7871_SPRD ,
  LTC7871_BUCK_BOOST
}
 
enum  ltc7871_iio_mfr_chip_ctrl_attrs {
  LTC7871_CML ,
  LTC7871_RESET ,
  LTC7871_WP
}
 
enum  ltc7871_iio_mfr_ssfm_attrs {
  LTC7871_FSR ,
  LTC7871_MSF
}
 

Functions

uint32_t ltc7871_iio_get_mask_mfr_fault (enum ltc7871_iio_mfr_fault_attrs attr)
 Get the mask for the MFR_FAULT register.
 
uint32_t ltc7871_iio_get_mask_mfr_oc_fault (enum ltc7871_iio_mfr_oc_fault_attrs attr)
 Get the mask for the MFR_OC_FAULT register.
 
uint32_t ltc7871_iio_get_mask_mfr_noc_fault (enum ltc7871_iio_mfr_noc_fault_attrs attr)
 Get the mask for the MFR_NOC_FAULT register.
 
uint32_t ltc7871_iio_get_mask_mfr_status (enum ltc7871_iio_mfr_status_attrs attr)
 Get the mask for the MFR_STATUS register.
 
uint32_t ltc7871_iio_get_mask_mfr_config1 (enum ltc7871_iio_mfr_config1_attrs attr)
 Get the mask for the MFR_CONFIG1 register.
 
uint32_t ltc7871_iio_get_mask_mfr_config2 (enum ltc7871_iio_mfr_config2_attrs attr)
 Get the mask for the MFR_CONFIG2 register.
 
uint32_t ltc7871_iio_get_mask_mfr_chip_ctrl (enum ltc7871_iio_mfr_chip_ctrl_attrs attr)
 Get the mask for the MFR_CHIP_CTRL register.
 
int ltc7871_iio_init (struct ltc7871_iio_dev **iio_dev, struct ltc7871_iio_dev_init_param *init_param)
 Initializes the LTC7871 IIO descriptor.
 
int ltc7871_iio_remove (struct ltc7871_iio_dev *desc)
 Free resources allocated by the init function.
 

Detailed Description

Source file for the LTC7871 IIO Driver.

Author
Aldrin Abacan (aldri.nosp@m.n.ab.nosp@m.acan@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

Copyright 2024(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Enumeration Type Documentation

◆ ltc7871_iio_mfr_chip_ctrl_attrs

Enumerator
LTC7871_CML 
LTC7871_RESET 
LTC7871_WP 

◆ ltc7871_iio_mfr_config1_attrs

Enumerator
LTC7871_SERCUR_WARNING 
LTC7871_DRVCC_SET 
LTC7871_ILIM_SET 

◆ ltc7871_iio_mfr_config2_attrs

Enumerator
LTC7871_BURST 
LTC7871_DCM 
LTC7871_HIZ 
LTC7871_SPRD 
LTC7871_BUCK_BOOST 

◆ ltc7871_iio_mfr_fault_attrs

Enumerator
LTC7871_VLOW_OV 
LTC7871_VHIGH_OV 
LTC7871_VHIGH_UV 
LTC7871_DRVCC_UV 
LTC7871_V5_UV 
LTC7871_VREF_BAD 
LTC7871_OVER_TEMP 

◆ ltc7871_iio_mfr_noc_fault_attrs

Enumerator
LTC7871_NOC_FAULT_6 
LTC7871_NOC_FAULT_5 
LTC7871_NOC_FAULT_4 
LTC7871_NOC_FAULT_3 
LTC7871_NOC_FAULT_2 
LTC7871_NOC_FAULT_1 
LTC7871_NOC_FAULT_0 

◆ ltc7871_iio_mfr_oc_fault_attrs

Enumerator
LTC7871_OC_FAULT_6 
LTC7871_OC_FAULT_5 
LTC7871_OC_FAULT_4 
LTC7871_OC_FAULT_3 
LTC7871_OC_FAULT_2 
LTC7871_OC_FAULT_1 
LTC7871_OC_FAULT_0 

◆ ltc7871_iio_mfr_ssfm_attrs

Enumerator
LTC7871_FSR 
LTC7871_MSF 

◆ ltc7871_iio_mfr_status_attrs

Enumerator
LTC7871_PGOOD 
LTC7871_MAX_CURRENT 
LTC7871_SS_DONE 

Function Documentation

◆ ltc7871_iio_get_mask_mfr_chip_ctrl()

uint32_t ltc7871_iio_get_mask_mfr_chip_ctrl ( enum ltc7871_iio_mfr_chip_ctrl_attrs attr)

Get the mask for the MFR_CHIP_CTRL register.

Parameters
attr- The attribute for which the mask is needed.
Returns
The mask for the MFR_CHIP_CTRL command register.

◆ ltc7871_iio_get_mask_mfr_config1()

uint32_t ltc7871_iio_get_mask_mfr_config1 ( enum ltc7871_iio_mfr_config1_attrs attr)

Get the mask for the MFR_CONFIG1 register.

Parameters
attr- The attribute for which the mask is needed.
Returns
The mask for the MFR_CONFIG1 command register.

◆ ltc7871_iio_get_mask_mfr_config2()

uint32_t ltc7871_iio_get_mask_mfr_config2 ( enum ltc7871_iio_mfr_config2_attrs attr)

Get the mask for the MFR_CONFIG2 register.

Parameters
attr- The attribute for which the mask is needed.
Returns
The mask for the MFR_CONFIG2 command register.

◆ ltc7871_iio_get_mask_mfr_fault()

uint32_t ltc7871_iio_get_mask_mfr_fault ( enum ltc7871_iio_mfr_fault_attrs attr)

Get the mask for the MFR_FAULT register.

Parameters
attr- The attribute for which the mask is needed.
Returns
The mask for the MFR_FAULT command register.

◆ ltc7871_iio_get_mask_mfr_noc_fault()

uint32_t ltc7871_iio_get_mask_mfr_noc_fault ( enum ltc7871_iio_mfr_noc_fault_attrs attr)

Get the mask for the MFR_NOC_FAULT register.

Parameters
attr- The attribute for which the mask is needed.
Returns
The mask for the MFR_NOC_FAULT command register.

◆ ltc7871_iio_get_mask_mfr_oc_fault()

uint32_t ltc7871_iio_get_mask_mfr_oc_fault ( enum ltc7871_iio_mfr_oc_fault_attrs attr)

Get the mask for the MFR_OC_FAULT register.

Parameters
attr- The attribute for which the mask is needed.
Returns
The mask for the MFR_OC_FAULT command register.

◆ ltc7871_iio_get_mask_mfr_status()

uint32_t ltc7871_iio_get_mask_mfr_status ( enum ltc7871_iio_mfr_status_attrs attr)

Get the mask for the MFR_STATUS register.

Parameters
attr- The attribute for which the mask is needed.
Returns
The mask for the MFR_STATUS command register.

◆ ltc7871_iio_init()

int ltc7871_iio_init ( struct ltc7871_iio_dev ** iio_dev,
struct ltc7871_iio_dev_init_param * init_param )

Initializes the LTC7871 IIO descriptor.

Parameters
iio_dev- The iio device descriptor.
init_param- The structure that contains the device initial parameters.
Returns
0 in case of success, an error code otherwise.

◆ ltc7871_iio_remove()

int ltc7871_iio_remove ( struct ltc7871_iio_dev * desc)

Free resources allocated by the init function.

Parameters
desc- The iio device descriptor.
Returns
0 in case of success, an error code otherwise.