no-OS
Macros | Functions
axi_adxcvr.c File Reference

Driver for the ADI AXI-ADXCVR Module. More...

#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include "no_os_axi_io.h"
#include "no_os_util.h"
#include "no_os_error.h"
#include "no_os_delay.h"
#include "xilinx_transceiver.h"
#include "axi_adxcvr.h"
#include "no_os_print_log.h"
Include dependency graph for axi_adxcvr.c:

Macros

#define ADXCVR_REG_RESETN   0x0010
 
#define ADXCVR_RESETN   (1 << 0)
 
#define ADXCVR_BUFSTATUS_RST   NO_OS_BIT(1)
 
#define ADXCVR_REG_STATUS   0x0014
 
#define ADXCVR_STATUS   (1 << 0)
 
#define ADXCVR_BUFSTATUS_UNDERFLOW   NO_OS_BIT(5)
 
#define ADXCVR_BUFSTATUS_OVERFLOW   NO_OS_BIT(6)
 
#define ADXCVR_REG_CONTROL   0x0020
 
#define ADXCVR_LPM_DFE_N   (1 << 12)
 
#define ADXCVR_RATE(x)   (((x) & 0x7) << 8)
 
#define ADXCVR_SYSCLK_SEL(x)   (((x) & 0x3) << 4)
 
#define ADXCVR_OUTCLK_SEL(x)   (((x) & 0x7) << 0)
 
#define ADXCVR_REG_SYNTH   0x24
 
#define ADXCVR_REG_DRP_SEL(x)   (0x0040 + (x))
 
#define ADXCVR_REG_DRP_CTRL(x)   (0x0044 + (x))
 
#define ADXCVR_DRP_CTRL_WR   (1 << 28)
 
#define ADXCVR_DRP_CTRL_ADDR(x)   (((x) & 0xFFF) << 16)
 
#define ADXCVR_DRP_CTRL_WDATA(x)   (((x) & 0xFFFF) << 0)
 
#define ADXCVR_REG_DRP_STATUS(x)   (0x0048 + (x))
 
#define ADXCVR_DRP_STATUS_BUSY   (1 << 16)
 
#define ADXCVR_DRP_STATUS_RDATA(x)   (((x) & 0xFFFF) << 0)
 
#define ADXCVR_DRP_PORT_ADDR_COMMON   0x00
 
#define ADXCVR_DRP_PORT_ADDR_CHANNEL   0x20
 
#define ADXCVR_DRP_PORT_COMMON(x)   (x)
 
#define ADXCVR_DRP_PORT_CHANNEL(x)   (0x100 + (x))
 
#define ADXCVR_BROADCAST   0xff
 
#define ADI_AXI_PCORE_VER(major, minor, patch)   (((major) << 16) | ((minor) << 8) | (patch))
 

Functions

int32_t adxcvr_write (struct adxcvr *xcvr, uint32_t reg_addr, uint32_t reg_val)
 AXI ADXCVR Write. More...
 
int32_t adxcvr_read (struct adxcvr *xcvr, uint32_t reg_addr, uint32_t *reg_val)
 AXI ADXCVR Read. More...
 
int32_t adxcvr_drp_wait_idle (struct adxcvr *xcvr, uint32_t drp_addr)
 Read AXI ADXCVR DRP status. More...
 
int32_t adxcvr_drp_read (struct adxcvr *xcvr, uint32_t drp_port, uint32_t reg, uint32_t *val)
 AXI ADXCVR DPR Port Read. More...
 
int32_t adxcvr_drp_write (struct adxcvr *xcvr, uint32_t drp_port, uint32_t reg, uint32_t val)
 AXI ADXCVR DPR Port Write. More...
 
int adxcvr_clk_set_rate (struct adxcvr *xcvr, uint32_t rate, uint32_t parent_rate)
 AXI ADXCVR Clock Set Rate. More...
 
int32_t adxcvr_status_error (struct adxcvr *xcvr)
 AXI ADXCVR Status Read. More...
 
