Line 299... |
Line 299... |
|
|
|
|
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
/*!Resets the local JTAG via JP1
|
/*!Resets the local JTAG via JP1
|
|
|
Only works if this is a local connection
|
Only works if this is a local connection. The old code used to ignore the
|
|
write function results, but that upsets some particularly picky Ubuntu GCC
|
|
compilers, so we get the result and do nothing with it.
|
|
|
Writes:
|
Writes:
|
@verbatim
|
@verbatim
|
TCK=0 TRST=0 TMS=0 TDI=0
|
TCK=0 TRST=0 TMS=0 TDI=0
|
TCK=0 TRST=1 TMS=0 TDI=0
|
TCK=0 TRST=1 TMS=0 TDI=0
|
Line 315... |
Line 317... |
static void
|
static void
|
jp1_ll_reset_jp1()
|
jp1_ll_reset_jp1()
|
{
|
{
|
unsigned char data;
|
unsigned char data;
|
int lp = or1k_jtag_connection.device.lp; /* CZ */
|
int lp = or1k_jtag_connection.device.lp; /* CZ */
|
|
ssize_t res; /* So don't ignore results */
|
|
|
if (OR1K_JTAG_LOCAL != or1k_jtag_connection.location)
|
if (OR1K_JTAG_LOCAL != or1k_jtag_connection.location)
|
{
|
{
|
error ("jp1_ll_reset_jp1 called without a local connection!");
|
error ("jp1_ll_reset_jp1 called without a local connection!");
|
}
|
}
|
|
|
data = 0;
|
data = 0;
|
write (lp, &data, sizeof (data));
|
res = write (lp, &data, sizeof (data));
|
JP1_WAIT ();
|
JP1_WAIT ();
|
|
|
data = JP1_TRST;
|
data = JP1_TRST;
|
write (lp, &data, sizeof (data) );
|
res = write (lp, &data, sizeof (data) );
|
JP1_WAIT ();
|
JP1_WAIT ();
|
|
|
} /* jp1_ll_reset_jp1() */
|
} /* jp1_ll_reset_jp1() */
|
|
|
|
|
Line 357... |
Line 360... |
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
|
|
static unsigned char
|
static unsigned char
|
jp1_ll_read_jp1()
|
jp1_ll_read_jp1()
|
{
|
{
|
int data = 0; /* Initialize to keep GCC 4.4.1 OK */
|
int data;
|
|
|
if (OR1K_JTAG_LOCAL != or1k_jtag_connection.location)
|
if (OR1K_JTAG_LOCAL != or1k_jtag_connection.location)
|
{ /* CZ */
|
{ /* CZ */
|
error ("jp1_ll_read_jp1 called without a local connection!");
|
error ("jp1_ll_read_jp1 called without a local connection!");
|
}
|
}
|
Line 382... |
Line 385... |
Takes TMS and TDI values from the bottom two bits of the argument
|
Takes TMS and TDI values from the bottom two bits of the argument
|
|
|
Rewritten by Jeremy Bennett to work whatever the TMS and TDI bit positions
|
Rewritten by Jeremy Bennett to work whatever the TMS and TDI bit positions
|
in JP1.
|
in JP1.
|
|
|
|
The old code used to ignore the write function results, but that upsets
|
|
some particularly picky Ubuntu GCC compilers, so we get the result and do
|
|
nothing with it.
|
|
|
Writes:
|
Writes:
|
@verbatim
|
@verbatim
|
TCK=0 TRST=1 TMS=tms TDI=tdi
|
TCK=0 TRST=1 TMS=tms TDI=tdi
|
TCK=1 TRST=1 TMS=tms TDI=tdi
|
TCK=1 TRST=1 TMS=tms TDI=tdi
|
@endverbatim
|
@endverbatim
|
Line 398... |
Line 405... |
jp1_ll_write_jp1 (unsigned char tms,
|
jp1_ll_write_jp1 (unsigned char tms,
|
unsigned char tdi)
|
unsigned char tdi)
|
{
|
{
|
unsigned char data;
|
unsigned char data;
|
int lp = or1k_jtag_connection.device.lp; /* CZ */
|
int lp = or1k_jtag_connection.device.lp; /* CZ */
|
|
ssize_t res; /* So don't ignore results */
|
|
|
if (OR1K_JTAG_LOCAL != or1k_jtag_connection.location)
|
if (OR1K_JTAG_LOCAL != or1k_jtag_connection.location)
|
{
|
{
|
error ("jp1_ll_write_jp1 called without a local connection!");
|
error ("jp1_ll_write_jp1 called without a local connection!");
|
}
|
}
|
|
|
data = (tms ? JP1_TDI : 0) |
|
data = (tms ? JP1_TDI : 0) |
|
(tdi ? JP1_TMS : 0) |
|
(tdi ? JP1_TMS : 0) |
|
JP1_TRST;
|
JP1_TRST;
|
write (lp, &data, sizeof (data) );
|
res = write (lp, &data, sizeof (data) );
|
JP1_WAIT ();
|
JP1_WAIT ();
|
|
|
/* rise clock */
|
/* rise clock */
|
data |= JP1_TCK;
|
data |= JP1_TCK;
|
write (lp, &data, sizeof (data) );
|
res = write (lp, &data, sizeof (data) );
|
JP1_WAIT ();
|
JP1_WAIT ();
|
|
|
/* Update the CRC for this TDI bit */
|
/* Update the CRC for this TDI bit */
|
jp1_crc_w = jp1_ll_crc_calc (jp1_crc_w, tdi ? 1 : 0);
|
jp1_crc_w = jp1_ll_crc_calc (jp1_crc_w, tdi ? 1 : 0);
|
|
|