Replace urj_debug_mode in cmd_debug with setting urj_log_state.level

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@1605 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Rutger Hofman 16 years ago
parent 4d0c186493
commit 64ae992278

@ -1,10 +1,15 @@
2009-05-18 Rutger Hofman <rfhh>
* 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 <rfhh>
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

@ -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.

@ -25,11 +25,10 @@
#include <sysdep.h>
#include <stdio.h>
#include <string.h>
#include <urjtag/error.h>
#include <urjtag/jtag.h>
#include <urjtag/log.h>
#include <urjtag/cmd.h>
@ -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
};

@ -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;
}

@ -32,7 +32,6 @@
#include <urjtag/jtag.h>
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);

Loading…
Cancel
Save