OpenCores
URL https://opencores.org/ocsvn/openarty/openarty/trunk

Subversion Repositories openarty

[/] [openarty/] [trunk/] [sw/] [host/] [regdefs.cpp] - Blame information for rev 51

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3 51 dgisselq
// Filename:    regdefs.cpp
4 4 dgisselq
//
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 51 dgisselq
// Copyright (C) 2015-2017, Gisselquist Technology, LLC
15 4 dgisselq
//
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 51 dgisselq
// with this program.  (It's in the $(ROOT)/doc directory.  Run make with no
28 4 dgisselq
// 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 51 dgisselq
        { R_GPS_FIFO,   "GPSFIFO"               },
67 4 dgisselq
        { R_GPS_SETUP,  "GPSUART"               },
68
        { R_CLR0,       "CLRLED0"               },
69
        { R_CLR1,       "CLRLED1"               },
70
        { R_CLR2,       "CLRLED2"               },
71
        { R_CLR3,       "CLRLED3"               },
72
        { R_CLR0,       "CLR0"                  },
73
        { R_CLR1,       "CLR1"                  },
74
        { R_CLR2,       "CLR2"                  },
75
        { R_CLR3,       "CLR3"                  },
76
        { R_DATE,       "DATE"                  },
77
        { R_GPIO,       "GPIO"                  },
78
        { R_UARTRX,     "AUXRX"                 },
79
        { R_UARTRX,     "RX"                    },
80 51 dgisselq
        { R_UART_FIFO,  "AUXFIFO"               },
81 4 dgisselq
        { R_UARTTX,     "AUXTX"                 },
82
        { R_UARTTX,     "TX"                    },
83
        //
84
        { R_GPSRX,              "GPSRX"         },
85
        { R_GPSTX,              "GPSTX"         },
86
        // Scope registers--these scopes may or may not be present depending
87
        // upon your current configuration.
88 6 dgisselq
        { R_QSCOPE,     "SCOPE"                 },      // Scope zero
89 4 dgisselq
        { R_QSCOPE,     "SCOP"                  },
90
        { R_QSCOPED,    "SCOPDATA"              },
91
        { R_QSCOPED,    "SCDATA"                },
92
        { R_QSCOPED,    "SCOPED"                },
93
        { R_QSCOPED,    "SCOPD"                 },
94 30 dgisselq
        { R_CPUSCOPE,   "CPUSCOPE"              },
95
        { R_CPUSCOPED,  "CPUSCOPD"              },
96
        { R_CPUSCOPED,  "CPUSCOPED"             },
97 6 dgisselq
        { R_GPSCOPE,    "GPSSCOPE"              },      // Scope one
98 4 dgisselq
        { R_GPSCOPE,    "GPSSCOP"               },
99
        { R_GPSCOPED,   "GPSSCDATA"             },
100
        { R_GPSCOPED,   "GPSSCD"                },
101
        { R_GPSCOPED,   "GPSDATA"               },
102 14 dgisselq
        { R_CFGSCOPE,   "CFGSCOPE"              },      // Scope one
103
        { R_CFGSCOPE,   "CFGSCOP"               },
104
        { R_CFGSCOPED,  "CFGSCDATA"             },
105
        { R_CFGSCOPED,  "CFGSCD"                },
106 30 dgisselq
        { R_BUSSCOPE,   "BUSSCOPE"              },      // Scope one
107
        { R_BUSSCOPED,  "BUSSCOPD"              },
108 6 dgisselq
        { R_RAMSCOPE,   "RAMSCOPE"              },      // Scope two
109 4 dgisselq
        { R_RAMSCOPE,   "RAMSCOP"               },
110
        { R_RAMSCOPED,  "RAMSCOPD"              },
111 6 dgisselq
        { R_NETSCOPE,   "NETSCOPE"              },      // Scope three
112
        { R_NETSCOPE,   "NETSCOP"               },
113
        { R_NETSCOPED,  "NETSCOPED"             },
114
        { R_NETSCOPED,  "NETSCOPD"              },
115 4 dgisselq
        // RTC registers
116
        { R_CLOCK,      "CLOCK"                 },
117
        { R_CLOCK,      "TIME"                  },
118
        { R_TIMER,      "TIMER"                 },
119
        { R_STOPWATCH,  "STOPWACH"              },
120
        { R_STOPWATCH,  "STOPWATCH"             },
