Imported Upstream version 3.0
[debian/gnuradio] / usrp / firmware / include / syncdelay.h
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2003 Free Software Foundation, Inc.
4  * 
5  * This file is part of GNU Radio
6  * 
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  * 
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING.  If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 #ifndef _SYNCDELAY_H_
23 #define _SYNCDELAY_H_
24
25 /*
26  * Magic delay required between access to certain xdata registers (TRM page 15-106).
27  * For our configuration, 48 MHz FX2 / 48 MHz IFCLK, we need three cycles.  Each
28  * NOP is a single cycle....
29  *
30  * From TRM page 15-105:
31  *
32  * Under certain conditions, some read and write access to the FX2 registers must
33  * be separated by a "synchronization delay".  The delay is necessary only under the
34  * following conditions:
35  *
36  *   - between a write to any register in the 0xE600 - 0xE6FF range and a write to one
37  *     of the registers listed below.
38  *
39  *   - between a write to one of the registers listed below and a read from any register
40  *     in the 0xE600 - 0xE6FF range.
41  *
42  *   Registers which require a synchronization delay:
43  *
44  *      FIFORESET                       FIFOPINPOLAR
45  *      INPKTEND                        EPxBCH:L
46  *      EPxFIFOPFH:L                    EPxAUTOINLENH:L
47  *      EPxFIFOCFG                      EPxGPIFFLGSEL
48  *      PINFLAGSAB                      PINFLAGSCD
49  *      EPxFIFOIE                       EPxFIFOIRQ
50  *      GPIFIE                          GPIFIRQ
51  *      UDMACRCH:L                      GPIFADRH:L
52  *      GPIFTRIG                        EPxGPIFTRIG
53  *      OUTPKTEND                       REVCTL
54  *      GPIFTCB3                        GPIFTCB2
55  *      GPIFTCB1                        GPIFTCB0
56  */
57
58 /*
59  * FIXME ensure that the peep hole optimizer isn't screwing us
60  */
61 #define SYNCDELAY       _asm nop; nop; nop; _endasm
62 #define NOP             _asm nop; _endasm
63
64
65 #endif /* _SYNCDELAY_H_ */