1 |
5 |
dgisselq |
////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
//
|
3 |
|
|
// Filename: regdefs.h
|
4 |
|
|
//
|
5 |
|
|
// Project: XuLA2 board
|
6 |
|
|
//
|
7 |
|
|
// Purpose:
|
8 |
|
|
//
|
9 |
|
|
//
|
10 |
|
|
// Creator: Dan Gisselquist, Ph.D.
|
11 |
|
|
// Gisselquist Technology, LLC
|
12 |
|
|
//
|
13 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
14 |
|
|
//
|
15 |
|
|
// Copyright (C) 2015, Gisselquist Technology, LLC
|
16 |
|
|
//
|
17 |
|
|
// This program is free software (firmware): you can redistribute it and/or
|
18 |
|
|
// modify it under the terms of the GNU General Public License as published
|
19 |
|
|
// by the Free Software Foundation, either version 3 of the License, or (at
|
20 |
|
|
// your option) any later version.
|
21 |
|
|
//
|
22 |
|
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
23 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
24 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
25 |
|
|
// for more details.
|
26 |
|
|
//
|
27 |
|
|
// License: GPL, v3, as defined and found on www.gnu.org,
|
28 |
|
|
// http://www.gnu.org/licenses/gpl.html
|
29 |
|
|
//
|
30 |
|
|
//
|
31 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
32 |
|
|
//
|
33 |
|
|
//
|
34 |
|
|
#ifndef REGDEFS_H
|
35 |
|
|
#define REGDEFS_H
|
36 |
|
|
|
37 |
|
|
// #define R_RESET 0x00000100
|
38 |
|
|
// #define R_STATUS 0x00000101
|
39 |
|
|
// #define R_CONTROL 0x00000101
|
40 |
31 |
dgisselq |
#define R_VERSION 0x00000101
|
41 |
|
|
#define R_ICONTROL 0x00000102
|
42 |
|
|
#define R_BUSERR 0x00000103
|
43 |
|
|
#define R_ITIMER 0x00000104
|
44 |
5 |
dgisselq |
#define R_DATE 0x00000105
|
45 |
|
|
#define R_GPIO 0x00000106
|
46 |
|
|
#define R_UART_CTRL 0x00000107
|
47 |
33 |
dgisselq |
#define R_PWM_DATA 0x00000108
|
48 |
|
|
#define R_PWM_INTERVAL 0x00000109
|
49 |
5 |
dgisselq |
#define R_UART_RX 0x0000010a
|
50 |
|
|
#define R_UART_TX 0x0000010b
|
51 |
|
|
#define R_SPIF_EREG 0x0000010c
|
52 |
|
|
#define R_SPIF_CREG 0x0000010d
|
53 |
|
|
#define R_SPIF_SREG 0x0000010e
|
54 |
|
|
#define R_SPIF_IDREG 0x0000010f
|
55 |
|
|
#define R_CLOCK 0x00000110
|
56 |
|
|
#define R_TIMER 0x00000111
|
57 |
|
|
#define R_STOPWATCH 0x00000112
|
58 |
|
|
#define R_CKALARM 0x00000113
|
59 |
|
|
#define R_CKSPEED 0x00000114
|
60 |
|
|
|
61 |
29 |
dgisselq |
// And because the flash driver needs these constants defined ...
|
62 |
|
|
#define R_QSPI_EREG 0x0000010c
|
63 |
|
|
#define R_QSPI_CREG 0x0000010d
|
64 |
|
|
#define R_QSPI_SREG 0x0000010e
|
65 |
|
|
#define R_QSPI_IDREG 0x0000010f
|
66 |
|
|
|
67 |
5 |
dgisselq |
// GPS registers
|
68 |
|
|
// 0x00000114
|
69 |
|
|
// 0x00000115
|
70 |
|
|
// 0x00000116
|
71 |
|
|
// 0x00000117
|
72 |
|
|
|
73 |
|
|
// WB Scope registers wb_addr[31:3]==30'h23, i.e. 46, 8c, 118
|
74 |
|
|
#define R_QSCOPE 0x00000118 // Quad SPI scope ctrl
|
75 |
|
|
#define R_QSCOPED 0x00000119 // and data
|
76 |
|
|
#define R_CFGSCOPE 0x0000011a // Configuration/ICAPE scope control
|
77 |
|
|
#define R_CFGSCOPED 0x0000011b // and data
|
78 |
|
|
#define R_RAMSCOPE 0x0000011c // SDRAM scope control
|
79 |
|
|
#define R_RAMSCOPED 0x0000011d // and data
|
80 |
|
|
#define R_CPUSCOPE 0x0000011e // SDRAM scope control
|
81 |
|
|
#define R_CPUSCOPED 0x0000011f // and data
|
82 |
|
|
//
|
83 |
|
|
// SD Card
|
84 |
77 |
dgisselq |
#define R_SDCARD_CTRL 0x00000120
|
85 |
|
|
#define R_SDCARD_DATA 0x00000121
|
86 |
|
|
#define R_SDCARD_FIFOA 0x00000122
|
87 |
|
|
#define R_SDCARD_FIFOB 0x00000123
|
88 |
5 |
dgisselq |
//
|
89 |
|
|
// Unused/open
|
90 |
|
|
// #define SOMETHING 0x00000124 -- 0x013f (28 spaces)
|
91 |
|
|
//
|
92 |
|
|
// FPGA CONFIG/ICAP REGISTERS
|
93 |
|
|
#define R_CFG_CRC 0x00000140
|
94 |
|
|
#define R_CFG_FAR_MAJ 0x00000141
|
95 |
|
|
#define R_CFG_FAR_MIN 0x00000142
|
96 |
|
|
#define R_CFG_FDRI 0x00000143
|
97 |
|
|
#define R_CFG_FDRO 0x00000144
|
98 |
|
|
#define R_CFG_CMD 0x00000145
|
99 |
|
|
#define R_CFG_CTL 0x00000146
|
100 |
|
|
#define R_CFG_MASK 0x00000147
|
101 |
|
|
#define R_CFG_STAT 0x00000148
|
102 |
|
|
#define R_CFG_LOUT 0x00000149
|
103 |
|
|
#define R_CFG_COR1 0x0000014a
|
104 |
|
|
#define R_CFG_COR2 0x0000014b
|
105 |
|
|
#define R_CFG_PWRDN 0x0000014c
|
106 |
|
|
#define R_CFG_FLR 0x0000014d
|
107 |
|
|
#define R_CFG_IDCODE 0x0000014e
|
108 |
|
|
#define R_CFG_CWDT 0x0000014f
|
109 |
|
|
#define R_CFG_HCOPT 0x00000150
|
110 |
|
|
#define R_CFG_CSBO 0x00000152
|
111 |
|
|
#define R_CFG_GEN1 0x00000153
|
112 |
|
|
#define R_CFG_GEN2 0x00000154
|
113 |
|
|
#define R_CFG_GEN3 0x00000155
|
114 |
|
|
#define R_CFG_GEN4 0x00000156
|
115 |
|
|
#define R_CFG_GEN5 0x00000157
|
116 |
|
|
#define R_CFG_MODE 0x00000158
|
117 |
|
|
#define R_CFG_GWE 0x00000159
|
118 |
|
|
#define R_CFG_GTS 0x0000015a
|
119 |
|
|
#define R_CFG_MFWR 0x0000015b
|
120 |
|
|
#define R_CFG_CCLK 0x0000015c
|
121 |
|
|
#define R_CFG_SEU 0x0000015d
|
122 |
|
|
#define R_CFG_EXP 0x0000015e
|
123 |
|
|
#define R_CFG_RDBK 0x0000015f
|
124 |
|
|
#define R_CFG_BOOTSTS 0x00000160
|
125 |
|
|
#define R_CFG_EYE 0x00000161
|
126 |
|
|
#define R_CFG_CBC 0x00000162
|
127 |
|
|
|
128 |
|
|
// RAM memory space
|
129 |
|
|
#define RAMBASE 0x00002000
|
130 |
|
|
#define MEMWORDS (1<<13)
|
131 |
|
|
// Flash memory space
|
132 |
|
|
#define SPIFLASH 0x00040000
|
133 |
|
|
#define FLASHWORDS (1<<18)
|
134 |
|
|
// SDRAM memory space
|
135 |
|
|
#define SDRAMBASE 0x00800000
|
136 |
29 |
dgisselq |
#define SDRAMWORDS (1<<25)
|
137 |
5 |
dgisselq |
// Zip CPU Control and Debug registers
|
138 |
|
|
#define R_ZIPCTRL 0x01000000
|
139 |
11 |
dgisselq |
#define R_ZIPDATA 0x01000001
|
140 |
5 |
dgisselq |
|
141 |
|
|
|
142 |
|
|
// Interrupt control constants
|
143 |
|
|
#define GIE 0x80000000 // Enable all interrupts
|
144 |
24 |
dgisselq |
#define SCOPEN 0x80080008 // Enable WBSCOPE interrupts
|
145 |
29 |
dgisselq |
#define ISPIF_EN 0x80040004 // Enable SPI Flash interrupts
|
146 |
|
|
#define ISPIF_DIS 0x00040000 // Disable SPI Flash interrupts
|
147 |
|
|
#define ISPIF_CLR 0x00000004 // Clear pending SPI Flash interrupt
|
148 |
5 |
dgisselq |
|
149 |
|
|
// Flash control constants
|
150 |
|
|
#define ERASEFLAG 0x80000000
|
151 |
|
|
#define DISABLEWP 0x10000000
|
152 |
|
|
|
153 |
|
|
#define SZPAGE 64
|
154 |
|
|
#define PGLEN 64
|
155 |
|
|
#define NPAGES 32
|
156 |
|
|
#define SECTORSZ (NPAGES * SZPAGE)
|
157 |
|
|
#define NSECTORS 256
|
158 |
29 |
dgisselq |
#define SECTOROF(A) ((A) & (-1<<10))
|
159 |
|
|
#define PAGEOF(A) ((A) & (-1<<6))
|
160 |
5 |
dgisselq |
|
161 |
|
|
#define RAMLEN 0x02000
|
162 |
|
|
|
163 |
|
|
// ZIP Control sequences
|
164 |
|
|
#define CPU_GO 0x0000
|
165 |
|
|
#define CPU_RESET 0x0040
|
166 |
|
|
#define CPU_INT 0x0080
|
167 |
|
|
#define CPU_STEP 0x0100
|
168 |
|
|
#define CPU_STALL 0x0200
|
169 |
|
|
#define CPU_HALT 0x0400
|
170 |
|
|
#define CPU_CLRCACHE 0x0800
|
171 |
|
|
#define CPU_sR0 (0x0000|CPU_HALT)
|
172 |
|
|
#define CPU_sSP (0x000d|CPU_HALT)
|
173 |
|
|
#define CPU_sCC (0x000e|CPU_HALT)
|
174 |
|
|
#define CPU_sPC (0x000f|CPU_HALT)
|
175 |
|
|
#define CPU_uR0 (0x0010|CPU_HALT)
|
176 |
|
|
#define CPU_uSP (0x001d|CPU_HALT)
|
177 |
|
|
#define CPU_uCC (0x001e|CPU_HALT)
|
178 |
|
|
#define CPU_uPC (0x001f|CPU_HALT)
|
179 |
|
|
|
180 |
|
|
// Scop definition/sequences
|
181 |
|
|
#define SCOPE_NO_RESET 0x80000000
|
182 |
|
|
#define SCOPE_TRIGGER (0x08000000|SCOPE_NO_RESET)
|
183 |
|
|
#define SCOPE_DISABLE (0x04000000)
|
184 |
|
|
|
185 |
|
|
typedef struct {
|
186 |
|
|
unsigned m_addr;
|
187 |
|
|
const char *m_name;
|
188 |
|
|
} REGNAME;
|
189 |
|
|
|
190 |
|
|
extern const REGNAME *bregs;
|
191 |
|
|
extern const int NREGS;
|
192 |
|
|
// #define NREGS (sizeof(bregs)/sizeof(bregs[0]))
|
193 |
|
|
|
194 |
|
|
extern unsigned addrdecode(const char *v);
|
195 |
|
|
extern const char *addrname(const unsigned v);
|
196 |
|
|
|
197 |
|
|
#include "ttybus.h"
|
198 |
|
|
// #include "portbus.h"
|
199 |
|
|
|
200 |
|
|
typedef TTYBUS FPGA;
|
201 |
|
|
|
202 |
|
|
#endif
|