no-OS
Classes | Macros | Enumerations | Functions
adaq8092.h File Reference

Header file of ADAQ8092 Driver. More...

#include <stdint.h>
#include <string.h>
#include "no_os_util.h"
#include "no_os_spi.h"
#include "no_os_gpio.h"
Include dependency graph for adaq8092.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  adaq8092_init_param
 ADAQ8092 Device initialization parameters. More...
 
struct  adaq8092_dev
 ADAQ8092 Device structure. More...
 

Macros

#define ADAQ8092_SPI_READ   NO_OS_BIT(7)
 
#define ADAQ8092_ADDR(x)   ((x) & 0xFF)
 
#define ADAQ8092_REG_RESET   0x00
 
#define ADAQ8092_REG_POWERDOWN   0x01
 
#define ADAQ8092_REG_TIMING   0x02
 
#define ADAQ8092_REG_OUTPUT_MODE   0x03
 
#define ADAQ8092_REG_DATA_FORMAT   0x04
 
#define ADAQ8092_RESET   NO_OS_BIT(7)
 
#define ADAQ8092_POWERDOWN_MODE   NO_OS_GENMASK(1, 0)
 
#define ADAQ8092_CLK_INVERT   NO_OS_BIT(3)
 
#define ADAQ8092_CLK_PHASE   NO_OS_GENMASK(2, 1)
 
#define ADAQ8092_CLK_DUTYCYCLE   NO_OS_BIT(0)
 
#define ADAQ8092_ILVDS   NO_OS_GENMASK(6, 4)
 
#define ADAQ8092_TERMON   NO_OS_BIT(3)
 
#define ADAQ8092_OUTOFF   NO_OS_BIT(2)
 
#define ADAQ8092_OUTMODE   NO_OS_GENMASK(1, 0)
 
#define ADAQ8092_OUTTEST   NO_OS_GENMASK(5, 3)
 
#define ADAQ8092_ABP   NO_OS_BIT(2)
 
#define ADAQ8092_RAND   NO_OS_BIT(1)
 
#define ADAQ8092_TWOSCOMP   NO_OS_BIT(0)
 

Enumerations

enum  adaq8092_powerdown_modes {
  ADAQ8092_NORMAL_OP,
  ADAQ8092_CH1_NORMAL_CH2_NAP,
  ADAQ8092_CH1_CH2_NAP,
  ADAQ8092_SLEEP
}
 
enum  adaq8092_clk_invert {
  ADAQ8092_CLK_POL_NORMAL,
  ADAQ8092_CLK_POL_INVERTED
}
 
enum  adaq8092_clk_phase_delay {
  ADAQ8092_NO_DELAY,
  ADAQ8092_CLKOUT_DELAY_45DEG,
  ADAQ8092_CLKOUT_DELAY_90DEG,
  ADAQ8092_CLKOUT_DELAY_180DEG
}
 
enum  adaq8092_clk_dutycycle {
  ADAQ8092_CLK_DC_STABILIZER_OFF,
  ADAQ8092_CLK_DC_STABILIZER_ON
}
 
enum  adaq8092_lvds_out_current {
  ADAQ8092_3M5A = 0,
  ADAQ8092_4MA = 1,
  ADAQ8092_4M5A = 2,
  ADAQ8092_3MA = 4,
  ADAQ8092_2M5A = 5,
  ADAQ8092_2M1A = 6,
  ADAQ8092_1M75 = 7
}
 
enum  adaq8092_internal_term {
  ADAQ8092_TERM_OFF,
  ADAQ8092_TERM_ON
}
 
enum  adaq8092_dout_enable {
  ADAQ8092_DOUT_ON,
  ADAQ8092_DOUT_OFF
}
 
enum  adaq8092_dout_modes {
  ADAQ8092_FULL_RATE_CMOS,
  ADAQ8092_DOUBLE_RATE_LVDS,
  ADAQ8092_DOUBLE_RATE_CMOS
}
 
enum  adaq8092_out_test_modes {
  ADAQ8092_TEST_OFF = 0,
  ADAQ8092_TEST_ONES = 1,
  ADAQ8092_TEST_ZEROS = 3,
  ADAQ8092_TEST_CHECKERBOARD = 5,
  ADAQ8092_TEST_ALTERNATING = 7
}
 
enum  adaq8092_alt_bit_pol {
  ADAQ8092_ALT_BIT_POL_OFF,
  ADAQ8092_ALT_BIT_POL_ON
}
 
