no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
axi_fmcadc5_sync.h
Go to the documentation of this file.
1/*
2 * axi_fmcadc5_sync.h
3 *
4 * Created on: Mar 30, 2018
5 * Author: adrimbar
6 */
7
8#ifndef SRC_I5G_H_
9#define SRC_I5G_H_
10
11/* Register addresses & data (direct access) */
12#define I5G_VERSION_ADDR (0x0000 << 2)
13#define I5G_IDENTIFIER_ADDR (0x0001 << 2)
14#define I5G_SCRATCH_ADDR (0x0002 << 2)
15#define I5G_TIMER_ADDR (0x0003 << 2)
16#define I5G_SPI_REQUEST_ADDR (0x0010 << 2)
17#define I5G_SPI_GRANT_ADDR (0x0011 << 2)
18#define I5G_SPI_SELECT_N_ADDR (0x0012 << 2)
19#define I5G_SPI_TRANSMIT_ADDR (0x0013 << 2)
20#define I5G_SPI_RECEIVE_ADDR (0x0014 << 2)
21#define I5G_SPI_BUSY_ADDR (0x0015 << 2)
22#define I5G_DELAY_ADDR (0x0020 << 2)
23#define I5G_DELAY_VERIFY_ADDR (0x0021 << 2)
24#define I5G_DELAY_LOCKED_ADDR (0x0022 << 2)
25#define I5G_SYNC_CONTROL_ADDR (0x0030 << 2)
26#define I5G_SYNC_STATUS_ADDR (0x0031 << 2)
27#define I5G_SYSREF_CONTROL_ADDR (0x0040 << 2)
28#define I5G_SYSREF_REQUEST_ADDR (0x0041 << 2)
29#define I5G_VCAL_CNT_ADDR (0x0050 << 2)
30#define I5G_VCAL_ENABLE_ADDR (0x0051 << 2)
31#define I5G_CAL_ENABLE_ADDR (0x0060 << 2)
32#define I5G_CAL_MAX_0_ADDR (0x0064 << 2)
33#define I5G_CAL_MIN_0_ADDR (0x0065 << 2)
34#define I5G_CAL_MAX_1_ADDR (0x0066 << 2)
35#define I5G_CAL_MIN_1_ADDR (0x0067 << 2)
36#define I5G_COR_ENABLE_ADDR (0x0061 << 2)
37#define I5G_COR_SCALE_0_ADDR (0x0068 << 2)
38#define I5G_COR_OFFSET_0_ADDR (0x0069 << 2)
39#define I5G_COR_SCALE_1_ADDR (0x006a << 2)
40#define I5G_COR_OFFSET_1_ADDR (0x006b << 2)
41
42/* Register addresses & data (direct access) */
43#define I5G_VERSION 0x040063 /* version (4.0a) */
44#define I5G_SPI_REQUEST_ACCESS 0x000001 /* request access */
45#define I5G_SPI_REQUEST_RELEASE 0x000000 /* release access */
46#define I5G_SPI_ACCESS_ENABLED 0x000001 /* request enabled */
47#define I5G_SPI_ACCESS_DISABLED 0x000000 /* request disabled */
48#define I5G_SPI_BUSY 0x000001 /* access busy */
49#define I5G_DELAY_LOCKED 0x000001 /* delay is locked */
50#define I5G_SYNC_SET 0x000007 /* dual mode and disabled */
51#define I5G_SYNC_RELEASE 0x000004 /* dual mode and enabled */
52#define I5G_SYNC_OOS 0x000000 /* out-of-sync */
53#define I5G_SYSREF_SET 0x000021 /* one-shot and disabled */
54#define I5G_SYSREF_RELEASE 0x000020 /* one-shot and enabled */
55#define I5G_SYSREF_REQUEST 0x000001 /* sysref-request */
56#define I5G_SYSREF_BUSY 0x000001 /* sysref-busy */
57#define I5G_VCAL_CNT_10M 0x000004 /* 100/((n+1)*2) */
58#define I5G_VCAL_ENABLE 0x000001 /* enable */
59#define I5G_VCAL_DISABLE 0x000000 /* enable */
60#define I5G_CAL_ENABLE 0x000001 /* enable */
61#define I5G_CAL_DISABLE 0x000000 /* enable */
62#define I5G_COR_ENABLE 0x000001 /* enable */
63#define I5G_COR_DISABLE 0x000000 /* enable */
64
65/* Register addresses & data (indirect access) */
66#define I5G_AD9625_ID_ADDR 0x000001 /* identifier address */
67#define I5G_AD9625_ID_DATA 0x000041 /* refer data sheet for details */
68#define I5G_AD9625_ST_ADDR 0x000072 /* sysref time-stamp address [7:6] */
69#define I5G_AD9625_ST_DATA 0x00008b /* sysref timestamping enabled (2'b10) */
70#define I5G_AD9625_SG_ADDR 0x00013c /* sysref guard band [7:5] */
71#define I5G_AD9625_SS_ADDR 0x000100 /* sysref status reporting [2] */
72#define I5G_AD9625_SS_MASK 0x000004 /* setup violations mask */
73#define I5G_AD9625_SS_SET 0x000004 /* setup violations detected */
74#define I5G_AD9625_IO_ADDR 0x0000ff /* internal update address [0] */
75#define I5G_AD9625_IO_DATA 0x000001 /* register update(1), self-clearing */
76#define I5G_AD9625_SC_ADDR 0x00003a /* sysref control address */
77
78/* [6] run(0)/clear(1), [3] @pos(0)/@neg(1), [2] continous(0)/one-shot(1),
79 * [1] disable(0)/enable(0)
80 * */
81#define I5G_AD9625_SC_ENABLE(sel) ((sel == 1) ? 0x00000e : 0x000006)
82#define I5G_AD9625_SC_RECEIVED(sel) ((sel == 1) ? 0x00000c : 0x000004)
83#define I5G_AD9625_SC_CLEAR(sel) ((sel == 1) ? 0x00004e : 0x000046)
84
85/* Default is ms, we need finer delays (10ns) */
86#define I5G_TIMER_US(d) ((d*100)-1)
87
88struct s_i5g {
91 int32_t regs;
92 int32_t ad9625_cs_0;
93 int32_t ad9625_cs_1;
94 int32_t sysref_delay;
95};
96
105
106/* Initializes core descriptor with the devices */
107int32_t i5g_setup(struct s_i5g **descriptor,
108 struct s_i5g_init init_param);
109
110/* Free the resources allocated by i5g_setup() */
111int32_t i5g_remove(struct s_i5g *desc);
112
113#endif /* SRC_I5G_H_ */
struct ad7616_init_param init_param
Definition ad7616_sdz.c:107
int32_t i5g_remove(struct s_i5g *desc)
Definition axi_fmcadc5_sync.c:416
int32_t i5g_setup(struct s_i5g **descriptor, struct s_i5g_init init_param)
Definition axi_fmcadc5_sync.c:377
Definition ad9625.h:76
Definition axi_fmcadc5_sync.h:97
int32_t ad9625_cs_0
Definition axi_fmcadc5_sync.h:101
struct ad9625_dev * ad9625_1_device
Definition axi_fmcadc5_sync.h:99
int32_t ad9625_cs_1
Definition axi_fmcadc5_sync.h:102
int32_t regs
Definition axi_fmcadc5_sync.h:100
int32_t sysref_delay
Definition axi_fmcadc5_sync.h:103
struct ad9625_dev * ad9625_0_device
Definition axi_fmcadc5_sync.h:98
Definition axi_fmcadc5_sync.h:88
struct ad9625_dev * ad9625_1_device
Definition axi_fmcadc5_sync.h:90
int32_t sysref_delay
Definition axi_fmcadc5_sync.h:94
struct ad9625_dev * ad9625_0_device
Definition axi_fmcadc5_sync.h:89
int32_t ad9625_cs_0
Definition axi_fmcadc5_sync.h:92
int32_t ad9625_cs_1
Definition axi_fmcadc5_sync.h:93
int32_t regs
Definition axi_fmcadc5_sync.h:91