Statistics
| Branch: | Tag: | Revision:

root / host / utils / usrp_e_regs.hpp @ cd84e9db

History | View | Annotate | Download (7.58 KB)

1

    
2

    
3
////////////////////////////////////////////////////////////////
4
//
5
//         Memory map for embedded wishbone bus
6
//
7
////////////////////////////////////////////////////////////////
8

    
9
// All addresses are byte addresses.  All accesses are word (16-bit) accesses.
10
//  This means that address bit 0 is usually 0.
11
//  There are 11 bits of address for the control.
12

    
13
#ifndef __USRP_E_REGS_H
14
#define __USRP_E_REGS_H
15

    
16
/////////////////////////////////////////////////////
17
// Slave pointers
18

    
19
#define UE_REG_SLAVE(n) ((n)<<7)
20
#define UE_REG_SR_ADDR(n) ((UE_REG_SLAVE(5)) + (4*(n)))
21

    
22
/////////////////////////////////////////////////////
23
// Slave 0 -- Misc Regs
24

    
25
#define UE_REG_MISC_BASE UE_REG_SLAVE(0)
26

    
27
#define UE_REG_MISC_LED        UE_REG_MISC_BASE + 0
28
#define UE_REG_MISC_SW         UE_REG_MISC_BASE + 2
29
#define UE_REG_MISC_CGEN_CTRL  UE_REG_MISC_BASE + 4
30
#define UE_REG_MISC_CGEN_ST    UE_REG_MISC_BASE + 6
31
#define UE_REG_MISC_TEST       UE_REG_MISC_BASE + 8
32
#define UE_REG_MISC_RX_LEN     UE_REG_MISC_BASE + 10
33
#define UE_REG_MISC_TX_LEN     UE_REG_MISC_BASE + 12
34

    
35
/////////////////////////////////////////////////////
36
// Slave 1 -- UART
37
//   CLKDIV is 16 bits, others are only 8
38

    
39
#define UE_REG_UART_BASE UE_REG_SLAVE(1)
40

    
41
#define UE_REG_UART_CLKDIV  UE_REG_UART_BASE + 0
42
#define UE_REG_UART_TXLEVEL UE_REG_UART_BASE + 2
43
#define UE_REG_UART_RXLEVEL UE_REG_UART_BASE + 4
44
#define UE_REG_UART_TXCHAR  UE_REG_UART_BASE + 6
45
#define UE_REG_UART_RXCHAR  UE_REG_UART_BASE + 8
46

    
47
/////////////////////////////////////////////////////
48
// Slave 2 -- SPI Core
49
//   This should be accessed through the IOCTL
50
//   Users should not touch directly
51

    
52
#define UE_REG_SPI_BASE UE_REG_SLAVE(2)
53

    
54
//spi slave constants
55
#define UE_SPI_SS_AD9522    (1 << 3)
56
#define UE_SPI_SS_AD9862    (1 << 2)
57
#define UE_SPI_SS_TX_DB     (1 << 1)
58
#define UE_SPI_SS_RX_DB     (1 << 0)
59

    
60
////////////////////////////////////////////////
61
// Slave 3 -- I2C Core
62
//   This should be accessed through the IOCTL
63
//   Users should not touch directly
64

    
65
#define UE_REG_I2C_BASE UE_REG_SLAVE(3)
66

    
67

    
68
////////////////////////////////////////////////
69
// Slave 4 -- GPIO
70

    
71
#define UE_REG_GPIO_BASE UE_REG_SLAVE(4)
72

    
73
#define UE_REG_GPIO_RX_IO      UE_REG_GPIO_BASE + 0
74
#define UE_REG_GPIO_TX_IO      UE_REG_GPIO_BASE + 2
75
#define UE_REG_GPIO_RX_DDR     UE_REG_GPIO_BASE + 4
76
#define UE_REG_GPIO_TX_DDR     UE_REG_GPIO_BASE + 6
77
#define UE_REG_GPIO_RX_SEL     UE_REG_GPIO_BASE + 8
78
#define UE_REG_GPIO_TX_SEL     UE_REG_GPIO_BASE + 10
79
#define UE_REG_GPIO_RX_DBG     UE_REG_GPIO_BASE + 12
80
#define UE_REG_GPIO_TX_DBG     UE_REG_GPIO_BASE + 14
81

    
82
//possible bit values for sel when dbg is 0:
83
#define GPIO_SEL_SW    0 // if pin is an output, set by software in the io reg
84
#define GPIO_SEL_ATR   1 // if pin is an output, set by ATR logic
85

    
86
//possible bit values for sel when dbg is 1:
87
#define GPIO_SEL_DEBUG_0   0 // if pin is an output, debug lines from FPGA fabric
88
#define GPIO_SEL_DEBUG_1   1 // if pin is an output, debug lines from FPGA fabric
89

    
90

    
91
////////////////////////////////////////////////////
92
// Slave 5 -- Settings Bus
93
//
94
// Output-only, no readback, 32 registers total
95
//  Each register must be written 32 bits at a time
96
//  First the address xxx_xx00 and then xxx_xx10
97

    
98
#define UE_REG_SETTINGS_BASE UE_REG_SLAVE(5)
99

    
100
///////////////////////////////////////////////////
101
// Slave 6 -- ATR Controller
102
//   16 regs
103

    
104
#define UE_REG_ATR_BASE  UE_REG_SLAVE(6)
105

    
106
#define        UE_REG_ATR_IDLE_RXSIDE  UE_REG_ATR_BASE + 0
107
#define        UE_REG_ATR_IDLE_TXSIDE  UE_REG_ATR_BASE + 2
108
#define UE_REG_ATR_INTX_RXSIDE  UE_REG_ATR_BASE + 4
109
#define UE_REG_ATR_INTX_TXSIDE  UE_REG_ATR_BASE + 6
110
#define        UE_REG_ATR_INRX_RXSIDE  UE_REG_ATR_BASE + 8
111
#define        UE_REG_ATR_INRX_TXSIDE  UE_REG_ATR_BASE + 10
112
#define        UE_REG_ATR_FULL_RXSIDE  UE_REG_ATR_BASE + 12
113
#define        UE_REG_ATR_FULL_TXSIDE  UE_REG_ATR_BASE + 14
114

    
115
/////////////////////////////////////////////////
116
// DSP RX Regs
117
////////////////////////////////////////////////
118
#define UE_REG_DSP_RX_FREQ         UE_REG_SR_ADDR(0)
119
#define UE_REG_DSP_RX_SCALE_IQ     UE_REG_SR_ADDR(1)  // {scale_i,scale_q}
120
#define UE_REG_DSP_RX_DECIM_RATE   UE_REG_SR_ADDR(2)  // hb and decim rate
121
#define UE_REG_DSP_RX_DCOFFSET_I   UE_REG_SR_ADDR(3) // Bit 31 high sets fixed offset mode, using lower 14 bits, // otherwise it is automatic
122
#define UE_REG_DSP_RX_DCOFFSET_Q   UE_REG_SR_ADDR(4) // Bit 31 high sets fixed offset mode, using lower 14 bits
123
#define UE_REG_DSP_RX_MUX          UE_REG_SR_ADDR(5)
124

    
125
///////////////////////////////////////////////////
126
// VITA RX CTRL regs
127
///////////////////////////////////////////////////
128
// The following 3 are logically a single command register.
129
// They are clocked into the underlying fifo when time_ticks is written.
130
#define UE_REG_CTRL_RX_STREAM_CMD        UE_REG_SR_ADDR(8) // {now, chain, num_samples(30)
131
#define UE_REG_CTRL_RX_TIME_SECS         UE_REG_SR_ADDR(9)
132
#define UE_REG_CTRL_RX_TIME_TICKS        UE_REG_SR_ADDR(10)
133
#define UE_REG_CTRL_RX_CLEAR_OVERRUN     UE_REG_SR_ADDR(11) // write anything to clear overrun
134
#define UE_REG_CTRL_RX_VRT_HEADER        UE_REG_SR_ADDR(12) // word 0 of packet.  FPGA fills in packet counter
135
#define UE_REG_CTRL_RX_VRT_STREAM_ID     UE_REG_SR_ADDR(13) // word 1 of packet.
136
#define UE_REG_CTRL_RX_VRT_TRAILER       UE_REG_SR_ADDR(14)
137
#define UE_REG_CTRL_RX_NSAMPS_PER_PKT    UE_REG_SR_ADDR(15)
138
#define UE_REG_CTRL_RX_NCHANNELS         UE_REG_SR_ADDR(16) // 1 in basic case, up to 4 for vector sources
139

    
140
/////////////////////////////////////////////////
141
// DSP TX Regs
142
////////////////////////////////////////////////
143
#define UE_REG_DSP_TX_FREQ         UE_REG_SR_ADDR(17)
144
#define UE_REG_DSP_TX_SCALE_IQ     UE_REG_SR_ADDR(18) // {scale_i,scale_q}
145
#define UE_REG_DSP_TX_INTERP_RATE  UE_REG_SR_ADDR(19)
146
#define UE_REG_DSP_TX_UNUSED       UE_REG_SR_ADDR(20)
147
#define UE_REG_DSP_TX_MUX          UE_REG_SR_ADDR(21)
148

    
149
/////////////////////////////////////////////////
150
// VITA TX CTRL regs
151
////////////////////////////////////////////////
152
#define UE_REG_CTRL_TX_NCHANNELS         UE_REG_SR_ADDR(24)
153
#define UE_REG_CTRL_TX_CLEAR_UNDERRUN    UE_REG_SR_ADDR(25)
154
#define UE_REG_CTRL_TX_REPORT_SID        UE_REG_SR_ADDR(26)
155
#define UE_REG_CTRL_TX_POLICY            UE_REG_SR_ADDR(27)
156

    
157
#define UE_FLAG_CTRL_TX_POLICY_WAIT          (0x1 << 0)
158
#define UE_FLAG_CTRL_TX_POLICY_NEXT_PACKET   (0x1 << 1)
159
#define UE_FLAG_CTRL_TX_POLICY_NEXT_BURST    (0x1 << 2)
160

    
161
/////////////////////////////////////////////////
162
// VITA49 64 bit time (write only)
163
////////////////////////////////////////////////
164
  /*!
165
   * \brief Time 64 flags
166
   *
167
   * <pre>
168
   *
169
   *    3                   2                   1
170
   *  1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
171
   * +-----------------------------------------------------------+-+-+
172
   * |                                                           |S|P|
173
   * +-----------------------------------------------------------+-+-+
174
   *
175
   * P - PPS edge selection (0=negedge, 1=posedge, default=0)
176
   * S - Source (0=sma, 1=mimo, 0=default)
177
   *
178
   * </pre>
179
   */
180
#define UE_REG_TIME64_SECS  UE_REG_SR_ADDR(28)  // value to set absolute secs to on next PPS
181
#define UE_REG_TIME64_TICKS UE_REG_SR_ADDR(29)  // value to set absolute ticks to on next PPS
182
#define UE_REG_TIME64_FLAGS UE_REG_SR_ADDR(30)  // flags - see chart above
183
#define UE_REG_TIME64_IMM   UE_REG_SR_ADDR(31)  // set immediate (0=latch on next pps, 1=latch immediate, default=0)
184
#define UE_REG_TIME64_TPS   UE_REG_SR_ADDR(31)  // clock ticks per second (counter rollover)
185

    
186
//pps flags (see above)
187
#define UE_FLAG_TIME64_PPS_NEGEDGE (0 << 0)
188
#define UE_FLAG_TIME64_PPS_POSEDGE (1 << 0)
189
#define UE_FLAG_TIME64_PPS_SMA     (0 << 1)
190
#define UE_FLAG_TIME64_PPS_MIMO    (1 << 1)
191

    
192
#define UE_FLAG_TIME64_LATCH_NOW 1
193
#define UE_FLAG_TIME64_LATCH_NEXT_PPS 0
194

    
195
#endif
196