From 8d8937f1a68e1b050b92f91b1d264bf4bd3af489 Mon Sep 17 00:00:00 2001 From: oharboe Date: Wed, 17 Jun 2009 10:51:34 +0000 Subject: [PATCH] dummy driver now works under eCos git-svn-id: svn://svn.berlios.de/openocd/trunk@2268 b42882b7-edfa-0310-969c-e2dbd0fdcd60 --- configure.in | 17 ++++++++++++++--- src/ecosboard.c | 30 +++++++++++++++++++++++++----- src/jtag/Makefile.am | 2 +- src/jtag/jtag.h | 2 +- src/jtag/tcl.c | 4 ++-- src/jtag/zy1000/zy1000.c | 24 ------------------------ 6 files changed, 43 insertions(+), 36 deletions(-) diff --git a/configure.in b/configure.in index ef552f5c..9250dc58 100644 --- a/configure.in +++ b/configure.in @@ -329,9 +329,13 @@ AC_ARG_ENABLE(amtjtagaccel, [build_amtjtagaccel=$enableval], [build_amtjtagaccel=no]) AC_ARG_ENABLE(ecosboard, - AS_HELP_STRING([--enable-ecosboard], [Enable building support for eCosBoard based JTAG debugger]), + AS_HELP_STRING([--enable-ecosboard], [Enable building support for eCos based JTAG debugger]), [build_ecosboard=$enableval], [build_ecosboard=no]) +AC_ARG_ENABLE(zy1000, + AS_HELP_STRING([--enable-zy1000], [Enable ZY1000 interface]), + [build_zy1000=$enableval], [build_zy1000=no]) + AC_ARG_ENABLE(ioutil, AS_HELP_STRING([--enable-ioutil], [Enable ioutil functions - useful for standalone OpenOCD implementations]), [build_ioutil=$enableval], [build_ioutil=no]) @@ -400,7 +404,7 @@ AC_ARG_ENABLE(minidriver_dummy, build_minidriver=no AC_MSG_CHECKING([whether to enable ZY1000 minidriver]) -if test $build_ecosboard = yes; then +if test $build_zy1000 = yes; then if test $build_minidriver = yes; then AC_MSG_ERROR([Multiple minidriver options have been enabled.]) fi @@ -408,7 +412,7 @@ if test $build_ecosboard = yes; then [Define to 1 if you have the header file.]) build_minidriver=yes fi -AC_MSG_RESULT($build_ecosboard) +AC_MSG_RESULT($build_zy1000) AC_MSG_CHECKING([whether to enable dummy minidriver]) @@ -527,6 +531,12 @@ else AC_DEFINE(BUILD_ECOSBOARD, 0, [0 if you don't want eCosBoard.]) fi +if test $build_zy1000 = yes; then + AC_DEFINE(BUILD_ZY1000, 1, [1 if you want ZY1000.]) +else + AC_DEFINE(BUILD_ZY1000, 0, [0 if you don't want ZY1000.]) +fi + if test $build_ioutil = yes; then AC_DEFINE(BUILD_IOUTIL, 1, [1 if you want ioutils.]) else @@ -898,6 +908,7 @@ AM_CONDITIONAL(DUMMY, test $build_dummy = yes) AM_CONDITIONAL(GIVEIO, test x$parport_use_giveio = xyes) AM_CONDITIONAL(EP93XX, test $build_ep93xx = yes) AM_CONDITIONAL(ECOSBOARD, test $build_ecosboard = yes) +AM_CONDITIONAL(ZY1000, test $build_zy1000 = yes) AM_CONDITIONAL(IOUTIL, test $build_ioutil = yes) AM_CONDITIONAL(HTTPD, test $build_httpd = yes) AM_CONDITIONAL(AT91RM9200, test $build_at91rm9200 = yes) diff --git a/src/ecosboard.c b/src/ecosboard.c index 20907576..0b1bf36e 100644 --- a/src/ecosboard.c +++ b/src/ecosboard.c @@ -191,7 +191,6 @@ int zy1000_configuration_output_handler_log(struct command_context_s *context, } #ifdef CYGPKG_PROFILE_GPROF -extern void start_profile(void); int eCosBoard_handle_eCosBoard_profile_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) { @@ -304,7 +303,7 @@ void format(void) e.len = ds.dev_size; e.err_address = &err_addr; - diag_printf("Formatting 0x%08x bytes\n", ds.dev_size); + diag_printf("Formatting 0x%08x bytes\n", (int)ds.dev_size); err = cyg_io_get_config(handle, CYG_IO_GET_CONFIG_FLASH_ERASE, &e, &len); if (err != ENOERR) { @@ -421,8 +420,6 @@ static int zylinjtag_Jim_Command_reboot(Jim_Interp *interp, int argc, } -extern Jim_Interp *interp; - static void zylinjtag_startNetwork(void) { // Bring TCP/IP up immediately before we're ready to accept commands. @@ -860,7 +857,7 @@ int boolParam(char *var); command_context_t *setup_command_handler(void); -extern const char *zylin_config_dir; +static const char *zylin_config_dir="/config/settings"; int add_default_dirs(void) { @@ -1551,3 +1548,26 @@ static int logfs_fo_close(struct CYG_FILE_TAG *fp) return ENOERR; } +int loadFile(const char *fileName, void **data, int *len); + +/* boolean parameter stored on config */ +int boolParam(char *var) +{ + bool result = false; + char *name = alloc_printf("%s/%s", zylin_config_dir, var); + if (name == NULL) + return result; + + void *data; + int len; + if (loadFile(name, &data, &len) == ERROR_OK) + { + if (len > 1) + len = 1; + result = strncmp((char *) data, "1", len) == 0; + free(data); + } + free(name); + return result; +} + diff --git a/src/jtag/Makefile.am b/src/jtag/Makefile.am index 58bbff36..5af6c74f 100644 --- a/src/jtag/Makefile.am +++ b/src/jtag/Makefile.am @@ -9,7 +9,7 @@ DRIVERFILES = if MINIDRIVER -if ECOSBOARD +if ZY1000 DRIVERFILES += zy1000/zy1000.c AM_CPPFLAGS += -I$(srcdir)/zy1000 endif diff --git a/src/jtag/jtag.h b/src/jtag/jtag.h index cddceef4..459f7fd0 100644 --- a/src/jtag/jtag.h +++ b/src/jtag/jtag.h @@ -62,7 +62,7 @@ */ typedef enum tap_state { -#if BUILD_ECOSBOARD +#if BUILD_ZY1000 /* These are the old numbers. Leave as-is for now... */ TAP_RESET = 0, TAP_IDLE = 8, TAP_DRSELECT = 1, TAP_DRCAPTURE = 2, TAP_DRSHIFT = 3, TAP_DREXIT1 = 4, diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c index fc2671e2..ad4d886a 100644 --- a/src/jtag/tcl.c +++ b/src/jtag/tcl.c @@ -49,7 +49,7 @@ static const Jim_Nvp nvp_jtag_tap_event[] = { /* jtag interfaces (parport, FTDI-USB, TI-USB, ...) */ -#if BUILD_ECOSBOARD == 1 +#if BUILD_ZY1000 == 1 extern jtag_interface_t zy1000_interface; #elif defined(BUILD_MINIDRIVER_DUMMY) extern jtag_interface_t minidummy_interface; @@ -119,7 +119,7 @@ static const Jim_Nvp nvp_jtag_tap_event[] = { * or some number of standard driver interfaces, never both. */ jtag_interface_t *jtag_interfaces[] = { -#if BUILD_ECOSBOARD == 1 +#if BUILD_ZY1000 == 1 &zy1000_interface, #elif defined(BUILD_MINIDRIVER_DUMMY) &minidummy_interface, diff --git a/src/jtag/zy1000/zy1000.c b/src/jtag/zy1000/zy1000.c index 4dbdef24..daac0772 100644 --- a/src/jtag/zy1000/zy1000.c +++ b/src/jtag/zy1000/zy1000.c @@ -33,7 +33,6 @@ #define ZYLIN_TIME __TIME__ #define ZYLIN_OPENOCD "$Revision$" #define ZYLIN_OPENOCD_VERSION "Zylin JTAG ZY1000 " ZYLIN_VERSION " " ZYLIN_DATE " " ZYLIN_TIME -const char *zylin_config_dir="/config/settings"; /* low level command set */ @@ -783,27 +782,4 @@ void embeddedice_write_dcc(jtag_tap_t *tap, int reg_addr, u8 *buffer, int little } } -int loadFile(const char *fileName, void **data, int *len); - -/* boolean parameter stored on config */ -int boolParam(char *var) -{ - bool result = false; - char *name = alloc_printf("%s/%s", zylin_config_dir, var); - if (name == NULL) - return result; - - void *data; - int len; - if (loadFile(name, &data, &len) == ERROR_OK) - { - if (len > 1) - len = 1; - result = strncmp((char *) data, "1", len) == 0; - free(data); - } - free(name); - return result; -} - -- 2.39.5