2003-01-18 Marcel Telka <marcel@telka.sk>

* src/jtag.c (main): Added new 'frequency' command.
	* src/help.c (help): Added help for 'frequency' command.
	* include/cable.h (cable_wait): Added new function prototype.
	* src/tap/cable.c (cable_wait): Added new function.
	* src/tap/cable/byteblaster.c (byteblaster_clock): Added support for TCK
		frequency limit.
	(byteblaster_get_tdo): Ditto.
	* src/tap/cable/dlc5.c (dlc5_clock): Ditto.
	(dlc5_get_tdo): Ditto.
	* src/tap/cable/ea253.c (ea253_clock): Ditto.
	(ea253_get_tdo): Ditto.
	* src/tap/cable/ei012.c (ei012_clock): Ditto.
	(ei012_get_tdo): Ditto.
	* src/tap/cable/wiggler.c (wiggler_clock): Ditto.
	(wiggler_get_tdo): Ditto.


git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@320 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Marcel Telka 22 years ago
parent ded25d2b2f
commit bf49310557

@ -1,3 +1,21 @@
2003-01-18 Marcel Telka <marcel@telka.sk>
* src/jtag.c (main): Added new 'frequency' command.
* src/help.c (help): Added help for 'frequency' command.
* include/cable.h (cable_wait): Added new function prototype.
* src/tap/cable.c (cable_wait): Added new function.
* src/tap/cable/byteblaster.c (byteblaster_clock): Added support for TCK
frequency limit.
(byteblaster_get_tdo): Ditto.
* src/tap/cable/dlc5.c (dlc5_clock): Ditto.
(dlc5_get_tdo): Ditto.
* src/tap/cable/ea253.c (ea253_clock): Ditto.
(ea253_get_tdo): Ditto.
* src/tap/cable/ei012.c (ei012_clock): Ditto.
(ei012_get_tdo): Ditto.
* src/tap/cable/wiggler.c (wiggler_clock): Ditto.
(wiggler_get_tdo): Ditto.
2003-01-16 Marcel Telka <marcel@telka.sk>
* data/MANUFACTURERS: Added Cypress (patch 669157). Thanks to Chris Ellec.

@ -1,6 +1,7 @@
$Id$
* Added new manufacturer: Cypress. (patch 669157, Chris Ellec)
* Added new 'frequency' command to limit maximum TCK frequency
jtag-0.2.1 (2003-01-13):

@ -38,6 +38,9 @@ typedef struct {
void (*set_trst)( int );
} cable_driver_t;
extern uint32_t frequency;
void cable_wait( void );
extern cable_driver_t *cable;
#define tap_clock cable->clock
#define tap_get_tdo cable->get_tdo

