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