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

Header file for pulsar_adc Driver. More...

#include <stdbool.h>
#include "spi_engine.h"
#include "clk_axi_clkgen.h"
#include "no_os_pwm.h"
#include "no_os_gpio.h"
Include dependency graph for pulsar_adc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pulsar_adc_dev_info
 
struct  pulsar_adc_dev
 
struct  pulsar_adc_init_param
 

Macros

#define PULSAR_ADC_READ_COMMAND   0x54
 
#define PULSAR_ADC_WRITE_COMMAND   0x14
 
#define PULSAR_ADC_RESERVED_MSK   0xE0
 
#define PULSAR_ADC_TURBO_MODE(x)   (((x) & 0x1) << 1)
 
#define PULSAR_ADC_HIGH_Z_MODE(x)   (((x) & 0x1) << 2)
 
#define PULSAR_ADC_SPAN_COMPRESSION(x)   (((x) & 0x1) << 3)
 
#define PULSAR_ADC_EN_STATUS_BITS(x)   (((x) & 0x1) << 4)
 

Enumerations

enum  pulsar_adc_supported_dev_ids {
  ID_AD4000,
  ID_AD4001,
  ID_AD4002,
  ID_AD4003,
  ID_AD4004,
  ID_AD4005,
  ID_AD4006,
  ID_AD4007,
  ID_AD4008,
  ID_AD4010,
  ID_AD4011,
  ID_AD4020,
  ID_AD4021,
  ID_AD4022,
  ID_ADAQ4003,
  ID_AD7690,
  ID_AD7691,
  ID_AD7693,
  ID_AD7942,
  ID_AD7944,
  ID_AD7946,
  ID_AD7980,
  ID_AD7982,
  ID_AD7983,
  ID_AD7984,
  ID_AD7985,
  ID_AD7986
}
 

Functions

int32_t pulsar_adc_spi_reg_read (struct pulsar_adc_dev *dev, uint8_t *reg_data)
 
int32_t pulsar_adc_spi_reg_write (struct pulsar_adc_dev *dev, uint8_t reg_data)
 
int32_t pulsar_adc_init (struct pulsar_adc_dev **device, struct pulsar_adc_init_param *init_param)
 
int32_t pulsar_adc_remove (struct pulsar_adc_dev *dev)
 Free the resources allocated by pulsar_adc_init(). More...
 
int32_t pulsar_adc_read_data (struct pulsar_adc_dev *dev, uint32_t *buf, uint16_t samples)
 

Detailed Description

Header file for pulsar_adc Driver.

Author
Mircea Caprioru (mirce.nosp@m.a.ca.nosp@m.prior.nosp@m.u@an.nosp@m.alog..nosp@m.com)

Copyright 2018(c) Analog Devices, Inc.

All rights reserved.

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 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, 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

◆ PULSAR_ADC_EN_STATUS_BITS

#define PULSAR_ADC_EN_STATUS_BITS (   x)    (((x) & 0x1) << 4)

◆ PULSAR_ADC_HIGH_Z_MODE

#define PULSAR_ADC_HIGH_Z_MODE (   x)    (((x) & 0x1) << 2)

◆ PULSAR_ADC_READ_COMMAND

#define PULSAR_ADC_READ_COMMAND   0x54

◆ PULSAR_ADC_RESERVED_MSK

#define PULSAR_ADC_RESERVED_MSK   0xE0

◆ PULSAR_ADC_SPAN_COMPRESSION

#define PULSAR_ADC_SPAN_COMPRESSION (   x)    (((x) & 0x1) << 3)

◆ PULSAR_ADC_TURBO_MODE

#define PULSAR_ADC_TURBO_MODE (   x)    (((x) & 0x1) << 1)

◆ PULSAR_ADC_WRITE_COMMAND

#define PULSAR_ADC_WRITE_COMMAND   0x14

Enumeration Type Documentation

◆ pulsar_adc_supported_dev_ids

Enumerator
ID_AD4000 
ID_AD4001 
ID_AD4002 
ID_AD4003 
ID_AD4004 
ID_AD4005 
ID_AD4006 
ID_AD4007 
ID_AD4008 
ID_AD4010 
ID_AD4011 
ID_AD4020 
ID_AD4021 
ID_AD4022 
ID_ADAQ4003 
ID_AD7690 
ID_AD7691 
ID_AD7693 
ID_AD7942 
ID_AD7944 
ID_AD7946 
ID_AD7980 
ID_AD7982 
ID_AD7983 
ID_AD7984 
ID_AD7985 
ID_AD7986 

Function Documentation

◆ pulsar_adc_init()

int32_t pulsar_adc_init ( struct pulsar_adc_dev **  device,
struct pulsar_adc_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.
Here is the caller graph for this function:

◆ pulsar_adc_read_data()

int32_t pulsar_adc_read_data ( struct pulsar_adc_dev dev,
uint32_t *  buf,
uint16_t  samples 
)

Read conversion results from device.

Parameters
dev- The device structure.
buf- Buffer to hold the conversion results data
samples- number of samples to read
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ pulsar_adc_remove()

int32_t pulsar_adc_remove ( struct pulsar_adc_dev dev)

Free the resources allocated by pulsar_adc_init().

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

◆ pulsar_adc_spi_reg_read()

int32_t pulsar_adc_spi_reg_read ( struct pulsar_adc_dev dev,
uint8_t *  reg_data 
)

Read from device.

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

◆ pulsar_adc_spi_reg_write()

int32_t pulsar_adc_spi_reg_write ( struct pulsar_adc_dev dev,
uint8_t  reg_data 
)

Write to device.

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