/* -*- c++ -*- */\r
-\r
/*-----------------------------------------------------------------------------\r
-\r
* Synchronization delay for FX2 access to specific registers\r
-\r
*-----------------------------------------------------------------------------\r
-\r
* Code taken from USRP2 firmware (GNU Radio Project), version 3.0.2,\r
-\r
* Copyright 2003 Free Software Foundation, Inc.\r
-\r
*-----------------------------------------------------------------------------\r
-\r
* This code is part of usbjtag. usbjtag is free software; you can redistribute\r
-\r
* it and/or modify it under the terms of the GNU General Public License as\r
-\r
* published by the Free Software Foundation; either version 2 of the License,\r
-\r
* or (at your option) any later version. usbjtag is distributed in the hope\r
-\r
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied\r
-\r
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-\r
* GNU General Public License for more details. You should have received a\r
-\r
* copy of the GNU General Public License along with this program in the file\r
-\r
* COPYING; if not, write to the Free Software Foundation, Inc., 51 Franklin\r
-\r
* St, Fifth Floor, Boston, MA 02110-1301 USA\r
-\r
*-----------------------------------------------------------------------------\r
-\r
*/\r
\r
-\r
-\r
#ifndef _SYNCDELAY_H_\r
-\r
#define _SYNCDELAY_H_\r
\r
-\r
-\r
/*\r
-\r
* Magic delay required between access to certain xdata registers (TRM page 15-106).\r
-\r
* For our configuration, 48 MHz FX2 / 48 MHz IFCLK, we need three cycles. Each\r
-\r
* NOP is a single cycle....\r
-\r
*\r
-\r
* From TRM page 15-105:\r
-\r
*\r
-\r
* Under certain conditions, some read and write access to the FX2 registers must\r
-\r
* be separated by a "synchronization delay". The delay is necessary only under the\r
-\r
* following conditions:\r
-\r
*\r
-\r
* - between a write to any register in the 0xE600 - 0xE6FF range and a write to one\r
-\r
* of the registers listed below.\r
-\r
*\r
-\r
* - between a write to one of the registers listed below and a read from any register\r
-\r
* in the 0xE600 - 0xE6FF range.\r
-\r
*\r
-\r
* Registers which require a synchronization delay:\r
-\r
*\r
-\r
* FIFORESET FIFOPINPOLAR\r
-\r
* INPKTEND EPxBCH:L\r
-\r
* EPxFIFOPFH:L EPxAUTOINLENH:L\r
-\r
* EPxFIFOCFG EPxGPIFFLGSEL\r
-\r
* PINFLAGSAB PINFLAGSCD\r
-\r
* EPxFIFOIE EPxFIFOIRQ\r
-\r
* GPIFIE GPIFIRQ\r
-\r
* UDMACRCH:L GPIFADRH:L\r
-\r
* GPIFTRIG EPxGPIFTRIG\r
-\r
* OUTPKTEND REVCTL\r
-\r
* GPIFTCB3 GPIFTCB2\r
-\r
* GPIFTCB1 GPIFTCB0\r
-\r
*/\r
\r
-\r
-\r
/*\r
-\r
* FIXME ensure that the peep hole optimizer isn't screwing us\r
-\r
*/\r
-\r
#define SYNCDELAY _asm nop; nop; nop; _endasm\r
-\r
#define NOP _asm nop; _endasm\r
\r
\r
-\r
-\r
-\r
#endif /* _SYNCDELAY_H_ */\r
-\r