int32_t adxcvr_clk_enable (struct adxcvr *xcvr)
 AXI ADXCVR Clock Enable. More...
 
int32_t adxcvr_clk_disable (struct adxcvr *xcvr)
 AXI ADXCVR Clock Disable. More...
 
int32_t adxcvr_init (struct adxcvr **ad_xcvr, const struct adxcvr_init *init)
 AXI ADXCVR Device Initialization. More...
 
int32_t adxcvr_remove (struct adxcvr *xcvr)
 Free resoulces allocated for AXI_ADXCVR. More...
 

Detailed Description

Driver for the ADI AXI-ADXCVR Module.

Author
DBogdan (drago.nosp@m.s.bo.nosp@m.gdan@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

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

◆ ADI_AXI_PCORE_VER

#define ADI_AXI_PCORE_VER (   major,
  minor,
  patch 
)    (((major) << 16) | ((minor) << 8) | (patch))

◆ ADXCVR_BROADCAST

#define ADXCVR_BROADCAST   0xff

◆ ADXCVR_BUFSTATUS_OVERFLOW

#define ADXCVR_BUFSTATUS_OVERFLOW   NO_OS_BIT(6)

◆ ADXCVR_BUFSTATUS_RST

#define ADXCVR_BUFSTATUS_RST   NO_OS_BIT(1)

◆ ADXCVR_BUFSTATUS_UNDERFLOW

#define ADXCVR_BUFSTATUS_UNDERFLOW   NO_OS_BIT(5)

◆ ADXCVR_DRP_CTRL_ADDR

#define ADXCVR_DRP_CTRL_ADDR (   x)    (((x) & 0xFFF) << 16)

◆ ADXCVR_DRP_CTRL_WDATA

#define ADXCVR_DRP_CTRL_WDATA (   x)    (((x) & 0xFFFF) << 0)

◆ ADXCVR_DRP_CTRL_WR

#define ADXCVR_DRP_CTRL_WR   (1 << 28)

◆ ADXCVR_DRP_PORT_ADDR_CHANNEL

#define ADXCVR_DRP_PORT_ADDR_CHANNEL   0x20

◆ ADXCVR_DRP_PORT_ADDR_COMMON

#define ADXCVR_DRP_PORT_ADDR_COMMON   0x00

◆ ADXCVR_DRP_PORT_CHANNEL

#define ADXCVR_DRP_PORT_CHANNEL (   x)    (0x100 + (x))

◆ ADXCVR_DRP_PORT_COMMON

#define ADXCVR_DRP_PORT_COMMON (   x)    (x)

◆ ADXCVR_DRP_STATUS_BUSY

#define ADXCVR_DRP_STATUS_BUSY   (1 << 16)

◆ ADXCVR_DRP_STATUS_RDATA

#define ADXCVR_DRP_STATUS_RDATA (   x)    (((x) & 0xFFFF) << 0)

◆ ADXCVR_LPM_DFE_N

#define ADXCVR_LPM_DFE_N   (1 << 12)

◆ ADXCVR_OUTCLK_SEL

#define ADXCVR_OUTCLK_SEL (   x)    (((x) & 0x7) << 0)

◆ ADXCVR_RATE

#define ADXCVR_RATE (   x)    (((x) & 0x7) << 8)

◆ ADXCVR_REG_CONTROL

#define ADXCVR_REG_CONTROL   0x0020

◆ ADXCVR_REG_DRP_CTRL

#define ADXCVR_REG_DRP_CTRL (   x)    (0x0044 + (x))

◆ ADXCVR_REG_DRP_SEL

#define ADXCVR_REG_DRP_SEL (   x)    (0x0040 + (x))

◆ ADXCVR_REG_DRP_STATUS

#define ADXCVR_REG_DRP_STATUS (   x)    (0x0048 + (x))

◆ ADXCVR_REG_RESETN

#define ADXCVR_REG_RESETN   0x0010

◆ ADXCVR_REG_STATUS

