diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index 7c4a8bdd..8b178eb5 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -1,10 +1,15 @@ +2009-05-18 Rutger Hofman + + * src/cmd/cmd_debug.c, include/urjtag/jtag.h, src/global/urjtag.c: change + to set log level; remove unused global variable urj_debug_mode + 2009-05-18 Rutger Hofman Make it compile for my eCos BlackFin checkout. - numerous casts because "%zd" ever requires a size_t, even for a manifest constant; and because a uint32_t should be cast to a long unsigned to be printed with "%lu" (long unsigned is at least 32-bit) - - include/urjtag/urjtag.h, include/urjtag/urjtag.h.in: rename to only + * include/urjtag/urjtag.h, include/urjtag/urjtag.h.in: rename to only export .h files for modules actually configured: USB, SVF, BSDL are only conditionally exported diff --git a/urjtag/include/urjtag/jtag.h b/urjtag/include/urjtag/jtag.h index 8d29c369..889bb822 100644 --- a/urjtag/include/urjtag/jtag.h +++ b/urjtag/include/urjtag/jtag.h @@ -28,8 +28,6 @@ #include "types.h" extern int urj_big_endian; -/* @@@@ RFHH deprecate in favor of urj_log level */ -extern int urj_debug_mode; /** * Register the application name with global/data_dir. diff --git a/urjtag/src/cmd/cmd_debug.c b/urjtag/src/cmd/cmd_debug.c index 36383f83..b0b35f57 100644 --- a/urjtag/src/cmd/cmd_debug.c +++ b/urjtag/src/cmd/cmd_debug.c @@ -25,11 +25,10 @@ #include -#include #include #include -#include +#include #include @@ -38,11 +37,6 @@ static int cmd_debug_run (urj_chain_t *chain, char *params[]) { - long unsigned i; - - // @@@@ RFHH change this to control the urj_log level - // @@@@ RFHH urj_debug_mode isn't used anyway - if (urj_cmd_params (params) != 2) { urj_error_set (URJ_ERROR_SYNTAX, @@ -51,10 +45,29 @@ cmd_debug_run (urj_chain_t *chain, char *params[]) return URJ_STATUS_FAIL; } - if (urj_cmd_get_number (params[1], &i) != URJ_STATUS_OK) + if (0) + ; + else if (strcasecmp(params[1], "all") == 0) + urj_log_state.level = URJ_LOG_LEVEL_ALL; + else if (strcasecmp(params[1], "comm") == 0) + urj_log_state.level = URJ_LOG_LEVEL_COMM; + else if (strcasecmp(params[1], "debug") == 0) + urj_log_state.level = URJ_LOG_LEVEL_DEBUG; + else if (strcasecmp(params[1], "detail") == 0) + urj_log_state.level = URJ_LOG_LEVEL_DETAIL; + else if (strcasecmp(params[1], "normal") == 0) + urj_log_state.level = URJ_LOG_LEVEL_NORMAL; + else if (strcasecmp(params[1], "warning") == 0) + urj_log_state.level = URJ_LOG_LEVEL_WARNING; + else if (strcasecmp(params[1], "error") == 0) + urj_log_state.level = URJ_LOG_LEVEL_ERROR; + else if (strcasecmp(params[1], "silent") == 0) + urj_log_state.level = URJ_LOG_LEVEL_SILENT; + else + { + urj_error_set (URJ_ERROR_SYNTAX, "unknown log level '%s'", params[1]); return URJ_STATUS_FAIL; - - urj_debug_mode = i; + } return URJ_STATUS_OK; } @@ -63,15 +76,23 @@ static void cmd_debug_help (void) { urj_log (URJ_LOG_LEVEL_NORMAL, - _("Usage: %s n\n" - "Enabled debugging.\n" - "\n" "n =1 fileio, 2=tap commands, 4 =?\n"), + _("Usage: %s LEVEL\n" + "Set logging/debugging level.\n" + "\n" "LEVEL:\n" + "all every single bit as it is transmitted\n" + "comm low level communication details\n" + "debug more details of interest for developers\n" + "detail verbose output\n" + "normal just noteworthy info\n" + "warning unmissable warnings\n" + "error only fatal errors\n" + "silent suppress logging output\n"), "debug"); } const urj_cmd_t urj_cmd_debug = { "debug", - N_("debug jtag program"), + N_("set logging/debugging level"), cmd_debug_help, cmd_debug_run }; diff --git a/urjtag/src/cmd/cmd_dr.c b/urjtag/src/cmd/cmd_dr.c index b314ac45..a7510540 100644 --- a/urjtag/src/cmd/cmd_dr.c +++ b/urjtag/src/cmd/cmd_dr.c @@ -73,7 +73,7 @@ cmd_dr_run (urj_chain_t *chain, char *params[]) if (dr == NULL) { urj_error_set (URJ_ERROR_ILLEGAL_STATE, - _("%s: part without active data register"), "dr"); + _("%s: instruction without active data register"), "dr"); return URJ_STATUS_FAIL; } diff --git a/urjtag/src/global/urjtag.c b/urjtag/src/global/urjtag.c index f8f44071..beabf91b 100644 --- a/urjtag/src/global/urjtag.c +++ b/urjtag/src/global/urjtag.c @@ -32,7 +32,6 @@ #include urj_error_state_t urj_error_state; -int urj_debug_mode = 0; int urj_big_endian = 0; static int stderr_vprintf (const char *fmt, va_list ap);