no-OS
Macros | Enumerations | Functions
iio_adp1050.c File Reference

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

#include <stdlib.h>
#include <stdio.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 "adp1050.h"
#include "iio_adp1050.h"
Include dependency graph for iio_adp1050.c:

Macros

#define ADP1050_IIO_FLOAT_FREQ_INDEX   24
 
#define ADP1050_IIO_FLOAT_FREQ(x)   ((((x) - 0xF800) / 2))
 
#define ADP1050_IIO_FLOAT_FREQ_ENUM(x)   ((((x) * 2) + 0xF800) + 1)
 
#define ADP1050_IIO_MODULATION_AVAIL_SIZE   8
 
#define ADP1050_IIO_MODULATION_AVAIL_MASK(x)   NO_OS_GENMASK((((x) * 2) + 1), ((x) * 2))
 
#define ADP1050_IIO_MODULATION_AVAIL_SELECT(x)   NO_OS_BIT(((x) * 2) + 1)
 
#define ADP1050_IIO_OUTPUT_CHANNELS   4
 
#define ADP1050_IIO_OUTPUT_CHANNEL(x)   ((x) - 4)
 
#define ADP1050_IIO_OUTA_DUTY_CYCLE_REPORTING   NO_OS_BIT(2)
 
#define ADP1050_IIO_OUTB_DUTY_CYCLE_REPORTING   NO_OS_BIT(3)
 
#define ADP1050_IIO_OUTA_OUTB_MASK   NO_OS_GENMASK(1, 0)
 
#define ADP1050_IIO_SR1_SR2_MASK   NO_OS_GENMASK(5, 4)
 
#define ADP1050_IIO_OUT_MASK   NO_OS_GENMASK(3, 0)
 
#define ADP1050_IIO_ENABLE_MASK(x)   NO_OS_BIT(x)
 
#define ADP1050_IIO_PULSE_DEFAULT_VAL   0x05
 

Enumerations

enum  adp1050_iio_enable_type {
  ADP1050_IIO_OUT_ENABLE,
  ADP1050_IIO_FEEDFORWARD_ENABLE,
  ADP1050_IIO_PULSE_ENABLE,
  ADP1050_IIO_FREQ_SYNC_ENABLE
}
 
enum  adp1050_iio_vout_value_type {
  ADP1050_IIO_VOUT_COMMAND_VALUE = ADP1050_VOUT_COMMAND,
  ADP1050_IIO_VOUT_MARGIN_LOW_VALUE = ADP1050_VOUT_MARGIN_LOW,
  ADP1050_IIO_VOUT_MARGIN_HIGH_VALUE = ADP1050_VOUT_MARGIN_HIGH,
  ADP1050_IIO_VOUT_SCALE_MONITOR_VALUE = ADP1050_VOUT_SCALE_MONITOR,
  ADP1050_IIO_VOUT_OFFSET_VALUE = ADP1050_VOUT_CAL_OFFSET
}
 
enum  adp1050_iio_input_chan_type {
  ADP1050_IIO_VIN_CHAN,
  ADP1050_IIO_IIN_CHAN,
  ADP1050_IIO_VOUT_CHAN,
  ADP1050_IIO_TEMP_CHAN
}
 
enum  adp1050_iio_output_chan_type {
  ADP1050_IIO_OUTA_CHAN = 4,
  ADP1050_IIO_OUTB_CHAN = 5,
  ADP1050_IIO_SR1_CHAN = 6,
  ADP1050_IIO_SR2_CHAN = 7
}
 

Functions

int adp1050_iio_init (struct adp1050_iio_desc **iio_desc, struct adp1050_iio_desc_init_param *init_param)
 Initializes the ADP1050 IIO descriptor. More...
 
int adp1050_iio_remove (struct adp1050_iio_desc *iio_desc)
 Free resources allocated by the init function. More...
 

Detailed Description

Source file for the ADP1050 IIO Driver.

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

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.

Macro Definition Documentation

◆ ADP1050_IIO_ENABLE_MASK

#define ADP1050_IIO_ENABLE_MASK (   x)    NO_OS_BIT(x)

◆ ADP1050_IIO_FLOAT_FREQ

#define ADP1050_IIO_FLOAT_FREQ (   x)    ((((x) - 0xF800) / 2))