@ -40,6 +40,7 @@ help( const char *cmd )
"\n"
"quit exit from %s\n"
"help display this help\n"
"frequency setup JTAG frequency\n"
"cable select JTAG cable\n"
"detect detect parts on the JTAG chain\n"
"discovery discovery unknown parts in the JTAG chain\n"
@ -64,6 +65,19 @@ help( const char *cmd )
"Usage: help [COMMAND]\n"
"Print short help for COMMAND, or list of available commands.\n"
);
else if (strcmp( cmd, "frequency" ) == 0)
printf(
"Usage: frequency FREQ\n"
"Change TCK frequency to FREQ.\n"
"\n"
"FREQ is in hertz. It's a maximum TCK frequency for JTAG interface.\n"
"In some cases the TCK frequency is less than FREQ, but the frequency\n"
"is never more than FREQ. Maximum supported frequency depends on JTAG\n"
"adapter.\n"
"\n"
"FREQ must be an unsigned integer. Minimum allowed frequency is 1 Hz.\n"
"Use 0 for FREQ to disable frequency limit.\n"
);
else if (strcmp( cmd, "cable" ) == 0) {
int i;

@ -100,6 +100,26 @@ main( void )
continue;
}
if (strcmp( t, "frequency" ) == 0) {
uint32_t freq;
t = get_token( NULL );
if (!t) {
printf( "Missing argument(s)\n" );
continue;
}
if ((sscanf( t, "0x%x", &freq ) != 1) && (sscanf( t, "%u", &freq ) != 1)) {
printf( "syntax error\n" );
continue;
}
printf( "Setting TCK frequency to %u Hz\n", freq );
frequency = freq;
continue;
}
if (strcmp( t, "cable" ) == 0) {
int i;
unsigned int port;

@ -23,6 +23,8 @@
*/
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
#include "cable.h"
@ -32,6 +34,8 @@ extern cable_driver_t ea253_cable_driver;
extern cable_driver_t ei012_cable_driver;
extern cable_driver_t wiggler_cable_driver;
uint32_t frequency = 0;
cable_driver_t *cable_drivers[] = {
&byteblaster_cable_driver,
&dlc5_cable_driver,
@ -40,3 +44,18 @@ cable_driver_t *cable_drivers[] = {
&wiggler_cable_driver,
NULL /* last must be NULL */
};
void
cable_wait( void )
{
useconds_t s;
if (!frequency)
return;
s = 1000000 / frequency / 2;
if (s == 0)
s = 1;
usleep( s );
}

@ -77,7 +77,9 @@ byteblaster_clock( int tms, int tdi )
tdi &= 1;
outb( (0 << TCK) | (tms << TMS) | (tdi << TDI), port );
cable_wait();
outb( (1 << TCK) | (tms << TMS) | (tdi << TDI), port );
cable_wait();
tap_state_clock( tms );
}
@ -86,6 +88,7 @@ static int
byteblaster_get_tdo( void )
{
outb( 0 << TCK, port );
cable_wait();
return ((inb( port + 1 ) ^ 0x80) >> TDO) & 1; /* BUSY is inverted */
}

@ -77,7 +77,9 @@ dlc5_clock( int tms, int tdi )
tdi &= 1;
outb( (1 << PROG) | (0 << TCK) | (tms << TMS) | (tdi << TDI), port );
cable_wait();
outb( (1 << PROG) | (1 << TCK) | (tms << TMS) | (tdi << TDI), port );
cable_wait();
tap_state_clock( tms );
}
@ -86,6 +88,7 @@ static int
dlc5_get_tdo( void )
{
outb( (1 << PROG) | (0 << TCK), port );
cable_wait();
return ((inb( port + 1 ) ^ 0x80) >> TDO) & 1; /* BUSY is inverted */
}

@ -76,7 +76,9 @@ ea253_clock( int tms, int tdi )
tdi &= 1;
outb( (trst << TRST) | (0 << TCK) | (tms << TMS) | (tdi << TDI), port );
cable_wait();
outb( (trst << TRST) | (1 << TCK) | (tms << TMS) | (tdi << TDI), port );
cable_wait();
tap_state_clock( tms );
}
@ -85,6 +87,7 @@ static int
ea253_get_tdo( void )
{
outb( (tap_state_get_trst() << TRST) | (0 << TCK), port );
cable_wait();
return ((inb( port + 1 ) ^ 0x80) >> TDO) & 1; /* BUSY is inverted */
}

@ -77,7 +77,9 @@ ei012_clock( int tms, int tdi )
tdi &= 1;
outb( (trst << TRST) | (0 << TCK) | (tms << TMS) | (tdi << TDI), port );
cable_wait();
outb( (trst << TRST) | (1 << TCK) | (tms << TMS) | (tdi << TDI), port );
cable_wait();
tap_state_clock( tms );
}
@ -86,6 +88,7 @@ static int
ei012_get_tdo( void )
{
outb( (tap_state_get_trst() << TRST) | (0 << TCK), port );
cable_wait();
return ((inb( port + 1 ) ^ 0x80) >> TDO) & 1; /* BUSY is inverted */
}

@ -80,7 +80,9 @@ wiggler_clock( int tms, int tdi )
tdi &= 1;
outb( (trst << TRST) | (0 << TCK) | (tms << TMS) | (tdi << TDI), port );
cable_wait();
outb( (trst << TRST) | (1 << TCK) | (tms << TMS) | (tdi << TDI), port );
cable_wait();
tap_state_clock( tms );
}
@ -89,6 +91,7 @@ static int
wiggler_get_tdo( void )
{
outb( (tap_state_get_trst() << TRST) | (0 << TCK), port );
cable_wait();
return ((inb( port + 1 ) ^ 0x80) >> TDO) & 1; /* BUSY is inverted */
}

Loading…
Cancel
Save