#define ADXCVR_REG_STATUS   0x0014

◆ ADXCVR_REG_SYNTH

#define ADXCVR_REG_SYNTH   0x24

◆ ADXCVR_RESETN

#define ADXCVR_RESETN   (1 << 0)

◆ ADXCVR_STATUS

#define ADXCVR_STATUS   (1 << 0)

◆ ADXCVR_SYSCLK_SEL

#define ADXCVR_SYSCLK_SEL (   x)    (((x) & 0x3) << 4)

Function Documentation

◆ adxcvr_clk_disable()

int32_t adxcvr_clk_disable ( struct adxcvr xcvr)

AXI ADXCVR Clock Disable.

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

◆ adxcvr_clk_enable()

int32_t adxcvr_clk_enable ( struct adxcvr xcvr)

AXI ADXCVR Clock Enable.

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

◆ adxcvr_clk_set_rate()

int adxcvr_clk_set_rate ( struct adxcvr xcvr,
uint32_t  rate,
uint32_t  parent_rate 
)

AXI ADXCVR Clock Set Rate.

Parameters
xcvr- The device structure.
rate- The output rate (kHz).
parent_rate- The parent rate (kHz).
Returns
Returns 0 in case of success or negative error code otherwise.
Here is the caller graph for this function:

◆ adxcvr_drp_read()

int32_t adxcvr_drp_read ( struct adxcvr xcvr,
uint32_t  drp_port,
uint32_t  reg,
uint32_t *  val 
)

AXI ADXCVR DPR Port Read.

Parameters
xcvr- The device structure.
drp_port- The DRP Port.
reg- DRP Register address.
val- Data read.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ adxcvr_drp_wait_idle()

int32_t adxcvr_drp_wait_idle ( struct adxcvr xcvr,
uint32_t  drp_addr 
)

Read AXI ADXCVR DRP status.

Parameters
xcvr- Device Structure.
drp_addr- DRP Port address.
Returns
Returns status in case of success or negative error code otherwise.
Here is the caller graph for this function:

◆ adxcvr_drp_write()

int32_t adxcvr_drp_write ( struct adxcvr xcvr,
uint32_t  drp_port,
uint32_t  reg,
uint32_t  val 
)

AXI ADXCVR DPR Port Write.

Parameters
xcvr- The device structure.
drp_port- The DRP Port.
reg- DRP Register address.
val- Data to be written.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ adxcvr_init()

int32_t adxcvr_init ( struct adxcvr **  ad_xcvr,
const struct adxcvr_init init 
)

AXI ADXCVR Device Initialization.

adxcvr_init

Parameters
ad_xcvr- The device structure.
init- The structure containing the device initial parameters.
Returns
Returns 0 in case of success or negative error code otherwise.

◆ adxcvr_read()

int32_t adxcvr_read ( struct adxcvr xcvr,
uint32_t  reg_addr,
uint32_t *  reg_val 
)

AXI ADXCVR Read.

adxcvr_read

Parameters
xcvr- Device Structure.
reg_addr- The register address.
reg_val- Data read from the device.
Returns
Returns 0 in case of success or negative error code otherwise.
Here is the caller graph for this function:

◆ adxcvr_remove()

int32_t adxcvr_remove ( struct adxcvr xcvr)

Free resoulces allocated for AXI_ADXCVR.

adxcvr_remove

Parameters
xcvr- The device structure.
Returns
Returns 0 in case of success or negative error code.

◆ adxcvr_status_error()

int32_t adxcvr_status_error ( struct adxcvr xcvr)

AXI ADXCVR Status Read.

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

◆ adxcvr_write()

int32_t adxcvr_write ( struct adxcvr xcvr,
uint32_t  reg_addr,
uint32_t  reg_val 
)

AXI ADXCVR Write.

adxcvr_write

Parameters
xcvr- Device Structure.
reg_addr- The register address.
reg_val- Data value to write.
Returns
Returns 0 in case of success or negative error code otherwise.
Here is the caller graph for this function: