X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=debug.c;h=ba8d3f16f6e45e39a2c6954b13c22fcfbafc61b6;hb=421e7d6da138dc122cf33791f3631156f73cccd7;hp=11807589dc794b29bb450be25357d8ca126aeb8a;hpb=bf40d70e45ba8bdd45d68a35e8e7d12a0ff1e8bf;p=sigrok-firmware-fx2lafw.git diff --git a/debug.c b/debug.c index 11807589..ba8d3f16 100644 --- a/debug.c +++ b/debug.c @@ -22,39 +22,40 @@ #include #include - #include #include #include - #include "debug.h" #define MESSAGE_LENGTH_MAX 64 -void debugf(const char *format, ...) { +void debugf(const char *format, ...) +{ va_list arg; int count; - // Format the string - va_start (arg, format); + /* Format the string. */ + va_start(arg, format); count = vsprintf(EP6FIFOBUF, format, arg); - va_end (arg); + va_end(arg); - // Zero out the rest of the buffer - while(count < MESSAGE_LENGTH_MAX) + /* Zero out the rest of the buffer. */ + while (count < MESSAGE_LENGTH_MAX) EP6FIFOBUF[count++] = '\0'; - // Send the buffer + /* Send the buffer. */ count = 32; EP6BCH = MSB(count); SYNCDELAY4; EP6BCL = LSB(count); + SYNCDELAY4; } -void _assert(char *expr, const char *filename, unsigned int linenumber) { +void _assert(char *expr, const char *filename, unsigned int linenumber) +{ debugf("Assert(%s) failed at line %u in file %s.\n", - expr, linenumber, filename); - while(1); + expr, linenumber, filename); + while (1); } #endif