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

Source file of MAX22190 Driver. More...

#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "max22190.h"
#include "no_os_util.h"
#include "no_os_alloc.h"
Include dependency graph for max22190.c:

Functions

int max22190_filter_set (struct max22190_desc *desc, uint32_t ch, uint32_t clrf, uint32_t fbp, enum max22190_delay delay)
 Set filter delay, wite break detection and if the filter is used or bypassed.
 
int max22190_filter_get (struct max22190_desc *desc, uint32_t ch, uint32_t *clrf, uint32_t *fbp, enum max22190_delay *delay)
 Get filter delay, wite break detection and if the filter is used or bypassed.
 
int max22190_chan_state (struct max22190_desc *desc, uint32_t ch, enum max22190_ch_state state)
 Switch selected channel's state to disabled or enabled.
 
int max22190_wbe_get (struct max22190_desc *desc, uint32_t ch, bool *enabled)
 Get Wire Break detection for requested channel.
 
int max22190_wbe_set (struct max22190_desc *desc, uint32_t ch, bool enabled)
 Set Wire Break detection for requested channel.
 
int max22190_fault_enable_get (struct max22190_desc *desc, enum max22190_fault_enable fault_enable, bool *enabled)
 Get fault enable from the fault registers.
 
int max22190_fault_enable_set (struct max22190_desc *desc, enum max22190_fault_enable fault_enable, bool enabled)
 Set fault enable in the fault registers.
 
int max22190_reg_read (struct max22190_desc *desc, uint32_t addr, uint32_t *val)
 Register read function for MAX22190.
 
int max22190_reg_write (struct max22190_desc *desc, uint32_t addr, uint32_t val)
 Register write function for MAX22190.
 
int max22190_reg_update (struct max22190_desc *desc, uint32_t addr, uint32_t mask, uint32_t val)
 Register update function for MAX22190.
 
int max22190_init (struct max22190_desc **desc, struct max22190_init_param *param)
 MAX22190 Initialization function.
 
int max22190_remove (struct max22190_desc *desc)
 Free the resources allocated by initialization.
 

Detailed Description

Source file of MAX22190 Driver.

Author
Radu Sabau (radu..nosp@m.saba.nosp@m.u@ana.nosp@m.log..nosp@m.com)

Copyright 2023(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Function Documentation

◆ max22190_chan_state()

int max22190_chan_state ( struct max22190_desc * desc,
uint32_t ch,
enum max22190_ch_state state )

Switch selected channel's state to disabled or enabled.

Parameters
desc- MAX22190 device descriptor.
ch- Channel to disable/enable(0 based).
state- The state requested.
Returns
0 in case of success, negative error code otherwise.

◆ max22190_fault_enable_get()

int max22190_fault_enable_get ( struct max22190_desc * desc,
enum max22190_fault_enable fault_enable,
bool * enabled )

Get fault enable from the fault registers.

Parameters
desc- MAX22190 device descriptor
fault_enable- Specific fault enable to read
enabled- State of the selected enable (0 for disabled, 1 for enabled)
Returns
0 in case of succes, negative error code otherwise

◆ max22190_fault_enable_set()

int max22190_fault_enable_set ( struct max22190_desc * desc,
enum max22190_fault_enable fault_enable,
bool enabled )

Set fault enable in the fault registers.

Parameters
desc- MAX22190 device descriptor
fault_enable- Specific fault enable to write
enabled- State of the selected enable (0 for disabled, 1 for enabled)
Returns
0 in case of succes, negative error code otherwise

◆ max22190_filter_get()

int max22190_filter_get ( struct max22190_desc * desc,
uint32_t ch,
uint32_t * clrf,
uint32_t * fbp,
enum max22190_delay * delay )

Get filter delay, wite break detection and if the filter is used or bypassed.

Parameters
desc- MAX22190 device descriptor.
ch- The channel to which the filter corresponds(0 based).
clrf- Filter operation (0 - normal operation, 1 - filters fixed at mid -scale value for the chosen delay).
fbp- Filter usage(used - 0, bypassed - 1).
delay- Filter delay.
Returns
0 in case of success, negative error code otherwise.

◆ max22190_filter_set()

int max22190_filter_set ( struct max22190_desc * desc,
uint32_t ch,
uint32_t clrf,
uint32_t fbp,
enum max22190_delay delay )

Set filter delay, wite break detection and if the filter is used or bypassed.

Parameters
desc- MAX22190 device descriptor.
ch- The channel to which the filter corresponds(0 based).
clrf- Filter operation (0 - normal operation, 1 - filters fixed at mid -scale value for the chosen delay).
fbp- Filter usage(used - 0, bypassed - 1).
delay- Filter delay.
Returns
0 in case of success, negative error code otherwise.

◆ max22190_init()

int max22190_init ( struct max22190_desc ** desc,
struct max22190_init_param * param )

MAX22190 Initialization function.

Parameters
desc- MAX22190 device descriptor.
param- MAX22190 initalization parameter.
Returns
0 in case of success, negative error code otherwise.

◆ max22190_reg_read()

int max22190_reg_read ( struct max22190_desc * desc,
uint32_t addr,
uint32_t * val )

Register read function for MAX22190.

Parameters
desc- MAX22190 device descriptor.
addr- Register address from which data is read.
val- The value received from the read operation.
Returns
0 in case of success, negative error code otherwise.

◆ max22190_reg_update()

int max22190_reg_update ( struct max22190_desc * desc,
uint32_t addr,
uint32_t mask,
uint32_t val )

Register update function for MAX22190.

Parameters
desc- MAX22190 device descriptor.
addr- Register valueto wich data is updated.
mask- Corresponding mask to the data that will be updated.
val- Updated value to be written in the register at update.
Returns
0 in case of success, negative error code otherwise.

◆ max22190_reg_write()

int max22190_reg_write ( struct max22190_desc * desc,
uint32_t addr,
uint32_t val )

Register write function for MAX22190.

Parameters
desc- MAX22190 device descriptor.
addr- Register value to which data is written.
val- Value which is to be written to requested register.
Returns
0 in case of success, negative error code otherwise.

◆ max22190_remove()

int max22190_remove ( struct max22190_desc * desc)

Free the resources allocated by initialization.

Parameters
desc- MAX22190 device descriptor.
Returns
0 in case of success, negative error code otherwise.

◆ max22190_wbe_get()

int max22190_wbe_get ( struct max22190_desc * desc,
uint32_t ch,
bool * enabled )

Get Wire Break detection for requested channel.

Parameters
desc- MAX22190 device descriptor.
ch- Channel to read the WBE from.
enabled- State of the WBE for the specific channel returned after reading the register.
Returns
0 in case of succes, negative error code otherwise.

◆ max22190_wbe_set()

int max22190_wbe_set ( struct max22190_desc * desc,
uint32_t ch,
bool enabled )

Set Wire Break detection for requested channel.

Parameters
desc- MAX22190 device descriptor.
ch- Channel to set the WBE to.
enabled- State of the WBE for the specific channel to be set.
Returns
0 in case of succes, negative error code otherwise.