no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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.

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.

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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function: