This is an automated email from Gerrit.

Andreas Fritiofson (andreas.fritiof...@gmail.com) just uploaded a new patch set 
to Gerrit, which you can find at http://openocd.zylin.com/3805

-- gerrit

commit 4d8dc4ceee8ad5371179d13a82f8a2f279aef8bb
Author: Andreas Fritiofson <andreas.fritiof...@gmail.com>
Date:   Fri Apr 15 12:40:11 2016 +0200

    log: Add a new debug level (4) for verbose I/O debug
    
    Change ftdi SWD driver to use it instead of LOG_DEBUG().
    
    Change-Id: I17ba3de2086c7159209db61fba3faf067dfc5023
    Signed-off-by: Andreas Fritiofson <andreas.fritiof...@gmail.com>

diff --git a/src/helper/log.c b/src/helper/log.c
index e7af803..f838ac4 100644
--- a/src/helper/log.c
+++ b/src/helper/log.c
@@ -234,8 +234,8 @@ COMMAND_HANDLER(handle_debug_level_command)
        if (CMD_ARGC == 1) {
                int new_level;
                COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], new_level);
-               if ((new_level > LOG_LVL_DEBUG) || (new_level < 
LOG_LVL_SILENT)) {
-                       LOG_ERROR("level must be between %d and %d", 
LOG_LVL_SILENT, LOG_LVL_DEBUG);
+               if ((new_level > LOG_LVL_DEBUG_IO) || (new_level < 
LOG_LVL_SILENT)) {
+                       LOG_ERROR("level must be between %d and %d", 
LOG_LVL_SILENT, LOG_LVL_DEBUG_IO);
                        return ERROR_COMMAND_SYNTAX_ERROR;
                }
                debug_level = new_level;
@@ -273,7 +273,8 @@ static struct command_registration log_command_handlers[] = 
{
                .mode = COMMAND_ANY,
                .help = "Sets the verbosity level of debugging output. "
                        "0 shows errors only; 1 adds warnings; "
-                       "2 (default) adds other info; 3 adds debugging.",
+                       "2 (default) adds other info; 3 adds debugging,"
+                       "4 adds extra verbose debugging.",
                .usage = "number",
        },
        COMMAND_REGISTRATION_DONE
@@ -297,7 +298,7 @@ void log_init(void)
                int retval = parse_int(debug_env, &value);
                if (ERROR_OK == retval &&
                                debug_level >= LOG_LVL_SILENT &&
-                               debug_level <= LOG_LVL_DEBUG)
+                               debug_level <= LOG_LVL_DEBUG_IO)
                                debug_level = value;
        }
 
diff --git a/src/helper/log.h b/src/helper/log.h
index 6b93816..c47df80 100644
--- a/src/helper/log.h
+++ b/src/helper/log.h
@@ -54,7 +54,8 @@ enum log_levels {
        LOG_LVL_ERROR = 0,
        LOG_LVL_WARNING = 1,
        LOG_LVL_INFO = 2,
-       LOG_LVL_DEBUG = 3
+       LOG_LVL_DEBUG = 3,
+       LOG_LVL_DEBUG_IO = 4,
 };
 
 void log_printf(enum log_levels level, const char *file, unsigned line,
@@ -102,6 +103,14 @@ extern int debug_level;
 
 #define LOG_LEVEL_IS(FOO)  ((debug_level) >= (FOO))
 
+#define LOG_DEBUG_IO(expr ...) \
+       do { \
+               if (debug_level >= LOG_LVL_DEBUG_IO) \
+                       log_printf_lf(LOG_LVL_DEBUG, \
+                               __FILE__, __LINE__, __func__, \
+                               expr); \
+       } while (0)
+
 #define LOG_DEBUG(expr ...) \
        do { \
                if (debug_level >= LOG_LVL_DEBUG) \
diff --git a/src/jtag/drivers/ftdi.c b/src/jtag/drivers/ftdi.c
index 00fe37f..342e321 100644
--- a/src/jtag/drivers/ftdi.c
+++ b/src/jtag/drivers/ftdi.c
@@ -1074,12 +1074,12 @@ static void ftdi_swd_swdio_en(bool enable)
  */
 static int ftdi_swd_run_queue(void)
 {
-       LOG_DEBUG("Executing %zu queued transactions", swd_cmd_queue_length);
+       LOG_DEBUG_IO("Executing %zu queued transactions", swd_cmd_queue_length);
        int retval;
        struct signal *led = find_signal_by_name("LED");
 
        if (queued_retval != ERROR_OK) {
-               LOG_DEBUG("Skipping due to previous errors: %d", queued_retval);
+               LOG_DEBUG_IO("Skipping due to previous errors: %d", 
queued_retval);
                goto skip;
        }
 
@@ -1100,7 +1100,7 @@ static int ftdi_swd_run_queue(void)
        for (size_t i = 0; i < swd_cmd_queue_length; i++) {
                int ack = buf_get_u32(swd_cmd_queue[i].trn_ack_data_parity_trn, 
1, 3);
 
-               LOG_DEBUG("%s %s %s reg %X = %08"PRIx32,
+               LOG_DEBUG_IO("%s %s %s reg %X = %08"PRIx32,
                                ack == SWD_ACK_OK ? "OK" : ack == SWD_ACK_WAIT 
? "WAIT" : ack == SWD_ACK_FAULT ? "FAULT" : "JUNK",
                                swd_cmd_queue[i].cmd & SWD_CMD_APnDP ? "AP" : 
"DP",
                                swd_cmd_queue[i].cmd & SWD_CMD_RnW ? "read" : 
"write",

-- 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to