enum  adaq8092_data_rand {
  ADAQ8092_DATA_RAND_OFF,
  ADAQ8092_DATA_RAND_ON
}
 
enum  adaq8092_twoscomp {
  ADAQ8092_OFFSET_BINARY,
  ADAQ8092_TWOS_COMPLEMENT
}
 

Functions

int adaq8092_read (struct adaq8092_dev *dev, uint8_t reg_addr, uint8_t *reg_data)
 Read device register. More...
 
int adaq8092_write (struct adaq8092_dev *dev, uint8_t reg_addr, uint8_t reg_data)
 Write device register. More...
 
int adaq8092_update_bits (struct adaq8092_dev *dev, uint8_t reg_addr, uint8_t mask, uint8_t reg_data)
 Update specific register bits. More...
 
int adaq8092_init (struct adaq8092_dev **device, struct adaq8092_init_param init_param)
 Initialize the device. More...
 
int adaq8092_remove (struct adaq8092_dev *dev)
 Remove the device and release resources. More...
 
int adaq8092_set_pd_mode (struct adaq8092_dev *dev, enum adaq8092_powerdown_modes mode)
 Set the device powerodown mode. More...
 
enum adaq8092_powerdown_modes adaq8092_get_pd_mode (struct adaq8092_dev *dev)
 Get the device powerdown mode. More...
 
int adaq8092_set_clk_pol_mode (struct adaq8092_dev *dev, enum adaq8092_clk_invert mode)
 Set the clock polarity mode. More...
 
enum adaq8092_clk_invert adaq8092_get_clk_pol_mode (struct adaq8092_dev *dev)
 Get the clock polarity mode. More...
 
int adaq8092_set_clk_phase_mode (struct adaq8092_dev *dev, enum adaq8092_clk_phase_delay mode)
 Set the clock phase delay mode. More...
 
enum adaq8092_clk_phase_delay adaq8092_get_clk_phase_mode (struct adaq8092_dev *dev)
 Get the clock phase delay mode. More...
 
int adaq8092_set_clk_dc_mode (struct adaq8092_dev *dev, enum adaq8092_clk_dutycycle mode)
 Set the clock duty cycle stabilizer mode. More...
 
enum adaq8092_clk_dutycycle adaq8092_get_clk_dc_mode (struct adaq8092_dev *dev)
 Get the clock duty cycle stabilizer mode. More...
 
int adaq8092_set_lvds_cur_mode (struct adaq8092_dev *dev, enum adaq8092_lvds_out_current mode)
 Set the LVDS output current mode. More...
 
enum adaq8092_lvds_out_current adaq8092_get_lvds_cur_mode (struct adaq8092_dev *dev)
 Get the LVDS output current mode. More...
 
int adaq8092_set_lvds_term_mode (struct adaq8092_dev *dev, enum adaq8092_internal_term mode)
 Set the LVDS internal temination mode. More...
 
enum adaq8092_internal_term adaq8092_get_lvds_term_mode (struct adaq8092_dev *dev)
 Get the LVDS internal temination device mode. More...
 
int adaq8092_set_dout_en (struct adaq8092_dev *dev, enum adaq8092_dout_enable mode)
 Set digital outputs. More...
 
enum adaq8092_dout_enable adaq8092_get_dout_en (struct adaq8092_dev *dev)
 Get digital outputs. More...
 
int adaq8092_set_dout_mode (struct adaq8092_dev *dev, enum adaq8092_dout_modes mode)
 Set the digital output mode. More...
 
enum adaq8092_dout_modes adaq8092_get_dout_mode (struct adaq8092_dev *dev)
 Get the digital output mode. More...
 
int adaq8092_set_test_mode (struct adaq8092_dev *dev, enum adaq8092_out_test_modes mode)
 Set digital output test pattern mode. More...
 
enum adaq8092_out_test_modes adaq8092_get_test_mode (struct adaq8092_dev *dev)
 Get digital output test pattern mode. More...
 
int adaq8092_set_alt_pol_en (struct adaq8092_dev *dev, enum adaq8092_alt_bit_pol mode)
 Set the alternate bit polarity mode. More...
 
enum adaq8092_alt_bit_pol adaq8092_get_alt_pol_en (struct adaq8092_dev *dev)
 Get the alternate bit polarity mode. More...
 
int adaq8092_set_data_rand_en (struct adaq8092_dev *dev, enum adaq8092_data_rand mode)
 Set the data output randomizer mode. More...
 
