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

Subversion Repositories openarty

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

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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