Imported Upstream version 3.0
[debian/gnuradio] / usrp / firmware / src / usrp2 / usrp_common.h
1 /* 
2  * USRP - Universal Software Radio Peripheral
3  *
4  * Copyright (C) 2003,2006 Free Software Foundation, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Boston, MA  02110-1301  USA
19  */
20
21 /*
22  * common defines and prototypes for USRP
23  *
24  * In comments below "TRM" refers to the EZ-USB FX2 Technical Reference Manual
25  */
26
27 #ifndef _USRPCOMMON_H_
28 #define _USRPCOMMON_H_
29
30 #include <usrp_config.h>
31 #include <usrp_rev2_regs.h>
32 #include <syncdelay.h>
33
34 /*
35  * From TRM page 15-105:
36  *
37  * Under certain conditions, some read and write access to the FX2
38  * registers must be separated by a "synchronization delay".  The
39  * delay is necessary only under the following conditions:
40  *
41  *   - between a write to any register in the 0xE600 - 0xE6FF range 
42  *     and a write to one of the registers listed below.
43  *
44  *   - between a write to one of the registers listed below and a read 
45  *     from any register in the 0xE600 - 0xE6FF range.
46  *
47  *   Registers which require a synchronization delay:
48  *
49  *      FIFORESET                       FIFOPINPOLAR
50  *      INPKTEND                        EPxBCH:L
51  *      EPxFIFOPFH:L                    EPxAUTOINLENH:L
52  *      EPxFIFOCFG                      EPxGPIFFLGSEL
53  *      PINFLAGSAB                      PINFLAGSCD
54  *      EPxFIFOIE                       EPxFIFOIRQ
55  *      GPIFIE                          GPIFIRQ
56  *      UDMACRCH:L                      GPIFADRH:L
57  *      GPIFTRIG                        EPxGPIFTRIG
58  *      OUTPKTEND                       REVCTL
59  *      GPIFTCB3                        GPIFTCB2
60  *      GPIFTCB1                        GPIFTCB0
61  */
62
63 #define TRUE            1
64 #define FALSE           0
65
66
67 void init_usrp (void);
68 void init_gpif (void);
69
70 void set_led_0 (unsigned char on);
71 void set_led_1 (unsigned char on);
72 void toggle_led_0 (void);
73 void toggle_led_1 (void);
74
75 #define la_trace(v)
76
77 #endif /* _USRPCOMMON_H_ */