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 |
|
|
|
77 |
|
|
sbit at 0x80+0 bitSPI_CLK; /**< \define 0x80 is the bit address of PORT A */
|
78 |
|
|
sbit at 0x80+1 bitSPI_MOSI; /**< \define Output from FX2 point of view, Master Out, Slave In */
|
79 |
|
|
sbit at 0x80+2 bitSPI_MISO; /**< \define In from FX2 point of view, Master In, Slave Out */
|
80 |
|
|
|
81 |
|
|
/* SPI related chipselect defines */
|
82 |
|
|
#define SPI_CS_PORT PORT_A /**< SPI chip select signals are connected to this port */
|
83 |
|
|
#define SPI_CS_OE OEA /**< SPI chip select port direction register */
|
84 |
|
|
#define bmSPI_CS_FLASH bmBIT3 /**< bitmask to enable the SPI Flash */
|
85 |
|
|
#define bmSPI_CS_MASK (bmSPI_CS_FLASH)/**< SPI chip select pin mask */
|
86 |
|
|
|
87 |
|
|
|
88 |
|
|
/* define stuff for Xilinx FPGA configuration */
|
89 |
|
|
|
90 |
|
|
/** select FPGA vendor */
|
91 |
|
|
#define XILINX
|
92 |
|
|
|
93 |
|
|
#define XILINX_DATA PORT_B /**< Data line port */
|
94 |
|
|
|
95 |
|
|
#define XILINX_DONE PORT_A /**< Done signal is connected here */
|
96 |
|
|
#define bmXILINX_DONE bmBIT7 /**< bitmask to access Done */
|
97 |
|
|
|
98 |
|
|
#define XILINX_PROG_B PORT_A /**< Prog_b signal is connected here */
|
99 |
|
|
#define bmXILINX_PROG_B bmBIT5 /**< bitmask to access Prog_b */
|
100 |
|
|
|
101 |
|
|
#define XILINX_INIT_B PORT_A /**< Init_b signal is connected here */
|
102 |
|
|
#define bmXILINX_INIT_B bmBIT4 /**< bitmask to access Init_b */
|
103 |
|
|
|
104 |
|
|
#define XILINX_CCLK GPIFIDLECTL /**< Cclk signal is connected here */
|
105 |
|
|
#define bmXILINX_CCLK bmBIT0 /**< bitmask to access Cclk */
|
106 |
|
|
|
107 |
|
|
#define XILINX_RDWR_B GPIFIDLECTL /**< Rdwr_b signal is connected here */
|
108 |
|
|
#define bmXILINX_RDWR_B bmBIT1 /**< bitmask to access Rdwr_b */
|
109 |
|
|
|
110 |
|
|
#define XILINX_CS_B GPIFIDLECTL /**< Cs_b signal is connected here */
|
111 |
|
|
#define bmXILINX_CS_B bmBIT2 /**< bitmask to access Cs_b */
|
112 |
|
|
|
113 |
|
|
#define XILINX_BUSY GPIFREADYSTAT /**< Busy signal is connected here */
|
114 |
|
|
#define bmXILINX_BUSY bmBIT1 /**< bitmask to access busy */
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
/*
|
118 |
|
|
* Port A (bit addressable):
|
119 |
|
|
*/
|
120 |
|
|
|
121 |
|
|
/* set here the direction and initial values of the pins */
|
122 |
|
|
|
123 |
|
|
#define bmPORT_A_OUTPUTS (bmSPI_CLK \
|
124 |
|
|
| bmSPI_MOSI \
|
125 |
|
|
| bmSPI_CS_FLASH \
|
126 |
|
|
| bmXILINX_PROG_B \
|
127 |
|
|
)
|
128 |
|
|
|
129 |
|
|
#define bmPORT_A_INITIAL (bmXILINX_PROG_B)
|
130 |
|
|
|
131 |
|
|
|
132 |
|
|
|
133 |
|
|
/* Port B: GPIF FD[7:0] and used for FPGA configuration */
|
134 |
|
|
#define bmPORT_B_OUTPUTS (0xFF )
|
135 |
|
|
#define bmPORT_B_INITIAL (0x00)
|
136 |
|
|
|
137 |
|
|
|
138 |
|
|
|
139 |
|
|
/*
|
140 |
|
|
* Port C (bit addressable):
|
141 |
|
|
* not available on the 56 pin EZ-USB FX2
|
142 |
|
|
* used for debuging purposes only on the GECKO3main prototype board
|
143 |
|
|
*/
|
144 |
|
|
|
145 |
|
|
#define LED_PORT PORT_C
|
146 |
|
|
#define bmPC_LED0 bmBIT6 /* active low */
|
147 |
|
|
#define bmPC_LED1 bmBIT7 /* active low */
|
148 |
|
|
|
149 |
|
|
#define ISR_DEBUG_PORT PORT_C
|
150 |
|
|
#define bmGPIF_DONE bmBIT0
|
151 |
|
|
#define bmGPIF_WF bmBIT1
|
152 |
|
|
#define bmFIFO_PF bmBIT2
|
153 |
|
|
|
154 |
|
|
sbit at 0xA0+6 bitPC_LED0; /* 0xA0 is the bit address of PORT C */
|
155 |
|
|
sbit at 0xA0+7 bitPC_LED1;
|
156 |
|
|
|
157 |
|
|
#define bmPORT_C_OUTPUTS (bmPC_LED0 \
|
158 |
|
|
| bmPC_LED1 \
|
159 |
|
|
| bmGPIF_DONE \
|
160 |
|
|
| bmGPIF_WF \
|
161 |
|
|
| bmFIFO_PF \
|
162 |
|
|
)
|
163 |
|
|
|
164 |
|
|
#define bmPORT_C_INITIAL (bmPC_LED0 | bmPC_LED1)
|
165 |
|
|
|
166 |
|
|
|
167 |
|
|
|
168 |
|
|
/* Port D: GPIF FD[15:8] */
|
169 |
|
|
|
170 |
|
|
/* Port E: not available on the 56 pin EZ-USB FX2, not used */
|
171 |
|
|
|
172 |
|
|
|
173 |
|
|
|
174 |
|
|
/* Port GPIF CTL outputs */
|
175 |
|
|
#define PORT_CTL GPIFIDLECTL
|
176 |
|
|
#define PORT_CTL_OE GPIFCTLCFG
|
177 |
|
|
|
178 |
|
|
#define bmPORT_CTL_OUTPUTS (0x00) // TRICTL = 0, CTL 0..2 as CMOS, Not Tristatable
|
179 |
|
|
#define bmPORT_CTL_INITIAL (bmBIT2 | bmBIT1 | bmBIT0)
|
180 |
|
|
|
181 |
|
|
|
182 |
|
|
#endif /* GECKO3MAIN */
|
183 |
|
|
|
184 |
|
|
|
185 |
|
|
|
186 |
|
|
/* ------------------------------------------------------------------------- */
|
187 |
|
|
/* not supported, only an example. only copied from USRP source code.
|
188 |
|
|
* does not work. only a guide to give you a start to port GECKO3COM to
|
189 |
|
|
* other boards using an EZ-USB FX2 device
|
190 |
|
|
*/
|
191 |
|
|
|
192 |
|
|
#ifdef USRP2
|
193 |
|
|
|
194 |
|
|
/** select FPGA vendor */
|
195 |
|
|
#define ALTERA
|
196 |
|
|
|
197 |
|
|
/*
|
198 |
|
|
* Port A (bit addressable):
|
199 |
|
|
*/
|
200 |
|
|
|
201 |
|
|
#define bmPA_S_CLK bmBIT0 // SPI serial clock
|
202 |
|
|
#define bmPA_S_DATA_TO_PERIPH bmBIT1 // SPI SDI (peripheral rel name)
|
203 |
|
|
#define bmPA_S_DATA_FROM_PERIPH bmBIT2 // SPI SDO (peripheral rel name)
|
204 |
|
|
#define bmPA_SEN_FPGA bmBIT3 // serial enable for FPGA (active low)
|
205 |
|
|
#define bmPA_SEN_CODEC_A bmBIT4 // serial enable AD9862 A (active low)
|
206 |
|
|
#define bmPA_SEN_CODEC_B bmBIT5 // serial enable AD9862 B (active low)
|
207 |
|
|
//#define bmPA_FX2_2 bmBIT6 // misc pin to FPGA (overflow)
|
208 |
|
|
//#define bmPA_FX2_3 bmBIT7 // misc pin to FPGA (underflow)
|
209 |
|
|
#define bmPA_RX_OVERRUN bmBIT6 // misc pin to FPGA (overflow)
|
210 |
|
|
#define bmPA_TX_UNDERRUN bmBIT7 // misc pin to FPGA (underflow)
|
211 |
|
|
|
212 |
|
|
|
213 |
|
|
sbit at 0x80+0 bitS_CLK; // 0x80 is the bit address of PORT A
|
214 |
|
|
sbit at 0x80+1 bitS_OUT; // out from FX2 point of view
|
215 |
|
|
sbit at 0x80+2 bitS_IN; // in from FX2 point of view
|
216 |
|
|
|
217 |
|
|
|
218 |
|
|
/* all outputs except S_DATA_FROM_PERIPH, FX2_2, FX2_3 */
|
219 |
|
|
|
220 |
|
|
#define bmPORT_A_OUTPUTS (bmPA_S_CLK \
|
221 |
|
|
| bmPA_S_DATA_TO_PERIPH \
|
222 |
|
|
| bmPA_SEN_FPGA \
|
223 |
|
|
| bmPA_SEN_CODEC_A \
|
224 |
|
|
| bmPA_SEN_CODEC_B \
|
225 |
|
|
)
|
226 |
|
|
|
227 |
|
|
#define bmPORT_A_INITIAL (bmPA_SEN_FPGA | bmPA_SEN_CODEC_A | bmPA_SEN_CODEC_B)
|
228 |
|
|
|
229 |
|
|
|
230 |
|
|
/* Port B: GPIF FD[7:0] */
|
231 |
|
|
|
232 |
|
|
/*
|
233 |
|
|
* Port C (bit addressable):
|
234 |
|
|
* 5:1 FPGA configuration
|
235 |
|
|
*/
|
236 |
|
|
|
237 |
|
|
#define PORT_C IOC // Port C
|
238 |
|
|
#define PORT_C_OE OEC // Port C direction register
|
239 |
|
|
|
240 |
|
|
#define ALTERA_CONFIG PORT_C
|
241 |
|
|
|
242 |
|
|
#define bmPC_nRESET bmBIT0 // reset line to codecs (active low)
|
243 |
|
|
#define bmALTERA_DATA0 bmBIT1
|
244 |
|
|
#define bmALTERA_NCONFIG bmBIT2
|
245 |
|
|
#define bmALTERA_DCLK bmBIT3
|
246 |
|
|
|
247 |
|
|
#define bmALTERA_CONF_DONE bmBIT4
|
248 |
|
|
#define bmALTERA_NSTATUS bmBIT5
|
249 |
|
|
#define bmPC_LED0 bmBIT6 // active low
|
250 |
|
|
#define bmPC_LED1 bmBIT7 // active low
|
251 |
|
|
|
252 |
|
|
sbit at 0xA0+1 bitALTERA_DATA0; // 0xA0 is the bit address of PORT C
|
253 |
|
|
sbit at 0xA0+3 bitALTERA_DCLK;
|
254 |
|
|
|
255 |
|
|
|
256 |
|
|
#define bmALTERA_BITS (bmALTERA_DATA0 \
|
257 |
|
|
| bmALTERA_NCONFIG \
|
258 |
|
|
| bmALTERA_DCLK \
|
259 |
|
|
| bmALTERA_CONF_DONE \
|
260 |
|
|
| bmALTERA_NSTATUS)
|
261 |
|
|
|
262 |
|
|
#define bmPORT_C_OUTPUTS (bmPC_nRESET \
|
263 |
|
|
| bmALTERA_DATA0 \
|
264 |
|
|
| bmALTERA_NCONFIG \
|
265 |
|
|
| bmALTERA_DCLK \
|
266 |
|
|
| bmPC_LED0 \
|
267 |
|
|
| bmPC_LED1 \
|
268 |
|
|
)
|
269 |
|
|
|
270 |
|
|
#define bmPORT_C_INITIAL (bmPC_LED0 | bmPC_LED1)
|
271 |
|
|
|
272 |
|
|
|
273 |
|
|
#define LED_PORT PORT_C
|
274 |
|
|
#define bmLED0 bmPC_LED0
|
275 |
|
|
#define bmLED1 bmPC_LED1
|
276 |
|
|
|
277 |
|
|
|
278 |
|
|
/* Port D: GPIF FD[15:8] */
|
279 |
|
|
|
280 |
|
|
/* Port E: not bit addressible */
|
281 |
|
|
|
282 |
|
|
#define PORT_E IOE // Port E
|
283 |
|
|
#define PORT_E_OE OEE // Port E direction register
|
284 |
|
|
|
285 |
|
|
#define bmPE_PE0 bmBIT0 // GPIF debug output
|
286 |
|
|
#define bmPE_PE1 bmBIT1 // GPIF debug output
|
287 |
|
|
#define bmPE_PE2 bmBIT2 // GPIF debug output
|
288 |
|
|
#define bmPE_FPGA_CLR_STATUS bmBIT3 // misc pin to FPGA (clear status)
|
289 |
|
|
#define bmPE_SEN_TX_A bmBIT4 // serial enable d'board TX A (active low)
|
290 |
|
|
#define bmPE_SEN_RX_A bmBIT5 // serial enable d'board RX A (active low)
|
291 |
|
|
#define bmPE_SEN_TX_B bmBIT6 // serial enable d'board TX B (active low)
|
292 |
|
|
#define bmPE_SEN_RX_B bmBIT7 // serial enable d'board RX B (active low)
|
293 |
|
|
|
294 |
|
|
|
295 |
|
|
#define bmPORT_E_OUTPUTS (bmPE_FPGA_CLR_STATUS \
|
296 |
|
|
| bmPE_SEN_TX_A \
|
297 |
|
|
| bmPE_SEN_RX_A \
|
298 |
|
|
| bmPE_SEN_TX_B \
|
299 |
|
|
| bmPE_SEN_RX_B \
|
300 |
|
|
)
|
301 |
|
|
|
302 |
|
|
|
303 |
|
|
#define bmPORT_E_INITIAL (bmPE_SEN_TX_A \
|
304 |
|
|
| bmPE_SEN_RX_A \
|
305 |
|
|
| bmPE_SEN_TX_B \
|
306 |
|
|
| bmPE_SEN_RX_B \
|
307 |
|
|
)
|
308 |
|
|
|
309 |
|
|
/*
|
310 |
|
|
* FPGA output lines that are tied to FX2 RDYx inputs.
|
311 |
|
|
* These are readable using GPIFREADYSTAT.
|
312 |
|
|
*/
|
313 |
|
|
#define bmFPGA_HAS_SPACE bmBIT0 // usbrdy[0] has room for 512 byte packet
|
314 |
|
|
#define bmFPGA_PKT_AVAIL bmBIT1 // usbrdy[1] has >= 512 bytes available
|
315 |
|
|
// #define bmTX_UNDERRUN bmBIT2 // usbrdy[2] D/A ran out of data
|
316 |
|
|
// #define bmRX_OVERRUN bmBIT3 // usbrdy[3] A/D ran out of buffer
|
317 |
|
|
|
318 |
|
|
/*
|
319 |
|
|
* FPGA input lines that are tied to the FX2 CTLx outputs.
|
320 |
|
|
*
|
321 |
|
|
* These are controlled by the GPIF microprogram...
|
322 |
|
|
*/
|
323 |
|
|
// WR bmBIT0 // usbctl[0]
|
324 |
|
|
// RD bmBIT1 // usbctl[1]
|
325 |
|
|
// OE bmBIT2 // usbctl[2]
|
326 |
|
|
|
327 |
|
|
#endif /* USRP2 */
|
328 |
|
|
|
329 |
|
|
|
330 |
|
|
#endif /* _GECKO3COM_REGS_H_ */
|