3 * Stefan Roese, esd gmbh germany, stefan.roese@esd-electronics.com
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24 /*******************************************************/
26 /* abstract: This file contains the routines to */
27 /* output values on the JTAG ports, to read */
28 /* the TDO bit, and to read a byte of data */
31 /*******************************************************/
34 #include <asm/processor.h>
39 static unsigned long output = 0;
40 static int filepos = 0;
41 static int oldstate = 0;
42 static int newstate = 0;
43 static int readptr = 0;
45 extern const unsigned char *xsvfdata;
47 /* if in debugging mode, then just set the variables */
48 void setPort(short p,short val)
70 out_be32((void *)GPIO0_OR, output);
78 setPort(TCK,0); /* set the TCK port to low */
79 setPort(TCK,1); /* set the TCK port to high */
83 /* read in a byte of data from the prom */
84 void readByte(unsigned char *data)
86 /* pretend reading using a file */
87 *data = xsvfdata[readptr++];
88 newstate = filepos++ >> 10;
89 if (newstate != oldstate) {
90 printf("%4d kB\r\r\r\r", newstate);
95 /* read the TDO bit from port */
96 unsigned char readTDOBit(void)
100 inputs = in_be32((void *)GPIO0_IR);
101 if (inputs & JTAG_TDO)
108 /* Wait at least the specified number of microsec. */
109 /* Use a timer if possible; otherwise estimate the number of instructions */
110 /* necessary to be run based on the microcontroller speed. For this example */
111 /* we pulse the TCK port a number of times based on the processor speed. */
112 void waitTime(long microsec)
114 udelay(microsec); /* esd */