enum adaq8092_data_rand adaq8092_get_data_rand_en (struct adaq8092_dev *dev)
 Get the data output randomizer mode. More...
 
int adaq8092_set_twos_comp (struct adaq8092_dev *dev, enum adaq8092_twoscomp mode)
 Set the Tows Complement mode. More...
 
enum adaq8092_twoscomp adaq8092_get_twos_comp (struct adaq8092_dev *dev)
 Get the Tows Complement mode. More...
 

Detailed Description

Header file of ADAQ8092 Driver.

Author
Antoniu Miclaus (anton.nosp@m.iu.m.nosp@m.iclau.nosp@m.s@an.nosp@m.alog..nosp@m.com)

Copyright 2022(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

◆ ADAQ8092_ABP

#define ADAQ8092_ABP   NO_OS_BIT(2)

◆ ADAQ8092_ADDR

#define ADAQ8092_ADDR (   x)    ((x) & 0xFF)

◆ ADAQ8092_CLK_DUTYCYCLE

#define ADAQ8092_CLK_DUTYCYCLE   NO_OS_BIT(0)

◆ ADAQ8092_CLK_INVERT

#define ADAQ8092_CLK_INVERT   NO_OS_BIT(3)

◆ ADAQ8092_CLK_PHASE

#define ADAQ8092_CLK_PHASE   NO_OS_GENMASK(2, 1)

◆ ADAQ8092_ILVDS

#define ADAQ8092_ILVDS   NO_OS_GENMASK(6, 4)

◆ ADAQ8092_OUTMODE

#define ADAQ8092_OUTMODE   NO_OS_GENMASK(1, 0)

◆ ADAQ8092_OUTOFF

#define ADAQ8092_OUTOFF   NO_OS_BIT(2)

◆ ADAQ8092_OUTTEST

#define ADAQ8092_OUTTEST   NO_OS_GENMASK(5, 3)

◆ ADAQ8092_POWERDOWN_MODE

#define ADAQ8092_POWERDOWN_MODE   NO_OS_GENMASK(1, 0)

◆ ADAQ8092_RAND

#define ADAQ8092_RAND   NO_OS_BIT(1)

◆ ADAQ8092_REG_DATA_FORMAT

#define ADAQ8092_REG_DATA_FORMAT   0x04

◆ ADAQ8092_REG_OUTPUT_MODE

#define ADAQ8092_REG_OUTPUT_MODE   0x03

◆ ADAQ8092_REG_POWERDOWN

#define ADAQ8092_REG_POWERDOWN   0x01

◆ ADAQ8092_REG_RESET

#define ADAQ8092_REG_RESET   0x00

◆ ADAQ8092_REG_TIMING

#define ADAQ8092_REG_TIMING   0x02

◆ ADAQ8092_RESET

#define ADAQ8092_RESET   NO_OS_BIT(7)

◆ ADAQ8092_SPI_READ

#define ADAQ8092_SPI_READ   NO_OS_BIT(7)

◆ ADAQ8092_TERMON

#define ADAQ8092_TERMON   NO_OS_BIT(3)

◆ ADAQ8092_TWOSCOMP

#define ADAQ8092_TWOSCOMP   NO_OS_BIT(0)

Enumeration Type Documentation

◆ adaq8092_alt_bit_pol

Enumerator
ADAQ8092_ALT_BIT_POL_OFF 
ADAQ8092_ALT_BIT_POL_ON 

◆ adaq8092_clk_dutycycle

Enumerator
ADAQ8092_CLK_DC_STABILIZER_OFF 
ADAQ8092_CLK_DC_STABILIZER_ON 

◆ adaq8092_clk_invert

Enumerator
ADAQ8092_CLK_POL_NORMAL 
ADAQ8092_CLK_POL_INVERTED 

◆ adaq8092_clk_phase_delay

Enumerator
ADAQ8092_NO_DELAY 
ADAQ8092_CLKOUT_DELAY_45DEG 
ADAQ8092_CLKOUT_DELAY_90DEG 
ADAQ8092_CLKOUT_DELAY_180DEG 

◆ adaq8092_data_rand

Enumerator
ADAQ8092_DATA_RAND_OFF 
ADAQ8092_DATA_RAND_ON 

◆ adaq8092_dout_enable

Enumerator
ADAQ8092_DOUT_ON 
ADAQ8092_DOUT_OFF 

◆ adaq8092_dout_modes

Enumerator
ADAQ8092_FULL_RATE_CMOS 
ADAQ8092_DOUBLE_RATE_LVDS 
ADAQ8092_DOUBLE_RATE_CMOS 

◆ adaq8092_internal_term

Enumerator
ADAQ8092_TERM_OFF 
ADAQ8092_TERM_ON 

◆ adaq8092_lvds_out_current

Enumerator
ADAQ8092_3M5A 
ADAQ8092_4MA 
ADAQ8092_4M5A 
ADAQ8092_3MA 
ADAQ8092_2M5A 
ADAQ8092_2M1A 
ADAQ8092_1M75 

◆ adaq8092_out_test_modes

Enumerator
ADAQ8092_TEST_OFF 
ADAQ8092_TEST_ONES 
ADAQ8092_TEST_ZEROS 
ADAQ8092_TEST_CHECKERBOARD 
ADAQ8092_TEST_ALTERNATING 

◆ adaq8092_powerdown_modes

Enumerator
ADAQ8092_NORMAL_OP 
ADAQ8092_CH1_NORMAL_CH2_NAP 
ADAQ8092_CH1_CH2_NAP 
ADAQ8092_SLEEP 

◆ adaq8092_twoscomp

Enumerator
ADAQ8092_OFFSET_BINARY 
ADAQ8092_TWOS_COMPLEMENT 

Function Documentation

◆ adaq8092_get_alt_pol_en()

enum adaq8092_alt_bit_pol adaq8092_get_alt_pol_en ( struct adaq8092_dev dev)

Get the alternate bit polarity mode.

Parameters
dev- The device structure.
Returns
alternate bit polarity mode.

◆ adaq8092_get_clk_dc_mode()

enum adaq8092_clk_dutycycle adaq8092_get_clk_dc_mode ( struct adaq8092_dev dev)

Get the clock duty cycle stabilizer mode.

Parameters
dev- The device structure.
Returns
clock duty cycle stabilizer mode.

◆ adaq8092_get_clk_phase_mode()

enum adaq8092_clk_phase_delay adaq8092_get_clk_phase_mode ( struct adaq8092_dev dev)

Get the clock phase delay mode.

Parameters
dev- The device structure.
Returns
clock phase delay mode.

◆ adaq8092_get_clk_pol_mode()

enum adaq8092_clk_invert adaq8092_get_clk_pol_mode ( struct adaq8092_dev dev)

Get the clock polarity mode.

Parameters
dev- The device structure.
Returns
clock polarity mode.

◆ adaq8092_get_data_rand_en()

enum adaq8092_data_rand adaq8092_get_data_rand_en ( struct adaq8092_dev dev)

Get the data output randomizer mode.

Parameters
dev- The device structure.
Returns
data output randomizer mode.

◆ adaq8092_get_dout_en()

enum adaq8092_dout_enable adaq8092_get_dout_en ( struct adaq8092_dev dev)

Get digital outputs.

Parameters
dev- The device structure.
Returns
digital outputs.

◆ adaq8092_get_dout_mode()

enum adaq8092_dout_modes adaq8092_get_dout_mode ( struct adaq8092_dev dev)

Get the digital output mode.

Parameters
dev- The device structure.
Returns
digital output mode.

◆ adaq8092_get_lvds_cur_mode()

enum adaq8092_lvds_out_current adaq8092_get_lvds_cur_mode ( struct adaq8092_dev dev)

Get the LVDS output current mode.

Parameters
dev- The device structure.
Returns
LVDS output current mode.

◆ adaq8092_get_lvds_term_mode()

enum adaq8092_internal_term adaq8092_get_lvds_term_mode ( struct adaq8092_dev dev)

Get the LVDS internal temination device mode.

Parameters
dev- The device structure.
Returns
LVDS internal temination device mode.

◆ adaq8092_get_pd_mode()

enum adaq8092_powerdown_modes adaq8092_get_pd_mode ( struct adaq8092_dev dev)

Get the device powerdown mode.

Parameters
dev- The device structure.
Returns
powerdown mode.

◆ adaq8092_get_test_mode()

enum adaq8092_out_test_modes adaq8092_get_test_mode ( struct adaq8092_dev dev)

Get digital output test pattern mode.

Parameters
dev- The device structure.
Returns
digital output test pattern mode.

◆ adaq8092_get_twos_comp()

enum adaq8092_twoscomp adaq8092_get_twos_comp ( struct adaq8092_dev dev)

Get the Tows Complement mode.

Parameters
dev- The device structure.
Returns
Tows Complement mode.

◆ adaq8092_init()

int adaq8092_init ( struct adaq8092_dev **  device,
struct adaq8092_init_param  init_param 
)

Initialize the device.

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

◆ adaq8092_read()

int adaq8092_read ( struct adaq8092_dev dev,
uint8_t  reg_addr,
uint8_t *  reg_data 
)

Read device register.

Parameters
dev- The device structure.
reg_addr- The register address.
reg_data- The data read from the register.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ adaq8092_remove()

int adaq8092_remove ( struct adaq8092_dev dev)

Remove the device and release resources.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ adaq8092_set_alt_pol_en()

int adaq8092_set_alt_pol_en ( struct adaq8092_dev dev,
enum adaq8092_alt_bit_pol  mode 
)

Set the alternate bit polarity mode.

Parameters
dev- The device structure.
mode- The device mode.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ adaq8092_set_clk_dc_mode()

int adaq8092_set_clk_dc_mode ( struct adaq8092_dev dev,
enum adaq8092_clk_dutycycle  mode 
)

Set the clock duty cycle stabilizer mode.

Parameters
dev- The device structure.
mode- The device mode.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ adaq8092_set_clk_phase_mode()

int adaq8092_set_clk_phase_mode ( struct adaq8092_dev dev,
enum adaq8092_clk_phase_delay  mode 
)

Set the clock phase delay mode.

Parameters
dev- The device structure.
mode- The device mode.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ adaq8092_set_clk_pol_mode()

int adaq8092_set_clk_pol_mode ( struct adaq8092_dev dev,
enum adaq8092_clk_invert  mode 
)

Set the clock polarity mode.

Parameters
dev- The device structure.
mode- The device mode.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ adaq8092_set_data_rand_en()

int adaq8092_set_data_rand_en ( struct adaq8092_dev dev,
enum adaq8092_data_rand  mode 
)

Set the data output randomizer mode.

Parameters
dev- The device structure.
mode- The device mode.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ adaq8092_set_dout_en()

int adaq8092_set_dout_en ( struct adaq8092_dev dev,
enum adaq8092_dout_enable  mode 
)

Set digital outputs.

Parameters
dev- The device structure.
mode- The device mode.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ adaq8092_set_dout_mode()

int adaq8092_set_dout_mode ( struct adaq8092_dev dev,
enum adaq8092_dout_modes  mode 
)

Set the digital output mode.

Parameters
dev- The device structure.
mode- The device mode.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ adaq8092_set_lvds_cur_mode()

int adaq8092_set_lvds_cur_mode ( struct adaq8092_dev dev,
enum adaq8092_lvds_out_current  mode 
)

Set the LVDS output current mode.

Parameters
dev- The device structure.
mode- The device mode.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ adaq8092_set_lvds_term_mode()

int adaq8092_set_lvds_term_mode ( struct adaq8092_dev dev,
enum adaq8092_internal_term  mode 
)

Set the LVDS internal temination mode.

Parameters
dev- The device structure.
mode- The device mode.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ adaq8092_set_pd_mode()

int adaq8092_set_pd_mode ( struct adaq8092_dev dev,
enum adaq8092_powerdown_modes  mode 
)

Set the device powerodown mode.

Parameters
dev- The device structure.
mode- The device mode.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ adaq8092_set_test_mode()

int adaq8092_set_test_mode ( struct adaq8092_dev dev,
enum adaq8092_out_test_modes  mode 
)

Set digital output test pattern mode.

Parameters
dev- The device structure.
mode- The device mode.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ adaq8092_set_twos_comp()

int adaq8092_set_twos_comp ( struct adaq8092_dev dev,
enum adaq8092_twoscomp  mode 
)

Set the Tows Complement mode.

Parameters
dev- The device structure.
mode- The device mode.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ adaq8092_update_bits()

int adaq8092_update_bits ( struct adaq8092_dev dev,
uint8_t  reg_addr,
uint8_t  mask,
uint8_t  reg_data 
)

Update specific register bits.

Parameters
dev- The device structure.
reg_addr- The register address.
mask- Specific bits mask.
reg_data- The data to be written.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ adaq8092_write()

int adaq8092_write ( struct adaq8092_dev dev,
uint8_t  reg_addr,
uint8_t  reg_data 
)

Write device register.

Parameters
dev-The device structure.
reg_addr- The register address.
reg_data- The data to be written.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function: