no-OS
|
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_alloc.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 "no_os_clk.h"
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_LINK_MODE(x) (((x) >> 12) & NO_OS_GENMASK(1, 0)) |
#define | ADXCVR_204B 0x01 |
#define | ADXCVR_204C 0x02 |
#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... | |
int | adxcvr_drp_read (struct adxcvr *xcvr, unsigned int drp_port, unsigned int reg, unsigned int *val) |
AXI ADXCVR DPR Port Read. More... | |
int | adxcvr_drp_write (struct adxcvr *xcvr, unsigned int drp_port, unsigned int reg, unsigned int val) |
AXI ADXCVR DPR Port Write. More... | |
int | adxcvr_clk_set_rate (struct adxcvr *xcvr, unsigned long rate, unsigned long parent_rate) |
AXI ADXCVR Clock Set Rate. More... | |
int32_t | adxcvr_status_error (struct adxcvr *xcvr) |
AXI ADXCVR Status Read. More... | |
int | adxcvr_clk_enable (struct adxcvr *xcvr) |
AXI ADXCVR Clock Enable. More... | |
int | 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... | |
int32_t | adxcvr_no_os_clk_enable (struct no_os_clk_desc *desc) |
int32_t | adxcvr_no_os_clk_disable (struct no_os_clk_desc *desc) |
int32_t | adxcvr_no_os_clk_recalc_rate (struct no_os_clk_desc *desc, uint64_t *rate) |
int32_t | adxcvr_no_os_clk_round_rate (struct no_os_clk_desc *desc, uint64_t rate, uint64_t *rounded_rate) |
int32_t | adxcvr_no_os_clk_set_rate (struct no_os_clk_desc *desc, uint64_t rate) |
Variables | |
const struct no_os_clk_platform_ops | adxcvr_clk_ops |
adxcvr clock ops More... | |
Driver for the ADI AXI-ADXCVR Module.
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:
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.
#define ADI_AXI_PCORE_VER | ( | major, | |
minor, | |||
patch | |||
) | (((major) << 16) | ((minor) << 8) | (patch)) |
#define ADXCVR_204B 0x01 |
#define ADXCVR_204C 0x02 |
#define ADXCVR_BROADCAST 0xff |
#define ADXCVR_BUFSTATUS_OVERFLOW NO_OS_BIT(6) |
#define ADXCVR_BUFSTATUS_RST NO_OS_BIT(1) |
#define ADXCVR_BUFSTATUS_UNDERFLOW NO_OS_BIT(5) |
#define ADXCVR_DRP_CTRL_ADDR | ( | x | ) | (((x) & 0xFFF) << 16) |
#define ADXCVR_DRP_CTRL_WDATA | ( | x | ) | (((x) & 0xFFFF) << 0) |
#define ADXCVR_DRP_CTRL_WR (1 << 28) |
#define ADXCVR_DRP_PORT_ADDR_CHANNEL 0x20 |
#define ADXCVR_DRP_PORT_ADDR_COMMON 0x00 |
#define ADXCVR_DRP_PORT_CHANNEL | ( | x | ) | (0x100 + (x)) |
#define ADXCVR_DRP_PORT_COMMON | ( | x | ) | (x) |
#define ADXCVR_DRP_STATUS_BUSY (1 << 16) |
#define ADXCVR_DRP_STATUS_RDATA | ( | x | ) | (((x) & 0xFFFF) << 0) |
#define ADXCVR_LINK_MODE | ( | x | ) | (((x) >> 12) & NO_OS_GENMASK(1, 0)) |
#define ADXCVR_LPM_DFE_N (1 << 12) |
#define ADXCVR_OUTCLK_SEL | ( | x | ) | (((x) & 0x7) << 0) |
#define ADXCVR_RATE | ( | x | ) | (((x) & 0x7) << 8) |
#define ADXCVR_REG_CONTROL 0x0020 |
#define ADXCVR_REG_DRP_CTRL | ( | x | ) | (0x0044 + (x)) |
#define ADXCVR_REG_DRP_SEL | ( | x | ) | (0x0040 + (x)) |
#define ADXCVR_REG_DRP_STATUS | ( | x | ) | (0x0048 + (x)) |
#define ADXCVR_REG_RESETN 0x0010 |
#define ADXCVR_REG_STATUS 0x0014 |
#define ADXCVR_REG_SYNTH 0x24 |
#define ADXCVR_RESETN (1 << 0) |
#define ADXCVR_STATUS (1 << 0) |
#define ADXCVR_SYSCLK_SEL | ( | x | ) | (((x) & 0x3) << 4) |
int adxcvr_clk_disable | ( | struct adxcvr * | xcvr | ) |
AXI ADXCVR Clock Disable.
xcvr | - The device structure. |
int adxcvr_clk_enable | ( | struct adxcvr * | xcvr | ) |
AXI ADXCVR Clock Enable.
xcvr | - The device structure. |
int adxcvr_clk_set_rate | ( | struct adxcvr * | xcvr, |
unsigned long | rate, | ||
unsigned long | parent_rate | ||
) |
AXI ADXCVR Clock Set Rate.
xcvr | - The device structure. |
rate | - The output rate (kHz). |
parent_rate | - The parent rate (kHz). |
int adxcvr_drp_read | ( | struct adxcvr * | xcvr, |
unsigned int | drp_port, | ||
unsigned int | reg, | ||
unsigned int * | val | ||
) |
AXI ADXCVR DPR Port Read.
xcvr | - The device structure. |
drp_port | - The DRP Port. |
reg | - DRP Register address. |
val | - Data read. |
int32_t adxcvr_drp_wait_idle | ( | struct adxcvr * | xcvr, |
uint32_t | drp_addr | ||
) |
Read AXI ADXCVR DRP status.
xcvr | - Device Structure. |
drp_addr | - DRP Port address. |
int adxcvr_drp_write | ( | struct adxcvr * | xcvr, |
unsigned int | drp_port, | ||
unsigned int | reg, | ||
unsigned int | val | ||
) |
AXI ADXCVR DPR Port Write.
xcvr | - The device structure. |
drp_port | - The DRP Port. |
reg | - DRP Register address. |
val | - Data to be written. |
int32_t adxcvr_init | ( | struct adxcvr ** | ad_xcvr, |
const struct adxcvr_init * | init | ||
) |
AXI ADXCVR Device Initialization.
ad_xcvr | - The device structure. |
init | - The structure containing the device initial parameters. |
int32_t adxcvr_no_os_clk_disable | ( | struct no_os_clk_desc * | desc | ) |
int32_t adxcvr_no_os_clk_enable | ( | struct no_os_clk_desc * | desc | ) |
int32_t adxcvr_no_os_clk_recalc_rate | ( | struct no_os_clk_desc * | desc, |
uint64_t * | rate | ||
) |
int32_t adxcvr_no_os_clk_round_rate | ( | struct no_os_clk_desc * | desc, |
uint64_t | rate, | ||
uint64_t * | rounded_rate | ||
) |
int32_t adxcvr_no_os_clk_set_rate | ( | struct no_os_clk_desc * | desc, |
uint64_t | rate | ||
) |
int32_t adxcvr_read | ( | struct adxcvr * | xcvr, |
uint32_t | reg_addr, | ||
uint32_t * | reg_val | ||
) |
AXI ADXCVR Read.
adxcvr_read
xcvr | - Device Structure. |
reg_addr | - The register address. |
reg_val | - Data read from the device. |
int32_t adxcvr_remove | ( | struct adxcvr * | xcvr | ) |
Free resoulces allocated for AXI_ADXCVR.
adxcvr_remove
xcvr | - The device structure. |
int32_t adxcvr_status_error | ( | struct adxcvr * | xcvr | ) |
AXI ADXCVR Status Read.
xcvr | - The device structure. |
int32_t adxcvr_write | ( | struct adxcvr * | xcvr, |
uint32_t | reg_addr, | ||
uint32_t | reg_val | ||
) |
AXI ADXCVR Write.
adxcvr_write
xcvr | - Device Structure. |
reg_addr | - The register address. |
reg_val | - Data value to write. |
const struct no_os_clk_platform_ops adxcvr_clk_ops |
adxcvr clock ops