Source file of MAX22196 Driver. More...
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "max22196.h"
#include "no_os_util.h"
#include "no_os_alloc.h"
Functions | |
int | max22196_reg_write (struct max22196_desc *desc, uint32_t reg, uint32_t val) |
MAX22196 register write function. | |
int | max22196_reg_read (struct max22196_desc *desc, uint32_t reg, uint32_t *val) |
MAX22196 register read function. | |
int | max22196_reg_update (struct max22196_desc *desc, uint32_t reg, uint32_t mask, uint32_t val) |
| |
int | max22196_set_mode (struct max22196_desc *desc, uint32_t ch, enum max22196_mode mode) |
| |
int | max22196_chan_cfg (struct max22196_desc *desc, uint32_t ch, uint32_t hi_thr, enum max22196_curr curr) |
| |
int | max22196_filter_set (struct max22196_desc *desc, uint32_t ch, uint32_t flt_en, uint32_t clr_filtr, enum max22196_delay delay) |
| |
int | max22196_filter_get (struct max22196_desc *desc, uint32_t ch, uint32_t *flt_en, uint32_t *clr_filtr, enum max22196_delay *delay) |
| |
int | max22196_fault_mask_set (struct max22196_desc *desc, enum max22196_fault_mask fault_mask, bool enabled) |
Set fault mask bits in the fault mask registers. | |
int | max22196_fault_mask_get (struct max22196_desc *desc, enum max22196_fault_mask fault_mask, bool *enabled) |
Get fault mask bits from the fault mask registers. | |
int | max22196_global_cfg (struct max22196_desc *desc, enum max22196_global_cfg global_cfg, bool enabled) |
Set global configuration. | |
int | max22196_set_chan_cnt (struct max22196_desc *desc, uint32_t ch, uint16_t cnt_msb_lsb_bytes) |
| |
int | max22196_get_chan_cnt (struct max22196_desc *desc, uint32_t ch, uint16_t *cnt_msb_lsb_bytes) |
MAX22196 channel counter get function. | |
int | max22196_init (struct max22196_desc **desc, struct max22196_init_param *param) |
Initialize and configure the MAX22196 device. | |
int | max22196_remove (struct max22196_desc *desc) |
Free the resources allocated during init. | |
Source file of MAX22196 Driver.
Copyright 2023(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.
int max22196_chan_cfg | ( | struct max22196_desc * | desc, |
uint32_t | ch, | ||
uint32_t | hi_thr, | ||
enum max22196_curr | curr ) |
desc | - The device descriptor for MAX22196. |
ch | - Channel for which the configuration is to be changed. |
hi_thr | - Voltage threshold(0 for inactive, 1 for active). |
curr | - Channel current to be set. |
int max22196_fault_mask_get | ( | struct max22196_desc * | desc, |
enum max22196_fault_mask | fault_mask, | ||
bool * | enabled ) |
Get fault mask bits from the fault mask registers.
desc | - MAX22196 device descriptor. |
fault_mask | - Requested fault to get mask from. |
enabled | - Mask state to be read. |
int max22196_fault_mask_set | ( | struct max22196_desc * | desc, |
enum max22196_fault_mask | fault_mask, | ||
bool | enabled ) |
Set fault mask bits in the fault mask registers.
desc | - MAX22196 device descriptor. |
fault_mask | - Requested fault to set mask to. |
enabled | - Mask state to be set. |
int max22196_filter_get | ( | struct max22196_desc * | desc, |
uint32_t | ch, | ||
uint32_t * | flt_en, | ||
uint32_t * | clr_filtr, | ||
enum max22196_delay * | delay ) |
desc | - MAX22196 device descriptor. |
ch | - Channel from which the filter values are read. |
flt_en | - Variable through which the fillter's state is read. |
clr_filtr | - Clear the filter value and set to mid-scale delay. |
delay | - Filter delay value to be read for the MAX22196's specified channel. |
int max22196_filter_set | ( | struct max22196_desc * | desc, |
uint32_t | ch, | ||
uint32_t | flt_en, | ||
uint32_t | clr_filtr, | ||
enum max22196_delay | delay ) |
desc | - MAX22196 device descriptor. |
ch | - Channel to which the filter values will be applied to. |
flt_en | - Filter enable value(0 for filter disabled, 1 for filter enable) |
clr_filtr | - Clear filter and set delay value to mid-scale. |
delay | - Filter delay to be set. |
int max22196_get_chan_cnt | ( | struct max22196_desc * | desc, |
uint32_t | ch, | ||
uint16_t * | cnt_msb_lsb_bytes ) |
MAX22196 channel counter get function.
desc | - MAX22196 device descriptor. |
ch | - Channel for which the channel counter is read. |
cnt_msb_lsb_bytes | - 8MSBs represent the MSB byte read from the specifc chanel's counter, 8LSBs represent the LSB byte. |
int max22196_global_cfg | ( | struct max22196_desc * | desc, |
enum max22196_global_cfg | global_cfg, | ||
bool | enabled ) |
Set global configuration.
desc | - MAX22196 device descriptor. |
global_cfg | - Specifc configuration to be set. |
enabled | - State of the specific configuration. |
int max22196_init | ( | struct max22196_desc ** | desc, |
struct max22196_init_param * | param ) |
Initialize and configure the MAX22196 device.
desc | - device descriptor for the MAX22196 that will be initialized. |
param | - initialization parameter for the device. |
int max22196_reg_read | ( | struct max22196_desc * | desc, |
uint32_t | reg, | ||
uint32_t * | val ) |
MAX22196 register read function.
desc | - The device descriptor for MAX22196. |
reg | - The register value where the data is read from. |
val | - The value returned from read. |
int max22196_reg_update | ( | struct max22196_desc * | desc, |
uint32_t | reg, | ||
uint32_t | mask, | ||
uint32_t | val ) |
desc | - The device descriptor for MAX22196. |
reg | - The register to be updated. |
mask | - The specific mask where the value will be updated. |
val | - The value that is to be written to the mask. |
int max22196_reg_write | ( | struct max22196_desc * | desc, |
uint32_t | reg, | ||
uint32_t | val ) |
MAX22196 register write function.
desc | - The device descriptor for MAX22196. |
reg | - The register where the information is to be written. |
val | - The value to be written to reg. |
int max22196_remove | ( | struct max22196_desc * | desc | ) |
Free the resources allocated during init.
desc | - device descriptor for the MAX14916 that will be initialized. |
int max22196_set_chan_cnt | ( | struct max22196_desc * | desc, |
uint32_t | ch, | ||
uint16_t | cnt_msb_lsb_bytes ) |
desc | - MAX22196 device descriptor. |
ch | - MAX22196 channel to which the counter is set. |
cnt_msb_lsb_bytes | - 8MSBs represent the MSB byte to be written to the specifc chanel's counter, 8LSBs represent the LSB byte. |
int max22196_set_mode | ( | struct max22196_desc * | desc, |
uint32_t | ch, | ||
enum max22196_mode | mode ) |
desc | - The device descriptor for MAX22196 |
ch | - The channel for which the mode will be set. |
mode | - The mode to be set. |