2 /*-----------------------------------------------------------------------------
\r
3 * Synchronization delay for FX2 access to specific registers
\r
4 *-----------------------------------------------------------------------------
\r
5 * Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2,
\r
6 * Copyright 2003 Free Software Foundation, Inc.
\r
7 *-----------------------------------------------------------------------------
\r
8 * This code is part of usbjtag. usbjtag is free software; you can redistribute
\r
9 * it and/or modify it under the terms of the GNU General Public License as
\r
10 * published by the Free Software Foundation; either version 2 of the License,
\r
11 * or (at your option) any later version. usbjtag is distributed in the hope
\r
12 * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
\r
13 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details. You should have received a
\r
15 * copy of the GNU General Public License along with this program in the file
\r
16 * COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin
\r
17 * St, Fifth Floor, Boston, MA 02110-1301 USA
\r
18 *-----------------------------------------------------------------------------
\r
21 #ifndef _SYNCDELAY_H_
\r
22 #define _SYNCDELAY_H_
\r
25 * Magic delay required between access to certain xdata registers (TRM page 15-106).
\r
26 * For our configuration, 48 MHz FX2 / 48 MHz IFCLK, we need three cycles. Each
\r
27 * NOP is a single cycle....
\r
29 * From TRM page 15-105:
\r
31 * Under certain conditions, some read and write access to the FX2 registers must
\r
32 * be separated by a "synchronization delay". The delay is necessary only under the
\r
33 * following conditions:
\r
35 * - between a write to any register in the 0xE600 - 0xE6FF range and a write to one
\r
36 * of the registers listed below.
\r
38 * - between a write to one of the registers listed below and a read from any register
\r
39 * in the 0xE600 - 0xE6FF range.
\r
41 * Registers which require a synchronization delay:
\r
43 * FIFORESET FIFOPINPOLAR
\r
45 * EPxFIFOPFH:L EPxAUTOINLENH:L
\r
46 * EPxFIFOCFG EPxGPIFFLGSEL
\r
47 * PINFLAGSAB PINFLAGSCD
\r
48 * EPxFIFOIE EPxFIFOIRQ
\r
50 * UDMACRCH:L GPIFADRH:L
\r
51 * GPIFTRIG EPxGPIFTRIG
\r
58 * FIXME ensure that the peep hole optimizer isn't screwing us
\r
60 #define SYNCDELAY _asm nop; nop; nop; _endasm
\r
61 #define NOP _asm nop; _endasm
\r
64 #endif /* _SYNCDELAY_H_ */
\r