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

Header file of AD525X Driver for Microblaze processor. This driver supporting the following devices : AD5232, AD5235, AD5252, AD5251, AD5254, AD5253, ADN2850. More...

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

Go to the source code of this file.

Classes

struct  ad525x_chip_info
 
struct  ad525x_dev
 
struct  ad525x_init_param
 

Macros

#define AD525X_RESET_OUT
 
#define AD525X_RESET_LOW
 
#define AD525X_RESET_HIGH
 
#define AD525X_SHUTDOWN_OUT
 
#define AD525X_SHUTDOWN_LOW
 
#define AD525X_SHUTDOWN_HIGH
 
#define AD525X_READY_IN   no_os_gpio_direction_input(dev->gpio_ready)
 
#define AD525X_READY_LOW
 
#define AD525X_READY_HIGH
 
#define AD525X_WP_BF_OUT
 
#define AD525X_WP_BF_LOW
 
#define AD525X_WP_BF_HIGH
 
#define AD525X_MEM_ADDR_MASK   0xF
 
#define AD525X_RDAC_ADDR_MASK_1BIT   0x1
 
#define AD525X_RDAC_ADDR_MASK_3BIT   0x7
 
#define AD525X_DATA8_MASK   0xFF
 
#define AD525X_DATA10_MASK   0x3FF
 
#define AD525X_CMD_NOP   0x0
 
#define AD525X_CMD_MEM2RDAC   0x1
 
#define AD525X_CMD_RDAC2MEM   0x2
 
#define AD525X_CMD_DECRDAC_6DB   0x3
 
#define AD525X_CMD_DECALLRDAC_6DB   0x4
 
#define AD525X_CMD_DECRDAC_ONE   0x5
 
#define AD525X_CMD_DECALLRDAC_ONE   0x6
 
#define AD525X_CMD_RESET   0x7
 
#define AD525X_CMD_INCRDAC_6DB   0x8
 
#define AD525X_CMD_INCALLRDAC_6DB   0x9
 
#define AD525X_CMD_INCRDAC_ONE   0xA
 
#define AD525X_CMD_INCALLRDAC_ONE   0xB
 
#define AD525X_CMD_SPI_OFFSET   0x4
 
#define AD525X_CMD_MASK   0xF
 
#define AD525X_CMD_SPI_SREG2MEM   0x3
 
#define AD525X_CMD_SPI_MEM2SREG   0x9
 
#define AD525X_CMD_SPI_RDAC2SREG   0xA
 
#define AD525X_CMD_SPI_SREG2RDAC   0xB
 
#define AD525X_I2C_HARD_ADDR   0x2C
 
#define AD525X_I2C_PIN_ADDR_MASK   0x03
 
#define AD525X_I2C_CNTR_MASK   0xBF
 
#define AD525X_I2C_CMD_OR_REG   0x80
 
#define AD525X_I2C_EE_OR_RDAC   0x20
 
#define AD525X_I2C_MEM_ADDR_MASK   0x1F
 
#define AD525X_CMD_I2C_OFFSET   0x3
 
#define AD525x_RDAC_TOLERANCE   0x0F
 
#define AD525X_RDAC0_SIGN_TOL   0x18
 
#define AD525X_RDAC0_DECIMAL_TOL   0x19
 
#define AD525X_RDAC1_SIGN_TOL   0x1A
 
#define AD525X_RDAC1_DECIMAL_TOL   0x1B
 
#define AD525X_RDAC2_SIGN_TOL   0x1C
 
#define AD525X_RDAC2_DECIMAL_TOL   0x1D
 
#define AD525X_RDAC3_SIGN_TOL   0x1E
 
#define AD525X_RDAC4_DECIMAL_TOL   0x1F
 

Enumerations

enum  bool_t {
  false,
  true,
  false,
  true,
  false,
  true
}
 
enum  ad525_x_type_t {
  ID_AD5232,
  ID_AD5235,
  ID_ADN2850,
  ID_AD5252,
  ID_AD5251,
  ID_AD5254,
  ID_AD5253
}
 
enum  comm_type_t {
  com_spi,
  com_i2c,
  SPI,
  I2C
}
 

Functions

int8_t ad525x_init (struct ad525x_dev **device, struct ad525x_init_param init_param)
 Initialize SPI and Initial Values for AD5172 Board. More...
 
int32_t ad525x_remove (struct ad525x_dev *dev)
 Free the resources allocated by ad525x_init(). More...
 
uint16_t ad525x_read_mem (struct ad525x_dev *dev, uint8_t address)
 Read data from the EEMEM. More...
 
void ad525x_write_mem (struct ad525x_dev *dev, uint8_t address, uint16_t data)
 Write data to EEMEM. More...
 
uint16_t ad525x_read_rdac (struct ad525x_dev *dev, uint8_t address)
 Read data from the RDAC register. More...
 
