summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Knispel <gknispel@avencall.com>2012-09-12 15:51:37 +0200
committerGuillaume Knispel <gknispel@avencall.com>2012-09-12 15:51:37 +0200
commit68af357688c9e3fd3c6541ddc08a6366c2eb3042 (patch)
tree174aa22531c4371ccd84de17145d7970f069bccb
parenta2389e20bf20155d42a680d30aa621ba3e916108 (diff)
fix the trace code
-rw-r--r--main.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/main.c b/main.c
index 7d14ce9..47cb35d 100644
--- a/main.c
+++ b/main.c
@@ -165,7 +165,7 @@ static void trace(u8 val)
tb_beg = TB_I(tb_beg + 1);
tb_fill--;
}
- trace_buffer[TB_I(tb_beg + (tb_fill++))];
+ trace_buffer[TB_I(tb_beg + (tb_fill++))] = val;
}
static inline char hex_nibble(u8 n)
@@ -194,10 +194,10 @@ static void dump_trace(void)
dump_byte(buf + pos, trace_buffer[TB_I(tb_beg + i)]);
pos += 3;
- if (i & 15 == 15) {
+ if ((i & 15) == 15) {
buf[pos++] = '\r';
buf[pos++] = '\n';
- } else if (i & 7 == 7) {
+ } else if ((i & 7) == 7) {
buf[pos++] = ' ';
}
@@ -243,9 +243,10 @@ int main(void)
#ifdef TRACE_SERIAL // debug behavior
switch (resetState) {
case ON_STATE:
- if (SW2State > 100)
+ if (SW2State > 100) {
dump_trace();
- resetState = RST_WAIT;
+ resetState = RST_WAIT;
+ }
break;
case RST_WAIT:
if (SW2State == 0)