/* system includes */
-#ifndef _WIN32
-#include <sys/io.h>
-#else
+#ifdef _WIN32
#include "errno.h"
#endif /* _WIN32 */
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
+#else /* not PARPORT_USE_PPDEV */
+#ifndef _WIN32
+#include <sys/io.h>
+#endif
#endif
#if PARPORT_USE_GIVEIO == 1
#include "log.h"
/* configuration */
-unsigned long amt_jtagaccel_port;
+u16 amt_jtagaccel_port;
/* interface variables
*/
.execute_queue = amt_jtagaccel_execute_queue,
- .support_pathmove = 0,
-
.speed = amt_jtagaccel_speed,
.register_commands = amt_jtagaccel_register_commands,
.init = amt_jtagaccel_init,
if (ar_status & 0x80)
{
- ERROR("amt_jtagaccel timed out while waiting for end of scan, rtck was %s", (rtck_enabled) ? "enabled" : "disabled");
+ ERROR("amt_jtagaccel timed out while waiting for end of scan, rtck was %s, last AR_STATUS: 0x%2.2x", (rtck_enabled) ? "enabled" : "disabled", ar_status);
exit(-1);
}
}
int scan_size;
enum scan_type type;
u8 *buffer;
+ int retval;
+
+ /* return ERROR_OK, unless a jtag_read_buffer returns a failed check
+ * that wasn't handled by a caller-provided error handler
+ */
+ retval = ERROR_OK;
while (cmd)
{
type = jtag_scan_type(cmd->cmd.scan);
amt_jtagaccel_scan(cmd->cmd.scan->ir_scan, type, buffer, scan_size);
if (jtag_read_buffer(buffer, cmd->cmd.scan) != ERROR_OK)
- return ERROR_JTAG_QUEUE_FAILED;
+ retval = ERROR_JTAG_QUEUE_FAILED;
if (buffer)
free(buffer);
break;
case JTAG_SLEEP:
#ifdef _DEBUG_JTAG_IO_
- DEBUG("sleep", cmd->cmd.sleep->us);
+ DEBUG("sleep %i", cmd->cmd.sleep->us);
#endif
jtag_sleep(cmd->cmd.sleep->us);
break;
cmd = cmd->next;
}
- return ERROR_OK;
+ return retval;
}
#if PARPORT_USE_GIVEIO == 1
#else
u8 status_port;
#endif
-
+ u8 ar_status;
+
#if PARPORT_USE_PPDEV == 1
if (device_handle > 0)
{
outb(0x04, amt_jtagaccel_port + 2);
#endif
+ if (rtck_enabled)
+ {
+ /* set RTCK enable bit */
+ aw_control_fsm |= 0x02;
+ }
+
/* enable JTAG port */
aw_control_fsm |= 0x04;
AMT_AW(aw_control_fsm);
amt_jtagaccel_reset(0, 0);
+ /* read status register */
+ AMT_AR(ar_status);
+ DEBUG("AR_STATUS: 0x%2.2x", ar_status);
+
return ERROR_OK;
}
if (strcmp(args[0], "enabled") == 0)
{
rtck_enabled = 1;
-
- /* set RTCK enable bit */
- aw_control_fsm |= 0x02;
- AMT_AW(aw_control_fsm);
+ }
+ else
+ {
+ rtck_enabled = 0;
}
}