void ad525x_write_rdac (struct ad525x_dev *dev, uint8_t address, uint16_t data)
 Write data to RDAC register. More...
 
void ad525x_write_command (struct ad525x_dev *dev, uint8_t command, uint8_t address)
 Write quick commands to the device. More...
 

Detailed Description

Header file of AD525X Driver for Microblaze processor. This driver supporting the following devices : AD5232, AD5235, AD5252, AD5251, AD5254, AD5253, ADN2850.

Author
Istvan Csomortani (istva.nosp@m.n.cs.nosp@m.omort.nosp@m.ani@.nosp@m.analo.nosp@m.g.co.nosp@m.m)

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

◆ AD525X_CMD_DECALLRDAC_6DB

#define AD525X_CMD_DECALLRDAC_6DB   0x4

◆ AD525X_CMD_DECALLRDAC_ONE

#define AD525X_CMD_DECALLRDAC_ONE   0x6

◆ AD525X_CMD_DECRDAC_6DB

#define AD525X_CMD_DECRDAC_6DB   0x3

◆ AD525X_CMD_DECRDAC_ONE

#define AD525X_CMD_DECRDAC_ONE   0x5

◆ AD525X_CMD_I2C_OFFSET

#define AD525X_CMD_I2C_OFFSET   0x3

◆ AD525X_CMD_INCALLRDAC_6DB

#define AD525X_CMD_INCALLRDAC_6DB   0x9

◆ AD525X_CMD_INCALLRDAC_ONE

#define AD525X_CMD_INCALLRDAC_ONE   0xB

◆ AD525X_CMD_INCRDAC_6DB

#define AD525X_CMD_INCRDAC_6DB   0x8

◆ AD525X_CMD_INCRDAC_ONE

#define AD525X_CMD_INCRDAC_ONE   0xA

◆ AD525X_CMD_MASK

#define AD525X_CMD_MASK   0xF

◆ AD525X_CMD_MEM2RDAC

#define AD525X_CMD_MEM2RDAC   0x1

◆ AD525X_CMD_NOP

#define AD525X_CMD_NOP   0x0

◆ AD525X_CMD_RDAC2MEM

#define AD525X_CMD_RDAC2MEM   0x2

◆ AD525X_CMD_RESET

#define AD525X_CMD_RESET   0x7

◆ AD525X_CMD_SPI_MEM2SREG

#define AD525X_CMD_SPI_MEM2SREG   0x9

◆ AD525X_CMD_SPI_OFFSET

#define AD525X_CMD_SPI_OFFSET   0x4

◆ AD525X_CMD_SPI_RDAC2SREG

#define AD525X_CMD_SPI_RDAC2SREG   0xA

◆ AD525X_CMD_SPI_SREG2MEM

#define AD525X_CMD_SPI_SREG2MEM   0x3

◆ AD525X_CMD_SPI_SREG2RDAC

#define AD525X_CMD_SPI_SREG2RDAC   0xB

◆ AD525X_DATA10_MASK

#define AD525X_DATA10_MASK   0x3FF

◆ AD525X_DATA8_MASK

#define AD525X_DATA8_MASK   0xFF

◆ AD525X_I2C_CMD_OR_REG

#define AD525X_I2C_CMD_OR_REG   0x80

◆ AD525X_I2C_CNTR_MASK

#define AD525X_I2C_CNTR_MASK   0xBF

◆ AD525X_I2C_EE_OR_RDAC

#define AD525X_I2C_EE_OR_RDAC   0x20

◆ AD525X_I2C_HARD_ADDR

#define AD525X_I2C_HARD_ADDR   0x2C

◆ AD525X_I2C_MEM_ADDR_MASK

#define AD525X_I2C_MEM_ADDR_MASK   0x1F

◆ AD525X_I2C_PIN_ADDR_MASK

#define AD525X_I2C_PIN_ADDR_MASK   0x03

◆ AD525X_MEM_ADDR_MASK

#define AD525X_MEM_ADDR_MASK   0xF

◆ AD525X_RDAC0_DECIMAL_TOL

#define AD525X_RDAC0_DECIMAL_TOL   0x19

◆ AD525X_RDAC0_SIGN_TOL

#define AD525X_RDAC0_SIGN_TOL   0x18

◆ AD525X_RDAC1_DECIMAL_TOL

#define AD525X_RDAC1_DECIMAL_TOL   0x1B

◆ AD525X_RDAC1_SIGN_TOL

#define AD525X_RDAC1_SIGN_TOL   0x1A

◆ AD525X_RDAC2_DECIMAL_TOL

#define AD525X_RDAC2_DECIMAL_TOL   0x1D

◆ AD525X_RDAC2_SIGN_TOL

