no-OS
Functions | Variables
pulsar_adc.c File Reference

Implementation of pulsar_adc Driver. More...

#include "stdio.h"
#include "stdlib.h"
#include "stdbool.h"
#include "string.h"
#include "pulsar_adc.h"
#include "spi_engine.h"
#include "no_os_error.h"
#include "no_os_alloc.h"
#include "no_os_util.h"
Include dependency graph for pulsar_adc.c:

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_read_data (struct pulsar_adc_dev *dev, uint32_t *buf, uint16_t samples)
 
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...
 

Variables

const struct pulsar_adc_dev_info pulsar_adc_devices []
 

Detailed Description

Implementation of 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.

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.

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:

Variable Documentation

◆ pulsar_adc_devices

const struct pulsar_adc_dev_info pulsar_adc_devices[]
Initial value:
= {
[ID_AD4000] = {.resolution = 16, .sign = 'u', .max_rate = 2000},
[ID_AD4001] = {.resolution = 16, .sign = 's', .max_rate = 2000},
[ID_AD4002] = {.resolution = 18, .sign = 'u', .max_rate = 2000},
[ID_AD4003] = {.resolution = 18, .sign = 's', .max_rate = 2000},
[ID_AD4004] = {.resolution = 16, .sign = 'u', .max_rate = 1000},
[ID_AD4005] = {.resolution = 16, .sign = 's', .max_rate = 1000},
[ID_AD4006] = {.resolution = 18, .sign = 'u', .max_rate = 1000},
[ID_AD4007] = {.resolution = 18, .sign = 's', .max_rate = 1000},
[ID_AD4008] = {.resolution = 16, .sign = 'u', .max_rate = 500},
[ID_AD4010] = {.resolution = 18, .sign = 'u', .max_rate = 500},
[ID_AD4011] = {.resolution = 18, .sign = 's', .max_rate = 500},
[ID_AD4020] = {.resolution = 20, .sign = 's', .max_rate = 1800},
[ID_AD4021] = {.resolution = 20, .sign = 's', .max_rate = 1000},
[ID_AD4022] = {.resolution = 20, .sign = 's', .max_rate = 500},
[ID_ADAQ4003] = {.resolution = 18, .sign = 's',.max_rate = 2000},
[ID_AD7690] = {.resolution = 18, .sign = 's', .max_rate = 400},
[ID_AD7691] = {.resolution = 18, .sign = 's', .max_rate = 250},
[ID_AD7693] = {.resolution = 16, .sign = 's', .max_rate = 500},
[ID_AD7942] = {.resolution = 14, .sign = 'u', .max_rate = 250},
[ID_AD7944] = {.resolution = 14, .sign = 'u', .max_rate = 2500},
[ID_AD7946] = {.resolution = 14, .sign = 's', .max_rate = 500},
[ID_AD7980] = {.resolution = 16, .sign = 'u', .max_rate = 1000},
[ID_AD7982] = {.resolution = 18, .sign = 's', .max_rate = 1000},
[ID_AD7983] = {.resolution = 16, .sign = 'u', .max_rate = 1330},
[ID_AD7984] = {.resolution = 18, .sign = 's', .max_rate = 1330},
[ID_AD7985] = {.resolution = 16, .sign = 'u', .max_rate = 2500},
[ID_AD7986] = {.resolution = 18, .sign = 's', .max_rate = 2000},
}
ID_AD4008
@ ID_AD4008
Definition: pulsar_adc.h:69
ID_AD4006
@ ID_AD4006
Definition: pulsar_adc.h:67
ID_AD4003
@ ID_AD4003
Definition: pulsar_adc.h:64
ID_AD7693
@ ID_AD7693
Definition: pulsar_adc.h:78
ID_AD7946
@ ID_AD7946
Definition: pulsar_adc.h:81
ID_AD4022
@ ID_AD4022
Definition: pulsar_adc.h:74
ID_AD4010
@ ID_AD4010
Definition: pulsar_adc.h:70
ID_AD7983
@ ID_AD7983
Definition: pulsar_adc.h:84
ID_AD7985
@ ID_AD7985
Definition: pulsar_adc.h:86
ID_AD7942
@ ID_AD7942
Definition: pulsar_adc.h:79
ID_AD7691
@ ID_AD7691
Definition: pulsar_adc.h:77
ID_AD7986
@ ID_AD7986
Definition: pulsar_adc.h:87
ID_AD7690
@ ID_AD7690
Definition: pulsar_adc.h:76
ID_AD4004
@ ID_AD4004
Definition: pulsar_adc.h:65
ID_AD7980
@ ID_AD7980
Definition: pulsar_adc.h:82
ID_AD4021
@ ID_AD4021
Definition: pulsar_adc.h:73
ID_AD4000
@ ID_AD4000
Definition: pulsar_adc.h:61
ID_ADAQ4003
@ ID_ADAQ4003
Definition: pulsar_adc.h:75
ID_AD4002
@ ID_AD4002
Definition: pulsar_adc.h:63
ID_AD4007
@ ID_AD4007
Definition: pulsar_adc.h:68
ID_AD4011
@ ID_AD4011
Definition: pulsar_adc.h:71
ID_AD4020
@ ID_AD4020
Definition: pulsar_adc.h:72
ID_AD7944
@ ID_AD7944
Definition: pulsar_adc.h:80
ID_AD7982
@ ID_AD7982
Definition: pulsar_adc.h:83
ID_AD4005
@ ID_AD4005
Definition: pulsar_adc.h:66
ID_AD7984
@ ID_AD7984
Definition: pulsar_adc.h:85
ID_AD4001
@ ID_AD4001
Definition: pulsar_adc.h:62