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

Subversion Repositories xulalx25soc

[/] [xulalx25soc/] [trunk/] [sw/] [regdefs.cpp] - Blame information for rev 77

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

Line No. Rev Author Line
1 5 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    regdefs.cpp
4
//
5
// Project:     XuLA2 board
6
//
7
// Purpose:     To give human readable names to the various registers available
8
//              internal to the processor on the wishbone bus.  This file is
9
//      primarily used for name to number translation within wbregs.cpp.
10
//      All names for a given register are equivalent, save only that the
11
//      register will always be identified by its first name in any output.
12
//
13
//
14
// Creator:     Dan Gisselquist, Ph.D.
15
//              Gisselquist Technology, LLC
16
//
17
////////////////////////////////////////////////////////////////////////////////
18
//
19
// Copyright (C) 2015, Gisselquist Technology, LLC
20
//
21
// This program is free software (firmware): you can redistribute it and/or
22
// modify it under the terms of  the GNU General Public License as published
23
// by the Free Software Foundation, either version 3 of the License, or (at
24
// your option) any later version.
25
//
26
// This program is distributed in the hope that it will be useful, but WITHOUT
27
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
28
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
29
// for more details.
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
#include <stdio.h>
39
#include <stdlib.h>
40
#include <strings.h>
41
#include <ctype.h>
42
#include "regdefs.h"
43
 
44
const   REGNAME raw_bregs[] = {
45
        // { R_RESET,   "RESET"                 },
46
        // { R_STATUS,  "STATUS"                },
47
        // { R_CONTROL, "CONTROL"               },
48
        { R_VERSION,    "VERSION"               },
49
        { R_ICONTROL,   "ICONTROL"              },
50
        { R_ICONTROL,   "INT"                   },
51
        { R_ICONTROL,   "PIC"                   },
52
        { R_ICONTROL,   "INTC"                  },
53
        { R_BUSERR,     "BUSERR"                },
54
        { R_BUSERR,     "BUS"                   },
55
        { R_DATE,       "DATE"                  },
56
        { R_GPIO,       "GPIO"                  },
57
        { R_UART_CTRL,  "UARTCTRL"              },
58
        { R_UART_CTRL,  "UART"                  },
59 31 dgisselq
        { R_PWM_INTERVAL,"PWMCTRL"              },
60 5 dgisselq
        { R_PWM_INTERVAL,"PWMI"                 },
61
        { R_PWM_DATA,   "PWMDATA"               },
62
        { R_PWM_DATA,   "PWM"                   },
63 31 dgisselq
        { R_PWM_DATA,   "PWMAUDIO"              },
64
        { R_PWM_DATA,   "AUDIO"                 },
65 5 dgisselq
        { R_UART_RX,    "UART-RX"               },
66 31 dgisselq
        { R_UART_RX,    "UARTRX"                },
67 5 dgisselq
        { R_UART_RX,    "RX"                    },
68
        { R_UART_TX,    "UART-TX"               },
69 31 dgisselq
        { R_UART_TX,    "UARTTX"                },
70 5 dgisselq
        { R_UART_TX,    "TX"                    },
71
        //
72
        { R_SPIF_EREG,  "SPIFEREG"              },
73
        { R_SPIF_EREG,  "SPIFE"                 },
74
        { R_SPIF_CREG,  "SPIFCONF"              },
75
        { R_SPIF_CREG,  "SPIFC"                 },
76
        { R_SPIF_SREG,  "SPIFSTAT"              },
77
        { R_SPIF_SREG,  "SPIFS"                 },
78
        { R_SPIF_IDREG, "SPIFID"                },
79
        { R_SPIF_IDREG, "SPIFI"                 },
80
        //
81
        { R_CLOCK,      "CLOCK"                 },
82
        { R_CLOCK,      "TIME"                  },
83
        { R_TIMER,      "TIMER"                 },
84
        { R_STOPWATCH,  "STOPWACH"              },
85
        { R_STOPWATCH,  "STOPWATCH"             },
86
        { R_CKALARM,    "CKALARM"               },
87
        { R_CKALARM,    "ALARM"                 },
88
        { R_CKSPEED,    "CKSPEED"               },
89
        // Scopes are defined and come and go.  Be aware, therefore, not all
90
        // of these scopes may be defined at the same time.
91
        { R_QSCOPE,     "SCOPE"                 },
92
        { R_QSCOPE,     "SCOP"                  },
93
        { R_QSCOPED,    "SCOPDATA"              },
94
        { R_QSCOPED,    "SCDATA"                },
95
        { R_CFGSCOPE,   "CFGSCOPE"              },
96
        { R_CFGSCOPE,   "CFGSCOP"               },
97
        { R_CFGSCOPED,  "CFGSCOPD"              },
98
        { R_CPUSCOPED,  "CPUSCOPD"              },
99
        { R_RAMSCOPE,   "MEMSCOPE"              },
100
        { R_RAMSCOPE,   "MEMSCOP"               },
101
        { R_RAMSCOPED,  "MEMSCOPD"              },
102
        { R_RAMSCOPE,   "RAMSCOPE"              },
103
        { R_RAMSCOPE,   "RAMSCOP"               },
104
        { R_RAMSCOPED,  "RAMSCOPD"              },
105 17 dgisselq
        { R_CPUSCOPE,   "CPUSCOPE"              },
106
        { R_CPUSCOPE,   "CPUSCOP"               },
107 5 dgisselq
        //
108 77 dgisselq
        // And now for the SDCard
109
        //
110
        { R_SDCARD_CTRL, "SDCARD"               },
111
        { R_SDCARD_DATA, "SDDATA"               },
112
        { R_SDCARD_FIFOA, "SDFIF0"              },
113
        { R_SDCARD_FIFOA, "SDFIFO"              },
114
        { R_SDCARD_FIFOA, "SDFIFA"              },
115
        { R_SDCARD_FIFOA, "SDFIFO0"             },
116
        { R_SDCARD_FIFOA, "SDFIFOA"             },
117
        { R_SDCARD_FIFOB, "SDFIF1"              },
118
        { R_SDCARD_FIFOB, "SDFIFB"              },
119
        { R_SDCARD_FIFOB, "SDFIFO1"             },
120
        { R_SDCARD_FIFOB, "SDFIFOB"             },
121
        //
122 5 dgisselq
        // For working with the ICAPE interface ... if I can ever get a
123
        // testing environment suitable to prove that it works.
124
        //
125
        { R_CFG_CRC,    "FPGACRC"               },
126
        { R_CFG_FAR_MAJ, "FPGAFARH"             },
127
        { R_CFG_FAR_MIN, "FPGAFARL"             },
128
        { R_CFG_FDRI,   "FPGAFDRI"              },
129
        { R_CFG_FDRO,   "FPGAFDRO"              },
130
        { R_CFG_CMD,    "FPGACMD"               },
131
        { R_CFG_CTL,    "FPGACTL"               },
132
        { R_CFG_MASK,   "FPGAMASK"              },
133
        { R_CFG_STAT,   "FPGASTAT"              },
134
        { R_CFG_LOUT,   "FPGALOUT"              },
135
        { R_CFG_COR1,   "FPGACOR1"              },
136
        { R_CFG_COR2,   "FPGACOR2"              },
137
        { R_CFG_PWRDN,  "FPGAPWRDN"             },
138
        { R_CFG_FLR,    "FPGAFLR"               },
139
        { R_CFG_IDCODE, "FPGAIDCODE"            },
140
        { R_CFG_CWDT,   "FPGACWDT"              },
141
        { R_CFG_HCOPT,  "FPGAHCOPT"             },
142
        { R_CFG_CSBO,   "FPGACSBO"              },
143
        { R_CFG_GEN1,   "FPGAGEN1"              },
144
        { R_CFG_GEN2,   "FPGAGEN2"              },
145
        { R_CFG_GEN3,   "FPGAGEN3"              },
146
        { R_CFG_GEN4,   "FPGAGEN4"              },
147
        { R_CFG_GEN5,   "FPGAGEN5"              },
148
        { R_CFG_MODE,   "FPGAMODE"              },
149
        { R_CFG_GWE,    "FPGAGWE"               },
150
        { R_CFG_GTS,    "FPGAGTS"               },
151
        { R_CFG_MFWR,   "FPGAMFWR"              },
152
        { R_CFG_CCLK,   "FPGACCLK"              },
153
        { R_CFG_SEU,    "FPGASEU"               },
154
        { R_CFG_EXP,    "FPGAEXP"               },
155
        { R_CFG_RDBK,   "FPGARDBK"              },
156
        { R_CFG_BOOTSTS, "BOOTSTS"              },
157
        { R_CFG_EYE,    "FPGAEYE"               },
158
        { R_CFG_CBC,    "FPGACBC"               },
159
        //
160
        //
161
        { R_ZIPCTRL,    "ZIPCTRL"               },
162
        { R_ZIPCTRL,    "ZIPC"                  },
163
        { R_ZIPCTRL,    "CPU"                   },
164
        { R_ZIPCTRL,    "CPUC"                  },
165
        { R_ZIPDATA,    "ZIPDATA"               },
166
        { R_ZIPDATA,    "ZIPD"                  },
167
        { R_ZIPDATA,    "CPUD"                  },
168
        //
169
        { RAMBASE,      "MEM"                   },
170
        { SPIFLASH,     "FLASH"                 },
171
        { SDRAMBASE,    "SDRAM"                 },
172
        { SDRAMBASE,    "RAM"                   }
173
};
174
 
175
#define RAW_NREGS       (sizeof(raw_bregs)/sizeof(bregs[0]))
176
 
177
const   REGNAME *bregs = raw_bregs;
178
const   int     NREGS = RAW_NREGS;
179
 
180
unsigned        addrdecode(const char *v) {
181
        if (isalpha(v[0])) {
182
                for(int i=0; i<NREGS; i++)
183
                        if (strcasecmp(v, bregs[i].m_name)==0)
184
                                return bregs[i].m_addr;
185
                fprintf(stderr, "Unknown register: %s\n", v);
186
                exit(-2);
187
        } else
188
                return strtoul(v, NULL, 0);
189
}
190
 
191
const   char *addrname(const unsigned v) {
192
        for(int i=0; i<NREGS; i++)
193
                if (bregs[i].m_addr == v)
194
                        return bregs[i].m_name;
195
        return NULL;
196
}
197
 

powered by: WebSVN 2.1.0

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