121
        { R_CKALARM,    "CKALARM"               },
122
        { R_CKALARM,    "ALARM"                 },
123
        // SDCard registers
124
        { R_SDCARD_CTRL, "SDCARD"               },
125
        { R_SDCARD_DATA, "SDDATA"               },
126
        { R_SDCARD_FIFOA, "SDFIF0"              },
127
        { R_SDCARD_FIFOA, "SDFIFO"              },
128
        { R_SDCARD_FIFOA, "SDFIFA"              },
129
        { R_SDCARD_FIFOA, "SDFIFO0"             },
130
        { R_SDCARD_FIFOA, "SDFIFOA"             },
131
        { R_SDCARD_FIFOB, "SDFIF1"              },
132
        { R_SDCARD_FIFOB, "SDFIFB"              },
133
        { R_SDCARD_FIFOB, "SDFIFO1"             },
134
        { R_SDCARD_FIFOB, "SDFIFOB"             },
135
        // GPS control loop control
136
        { R_GPS_ALPHA,  "ALPHA"                 },
137
        { R_GPS_BETA,   "BETA"                  },
138
        { R_GPS_GAMMA,  "GAMMA"                 },
139
        { R_GPS_STEP,   "GPSSTEP"               },
140
        // Network packet interface (not built yet)
141
        // OLED Control
142
        { R_OLED_CMD,   "OLED"                  },
143
        { R_OLED_CDATA, "OLEDCA"                },
144
        { R_OLED_CDATB, "OLEDCB"                },
145
        { R_OLED_DATA,  "ODATA"                 },
146
        // Unused section
147
        // GPS Testbench
148
        { R_GPSTB_FREQ,         "GPSFREQ"       },
149
        { R_GPSTB_JUMP,         "GPSJUMP"       },
150
        { R_GPSTB_ERRHI,        "ERRHI"         },
151
        { R_GPSTB_ERRLO,        "ERRLO"         },
152
        { R_GPSTB_COUNTHI,      "CNTHI"         },
153
        { R_GPSTB_COUNTLO,      "CNTLO"         },
154
        { R_GPSTB_STEPHI,       "STEPHI"        },
155
        { R_GPSTB_STEPLO,       "STEPLO"        },
156 30 dgisselq
        // Ethernet, packet control registers
157
        { R_NET_RXCMD,          "RXCMD"         },
158
        { R_NET_RXCMD,          "NETRX"         },
159
        { R_NET_TXCMD,          "TXCMD"         },
160
        { R_NET_TXCMD,          "NETTX"         },
161
        { R_NET_MACHI,          "MACHI"         },
162
        { R_NET_MACLO,          "MACLO"         },
163
        { R_NET_RXMISS,         "NETMISS"       },
164
        { R_NET_RXERR,          "NETERR"        },
165
        { R_NET_RXCRC,          "NETXCRC"       },
166 4 dgisselq
        // Ethernet  MDIO registers
167
        { R_MDIO_BMCR,          "BMCR"          },
168
        { R_MDIO_BMSR,          "BMSR"          },
169
        { R_MDIO_PHYIDR1,       "PHYIDR1"       },
170
        { R_MDIO_PHYIDR2,       "PHYIDR2"       },
171
        { R_MDIO_ANAR,          "ANAR"          },
172
        { R_MDIO_ANLPAR,        "ANLPAR"        },
173
        { R_MDIO_ANER,          "ANER"          },
174
        { R_MDIO_ANNPTR,        "ANNPTR"        },
175
        { R_MDIO_PHYSTS,        "PHYSTS"        },
176
        { R_MDIO_FCSCR,         "FCSCR"         },
177
        { R_MDIO_RECR,          "RECR"          },
178
        { R_MDIO_PCSR,          "PCSR"          },
179
        { R_MDIO_RBR,           "RBR"           },
180
        { R_MDIO_LEDCR,         "LEDCR"         },
181
        { R_MDIO_PHYCR,         "PHYCR"         },
182
        { R_MDIO_BTSCR,         "BTSCR"         },
183
        { R_MDIO_CDCTRL,        "CDCTRL"        },
184
        { R_MDIO_EDCR,          "EDCR"          },
185
        //
186
        // Flash configuration register names
187
        { R_QSPI_EREG,  "QSPIEREG"              },
188
        { R_QSPI_EREG,  "QSPIE"                 },
189
        { R_QSPI_STAT,  "QSPIS"                 },