◆ ADP1050_IIO_FLOAT_FREQ_ENUM

#define ADP1050_IIO_FLOAT_FREQ_ENUM (   x)    ((((x) * 2) + 0xF800) + 1)

◆ ADP1050_IIO_FLOAT_FREQ_INDEX

#define ADP1050_IIO_FLOAT_FREQ_INDEX   24

◆ ADP1050_IIO_MODULATION_AVAIL_MASK

#define ADP1050_IIO_MODULATION_AVAIL_MASK (   x)    NO_OS_GENMASK((((x) * 2) + 1), ((x) * 2))

◆ ADP1050_IIO_MODULATION_AVAIL_SELECT

#define ADP1050_IIO_MODULATION_AVAIL_SELECT (   x)    NO_OS_BIT(((x) * 2) + 1)

◆ ADP1050_IIO_MODULATION_AVAIL_SIZE

#define ADP1050_IIO_MODULATION_AVAIL_SIZE   8

◆ ADP1050_IIO_OUT_MASK

#define ADP1050_IIO_OUT_MASK   NO_OS_GENMASK(3, 0)

◆ ADP1050_IIO_OUTA_DUTY_CYCLE_REPORTING

#define ADP1050_IIO_OUTA_DUTY_CYCLE_REPORTING   NO_OS_BIT(2)

◆ ADP1050_IIO_OUTA_OUTB_MASK

#define ADP1050_IIO_OUTA_OUTB_MASK   NO_OS_GENMASK(1, 0)

◆ ADP1050_IIO_OUTB_DUTY_CYCLE_REPORTING

#define ADP1050_IIO_OUTB_DUTY_CYCLE_REPORTING   NO_OS_BIT(3)

◆ ADP1050_IIO_OUTPUT_CHANNEL

#define ADP1050_IIO_OUTPUT_CHANNEL (   x)    ((x) - 4)

◆ ADP1050_IIO_OUTPUT_CHANNELS

#define ADP1050_IIO_OUTPUT_CHANNELS   4

◆ ADP1050_IIO_PULSE_DEFAULT_VAL

#define ADP1050_IIO_PULSE_DEFAULT_VAL   0x05

◆ ADP1050_IIO_SR1_SR2_MASK

#define ADP1050_IIO_SR1_SR2_MASK   NO_OS_GENMASK(5, 4)

Enumeration Type Documentation

◆ adp1050_iio_enable_type

Enumerator
ADP1050_IIO_OUT_ENABLE 
ADP1050_IIO_FEEDFORWARD_ENABLE 
ADP1050_IIO_PULSE_ENABLE 
ADP1050_IIO_FREQ_SYNC_ENABLE 

◆ adp1050_iio_input_chan_type

Enumerator
ADP1050_IIO_VIN_CHAN 
ADP1050_IIO_IIN_CHAN 
ADP1050_IIO_VOUT_CHAN 
ADP1050_IIO_TEMP_CHAN 

◆ adp1050_iio_output_chan_type

Enumerator
ADP1050_IIO_OUTA_CHAN 
ADP1050_IIO_OUTB_CHAN 
ADP1050_IIO_SR1_CHAN 
ADP1050_IIO_SR2_CHAN 

◆ adp1050_iio_vout_value_type

Enumerator
ADP1050_IIO_VOUT_COMMAND_VALUE 
ADP1050_IIO_VOUT_MARGIN_LOW_VALUE 
ADP1050_IIO_VOUT_MARGIN_HIGH_VALUE 
ADP1050_IIO_VOUT_SCALE_MONITOR_VALUE 
ADP1050_IIO_VOUT_OFFSET_VALUE 

Function Documentation

◆ adp1050_iio_init()

int adp1050_iio_init ( struct adp1050_iio_desc **  iio_desc,
struct adp1050_iio_desc_init_param init_param 
)

Initializes the ADP1050 IIO descriptor.

Parameters
iio_desc- 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:

◆ adp1050_iio_remove()

int adp1050_iio_remove ( struct adp1050_iio_desc iio_desc)

Free resources allocated by the init function.

Parameters
iio_desc- The iio device descriptor.
Returns
0 in case of success, an error code otherwise.
Here is the caller graph for this function: