1 |
9 |
nussgipfel |
/* GECKO3COM
|
2 |
|
|
*
|
3 |
|
|
* Copyright (C) 2008 by
|
4 |
|
|
* ___ ____ _ _
|
5 |
|
|
* ( _`\ ( __)( ) ( )
|
6 |
|
|
* | (_) )| (_ | |_| | Bern University of Applied Sciences
|
7 |
|
|
* | _ <'| _) | _ | School of Engineering and
|
8 |
|
|
* | (_) )| | | | | | Information Technology
|
9 |
|
|
* (____/'(_) (_) (_)
|
10 |
|
|
*
|
11 |
|
|
*
|
12 |
|
|
* This program is free software: you can redistribute it and/or modify
|
13 |
|
|
* it under the terms of the GNU General Public License as published by
|
14 |
|
|
* the Free Software Foundation, either version 3 of the License, or
|
15 |
|
|
* (at your option) any later version.
|
16 |
|
|
*
|
17 |
|
|
* This program is distributed in the hope that it will be useful,
|
18 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
19 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
20 |
|
|
* GNU General Public License for more details.
|
21 |
|
|
* You should have received a copy of the GNU General Public License
|
22 |
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
23 |
|
|
*/
|
24 |
|
|
|
25 |
|
|
/*********************************************************************/
|
26 |
|
|
/** \file gecko3com_regs.h
|
27 |
|
|
*********************************************************************
|
28 |
|
|
* \brief register and bit mask definitions for the GECKO3COM project
|
29 |
|
|
* class.
|
30 |
|
|
*
|
31 |
|
|
* Here are all board specific definitions. If you try to
|
32 |
|
|
* port the GECKO3COM firmware to another board, start here!
|
33 |
|
|
*
|
34 |
|
|
* \author Christoph Zimmermann bfh.ch
|
35 |
|
|
* \date 2009-1-13
|
36 |
|
|
*
|
37 |
|
|
*/
|
38 |
|
|
|
39 |
|
|
#ifndef _GECKO3COM_REGS_H_
|
40 |
|
|
#define _GECKO3COM_REGS_H_
|
41 |
|
|
|
42 |
|
|
#include "fx2regs.h"
|
43 |
|
|
|
44 |
|
|
|
45 |
|
|
/* ------------------------------------------------------------------------- */
|
46 |
|
|
#ifdef GECKO3MAIN
|
47 |
|
|
|
48 |
|
|
#define PORT_A IOA /**< Port A */
|
49 |
|
|
#define PORT_A_OE OEA /**< Port A direction register */
|
50 |
|
|
|
51 |
|
|
#define PORT_B IOB /**< Port B */
|
52 |
|
|
#define PORT_B_OE OEB /**< Port B direction register */
|
53 |
|
|
|
54 |
|
|
#define PORT_C IOC /**< Port C */
|
55 |
|
|
#define PORT_C_OE OEC /**< Port C direction register */
|
56 |
|
|
|
57 |
|
|
/* Port GPIF CTL outputs */
|
58 |
|
|
#define PORT_CTL GPIFIDLECTL /**< GPIF control pin port */
|
59 |
|
|
#define PORT_CTL_OE GPIFCTLCFG /**< GPIF CTL port direction register */
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
/* define stuff for system reset */
|
63 |
|
|
#define RESET PORT_A /**< System reset signal is connected here */
|
64 |
|
|
#define RESET_OE OEA /**< Reset port direction register */
|
65 |
|
|
#define bmRESET bmBIT6 /**< bitmask to access system reset */
|
66 |
|
|
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
/* define connections for the SPI bus */
|
70 |
|
|
#define SPI_PORT PORT_A /**< SPI signals are connected to this port */
|
71 |
|
|
#define SPI_OE OEA /**< SPI port direction register */
|
72 |
|
|
#define bmSPI_CLK bmBIT0 /**< bitmask for SPI serial clock pin */
|
73 |
|
|
#define bmSPI_MOSI bmBIT1 /**< bitmask for SPI MOSI pin, Master Out, Slave In */
|
74 |
|
|
#define bmSPI_MISO bmBIT2 /**< bitmask for SPI MISO pin, Master In, Slave Out */
|
75 |
|
|
#define bmSPI_MASK (bmSPI_CLK | bmSPI_MOSI | bmSPI_MISO)/**< SPI bus pin mask */
|
76 |
35 |
nussgipfel |
#define bmSPI_OE_MASK (bmSPI_CLK | bmSPI_MOSI)/**< SPI bus output pin mask */
|
77 |
9 |
nussgipfel |
|
78 |
|
|
sbit at 0x80+0 bitSPI_CLK; /**< \define 0x80 is the bit address of PORT A */
|
79 |
|
|
sbit at 0x80+1 bitSPI_MOSI; /**< \define Output from FX2 point of view, Master Out, Slave In */
|
80 |
|
|
sbit at 0x80+2 bitSPI_MISO; /**< \define In from FX2 point of view, Master In, Slave Out */
|
81 |
|
|
|
82 |
|
|
/* SPI related chipselect defines */
|
83 |
|
|
#define SPI_CS_PORT PORT_A /**< SPI chip select signals are connected to this port */
|
84 |
|
|
#define SPI_CS_OE OEA /**< SPI chip select port direction register */
|
85 |
|
|
#define bmSPI_CS_FLASH bmBIT3 /**< bitmask to enable the SPI Flash */
|
86 |
|
|
#define bmSPI_CS_MASK (bmSPI_CS_FLASH)/**< SPI chip select pin mask */
|
87 |
|
|
|
88 |
|
|
|
89 |
|
|
/* define stuff for Xilinx FPGA configuration */
|
90 |
|
|
|
91 |
|
|
/** select FPGA vendor */
|
92 |
|
|
#define XILINX
|
93 |
|
|
|
94 |
|
|
#define XILINX_DATA PORT_B /**< Data line port */
|
95 |
|
|
|
96 |
|
|
#define XILINX_DONE PORT_A /**< Done signal is connected here */
|
97 |
|
|
#define bmXILINX_DONE bmBIT7 /**< bitmask to access Done */
|
98 |
|
|
|
99 |
|
|
#define XILINX_PROG_B PORT_A /**< Prog_b signal is connected here */
|
100 |
|
|
#define bmXILINX_PROG_B bmBIT5 /**< bitmask to access Prog_b */
|
101 |
|
|
|
102 |
|
|
#define XILINX_INIT_B PORT_A /**< Init_b signal is connected here */
|
103 |
|
|
#define bmXILINX_INIT_B bmBIT4 /**< bitmask to access Init_b */
|
104 |
|
|
|
105 |
|
|
#define XILINX_CCLK GPIFIDLECTL /**< Cclk signal is connected here */
|
106 |
|
|
#define bmXILINX_CCLK bmBIT0 /**< bitmask to access Cclk */
|
107 |
|
|
|
108 |
|
|
#define XILINX_RDWR_B GPIFIDLECTL /**< Rdwr_b signal is connected here */
|
109 |
|
|
#define bmXILINX_RDWR_B bmBIT1 /**< bitmask to access Rdwr_b */
|
110 |
|
|
|
111 |
|
|
#define XILINX_CS_B GPIFIDLECTL /**< Cs_b signal is connected here */
|
112 |
|
|
#define bmXILINX_CS_B bmBIT2 /**< bitmask to access Cs_b */
|
113 |
|
|
|
114 |
|
|
#define XILINX_BUSY GPIFREADYSTAT /**< Busy signal is connected here */
|
115 |
|
|
#define bmXILINX_BUSY bmBIT1 /**< bitmask to access busy */
|
116 |
|
|
|
117 |
|
|
|
118 |
20 |
nussgipfel |
/* define pinning of the GPIF interface RDY signals
|
119 |
|
|
accessible in the GPIFREADYSTAT register */
|
120 |
|
|
#define bmWRX bmBIT0 /**< GPIFREADYSTAT bitmask to access Write Request Xilinx */
|
121 |
32 |
nussgipfel |
#define bmRDYX bmBIT1 /**< GPIFREADYSTAT bitmask to access ReDY Xilinx */
|
122 |
20 |
nussgipfel |
|
123 |
|
|
/* define pinning of the GPIF interface CTL signals
|
124 |
|
|
accessible while the GPIF is in the IDLE state through the
|
125 |
|
|
GPIFIDLECTL register */
|
126 |
|
|
#define bmWRU bmBIT1 /**< GPIFREADYSTAT bitmask to access Write Request Xilinx */
|
127 |
32 |
nussgipfel |
#define bmRDYU bmBIT2 /**< GPIFREADYSTAT bitmask to access ReDY Xilinx */
|
128 |
20 |
nussgipfel |
|
129 |
9 |
nussgipfel |
/*
|
130 |
|
|
* Port A (bit addressable):
|
131 |
|
|
*/
|
132 |
|
|
|
133 |
|
|
/* set here the direction and initial values of the pins */
|
134 |
|
|
|
135 |
|
|
#define bmPORT_A_OUTPUTS (bmSPI_CLK \
|
136 |
|
|
| bmSPI_MOSI \
|
137 |
|
|
| bmSPI_CS_FLASH \
|
138 |
|
|
| bmXILINX_PROG_B \
|
139 |
|
|
)
|
140 |
|
|
|
141 |
|
|
#define bmPORT_A_INITIAL (bmXILINX_PROG_B)
|
142 |
|
|
|
143 |
|
|
|
144 |
|
|
|
145 |
|
|
/* Port B: GPIF FD[7:0] and used for FPGA configuration */
|
146 |
|
|
#define bmPORT_B_OUTPUTS (0xFF )
|
147 |
|
|
#define bmPORT_B_INITIAL (0x00)
|
148 |
|
|
|
149 |
|
|
|
150 |
|
|
|
151 |
|
|
/*
|
152 |
|
|
* Port C (bit addressable):
|
153 |
|
|
* not available on the 56 pin EZ-USB FX2
|
154 |
|
|
* used for debuging purposes only on the GECKO3main prototype board
|
155 |
|
|
*/
|
156 |
|
|
|
157 |
|
|
#define LED_PORT PORT_C
|
158 |
|
|
#define bmPC_LED0 bmBIT6 /* active low */
|
159 |
|
|
#define bmPC_LED1 bmBIT7 /* active low */
|
160 |
|
|
|
161 |
|
|
#define ISR_DEBUG_PORT PORT_C
|
162 |
|
|
#define bmGPIF_DONE bmBIT0
|
163 |
|
|
#define bmGPIF_WF bmBIT1
|
164 |
|
|
#define bmFIFO_PF bmBIT2
|
165 |
|
|
|
166 |
|
|
sbit at 0xA0+6 bitPC_LED0; /* 0xA0 is the bit address of PORT C */
|
167 |
|
|
sbit at 0xA0+7 bitPC_LED1;
|
168 |
|
|
|
169 |
|
|
#define bmPORT_C_OUTPUTS (bmPC_LED0 \
|
170 |
|
|
| bmPC_LED1 \
|
171 |
|
|
| bmGPIF_DONE \
|
172 |
|
|
| bmGPIF_WF \
|
173 |
|
|
| bmFIFO_PF \
|
174 |
|
|
)
|
175 |
|
|
|
176 |
|
|
#define bmPORT_C_INITIAL (bmPC_LED0 | bmPC_LED1)
|
177 |
|
|
|
178 |
|
|
|
179 |
|
|
|
180 |
|
|
/* Port D: GPIF FD[15:8] */
|
181 |
|
|
|
182 |
|
|
/* Port E: not available on the 56 pin EZ-USB FX2, not used */
|
183 |
|
|
|
184 |
|
|
|
185 |
|
|
|
186 |
|
|
/* Port GPIF CTL outputs */
|
187 |
|
|
#define PORT_CTL GPIFIDLECTL
|
188 |
|
|
#define PORT_CTL_OE GPIFCTLCFG
|
189 |
|
|
|
190 |
|
|
#define bmPORT_CTL_OUTPUTS (0x00) // TRICTL = 0, CTL 0..2 as CMOS, Not Tristatable
|
191 |
|
|
#define bmPORT_CTL_INITIAL (bmBIT2 | bmBIT1 | bmBIT0)
|
192 |
|
|
|
193 |
|
|
|
194 |
|
|
#endif /* GECKO3MAIN */
|
195 |
|
|
|
196 |
|
|
|
197 |
|
|
|
198 |
|
|
/* ------------------------------------------------------------------------- */
|
199 |
|
|
/* not supported, only an example. only copied from USRP source code.
|
200 |
|
|
* does not work. only a guide to give you a start to port GECKO3COM to
|
201 |
|
|
* other boards using an EZ-USB FX2 device
|
202 |
|
|
*/
|
203 |
|
|
|
204 |
|
|
#ifdef USRP2
|
205 |
|
|
|
206 |
|
|
/** select FPGA vendor */
|
207 |
|
|
#define ALTERA
|
208 |
|
|
|
209 |
|
|
/*
|
210 |
|
|
* Port A (bit addressable):
|
211 |
|
|
*/
|
212 |
|
|
|
213 |
|
|
#define bmPA_S_CLK bmBIT0 // SPI serial clock
|
214 |
|
|
#define bmPA_S_DATA_TO_PERIPH bmBIT1 // SPI SDI (peripheral rel name)
|
215 |
|
|
#define bmPA_S_DATA_FROM_PERIPH bmBIT2 // SPI SDO (peripheral rel name)
|
216 |
|
|
#define bmPA_SEN_FPGA bmBIT3 // serial enable for FPGA (active low)
|
217 |
|
|
#define bmPA_SEN_CODEC_A bmBIT4 // serial enable AD9862 A (active low)
|
218 |
|
|
#define bmPA_SEN_CODEC_B bmBIT5 // serial enable AD9862 B (active low)
|
219 |
|
|
//#define bmPA_FX2_2 bmBIT6 // misc pin to FPGA (overflow)
|
220 |
|
|
//#define bmPA_FX2_3 bmBIT7 // misc pin to FPGA (underflow)
|
221 |
|
|
#define bmPA_RX_OVERRUN bmBIT6 // misc pin to FPGA (overflow)
|
222 |
|
|
#define bmPA_TX_UNDERRUN bmBIT7 // misc pin to FPGA (underflow)
|
223 |
|
|
|
224 |
|
|
|
225 |
|
|
sbit at 0x80+0 bitS_CLK; // 0x80 is the bit address of PORT A
|
226 |
|
|
sbit at 0x80+1 bitS_OUT; // out from FX2 point of view
|
227 |
|
|
sbit at 0x80+2 bitS_IN; // in from FX2 point of view
|
228 |
|
|
|
229 |
|
|
|
230 |
|
|
/* all outputs except S_DATA_FROM_PERIPH, FX2_2, FX2_3 */
|
231 |
|
|
|
232 |
|
|
#define bmPORT_A_OUTPUTS (bmPA_S_CLK \
|
233 |
|
|
| bmPA_S_DATA_TO_PERIPH \
|
234 |
|
|
| bmPA_SEN_FPGA \
|
235 |
|
|
| bmPA_SEN_CODEC_A \
|
236 |
|
|
| bmPA_SEN_CODEC_B \
|
237 |
|
|
)
|
238 |
|
|
|
239 |
|
|
#define bmPORT_A_INITIAL (bmPA_SEN_FPGA | bmPA_SEN_CODEC_A | bmPA_SEN_CODEC_B)
|
240 |
|
|
|
241 |
|
|
|
242 |
|
|
/* Port B: GPIF FD[7:0] */
|
243 |
|
|
|
244 |
|
|
/*
|
245 |
|
|
* Port C (bit addressable):
|
246 |
|
|
* 5:1 FPGA configuration
|
247 |
|
|
*/
|
248 |
|
|
|
249 |
|
|
#define PORT_C IOC // Port C
|
250 |
|
|
#define PORT_C_OE OEC // Port C direction register
|
251 |
|
|
|
252 |
|
|
#define ALTERA_CONFIG PORT_C
|
253 |
|
|
|
254 |
|
|
#define bmPC_nRESET bmBIT0 // reset line to codecs (active low)
|
255 |
|
|
#define bmALTERA_DATA0 bmBIT1
|
256 |
|
|
#define bmALTERA_NCONFIG bmBIT2
|
257 |
|
|
#define bmALTERA_DCLK bmBIT3
|
258 |
|
|
|
259 |
|
|
#define bmALTERA_CONF_DONE bmBIT4
|
260 |
|
|
#define bmALTERA_NSTATUS bmBIT5
|
261 |
|
|
#define bmPC_LED0 bmBIT6 // active low
|
262 |
|
|
#define bmPC_LED1 bmBIT7 // active low
|
263 |
|
|
|
264 |
|
|
sbit at 0xA0+1 bitALTERA_DATA0; // 0xA0 is the bit address of PORT C
|
265 |
|
|
sbit at 0xA0+3 bitALTERA_DCLK;
|
266 |
|
|
|
267 |
|
|
|
268 |
|
|
#define bmALTERA_BITS (bmALTERA_DATA0 \
|
269 |
|
|
| bmALTERA_NCONFIG \
|
270 |
|
|
| bmALTERA_DCLK \
|
271 |
|
|
| bmALTERA_CONF_DONE \
|
272 |
|
|
| bmALTERA_NSTATUS)
|
273 |
|
|
|
274 |
|
|
#define bmPORT_C_OUTPUTS (bmPC_nRESET \
|
275 |
|
|
| bmALTERA_DATA0 \
|
276 |
|
|
| bmALTERA_NCONFIG \
|
277 |
|
|
| bmALTERA_DCLK \
|
278 |
|
|
| bmPC_LED0 \
|
279 |
|
|
| bmPC_LED1 \
|
280 |
|
|
)
|
281 |
|
|
|
282 |
|
|
#define bmPORT_C_INITIAL (bmPC_LED0 | bmPC_LED1)
|
283 |
|
|
|
284 |
|
|
|
285 |
|
|
#define LED_PORT PORT_C
|
286 |
|
|
#define bmLED0 bmPC_LED0
|
287 |
|
|
#define bmLED1 bmPC_LED1
|
288 |
|
|
|
289 |
|
|
|
290 |
|
|
/* Port D: GPIF FD[15:8] */
|
291 |
|
|
|
292 |
|
|
/* Port E: not bit addressible */
|
293 |
|
|
|
294 |
|
|
#define PORT_E IOE // Port E
|
295 |
|
|
#define PORT_E_OE OEE // Port E direction register
|
296 |
|
|
|
297 |
|
|
#define bmPE_PE0 bmBIT0 // GPIF debug output
|
298 |
|
|
#define bmPE_PE1 bmBIT1 // GPIF debug output
|
299 |
|
|
#define bmPE_PE2 bmBIT2 // GPIF debug output
|
300 |
|
|
#define bmPE_FPGA_CLR_STATUS bmBIT3 // misc pin to FPGA (clear status)
|
301 |
|
|
#define bmPE_SEN_TX_A bmBIT4 // serial enable d'board TX A (active low)
|
302 |
|
|
#define bmPE_SEN_RX_A bmBIT5 // serial enable d'board RX A (active low)
|
303 |
|
|
#define bmPE_SEN_TX_B bmBIT6 // serial enable d'board TX B (active low)
|
304 |
|
|
#define bmPE_SEN_RX_B bmBIT7 // serial enable d'board RX B (active low)
|
305 |
|
|
|
306 |
|
|
|
307 |
|
|
#define bmPORT_E_OUTPUTS (bmPE_FPGA_CLR_STATUS \
|
308 |
|
|
| bmPE_SEN_TX_A \
|
309 |
|
|
| bmPE_SEN_RX_A \
|
310 |
|
|
| bmPE_SEN_TX_B \
|
311 |
|
|
| bmPE_SEN_RX_B \
|
312 |
|
|
)
|
313 |
|
|
|
314 |
|
|
|
315 |
|
|
#define bmPORT_E_INITIAL (bmPE_SEN_TX_A \
|
316 |
|
|
| bmPE_SEN_RX_A \
|
317 |
|
|
| bmPE_SEN_TX_B \
|
318 |
|
|
| bmPE_SEN_RX_B \
|
319 |
|
|
)
|
320 |
|
|
|
321 |
|
|
/*
|
322 |
|
|
* FPGA output lines that are tied to FX2 RDYx inputs.
|
323 |
|
|
* These are readable using GPIFREADYSTAT.
|
324 |
|
|
*/
|
325 |
|
|
#define bmFPGA_HAS_SPACE bmBIT0 // usbrdy[0] has room for 512 byte packet
|
326 |
|
|
#define bmFPGA_PKT_AVAIL bmBIT1 // usbrdy[1] has >= 512 bytes available
|
327 |
|
|
// #define bmTX_UNDERRUN bmBIT2 // usbrdy[2] D/A ran out of data
|
328 |
|
|
// #define bmRX_OVERRUN bmBIT3 // usbrdy[3] A/D ran out of buffer
|
329 |
|
|
|
330 |
|
|
/*
|
331 |
|
|
* FPGA input lines that are tied to the FX2 CTLx outputs.
|
332 |
|
|
*
|
333 |
|
|
* These are controlled by the GPIF microprogram...
|
334 |
|
|
*/
|
335 |
|
|
// WR bmBIT0 // usbctl[0]
|
336 |
|
|
// RD bmBIT1 // usbctl[1]
|
337 |
|
|
// OE bmBIT2 // usbctl[2]
|
338 |
|
|
|
339 |
|
|
#endif /* USRP2 */
|
340 |
|
|
|
341 |
|
|
|
342 |
|
|
#endif /* _GECKO3COM_REGS_H_ */
|