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