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 |
|
|
//
|
39 |
|
|
#include <stdio.h>
|
40 |
|
|
#include <stdlib.h>
|
41 |
|
|
#include <strings.h>
|
42 |
|
|
#include <ctype.h>
|
43 |
|
|
#include "regdefs.h"
|
44 |
|
|
|
45 |
|
|
const REGNAME raw_bregs[] = {
|
46 |
|
|
{ R_VERSION, "VERSION" },
|
47 |
|
|
{ R_ICONTROL, "ICONTROL" },
|
48 |
|
|
{ R_ICONTROL, "INT" },
|
49 |
|
|
{ R_ICONTROL, "PIC" },
|
50 |
|
|
{ R_BUSERR, "BUSERR" },
|
51 |
|
|
{ R_BUSERR, "BUS" },
|
52 |
|
|
{ R_PWCOUNT, "PWRCOUNT" },
|
53 |
|
|
{ R_BTNSW, "BTNSW" },
|
54 |
|
|
{ R_BTNSW, "BTNS" },
|
55 |
|
|
{ R_BTNSW, "BTN" },
|
56 |
|
|
{ R_BTNSW, "SW" },
|
57 |
|
|
{ R_BTNSW, "SWITCHES" },
|
58 |
|
|
{ R_BTNSW, "SWITCH" },
|
59 |
|
|
{ R_LEDS, "LEDS" },
|
60 |
|
|
{ R_LEDS, "LED" },
|
61 |
|
|
{ R_UART_SETUP, "UARTSETUP" },
|
62 |
|
|
{ R_UART_SETUP, "UART" },
|
63 |
|
|
{ R_UART_SETUP, "AUXSETUP" },
|
64 |
|
|
{ R_UART_SETUP, "AUX" },
|
65 |
|
|
{ R_GPS_SETUP, "GPSSETUP" },
|
66 |
|
|
{ R_GPS_SETUP, "GPSUART" },
|
67 |
|
|
{ R_CLR0, "CLRLED0" },
|
68 |
|
|
{ R_CLR1, "CLRLED1" },
|
69 |
|
|
{ R_CLR2, "CLRLED2" },
|
70 |
|
|
{ R_CLR3, "CLRLED3" },
|
71 |
|
|
{ R_CLR0, "CLR0" },
|
72 |
|
|
{ R_CLR1, "CLR1" },
|
73 |
|
|
{ R_CLR2, "CLR2" },
|
74 |
|
|
{ R_CLR3, "CLR3" },
|
75 |
|
|
{ R_DATE, "DATE" },
|
76 |
|
|
{ R_GPIO, "GPIO" },
|
77 |
|
|
{ R_UARTRX, "AUXRX" },
|
78 |
|
|
{ R_UARTRX, "RX" },
|
79 |
|
|
{ R_UARTTX, "AUXTX" },
|
80 |
|
|
{ R_UARTTX, "TX" },
|
81 |
|
|
//
|
82 |
|
|
{ R_GPSRX, "GPSRX" },
|
83 |
|
|
{ R_GPSTX, "GPSTX" },
|
84 |
|
|
// Scope registers--these scopes may or may not be present depending
|
85 |
|
|
// upon your current configuration.
|
86 |
6 |
dgisselq |
{ R_QSCOPE, "SCOPE" }, // Scope zero
|
87 |
4 |
dgisselq |
{ R_QSCOPE, "SCOP" },
|
88 |
|
|
{ R_QSCOPED, "SCOPDATA" },
|
89 |
|
|
{ R_QSCOPED, "SCDATA" },
|
90 |
|
|
{ R_QSCOPED, "SCOPED" },
|
91 |
|
|
{ R_QSCOPED, "SCOPD" },
|
92 |
6 |
dgisselq |
{ R_GPSCOPE, "GPSSCOPE" }, // Scope one
|
93 |
4 |
dgisselq |
{ R_GPSCOPE, "GPSSCOP" },
|
94 |
|
|
{ R_GPSCOPED, "GPSSCDATA" },
|
95 |
|
|
{ R_GPSCOPED, "GPSSCD" },
|
96 |
|
|
{ R_GPSCOPED, "GPSDATA" },
|
97 |
6 |
dgisselq |
{ R_RAMSCOPE, "RAMSCOPE" }, // Scope two
|
98 |
4 |
dgisselq |
{ R_RAMSCOPE, "RAMSCOP" },
|
99 |
|
|
{ R_RAMSCOPED, "RAMSCOPD" },
|
100 |
6 |
dgisselq |
{ R_NETSCOPE, "NETSCOPE" }, // Scope three
|
101 |
|
|
{ R_NETSCOPE, "NETSCOP" },
|
102 |
|
|
{ R_NETSCOPED, "NETSCOPED" },
|
103 |
|
|
{ R_NETSCOPED, "NETSCOPD" },
|
104 |
4 |
dgisselq |
// RTC registers
|
105 |
|
|
{ R_CLOCK, "CLOCK" },
|
106 |
|
|
{ R_CLOCK, "TIME" },
|
107 |
|
|
{ R_TIMER, "TIMER" },
|
108 |
|
|
{ R_STOPWATCH, "STOPWACH" },
|
109 |
|
|
{ R_STOPWATCH, "STOPWATCH" },
|
110 |
|
|
{ R_CKALARM, "CKALARM" },
|
111 |
|
|
{ R_CKALARM, "ALARM" },
|
112 |
|
|
// SDCard registers
|
113 |
|
|
{ R_SDCARD_CTRL, "SDCARD" },
|
114 |
|
|
{ R_SDCARD_DATA, "SDDATA" },
|
115 |
|
|
{ R_SDCARD_FIFOA, "SDFIF0" },
|
116 |
|
|
{ R_SDCARD_FIFOA, "SDFIFO" },
|
117 |
|
|
{ R_SDCARD_FIFOA, "SDFIFA" },
|
118 |
|
|
{ R_SDCARD_FIFOA, "SDFIFO0" },
|
119 |
|
|
{ R_SDCARD_FIFOA, "SDFIFOA" },
|
120 |
|
|
{ R_SDCARD_FIFOB, "SDFIF1" },
|
121 |
|
|
{ R_SDCARD_FIFOB, "SDFIFB" },
|
122 |
|
|
{ R_SDCARD_FIFOB, "SDFIFO1" },
|
123 |
|
|
{ R_SDCARD_FIFOB, "SDFIFOB" },
|
124 |
|
|
// GPS control loop control
|
125 |
|
|
{ R_GPS_ALPHA, "ALPHA" },
|
126 |
|
|
{ R_GPS_BETA, "BETA" },
|
127 |
|
|
{ R_GPS_GAMMA, "GAMMA" },
|
128 |
|
|
{ R_GPS_STEP, "GPSSTEP" },
|
129 |
|
|
// Network packet interface (not built yet)
|
130 |
|
|
// OLED Control
|
131 |
|
|
{ R_OLED_CMD, "OLED" },
|
132 |
|
|
{ R_OLED_CDATA, "OLEDCA" },
|
133 |
|
|
{ R_OLED_CDATB, "OLEDCB" },
|
134 |
|
|
{ R_OLED_DATA, "ODATA" },
|
135 |
|
|
// Unused section
|
136 |
|
|
// GPS Testbench
|
137 |
|
|
{ R_GPSTB_FREQ, "GPSFREQ" },
|
138 |
|
|
{ R_GPSTB_JUMP, "GPSJUMP" },
|
139 |
|
|
{ R_GPSTB_ERRHI, "ERRHI" },
|
140 |
|
|
{ R_GPSTB_ERRLO, "ERRLO" },
|
141 |
|
|
{ R_GPSTB_COUNTHI, "CNTHI" },
|
142 |
|
|
{ R_GPSTB_COUNTLO, "CNTLO" },
|
143 |
|
|
{ R_GPSTB_STEPHI, "STEPHI" },
|
144 |
|
|
{ R_GPSTB_STEPLO, "STEPLO" },
|
145 |
|
|
//
|
146 |
|
|
// Ethernet MDIO registers
|
147 |
|
|
{ R_MDIO_BMCR, "BMCR" },
|
148 |
|
|
{ R_MDIO_BMSR, "BMSR" },
|
149 |
|
|
{ R_MDIO_PHYIDR1, "PHYIDR1" },
|
150 |
|
|
{ R_MDIO_PHYIDR2, "PHYIDR2" },
|
151 |
|
|
{ R_MDIO_ANAR, "ANAR" },
|
152 |
|
|
{ R_MDIO_ANLPAR, "ANLPAR" },
|
153 |
|
|
{ R_MDIO_ANER, "ANER" },
|
154 |
|
|
{ R_MDIO_ANNPTR, "ANNPTR" },
|
155 |
|
|
{ R_MDIO_PHYSTS, "PHYSTS" },
|
156 |
|
|
{ R_MDIO_FCSCR, "FCSCR" },
|
157 |
|
|
{ R_MDIO_RECR, "RECR" },
|
158 |
|
|
{ R_MDIO_PCSR, "PCSR" },
|
159 |
|
|
{ R_MDIO_RBR, "RBR" },
|
160 |
|
|
{ R_MDIO_LEDCR, "LEDCR" },
|
161 |
|
|
{ R_MDIO_PHYCR, "PHYCR" },
|
162 |
|
|
{ R_MDIO_BTSCR, "BTSCR" },
|
163 |
|
|
{ R_MDIO_CDCTRL, "CDCTRL" },
|
164 |
|
|
{ R_MDIO_EDCR, "EDCR" },
|
165 |
|
|
//
|
166 |
|
|
// Flash configuration register names
|
167 |
|
|
{ R_QSPI_EREG, "QSPIEREG" },
|
168 |
|
|
{ R_QSPI_EREG, "QSPIE" },
|
169 |
|
|
{ R_QSPI_STAT, "QSPIS" },
|
170 |
|
|
{ R_QSPI_NVCONF,"QSPINVCONF" },
|
171 |
|
|
{ R_QSPI_NVCONF,"QSPINV" },
|
172 |
|
|
{ R_QSPI_VCONF, "QSPIVCONF" },
|
173 |
|
|
{ R_QSPI_VCONF, "QSPIV" },
|
174 |
|
|
{ R_QSPI_EVCONF,"QSPIEVCONF" },
|
175 |
|
|
{ R_QSPI_EVCONF,"QSPIEV" },
|
176 |
|
|
{ R_QSPI_LOCK, "QSPILOCK" },
|
177 |
|
|
{ R_QSPI_FLAG, "QSPIFLAG" },
|
178 |
|
|
{ R_QSPI_ID, "QSPIID" },
|
179 |
|
|
{ R_QSPI_IDA, "QSPIIDA" },
|
180 |
|
|
{ R_QSPI_IDB, "QSPIIDB" },
|
181 |
|
|
{ R_QSPI_IDC, "QSPIIDC" },
|
182 |
|
|
{ R_QSPI_IDD, "QSPIIDD" },
|
183 |
|
|
{ R_QSPI_OTPWP, "QSPIOTPWP" },
|
184 |
|
|
{ R_QSPI_OTP, "QSPIOTP" },
|
185 |
|
|
//
|
186 |
|
|
{ R_CFG_CRC, "FPGACRC" },
|
187 |
|
|
{ R_CFG_FAR, "FPGAFAR" },
|
188 |
|
|
{ R_CFG_FDRI, "FPGAFDRI" },
|
189 |
|
|
{ R_CFG_FDRO, "FPGAFDRO" },
|
190 |
|
|
{ R_CFG_CMD, "FPGACMD" },
|
191 |
|
|
{ R_CFG_CTL0, "FPGACTL0" },
|
192 |
|
|
{ R_CFG_MASK, "FPGAMASK" },
|
193 |
|
|
{ R_CFG_STAT, "FPGASTAT" },
|
194 |
|
|
{ R_CFG_LOUT, "FPGALOUT" },
|
195 |
|
|
{ R_CFG_COR0, "FPGACOR0" },
|
196 |
|
|
{ R_CFG_MFWR, "FPGAMFWR" },
|
197 |
|
|
{ R_CFG_CBC, "FPGACBC" },
|
198 |
|
|
{ R_CFG_IDCODE, "FPGAIDCODE" },
|
199 |
|
|
{ R_CFG_AXSS, "FPGAAXSS" },
|
200 |
|
|
{ R_CFG_COR0, "FPGACOR1" },
|
201 |
|
|
{ R_CFG_WBSTAR, "WBSTAR" },
|
202 |
|
|
{ R_CFG_TIMER, "CFGTIMER" },
|
203 |
|
|
{ R_CFG_BOOTSTS,"BOOTSTS" },
|
204 |
|
|
{ R_CFG_CTL1, "FPGACTL1" },
|
205 |
|
|
{ R_CFG_BSPI, "FPGABSPI" },
|
206 |
|
|
//
|
207 |
|
|
{ R_ZIPCTRL, "ZIPCTRL" },
|
208 |
|
|
{ R_ZIPCTRL, "ZIPC" },
|
209 |
|
|
{ R_ZIPCTRL, "CPU" },
|
210 |
|
|
{ R_ZIPCTRL, "CPUC" },
|
211 |
|
|
{ R_ZIPDATA, "ZIPDATA" },
|
212 |
|
|
{ R_ZIPDATA, "ZIPD" },
|
213 |
|
|
{ R_ZIPDATA, "CPUD" },
|
214 |
|
|
{ EQSPIFLASH, "FLASH" },
|
215 |
|
|
{ MEMBASE, "BLKRAM" },
|
216 |
|
|
{ MEMBASE, "MEM" },
|
217 |
|
|
{ RAMBASE, "DDR3SDRAM" },
|
218 |
|
|
{ RAMBASE, "SDRAM" },
|
219 |
|
|
{ RAMBASE, "RAM" }
|
220 |
|
|
};
|
221 |
|
|
|
222 |
|
|
#define RAW_NREGS (sizeof(raw_bregs)/sizeof(bregs[0]))
|
223 |
|
|
|
224 |
|
|
const REGNAME *bregs = raw_bregs;
|
225 |
|
|
const int NREGS = RAW_NREGS;
|
226 |
|
|
|
227 |
|
|
unsigned addrdecode(const char *v) {
|
228 |
|
|
if (isalpha(v[0])) {
|
229 |
|
|
for(int i=0; i<NREGS; i++)
|
230 |
|
|
if (strcasecmp(v, bregs[i].m_name)==0)
|
231 |
|
|
return bregs[i].m_addr;
|
232 |
|
|
fprintf(stderr, "Unknown register: %s\n", v);
|
233 |
|
|
exit(-2);
|
234 |
|
|
} else
|
235 |
|
|
return strtoul(v, NULL, 0);
|
236 |
|
|
}
|
237 |
|
|
|
238 |
|
|
const char *addrname(const unsigned v) {
|
239 |
|
|
for(int i=0; i<NREGS; i++)
|
240 |
|
|
if (bregs[i].m_addr == v)
|
241 |
|
|
return bregs[i].m_name;
|
242 |
|
|
return NULL;
|
243 |
|
|
}
|
244 |
|
|
|