From a4f2e1eaaca40dbcc7916755efb094cacafbb65c Mon Sep 17 00:00:00 2001 From: drath Date: Tue, 9 Jan 2007 17:19:41 +0000 Subject: - disabled FT2232 debug output (that code should be fairly stable) - fixed bug in jtag.c where JTAG command type was wrong for PATHMOVE commands - added lattice ISP cable (experimental) - properly initialize parallel port (clear tristate bit) - fixed jtag/Makefile.am that failed with some versions of autotools - print error number if read() in gdbserver.c failed on Windows - fixed handling of opcodes with bits 27-25 b011 (comment was correct, code had a bug) - added support for AT91SAM7SE internal flash git-svn-id: svn://svn.berlios.de/openocd/trunk@122 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- src/jtag/Makefile.am | 4 +--- src/jtag/ft2232.c | 4 ++-- src/jtag/jtag.c | 2 +- src/jtag/parport.c | 23 +++++++++++++++++------ 4 files changed, 21 insertions(+), 12 deletions(-) (limited to 'src/jtag') diff --git a/src/jtag/Makefile.am b/src/jtag/Makefile.am index d4812a46..78230b62 100644 --- a/src/jtag/Makefile.am +++ b/src/jtag/Makefile.am @@ -28,14 +28,12 @@ endif if FT2232_LIBFTDI FT2232FILES = ft2232.c else -FT2232FILES = -endif - if FT2232_FTD2XX FT2232FILES = ft2232.c else FT2232FILES = endif +endif if AMTJTAGACCEL AMTJTAGACCELFILES = amt_jtagaccel.c diff --git a/src/jtag/ft2232.c b/src/jtag/ft2232.c index 096111bc..386da249 100644 --- a/src/jtag/ft2232.c +++ b/src/jtag/ft2232.c @@ -52,13 +52,13 @@ /* enable this to debug io latency */ -#if 1 +#if 0 #define _DEBUG_USB_IO_ #endif /* enable this to debug communication */ -#if 1 +#if 0 #define _DEBUG_USB_COMMS_ #endif diff --git a/src/jtag/jtag.c b/src/jtag/jtag.c index 259a327d..263eed1a 100644 --- a/src/jtag/jtag.c +++ b/src/jtag/jtag.c @@ -714,7 +714,7 @@ int jtag_add_pathmove(int num_states, enum tap_state *path) *last_cmd = cmd_queue_alloc(sizeof(jtag_command_t)); last_comand_pointer = &((*last_cmd)->next); (*last_cmd)->next = NULL; - (*last_cmd)->type = JTAG_RUNTEST; + (*last_cmd)->type = JTAG_PATHMOVE; (*last_cmd)->cmd.pathmove = cmd_queue_alloc(sizeof(pathmove_command_t)); (*last_cmd)->cmd.pathmove->num_states = num_states; diff --git a/src/jtag/parport.c b/src/jtag/parport.c index c87f98e4..8278bda9 100644 --- a/src/jtag/parport.c +++ b/src/jtag/parport.c @@ -98,6 +98,7 @@ cable_t cables[] = { "chameleon", 0x80, 0x00, 0x04, 0x01, 0x02, 0x00, 0x00, 0x80, 0x00 }, { "dlc5", 0x10, 0x00, 0x04, 0x02, 0x01, 0x00, 0x00, 0x00, 0x10 }, { "triton", 0x80, 0x08, 0x04, 0x01, 0x02, 0x00, 0x00, 0x80, 0x00 }, + { "lattice", 0x40, 0x10, 0x04, 0x02, 0x01, 0x08, 0x00, 0x00, 0x18 }, { NULL, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }; @@ -311,7 +312,7 @@ int parport_init(void) dataport_value = cable->PORT_INIT; #if PARPORT_USE_PPDEV == 1 - if (device_handle>0) + if (device_handle > 0) { ERROR("device is already opened"); return ERROR_JTAG_INIT_FAILED; @@ -322,13 +323,14 @@ int parport_init(void) snprintf(buffer, 256, "/dev/ppi%d", parport_port); device_handle = open(buffer, O_WRONLY); -#else +#else /* not __Free_BSD */ DEBUG("opening /dev/parport%d...", parport_port); snprintf(buffer, 256, "/dev/parport%d", parport_port); device_handle = open(buffer, O_WRONLY); -#endif - if (device_handle<0) +#endif /* __FreeBSD__ */ + + if (device_handle < 0) { ERROR("cannot open device. check it exists and that user read and write rights are set"); return ERROR_JTAG_INIT_FAILED; @@ -359,8 +361,9 @@ int parport_init(void) ERROR("cannot set compatible 1284 mode to device"); return ERROR_JTAG_INIT_FAILED; } -#endif -#else +#endif /* not __Free_BSD__ */ + +#else /* not PARPORT_USE_PPDEV */ if (parport_port == 0) { parport_port = 0x378; @@ -381,6 +384,14 @@ int parport_init(void) return ERROR_JTAG_INIT_FAILED; } DEBUG("...privileges granted"); + + /* make sure parallel port is in right mode (clear tristate and interrupt */ + #ifdef __FreeBSD__ + outb(parport_port + 2, 0x0); + #else + outb(0x0, dataport); + #endif + #endif /* PARPORT_USE_PPDEV */ parport_reset(0, 0); -- cgit v1.2.3