190 18 dgisselq
        { R_QSPI_NVCONF,"QSPINVCF"              },
191 4 dgisselq
        { R_QSPI_NVCONF,"QSPINV"                },
192 18 dgisselq
        { R_QSPI_VCONF, "QSPIVCNF"              },
193 4 dgisselq
        { R_QSPI_VCONF, "QSPIV"                 },
194 18 dgisselq
        { R_QSPI_EVCONF,"QSPIEVCF"              },
195 4 dgisselq
        { R_QSPI_EVCONF,"QSPIEV"                },
196
        { R_QSPI_LOCK,  "QSPILOCK"              },
197
        { R_QSPI_FLAG,  "QSPIFLAG"              },
198
        { R_QSPI_ID,    "QSPIID"                },
199
        { R_QSPI_IDA,   "QSPIIDA"               },
200
        { R_QSPI_IDB,   "QSPIIDB"               },
201
        { R_QSPI_IDC,   "QSPIIDC"               },
202
        { R_QSPI_IDD,   "QSPIIDD"               },
203
        { R_QSPI_OTPWP, "QSPIOTPWP"             },
204
        { R_QSPI_OTP,   "QSPIOTP"               },
205
        //
206
        { R_CFG_CRC,    "FPGACRC"               },
207
        { R_CFG_FAR,    "FPGAFAR"               },
208
        { R_CFG_FDRI,   "FPGAFDRI"              },
209
        { R_CFG_FDRO,   "FPGAFDRO"              },
210
        { R_CFG_CMD,    "FPGACMD"               },
211
        { R_CFG_CTL0,   "FPGACTL0"              },
212
        { R_CFG_MASK,   "FPGAMASK"              },
213
        { R_CFG_STAT,   "FPGASTAT"              },
214
        { R_CFG_LOUT,   "FPGALOUT"              },
215
        { R_CFG_COR0,   "FPGACOR0"              },
216
        { R_CFG_MFWR,   "FPGAMFWR"              },
217
        { R_CFG_CBC,    "FPGACBC"               },
218
        { R_CFG_IDCODE, "FPGAIDCODE"            },
219
        { R_CFG_AXSS,   "FPGAAXSS"              },
220
        { R_CFG_COR0,   "FPGACOR1"              },
221
        { R_CFG_WBSTAR, "WBSTAR"                },
222
        { R_CFG_TIMER,  "CFGTIMER"              },
223
        { R_CFG_BOOTSTS,"BOOTSTS"               },
224
        { R_CFG_CTL1,   "FPGACTL1"              },
225
        { R_CFG_BSPI,   "FPGABSPI"              },
226
        //
227
        { R_ZIPCTRL,    "ZIPCTRL"               },
228
        { R_ZIPCTRL,    "ZIPC"                  },
229
        { R_ZIPCTRL,    "CPU"                   },
230
        { R_ZIPCTRL,    "CPUC"                  },
231
        { R_ZIPDATA,    "ZIPDATA"               },
232
        { R_ZIPDATA,    "ZIPD"                  },
233
        { R_ZIPDATA,    "CPUD"                  },
234
        { EQSPIFLASH,   "FLASH"                 },
235
        { MEMBASE,      "BLKRAM"                },
236
        { MEMBASE,      "MEM"                   },
237
        { RAMBASE,      "DDR3SDRAM"             },
238
        { RAMBASE,      "SDRAM"                 },
239
        { RAMBASE,      "RAM"                   }
240
};
241
 
242
#define RAW_NREGS       (sizeof(raw_bregs)/sizeof(bregs[0]))
243
 
244
const   REGNAME *bregs = raw_bregs;
245
const   int     NREGS = RAW_NREGS;
246
 
247
unsigned        addrdecode(const char *v) {
248
        if (isalpha(v[0])) {
249
                for(int i=0; i<NREGS; i++)
250
                        if (strcasecmp(v, bregs[i].m_name)==0)
251
                                return bregs[i].m_addr;
252
                fprintf(stderr, "Unknown register: %s\n", v);
253
                exit(-2);
254
        } else
255
                return strtoul(v, NULL, 0);
256
}
257
 
258
const   char *addrname(const unsigned v) {
259
        for(int i=0; i<NREGS; i++)
260
                if (bregs[i].m_addr == v)
261
                        return bregs[i].m_name;
262
        return NULL;
263
}
264
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.