#define AD525X_RDAC2_SIGN_TOL   0x1C

◆ AD525X_RDAC3_SIGN_TOL

#define AD525X_RDAC3_SIGN_TOL   0x1E

◆ AD525X_RDAC4_DECIMAL_TOL

#define AD525X_RDAC4_DECIMAL_TOL   0x1F

◆ AD525X_RDAC_ADDR_MASK_1BIT

#define AD525X_RDAC_ADDR_MASK_1BIT   0x1

◆ AD525X_RDAC_ADDR_MASK_3BIT

#define AD525X_RDAC_ADDR_MASK_3BIT   0x7

◆ AD525x_RDAC_TOLERANCE

#define AD525x_RDAC_TOLERANCE   0x0F

◆ AD525X_READY_HIGH

#define AD525X_READY_HIGH
Value:

◆ AD525X_READY_IN

#define AD525X_READY_IN   no_os_gpio_direction_input(dev->gpio_ready)

◆ AD525X_READY_LOW

#define AD525X_READY_LOW
Value:
no_os_gpio_set_value(dev->gpio_ready, \

◆ AD525X_RESET_HIGH

#define AD525X_RESET_HIGH
Value:

◆ AD525X_RESET_LOW

#define AD525X_RESET_LOW
Value:
no_os_gpio_set_value(dev->gpio_reset, \

◆ AD525X_RESET_OUT

#define AD525X_RESET_OUT
Value:

◆ AD525X_SHUTDOWN_HIGH

#define AD525X_SHUTDOWN_HIGH
Value:
no_os_gpio_set_value(dev->gpio_shutdown, \

◆ AD525X_SHUTDOWN_LOW

#define AD525X_SHUTDOWN_LOW
Value:
no_os_gpio_set_value(dev->gpio_shutdown, \

◆ AD525X_SHUTDOWN_OUT

#define AD525X_SHUTDOWN_OUT
Value:

◆ AD525X_WP_BF_HIGH

#define AD525X_WP_BF_HIGH
Value:

◆ AD525X_WP_BF_LOW

#define AD525X_WP_BF_LOW
Value:

◆ AD525X_WP_BF_OUT

#define AD525X_WP_BF_OUT
Value:

Enumeration Type Documentation

◆ ad525_x_type_t

Enumerator
ID_AD5232 
ID_AD5235 
ID_ADN2850 
ID_AD5252 
ID_AD5251 
ID_AD5254 
ID_AD5253 

◆ bool_t

enum bool_t
Enumerator
false 
true 
false 
true 
false 
true 

◆ comm_type_t

Enumerator
com_spi 
com_i2c 
SPI 
I2C 

Function Documentation

◆ ad525x_init()

int8_t ad525x_init ( struct ad525x_dev **  device,
struct ad525x_init_param  init_param 
)

Initialize SPI and Initial Values for AD5172 Board.

Parameters
device- The device structure.
init_param- The structure that contains the device initial parameters.
Returns
success

◆ ad525x_read_mem()

uint16_t ad525x_read_mem ( struct ad525x_dev dev,
uint8_t  address 
)

Read data from the EEMEM.

Parameters
dev- The device structure.
address- desired address of the EEMEM memory
Returns
success

◆ ad525x_read_rdac()

uint16_t ad525x_read_rdac ( struct ad525x_dev dev,
uint8_t  address 
)

Read data from the RDAC register.

Parameters
dev- The device structure.
address- desired address of the RDAC registers
Returns
success

◆ ad525x_remove()

int32_t ad525x_remove ( struct ad525x_dev dev)

Free the resources allocated by ad525x_init().

Parameters
dev- The device structure.
Returns
ret - The result of the remove procedure.

◆ ad525x_write_command()

void ad525x_write_command ( struct ad525x_dev dev,
uint8_t  command,
uint8_t  address 
)

Write quick commands to the device.

Parameters
dev- The device structure.
command- desired command, the functionality of a command it may vary at diffrent devices
address- Address to be written
Returns
success

◆ ad525x_write_mem()

void ad525x_write_mem ( struct ad525x_dev dev,
uint8_t  address,
uint16_t  data 
)

Write data to EEMEM.

Parameters
dev- The device structure.
address- desired address of the EEMEM memory
data- the data which will be written to the memory
Returns
success

◆ ad525x_write_rdac()

void ad525x_write_rdac ( struct ad525x_dev dev,
uint8_t  address,
uint16_t  data 
)

Write data to RDAC register.

Parameters
dev- The device structure.
address- desired address of the RDAC register
data- the data which will be written to the RDAC register
Returns
success
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:117
NO_OS_GPIO_LOW
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:115
no_os_gpio_set_value
int32_t no_os_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: no_os_gpio.c:197
no_os_gpio_direction_output
int32_t no_os_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: no_os_gpio.c:147