diff options
author | hailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1> | 2010-01-07 03:32:17 +0000 |
---|---|---|
committer | hailfinger <hailfinger@2b7e53f0-3cfb-0310-b3e9-8179ed1497e1> | 2010-01-07 03:32:17 +0000 |
commit | 8327cfe61e9f5d8a6e985baa8dd612e194a40d54 (patch) | |
tree | ff145bc4ed987c3c81870ddb6e7ce6a929ca9b47 /buspirate_spi.c | |
parent | 0ae2330eb4c478b7d95474e157f89ad97a407142 (diff) | |
download | flashrom-8327cfe61e9f5d8a6e985baa8dd612e194a40d54.tar.gz |
Programmer debug messages during programmer init/shutdown are useful
because they print hardware settings and desired configuration. They
help in getting a quick overview of hardware and software state on
startup and shutdown.
Programmer debug messages during flash chip access are mostly a
distraction in logs and should only be enabled if someone is having
problems which are suspected to stem from a programmer hardware or
programmer software bug. Disable those messages by default, they can be
reenabled by #define COMM_DEBUG in the affected programmer file.
An added benefit is a tremendous size reduction in verbose
probe/read/write/erase logs because only flash chip driver messages
remain. In some cases, logs will shrink from 65 MB to 10 kB or less.
The right(tm) fix would be two different debug levels (DEBUG and SPEW)
and the ability to differentiate between programmer debug messages and
flash chip debug messages. Until the design for the message printing
infrastructure is finished, this is the best stop-gap measure we can
get.
Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: Sean Nelson <audioahcked@gmail.com>
git-svn-id: https://code.coreboot.org/svn/flashrom/trunk@834 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'buspirate_spi.c')
-rw-r--r-- | buspirate_spi.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/buspirate_spi.c b/buspirate_spi.c index 3006aa1..d67bfbc 100644 --- a/buspirate_spi.c +++ b/buspirate_spi.c @@ -25,6 +25,17 @@ #include "flash.h" #include "spi.h" +/* Change this to #define if you want lowlevel debugging of commands + * sent to the Bus Pirate. + */ +#undef COMM_DEBUG + +#ifdef COMM_DEBUG +#define msg_comm_debug printf_debug +#else +#define msg_comm_debug(...) do {} while (0) +#endif + /* Change this to #define if you want to test without a serial implementation */ #undef FAKE_COMMUNICATION @@ -47,14 +58,14 @@ int buspirate_sendrecv(unsigned char *buf, unsigned int writecnt, unsigned int r { int i, ret = 0; - printf_debug("%s: write %i, read %i\n", __func__, writecnt, readcnt); + msg_comm_debug("%s: write %i, read %i ", __func__, writecnt, readcnt); if (!writecnt && !readcnt) { fprintf(stderr, "Zero length command!\n"); return 1; } - printf_debug("Sending"); + msg_comm_debug("Sending"); for (i = 0; i < writecnt; i++) - printf_debug(" 0x%02x", buf[i]); + msg_comm_debug(" 0x%02x", buf[i]); #ifdef FAKE_COMMUNICATION /* Placate the caller for now. */ if (readcnt) { @@ -72,10 +83,10 @@ int buspirate_sendrecv(unsigned char *buf, unsigned int writecnt, unsigned int r if (ret) return ret; #endif - printf_debug(", receiving"); + msg_comm_debug(", receiving"); for (i = 0; i < readcnt; i++) - printf_debug(" 0x%02x", buf[i]); - printf_debug("\n"); + msg_comm_debug(" 0x%02x", buf[i]); + msg_comm_debug("\n"); return 0; } |