1 |
4 |
dgisselq |
////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
//
|
3 |
|
|
// Filename: regdefs.h
|
4 |
|
|
//
|
5 |
|
|
// Project: OpenArty, an entirely open SoC based upon the Arty platform
|
6 |
|
|
//
|
7 |
|
|
// Purpose:
|
8 |
|
|
//
|
9 |
|
|
// Creator: Dan Gisselquist, Ph.D.
|
10 |
|
|
// Gisselquist Technology, LLC
|
11 |
|
|
//
|
12 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
13 |
|
|
//
|
14 |
51 |
dgisselq |
// Copyright (C) 2015-2017, Gisselquist Technology, LLC
|
15 |
4 |
dgisselq |
//
|
16 |
|
|
// This program is free software (firmware): you can redistribute it and/or
|
17 |
|
|
// modify it under the terms of the GNU General Public License as published
|
18 |
|
|
// by the Free Software Foundation, either version 3 of the License, or (at
|
19 |
|
|
// your option) any later version.
|
20 |
|
|
//
|
21 |
|
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
22 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
23 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
24 |
|
|
// for more details.
|
25 |
|
|
//
|
26 |
|
|
// You should have received a copy of the GNU General Public License along
|
27 |
51 |
dgisselq |
// with this program. (It's in the $(ROOT)/doc directory. Run make with no
|
28 |
4 |
dgisselq |
// target there if the PDF file isn't present.) If not, see
|
29 |
|
|
// <http://www.gnu.org/licenses/> for a copy.
|
30 |
|
|
//
|
31 |
|
|
// License: GPL, v3, as defined and found on www.gnu.org,
|
32 |
|
|
// http://www.gnu.org/licenses/gpl.html
|
33 |
|
|
//
|
34 |
|
|
//
|
35 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
36 |
|
|
//
|
37 |
|
|
//
|
38 |
|
|
#ifndef REGDEFS_H
|
39 |
|
|
#define REGDEFS_H
|
40 |
|
|
|
41 |
33 |
dgisselq |
#define CLOCKFREQ_HZ 81250000
|
42 |
51 |
dgisselq |
#define R_VERSION 0x00000400
|
43 |
|
|
#define R_ICONTROL 0x00000404
|
44 |
|
|
#define R_BUSERR 0x00000408
|
45 |
|
|
#define R_PWCOUNT 0x0000040c
|
46 |
|
|
#define R_BTNSW 0x00000410
|
47 |
|
|
#define R_LEDS 0x00000414
|
48 |
|
|
#define R_DATE 0x00000418
|
49 |
|
|
#define R_GPIO 0x0000041c
|
50 |
|
|
#define R_CLR0 0x00000420
|
51 |
|
|
#define R_CLR1 0x00000424
|
52 |
|
|
#define R_CLR2 0x00000428
|
53 |
|
|
#define R_CLR3 0x0000042c
|
54 |
|
|
#define R_IOTIMES 0x00000430
|
55 |
|
|
#define R_IOSUBSEC 0x00000434
|
56 |
|
|
#define R_IOTIMSTEP 0x00000438
|
57 |
|
|
|
58 |
4 |
dgisselq |
// WB Scope registers
|
59 |
51 |
dgisselq |
#define R_QSCOPE 0x00000480 // Scope #0: Quad SPI scope ctrl
|
60 |
|
|
#define R_QSCOPED 0x00000484 // and data
|
61 |
|
|
#define R_CPUSCOPE 0x00000480 // CPU scope (if so configured)
|
62 |
|
|
#define R_CPUSCOPED 0x00000484 // and data
|
63 |
|
|
#define R_GPSCOPE 0x00000488 // Scope #1: GPS config scope control
|
64 |
|
|
#define R_GPSCOPED 0x0000048c // and data
|
65 |
|
|
#define R_CFGSCOPE 0x00000488 // ICAPE2 configuration scop control
|
66 |
|
|
#define R_CFGSCOPED 0x0000048c // and data
|
67 |
|
|
#define R_BUSSCOPE 0x00000488 // WBUBUS scope control
|
68 |
|
|
#define R_BUSSCOPED 0x0000048c // and data
|
69 |
|
|
#define R_RAMSCOPE 0x00000490 // Scope #2: DDR3 SDRAM Scope
|
70 |
|
|
#define R_RAMSCOPED 0x00000494 //
|
71 |
|
|
#define R_NETSCOPE 0x00000498 // Scope #3: Ethernet debug scope
|
72 |
|
|
#define R_NETSCOPED 0x0000049c //
|
73 |
4 |
dgisselq |
// RTC Clock Registers
|
74 |
51 |
dgisselq |
#define R_CLOCK 0x000004a0
|
75 |
|
|
#define R_TIMER 0x000004a4
|
76 |
|
|
#define R_STOPWATCH 0x000004a8
|
77 |
|
|
#define R_CKALARM 0x000004ac
|
78 |
|
|
// OLED
|
79 |
|
|
#define R_OLED_CMD 0x000004b0
|
80 |
|
|
#define R_OLED_CDATA 0x000004b4
|
81 |
|
|
#define R_OLED_CDATB 0x000004b8
|
82 |
|
|
#define R_OLED_DATA 0x000004bc
|
83 |
|
|
// WBUART - AUX
|
84 |
|
|
#define R_UART_SETUP 0x000004c0
|
85 |
|
|
#define R_UART_FIFO 0x000004c4
|
86 |
|
|
#define R_UARTRX 0x000004c8
|
87 |
|
|
#define R_UARTTX 0x000004cc
|
88 |
|
|
// WBUART - GPS
|
89 |
|
|
#define R_GPS_SETUP 0x000004d0
|
90 |
|
|
#define R_GPS_FIFO 0x000004d4
|
91 |
|
|
#define R_GPSRX 0x000004d8
|
92 |
|
|
#define R_GPSTX 0x000004dc
|
93 |
4 |
dgisselq |
// SD Card Control
|
94 |
51 |
dgisselq |
#define R_SDCARD_CTRL 0x000004e0
|
95 |
|
|
#define R_SDCARD_DATA 0x000004e4
|
96 |
|
|
#define R_SDCARD_FIFOA 0x000004e8
|
97 |
|
|
#define R_SDCARD_FIFOB 0x000004ec
|
98 |
|
|
// Unused, 4x positions
|
99 |
|
|
// Unused 0x000004f0
|
100 |
|
|
// Unused 0x000004f4
|
101 |
|
|
// Unused 0x000004f8
|
102 |
|
|
// Unused 0x000004fc
|
103 |
|
|
// GPS Loop control
|
104 |
|
|
#define R_GPS_ALPHA 0x00000500
|
105 |
|
|
#define R_GPS_BETA 0x00000504
|
106 |
|
|
#define R_GPS_GAMMA 0x00000508
|
107 |
|
|
#define R_GPS_STEP 0x0000050c
|
108 |
|
|
// Unused, 4x positions
|
109 |
|
|
// Unused 0x00000510
|
110 |
|
|
// Unused 0x00000514
|
111 |
|
|
// Unused 0x00000518
|
112 |
|
|
// Unused 0x0000051c
|
113 |
|
|
// GPS Testbench:
|
114 |
|
|
#define R_GPSTB_FREQ 0x00000520
|
115 |
|
|
#define R_GPSTB_JUMP 0x00000524
|
116 |
|
|
#define R_GPSTB_ERRHI 0x00000528
|
117 |
|
|
#define R_GPSTB_ERRLO 0x0000052c
|
118 |
|
|
#define R_GPSTB_COUNTHI 0x00000530
|
119 |
|
|
#define R_GPSTB_COUNTLO 0x00000534
|
120 |
|
|
#define R_GPSTB_STEPHI 0x00000538
|
121 |
|
|
#define R_GPSTB_STEPLO 0x0000053c
|
122 |
|
|
// Network packet interface
|
123 |
|
|
#define R_NET_RXCMD 0x00000540
|
124 |
|
|
#define R_NET_TXCMD 0x00000544
|
125 |
|
|
#define R_NET_MACHI 0x00000548
|
126 |
|
|
#define R_NET_MACLO 0x0000054c
|
127 |
|
|
#define R_NET_RXMISS 0x00000550
|
128 |
|
|
#define R_NET_RXERR 0x00000554
|
129 |
|
|
#define R_NET_RXCRC 0x00000558
|
130 |
|
|
#define R_NET_TXCOL 0x0000055c
|
131 |
|
|
// Unused: 0x560-0x57f
|
132 |
4 |
dgisselq |
// Ethernet configuration (MDIO) port: 0x1a0-0x1bf
|
133 |
51 |
dgisselq |
#define R_MDIO_BMCR 0x00000580
|
134 |
|
|
#define R_MDIO_BMSR 0x00000584
|
135 |
|
|
#define R_MDIO_PHYIDR1 0x00000588
|
136 |
|
|
#define R_MDIO_PHYIDR2 0x0000058c
|
137 |
|
|
#define R_MDIO_ANAR 0x00000590
|
138 |
|
|
#define R_MDIO_ANLPAR 0x00000594
|
139 |
|
|
// #define R_MDIO_ANLPARNP 0x00000594 // (duplicate reg)
|
140 |
|
|
#define R_MDIO_ANER 0x00000598
|
141 |
|
|
#define R_MDIO_ANNPTR 0x0000059c
|
142 |
|
|
// 8-15
|
143 |
|
|
#define R_MDIO_PHYSTS 0x000005c0
|
144 |
|
|
#define R_MDIO_FCSCR 0x000005d0
|
145 |
|
|
#define R_MDIO_RECR 0x000005d4
|
146 |
|
|
#define R_MDIO_PCSR 0x000005d8
|
147 |
|
|
#define R_MDIO_RBR 0x000005dc
|
148 |
|
|
#define R_MDIO_LEDCR 0x000005d0
|
149 |
|
|
#define R_MDIO_PHYCR 0x000005d4
|
150 |
|
|
#define R_MDIO_BTSCR 0x000005d8
|
151 |
|
|
#define R_MDIO_CDCTRL 0x000005dc
|
152 |
|
|
#define R_MDIO_EDCR 0x000005e4
|
153 |
|
|
//
|
154 |
4 |
dgisselq |
// Flash: 0x1c0-0x1df
|
155 |
51 |
dgisselq |
#define R_QSPI_EREG 0x00000600
|
156 |
|
|
#define R_QSPI_STAT 0x00000604
|
157 |
|
|
#define R_QSPI_NVCONF 0x00000608
|
158 |
|
|
#define R_QSPI_VCONF 0x0000060c
|
159 |
|
|
#define R_QSPI_EVCONF 0x00000610
|
160 |
|
|
#define R_QSPI_LOCK 0x00000614
|
161 |
|
|
#define R_QSPI_FLAG 0x00000618
|
162 |
|
|
// #define R_QSPI_ASYNC 0x0000061c
|
163 |
|
|
#define R_QSPI_ID 0x00000620
|
164 |
|
|
#define R_QSPI_IDA 0x00000624
|
165 |
|
|
#define R_QSPI_IDB 0x00000628
|
166 |
|
|
#define R_QSPI_IDC 0x0000062c
|
167 |
|
|
#define R_QSPI_IDD 0x00000630
|
168 |
4 |
dgisselq |
//
|
169 |
51 |
dgisselq |
#define R_QSPI_OTPWP 0x0000063c
|
170 |
|
|
#define R_QSPI_OTP 0x00000640
|
171 |
4 |
dgisselq |
|
172 |
51 |
dgisselq |
// FPGA CONFIG REGISTERS: 0x4e0-0x4ff
|
173 |
|
|
#define R_CFG_CRC 0x00000680
|
174 |
|
|
#define R_CFG_FAR 0x00000684
|
175 |
|
|
#define R_CFG_FDRI 0x00000688
|
176 |
|
|
#define R_CFG_FDRO 0x0000068c
|
177 |
|
|
#define R_CFG_CMD 0x00000690
|
178 |
|
|
#define R_CFG_CTL0 0x00000694
|
179 |
|
|
#define R_CFG_MASK 0x00000698
|
180 |
|
|
#define R_CFG_STAT 0x0000069c
|
181 |
|
|
#define R_CFG_LOUT 0x000006a0
|
182 |
|
|
#define R_CFG_COR0 0x000006a4
|
183 |
|
|
#define R_CFG_MFWR 0x000006a8
|
184 |
|
|
#define R_CFG_CBC 0x000006ac
|
185 |
|
|
#define R_CFG_IDCODE 0x000006b0
|
186 |
|
|
#define R_CFG_AXSS 0x000006b4
|
187 |
|
|
#define R_CFG_COR1 0x000006b8
|
188 |
|
|
#define R_CFG_WBSTAR 0x000006c0
|
189 |
|
|
#define R_CFG_TIMER 0x000006c4
|
190 |
|
|
#define R_CFG_BOOTSTS 0x000006d8
|
191 |
|
|
#define R_CFG_CTL1 0x000006e0
|
192 |
|
|
#define R_CFG_BSPI 0x000006fc
|
193 |
30 |
dgisselq |
// Network buffer space
|
194 |
51 |
dgisselq |
#define R_NET_RXBUF 0x00002000
|
195 |
|
|
#define R_NET_TXBUF 0x00003000
|
196 |
4 |
dgisselq |
// Block RAM memory space
|
197 |
51 |
dgisselq |
#define MEMBASE 0x00020000
|
198 |
|
|
#define MEMLEN 0x00020000
|
199 |
4 |
dgisselq |
// Flash memory space
|
200 |
51 |
dgisselq |
#define EQSPIFLASH 0x01000000
|
201 |
|
|
#define RESET_ADDRESS 0x01380000
|
202 |
|
|
// #define FLASHWORDS (1<<22)
|
203 |
|
|
#define FLASHLEN (1<<24)
|
204 |
4 |
dgisselq |
// DDR3 SDRAM memory space
|
205 |
51 |
dgisselq |
#define RAMBASE 0x10000000
|
206 |
6 |
dgisselq |
#define SDRAMBASE RAMBASE
|
207 |
51 |
dgisselq |
// #define RAMWORDS (1<<26)
|
208 |
|
|
#define RAMLEN (1<<28)
|
209 |
4 |
dgisselq |
// Zip CPU Control and Debug registers
|
210 |
51 |
dgisselq |
#define R_ZIPCTRL 0x20000000
|
211 |
|
|
#define R_ZIPDATA 0x20000004
|
212 |
4 |
dgisselq |
|
213 |
|
|
// Interrupt control constants
|
214 |
|
|
#define GIE 0x80000000 // Enable all interrupts
|
215 |
|
|
#define ISPIF_EN 0x82000200 // Enable all, enable QSPI, clear QSPI
|
216 |
|
|
#define ISPIF_DIS 0x02000200 // Disable all, disable QSPI
|
217 |
|
|
#define ISPIF_CLR 0x00000200 // Clear QSPI interrupt
|
218 |
|
|
#define SCOPEN 0x84000400 // Enable WBSCOPE interrupts
|
219 |
|
|
|
220 |
|
|
// Flash control constants
|
221 |
14 |
dgisselq |
#define ERASEFLAG 0xc00001be
|
222 |
|
|
#define DISABLEWP 0x40000000
|
223 |
|
|
#define ENABLEWP 0x00000000
|
224 |
4 |
dgisselq |
|
225 |
14 |
dgisselq |
#define SZPAGEB 256
|
226 |
|
|
#define PGLENB 256
|
227 |
|
|
#define SZPAGEW 64
|
228 |
|
|
#define PGLENW 64
|
229 |
4 |
dgisselq |
#define NPAGES 256
|
230 |
14 |
dgisselq |
#define SECTORSZB (NPAGES * SZPAGEB) // In bytes, not words!!
|
231 |
|
|
#define SECTORSZW (NPAGES * SZPAGEW) // In words
|
232 |
4 |
dgisselq |
#define NSECTORS 64
|
233 |
51 |
dgisselq |
#define SECTOROF(A) ((A) & (-1<<16))
|
234 |
|
|
#define SUBSECTOROF(A) ((A) & (-1<<12))
|
235 |
|
|
#define PAGEOF(A) ((A) & (-1<<8))
|
236 |
4 |
dgisselq |
|
237 |
|
|
#define CPU_GO 0x0000
|
238 |
|
|
#define CPU_RESET 0x0040
|
239 |
|
|
#define CPU_INT 0x0080
|
240 |
|
|
#define CPU_STEP 0x0100
|
241 |
|
|
#define CPU_STALL 0x0200
|
242 |
|
|
#define CPU_HALT 0x0400
|
243 |
|
|
#define CPU_CLRCACHE 0x0800
|
244 |
30 |
dgisselq |
#define CPU_sR0 0x0000
|
245 |
|
|
#define CPU_sSP 0x000d
|
246 |
|
|
#define CPU_sCC 0x000e
|
247 |
|
|
#define CPU_sPC 0x000f
|
248 |
|
|
#define CPU_uR0 0x0010
|
249 |
|
|
#define CPU_uSP 0x001d
|
250 |
|
|
#define CPU_uCC 0x001e
|
251 |
|
|
#define CPU_uPC 0x001f
|
252 |
4 |
dgisselq |
|
253 |
|
|
#define SCOPE_NO_RESET 0x80000000
|
254 |
|
|
#define SCOPE_TRIGGER (0x08000000|SCOPE_NO_RESET)
|
255 |
30 |
dgisselq |
#define SCOPE_MANUAL SCOPE_TRIGGER
|
256 |
4 |
dgisselq |
#define SCOPE_DISABLE (0x04000000)
|
257 |
|
|
|
258 |
|
|
typedef struct {
|
259 |
|
|
unsigned m_addr;
|
260 |
|
|
const char *m_name;
|
261 |
|
|
} REGNAME;
|
262 |
|
|
|
263 |
|
|
extern const REGNAME *bregs;
|
264 |
|
|
extern const int NREGS;
|
265 |
|
|
// #define NREGS (sizeof(bregs)/sizeof(bregs[0]))
|
266 |
|
|
|
267 |
|
|
extern unsigned addrdecode(const char *v);
|
268 |
|
|
extern const char *addrname(const unsigned v);
|
269 |
|
|
|
270 |
|
|
#include "ttybus.h"
|
271 |
|
|
// #include "portbus.h"
|
272 |
|
|
|
273 |
|
|
typedef TTYBUS FPGA;
|
274 |
|
|
|
275 |
|
|
#endif
|