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