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 |
|
|
// Copyright (C) 2015-2016, Gisselquist Technology, LLC
|
15 |
|
|
//
|
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 |
|
|
// with this program. (It's in the $(ROOT)/doc directory, run make with no
|
28 |
|
|
// 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 |
4 |
dgisselq |
#define R_VERSION 0x00000100
|
43 |
|
|
#define R_ICONTROL 0x00000101
|
44 |
|
|
#define R_BUSERR 0x00000102
|
45 |
|
|
#define R_PWCOUNT 0x00000103
|
46 |
|
|
#define R_BTNSW 0x00000104
|
47 |
|
|
#define R_LEDS 0x00000105
|
48 |
|
|
#define R_UART_SETUP 0x00000106
|
49 |
|
|
#define R_GPS_SETUP 0x00000107
|
50 |
|
|
#define R_CLR0 0x00000108
|
51 |
|
|
#define R_CLR1 0x00000109
|
52 |
|
|
#define R_CLR2 0x0000010a
|
53 |
|
|
#define R_CLR3 0x0000010b
|
54 |
|
|
#define R_DATE 0x0000010c
|
55 |
18 |
dgisselq |
#define R_GPIO 0x0000010d // No GPIO device exists ... yet
|
56 |
4 |
dgisselq |
#define R_UARTRX 0x0000010e
|
57 |
|
|
#define R_UARTTX 0x0000010f
|
58 |
|
|
#define R_GPSRX 0x00000110
|
59 |
|
|
#define R_GPSTX 0x00000111
|
60 |
|
|
// WB Scope registers
|
61 |
30 |
dgisselq |
#define R_QSCOPE 0x00000120 // Scope #0: Quad SPI scope ctrl
|
62 |
4 |
dgisselq |
#define R_QSCOPED 0x00000121 // and data
|
63 |
30 |
dgisselq |
#define R_CPUSCOPE 0x00000120 // CPU scope (if so configured)
|
64 |
|
|
#define R_CPUSCOPED 0x00000121 // and data
|
65 |
|
|
#define R_GPSCOPE 0x00000122 // Scope #1: GPS config scope control
|
66 |
14 |
dgisselq |
#define R_GPSCOPED 0x00000123 // and data
|
67 |
|
|
#define R_CFGSCOPE 0x00000122 // ICAPE2 configuration scop control
|
68 |
|
|
#define R_CFGSCOPED 0x00000123 // and data
|
69 |
30 |
dgisselq |
#define R_BUSSCOPE 0x00000122 // WBUBUS scope control
|
70 |
|
|
#define R_BUSSCOPED 0x00000123 // and data
|
71 |
|
|
#define R_RAMSCOPE 0x00000124 // Scope #2: DDR3 SDRAM Scope
|
72 |
6 |
dgisselq |
#define R_RAMSCOPED 0x00000125 //
|
73 |
30 |
dgisselq |
#define R_NETSCOPE 0x00000126 // Scope #3: Ethernet debug scope
|
74 |
6 |
dgisselq |
#define R_NETSCOPED 0x00000127 //
|
75 |
4 |
dgisselq |
// RTC Clock Registers
|
76 |
|
|
#define R_CLOCK 0x00000128
|
77 |
|
|
#define R_TIMER 0x00000129
|
78 |
|
|
#define R_STOPWATCH 0x0000012a
|
79 |
|
|
#define R_CKALARM 0x0000012b
|
80 |
|
|
// SD Card Control
|
81 |
|
|
#define R_SDCARD_CTRL 0x0000012c
|
82 |
|
|
#define R_SDCARD_DATA 0x0000012d
|
83 |
|
|
#define R_SDCARD_FIFOA 0x0000012e
|
84 |
|
|
#define R_SDCARD_FIFOB 0x0000012f
|
85 |
|
|
// GPS Loop control, 0x0130
|
86 |
|
|
#define R_GPS_ALPHA 0x00000130
|
87 |
|
|
#define R_GPS_BETA 0x00000131
|
88 |
|
|
#define R_GPS_GAMMA 0x00000132
|
89 |
|
|
#define R_GPS_STEP 0x00000133
|
90 |
|
|
// OLED
|
91 |
30 |
dgisselq |
#define R_OLED_CMD 0x00000134
|
92 |
|
|
#define R_OLED_CDATA 0x00000135
|
93 |
|
|
#define R_OLED_CDATB 0x00000136
|
94 |
|
|
#define R_OLED_DATA 0x00000137
|
95 |
|
|
// Network packet interface, 0x0184
|
96 |
|
|
#define R_NET_RXCMD 0x00000138
|
97 |
|
|
#define R_NET_TXCMD 0x00000139
|
98 |
|
|
#define R_NET_MACHI 0x0000013a
|
99 |
|
|
#define R_NET_MACLO 0x0000013b
|
100 |
|
|
#define R_NET_RXMISS 0x0000013c
|
101 |
|
|
#define R_NET_RXERR 0x0000013d
|
102 |
|
|
#define R_NET_RXCRC 0x0000013e
|
103 |
|
|
#define R_NET_TXCOL 0x0000013f
|
104 |
4 |
dgisselq |
// Unused: 0x13c-0x13f
|
105 |
|
|
// GPS Testbench: 0x140-0x147
|
106 |
|
|
#define R_GPSTB_FREQ 0x00000140
|
107 |
|
|
#define R_GPSTB_JUMP 0x00000141
|
108 |
|
|
#define R_GPSTB_ERRHI 0x00000142
|
109 |
|
|
#define R_GPSTB_ERRLO 0x00000143
|
110 |
|
|
#define R_GPSTB_COUNTHI 0x00000144
|
111 |
|
|
#define R_GPSTB_COUNTLO 0x00000145
|
112 |
|
|
#define R_GPSTB_STEPHI 0x00000146
|
113 |
|
|
#define R_GPSTB_STEPLO 0x00000147
|
114 |
|
|
// Unused: 0x148-0x19f
|
115 |
|
|
// Ethernet configuration (MDIO) port: 0x1a0-0x1bf
|
116 |
|
|
#define R_MDIO_BMCR 0x000001a0
|
117 |
|
|
#define R_MDIO_BMSR 0x000001a1
|
118 |
|
|
#define R_MDIO_PHYIDR1 0x000001a2
|
119 |
|
|
#define R_MDIO_PHYIDR2 0x000001a3
|
120 |
|
|
#define R_MDIO_ANAR 0x000001a4
|
121 |
|
|
#define R_MDIO_ANLPAR 0x000001a5
|
122 |
|
|
// #define R_MDIO_ANLPARNP 0x000001a5
|
123 |
|
|
#define R_MDIO_ANER 0x000001a6
|
124 |
|
|
#define R_MDIO_ANNPTR 0x000001a7
|
125 |
|
|
#define R_MDIO_PHYSTS 0x000001b0
|
126 |
|
|
#define R_MDIO_FCSCR 0x000001b4
|
127 |
|
|
#define R_MDIO_RECR 0x000001b5
|
128 |
|
|
#define R_MDIO_PCSR 0x000001b6
|
129 |
|
|
#define R_MDIO_RBR 0x000001b7
|
130 |
|
|
#define R_MDIO_LEDCR 0x000001b8
|
131 |
|
|
#define R_MDIO_PHYCR 0x000001b9
|
132 |
|
|
#define R_MDIO_BTSCR 0x000001ba
|
133 |
|
|
#define R_MDIO_CDCTRL 0x000001bb
|
134 |
|
|
#define R_MDIO_EDCR 0x000001bd
|
135 |
|
|
// Flash: 0x1c0-0x1df
|
136 |
|
|
#define R_QSPI_EREG 0x000001c0
|
137 |
|
|
#define R_QSPI_STAT 0x000001c1
|
138 |
|
|
#define R_QSPI_NVCONF 0x000001c2
|
139 |
|
|
#define R_QSPI_VCONF 0x000001c3
|
140 |
|
|
#define R_QSPI_EVCONF 0x000001c4
|
141 |
|
|
#define R_QSPI_LOCK 0x000001c5
|
142 |
|
|
#define R_QSPI_FLAG 0x000001c6
|
143 |
|
|
// #define R_QSPI_ASYNC 0x000001c7
|
144 |
|
|
#define R_QSPI_ID 0x000001c8
|
145 |
|
|
#define R_QSPI_IDA 0x000001c9
|
146 |
|
|
#define R_QSPI_IDB 0x000001ca
|
147 |
|
|
#define R_QSPI_IDC 0x000001cb
|
148 |
|
|
#define R_QSPI_IDD 0x000001cc
|
149 |
|
|
//
|
150 |
|
|
#define R_QSPI_OTPWP 0x000001cf
|
151 |
|
|
#define R_QSPI_OTP 0x000001d0
|
152 |
|
|
|
153 |
|
|
// FPGA CONFIG REGISTERS: 0x1e0-0x1ff
|
154 |
|
|
#define R_CFG_CRC 0x000001e0
|
155 |
|
|
#define R_CFG_FAR 0x000001e1
|
156 |
|
|
#define R_CFG_FDRI 0x000001e2
|
157 |
|
|
#define R_CFG_FDRO 0x000001e3
|
158 |
|
|
#define R_CFG_CMD 0x000001e4
|
159 |
|
|
#define R_CFG_CTL0 0x000001e5
|
160 |
|
|
#define R_CFG_MASK 0x000001e6
|
161 |
|
|
#define R_CFG_STAT 0x000001e7
|
162 |
|
|
#define R_CFG_LOUT 0x000001e8
|
163 |
|
|
#define R_CFG_COR0 0x000001e9
|
164 |
|
|
#define R_CFG_MFWR 0x000001ea
|
165 |
|
|
#define R_CFG_CBC 0x000001eb
|
166 |
|
|
#define R_CFG_IDCODE 0x000001ec
|
167 |
|
|
#define R_CFG_AXSS 0x000001ed
|
168 |
|
|
#define R_CFG_COR1 0x000001ee
|
169 |
|
|
#define R_CFG_WBSTAR 0x000001f0
|
170 |
|
|
#define R_CFG_TIMER 0x000001f1
|
171 |
|
|
#define R_CFG_BOOTSTS 0x000001f6
|
172 |
|
|
#define R_CFG_CTL1 0x000001f8
|
173 |
|
|
#define R_CFG_BSPI 0x000001ff
|
174 |
30 |
dgisselq |
// Network buffer space
|
175 |
|
|
#define R_NET_RXBUF 0x00000800
|
176 |
|
|
#define R_NET_TXBUF 0x00000c00
|
177 |
4 |
dgisselq |
// Block RAM memory space
|
178 |
|
|
#define MEMBASE 0x00008000
|
179 |
|
|
#define MEMWORDS 0x00008000
|
180 |
|
|
// Flash memory space
|
181 |
|
|
#define EQSPIFLASH 0x00400000
|
182 |
30 |
dgisselq |
#define RESET_ADDRESS 0x004e0000
|
183 |
4 |
dgisselq |
#define FLASHWORDS (1<<22)
|
184 |
|
|
// DDR3 SDRAM memory space
|
185 |
|
|
#define RAMBASE 0x04000000
|
186 |
6 |
dgisselq |
#define SDRAMBASE RAMBASE
|
187 |
4 |
dgisselq |
#define RAMWORDS (1<<26)
|
188 |
|
|
// Zip CPU Control and Debug registers
|
189 |
30 |
dgisselq |
#define R_ZIPCTRL 0x08000000
|
190 |
|
|
#define R_ZIPDATA 0x08000001
|
191 |
4 |
dgisselq |
|
192 |
|
|
// Interrupt control constants
|
193 |
|
|
#define GIE 0x80000000 // Enable all interrupts
|
194 |
|
|
#define ISPIF_EN 0x82000200 // Enable all, enable QSPI, clear QSPI
|
195 |
|
|
#define ISPIF_DIS 0x02000200 // Disable all, disable QSPI
|
196 |
|
|
#define ISPIF_CLR 0x00000200 // Clear QSPI interrupt
|
197 |
|
|
#define SCOPEN 0x84000400 // Enable WBSCOPE interrupts
|
198 |
|
|
|
199 |
|
|
// Flash control constants
|
200 |
14 |
dgisselq |
#define ERASEFLAG 0xc00001be
|
201 |
|
|
#define DISABLEWP 0x40000000
|
202 |
|
|
#define ENABLEWP 0x00000000
|
203 |
4 |
dgisselq |
|
204 |
14 |
dgisselq |
#define SZPAGEB 256
|
205 |
|
|
#define PGLENB 256
|
206 |
|
|
#define SZPAGEW 64
|
207 |
|
|
#define PGLENW 64
|
208 |
4 |
dgisselq |
#define NPAGES 256
|
209 |
14 |
dgisselq |
#define SECTORSZB (NPAGES * SZPAGEB) // In bytes, not words!!
|
210 |
|
|
#define SECTORSZW (NPAGES * SZPAGEW) // In words
|
211 |
4 |
dgisselq |
#define NSECTORS 64
|
212 |
|
|
#define SECTOROF(A) ((A) & (-1<<14))
|
213 |
14 |
dgisselq |
#define SUBSECTOROF(A) ((A) & (-1<<10))
|
214 |
4 |
dgisselq |
#define PAGEOF(A) ((A) & (-1<<6))
|
215 |
|
|
|
216 |
|
|
#define CPU_GO 0x0000
|
217 |
|
|
#define CPU_RESET 0x0040
|
218 |
|
|
#define CPU_INT 0x0080
|
219 |
|
|
#define CPU_STEP 0x0100
|
220 |
|
|
#define CPU_STALL 0x0200
|
221 |
|
|
#define CPU_HALT 0x0400
|
222 |
|
|
#define CPU_CLRCACHE 0x0800
|
223 |
30 |
dgisselq |
#define CPU_sR0 0x0000
|
224 |
|
|
#define CPU_sSP 0x000d
|
225 |
|
|
#define CPU_sCC 0x000e
|
226 |
|
|
#define CPU_sPC 0x000f
|
227 |
|
|
#define CPU_uR0 0x0010
|
228 |
|
|
#define CPU_uSP 0x001d
|
229 |
|
|
#define CPU_uCC 0x001e
|
230 |
|
|
#define CPU_uPC 0x001f
|
231 |
4 |
dgisselq |
|
232 |
|
|
#define SCOPE_NO_RESET 0x80000000
|
233 |
|
|
#define SCOPE_TRIGGER (0x08000000|SCOPE_NO_RESET)
|
234 |
30 |
dgisselq |
#define SCOPE_MANUAL SCOPE_TRIGGER
|
235 |
4 |
dgisselq |
#define SCOPE_DISABLE (0x04000000)
|
236 |
|
|
|
237 |
|
|
typedef struct {
|
238 |
|
|
unsigned m_addr;
|
239 |
|
|
const char *m_name;
|
240 |
|
|
} REGNAME;
|
241 |
|
|
|
242 |
|
|
extern const REGNAME *bregs;
|
243 |
|
|
extern const int NREGS;
|
244 |
|
|
// #define NREGS (sizeof(bregs)/sizeof(bregs[0]))
|
245 |
|
|
|
246 |
|
|
extern unsigned addrdecode(const char *v);
|
247 |
|
|
extern const char *addrname(const unsigned v);
|
248 |
|
|
|
249 |
|
|
#include "ttybus.h"
|
250 |
|
|
// #include "portbus.h"
|
251 |
|
|
|
252 |
|
|
typedef TTYBUS FPGA;
|
253 |
|
|
|
254 |
|
|
#endif
|