no-OS
|
Driver for the Analog Devices AXI CLKGEN. More...
#include "clk_axi_clkgen.h"
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include "no_os_util.h"
#include "no_os_alloc.h"
#include "no_os_error.h"
#include "no_os_delay.h"
#include "no_os_axi_io.h"
Macros | |
#define | AXI_PCORE_VER(major, minor, letter) ((major << 16) | (minor << 8) | letter) |
#define | AXI_PCORE_VER_MAJOR(version) (version >> 16) |
#define | AXI_PCORE_VER_MINOR(version) ((version >> 8) & 0xff) |
#define | AXI_PCORE_VER_LETTER(version) (version & 0xff) |
#define | AXI_REG_VERSION 0x0000 |
#define | AXI_VERSION(x) (((x) & 0xffffffff) << 0) |
#define | AXI_VERSION_IS(x, y, z) ((x) << 16 | (y) << 8 | (z)) |
#define | AXI_VERSION_MAJOR(x) ((x) >> 16) |
#define | AXI_REG_FPGA_INFO 0x001C |
#define | AXI_REG_FPGA_VOLTAGE 0x0140 |
#define | AXI_INFO_FPGA_TECH(info) ((info) >> 24) |
#define | AXI_INFO_FPGA_FAMILY(info) (((info) >> 16) & 0xff) |
#define | AXI_INFO_FPGA_SPEED_GRADE(info) (((info) >> 8) & 0xff) |
#define | AXI_INFO_FPGA_DEV_PACKAGE(info) ((info) & 0xff) |
#define | AXI_INFO_FPGA_VOLTAGE(val) ((val) & 0xffff) |
#define | AXI_CLKGEN_REG_RESETN 0x40 |
#define | AXI_CLKGEN_MMCM_RESETN NO_OS_BIT(1) |
#define | AXI_CLKGEN_RESETN NO_OS_BIT(0) |
#define | AXI_CLKGEN_REG_STATUS 0x5c |
#define | AXI_CLKGEN_STATUS NO_OS_BIT(0) |
#define | AXI_CLKGEN_REG_DRP_CNTRL 0x70 |
#define | AXI_CLKGEN_DRP_CNTRL_SEL NO_OS_BIT(29) |
#define | AXI_CLKGEN_DRP_CNTRL_READ NO_OS_BIT(28) |
#define | AXI_CLKGEN_REG_DRP_STATUS 0x74 |
#define | AXI_CLKGEN_DRP_STATUS_BUSY NO_OS_BIT(16) |
#define | MMCM_REG_CLKOUT0_1 0x08 |
#define | MMCM_REG_CLKOUT0_2 0x09 |
#define | MMCM_REG_CLKOUT1_1 0x0A |
#define | MMCM_REG_CLKOUT1_2 0x0B |
#define | MMCM_REG_CLK_FB1 0x14 |
#define | MMCM_REG_CLK_FB2 0x15 |
#define | MMCM_REG_CLK_DIV 0x16 |
#define | MMCM_REG_LOCK1 0x18 |
#define | MMCM_REG_LOCK2 0x19 |
#define | MMCM_REG_LOCK3 0x1a |
#define | MMCM_REG_FILTER1 0x4e |
#define | MMCM_REG_FILTER2 0x4f |
Functions | |
int32_t | axi_clkgen_write (struct axi_clkgen *clkgen, uint32_t reg_addr, uint32_t reg_val) |
axi_clkgen_write More... | |
int32_t | axi_clkgen_read (struct axi_clkgen *clkgen, uint32_t reg_addr, uint32_t *reg_val) |
axi_clkgen_read More... | |
void | axi_clkgen_mmcm_write (struct axi_clkgen *clkgen, uint32_t reg, uint32_t val, uint32_t mask) |
axi_clkgen_mmcm_write More... | |
void | axi_clkgen_calc_params (struct axi_clkgen *axi_clkgen, uint32_t fin, uint32_t fout, uint32_t *best_d, uint32_t *best_m, uint32_t *best_dout) |
axi_clkgen_calc_params More... | |
void | axi_clkgen_calc_clk_params (uint32_t divider, uint32_t *low, uint32_t *high, uint32_t *edge, uint32_t *nocount) |
axi_clkgen_calc_clk_params More... | |
int32_t | axi_clkgen_set_rate (struct axi_clkgen *clkgen, uint32_t rate) |
axi_clkgen_set_rate More... | |
int32_t | axi_clkgen_get_rate (struct axi_clkgen *clkgen, uint32_t *rate) |
axi_clkgen_get_rate More... | |
int32_t | axi_clkgen_init (struct axi_clkgen **clk, const struct axi_clkgen_init *init) |
axi_clkgen_init More... | |
int32_t | axi_clkgen_remove (struct axi_clkgen *clkgen) |
axi_clkgen_remove More... | |
Driver for the Analog Devices AXI CLKGEN.
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 AXI_CLKGEN_DRP_CNTRL_READ NO_OS_BIT(28) |
#define AXI_CLKGEN_DRP_CNTRL_SEL NO_OS_BIT(29) |
#define AXI_CLKGEN_DRP_STATUS_BUSY NO_OS_BIT(16) |
#define AXI_CLKGEN_MMCM_RESETN NO_OS_BIT(1) |
#define AXI_CLKGEN_REG_DRP_CNTRL 0x70 |
#define AXI_CLKGEN_REG_DRP_STATUS 0x74 |
#define AXI_CLKGEN_REG_RESETN 0x40 |
#define AXI_CLKGEN_REG_STATUS 0x5c |
#define AXI_CLKGEN_RESETN NO_OS_BIT(0) |
#define AXI_CLKGEN_STATUS NO_OS_BIT(0) |
#define AXI_INFO_FPGA_DEV_PACKAGE | ( | info | ) | ((info) & 0xff) |
#define AXI_INFO_FPGA_FAMILY | ( | info | ) | (((info) >> 16) & 0xff) |
#define AXI_INFO_FPGA_SPEED_GRADE | ( | info | ) | (((info) >> 8) & 0xff) |
#define AXI_INFO_FPGA_TECH | ( | info | ) | ((info) >> 24) |
#define AXI_INFO_FPGA_VOLTAGE | ( | val | ) | ((val) & 0xffff) |
#define AXI_PCORE_VER | ( | major, | |
minor, | |||
letter | |||
) | ((major << 16) | (minor << 8) | letter) |
#define AXI_PCORE_VER_LETTER | ( | version | ) | (version & 0xff) |
#define AXI_PCORE_VER_MAJOR | ( | version | ) | (version >> 16) |
#define AXI_PCORE_VER_MINOR | ( | version | ) | ((version >> 8) & 0xff) |
#define AXI_REG_FPGA_INFO 0x001C |
#define AXI_REG_FPGA_VOLTAGE 0x0140 |
#define AXI_REG_VERSION 0x0000 |
#define AXI_VERSION | ( | x | ) | (((x) & 0xffffffff) << 0) |
#define AXI_VERSION_IS | ( | x, | |
y, | |||
z | |||
) | ((x) << 16 | (y) << 8 | (z)) |
#define AXI_VERSION_MAJOR | ( | x | ) | ((x) >> 16) |
#define MMCM_REG_CLK_DIV 0x16 |
#define MMCM_REG_CLK_FB1 0x14 |
#define MMCM_REG_CLK_FB2 0x15 |
#define MMCM_REG_CLKOUT0_1 0x08 |
#define MMCM_REG_CLKOUT0_2 0x09 |
#define MMCM_REG_CLKOUT1_1 0x0A |
#define MMCM_REG_CLKOUT1_2 0x0B |
#define MMCM_REG_FILTER1 0x4e |
#define MMCM_REG_FILTER2 0x4f |
#define MMCM_REG_LOCK1 0x18 |
#define MMCM_REG_LOCK2 0x19 |
#define MMCM_REG_LOCK3 0x1a |
enum axi_fgpa_technology |
enum axi_fpga_family |
enum axi_fpga_speed_grade |
Enum for FPGA's speed-grade.
void axi_clkgen_calc_clk_params | ( | uint32_t | divider, |
uint32_t * | low, | ||
uint32_t * | high, | ||
uint32_t * | edge, | ||
uint32_t * | nocount | ||
) |
axi_clkgen_calc_clk_params
void axi_clkgen_calc_params | ( | struct axi_clkgen * | axi_clkgen, |
uint32_t | fin, | ||
uint32_t | fout, | ||
uint32_t * | best_d, | ||
uint32_t * | best_m, | ||
uint32_t * | best_dout | ||
) |
axi_clkgen_calc_params
int32_t axi_clkgen_get_rate | ( | struct axi_clkgen * | clkgen, |
uint32_t * | rate | ||
) |
axi_clkgen_get_rate
int32_t axi_clkgen_init | ( | struct axi_clkgen ** | clk, |
const struct axi_clkgen_init * | init | ||
) |
void axi_clkgen_mmcm_write | ( | struct axi_clkgen * | clkgen, |
uint32_t | reg, | ||
uint32_t | val, | ||
uint32_t | mask | ||
) |
axi_clkgen_mmcm_write
int32_t axi_clkgen_read | ( | struct axi_clkgen * | clkgen, |
uint32_t | reg_addr, | ||
uint32_t * | reg_val | ||
) |
axi_clkgen_read
int32_t axi_clkgen_remove | ( | struct axi_clkgen * | clkgen | ) |
axi_clkgen_remove
int32_t axi_clkgen_set_rate | ( | struct axi_clkgen * | clkgen, |
uint32_t | rate | ||
) |
axi_clkgen_set_rate
int32_t axi_clkgen_write | ( | struct axi_clkgen * | clkgen, |
uint32_t | reg_addr, | ||
uint32_t | reg_val | ||
) |
axi_clkgen_write