diff options
-rw-r--r-- | firmware/debug.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/firmware/debug.c b/firmware/debug.c index 23ba8f8117..ec33cfca68 100644 --- a/firmware/debug.c +++ b/firmware/debug.c | |||
@@ -22,8 +22,10 @@ | |||
22 | #include <stdarg.h> | 22 | #include <stdarg.h> |
23 | #include "config.h" | 23 | #include "config.h" |
24 | 24 | ||
25 | #ifdef DEBUG | ||
25 | static char debugmembuf[100]; | 26 | static char debugmembuf[100]; |
26 | static char debugbuf[200]; | 27 | static char debugbuf[200]; |
28 | #endif | ||
27 | 29 | ||
28 | #ifndef SIMULATOR /* allow non archos platforms to display output */ | 30 | #ifndef SIMULATOR /* allow non archos platforms to display output */ |
29 | 31 | ||
@@ -39,6 +41,7 @@ void debug_init(void) | |||
39 | IPRE |= 0xf000; /* Set to highest priority */ | 41 | IPRE |= 0xf000; /* Set to highest priority */ |
40 | } | 42 | } |
41 | 43 | ||
44 | #ifdef DEBUG | ||
42 | static int debug_tx_ready(void) | 45 | static int debug_tx_ready(void) |
43 | { | 46 | { |
44 | return (SSR1 & SCI_TDRE); | 47 | return (SSR1 & SCI_TDRE); |
@@ -60,7 +63,8 @@ static void debug_tx_char(char ch) | |||
60 | 63 | ||
61 | static void debug_handle_error(char ssr) | 64 | static void debug_handle_error(char ssr) |
62 | { | 65 | { |
63 | SSR1 &= ~(SCI_ORER | SCI_PER | SCI_FER); | 66 | (void)ssr; |
67 | SSR1 &= ~(SCI_ORER | SCI_PER | SCI_FER); | ||
64 | } | 68 | } |
65 | 69 | ||
66 | static int debug_rx_ready(void) | 70 | static int debug_rx_ready(void) |
@@ -163,6 +167,7 @@ static void putpacket (char *buffer) | |||
163 | SCR1 |= 0x40; | 167 | SCR1 |= 0x40; |
164 | } | 168 | } |
165 | 169 | ||
170 | |||
166 | /* convert the memory, pointed to by mem into hex, placing result in buf */ | 171 | /* convert the memory, pointed to by mem into hex, placing result in buf */ |
167 | /* return a pointer to the last char put in buf (null) */ | 172 | /* return a pointer to the last char put in buf (null) */ |
168 | static char *mem2hex (char *mem, char *buf, int count) | 173 | static char *mem2hex (char *mem, char *buf, int count) |
@@ -186,6 +191,7 @@ static void debug(char *msg) | |||
186 | mem2hex(msg, &debugbuf[1], strlen(msg)); | 191 | mem2hex(msg, &debugbuf[1], strlen(msg)); |
187 | putpacket(debugbuf); | 192 | putpacket(debugbuf); |
188 | } | 193 | } |
194 | #endif /* end of DEBUG section */ | ||
189 | 195 | ||
190 | void debugf(char *fmt, ...) | 196 | void debugf(char *fmt, ...) |
191 | { | 197 | { |
@@ -196,6 +202,8 @@ void debugf(char *fmt, ...) | |||
196 | vsnprintf(debugmembuf, sizeof(debugmembuf), fmt, ap); | 202 | vsnprintf(debugmembuf, sizeof(debugmembuf), fmt, ap); |
197 | va_end(ap); | 203 | va_end(ap); |
198 | debug(debugmembuf); | 204 | debug(debugmembuf); |
205 | #else | ||
206 | (void)fmt; | ||
199 | #endif | 207 | #endif |
200 | } | 208 | } |
201 | 209 | ||