|
|
@@ -26,13 +26,17 @@ |
|
|
|
|
|
|
|
#include "misc.h" |
|
|
|
|
|
|
|
#include <stdarg.h> |
|
|
|
|
|
|
|
#include <usbd_cdc_if.h> |
|
|
|
#include <usb_device.h> |
|
|
|
|
|
|
|
static volatile uint32_t holding; |
|
|
|
void |
|
|
|
Error_Handler(void) |
|
|
|
{ |
|
|
|
/* XXX - handle error */ |
|
|
|
debug_printf("error_handler\n"); |
|
|
|
for (;;) holding++; |
|
|
|
} |
|
|
|
|
|
|
|
/* |
|
|
@@ -48,3 +52,31 @@ wait_for_vcp(void) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#if MEM_DEBUG_BUF |
|
|
|
static char debugbuf[1024]; |
|
|
|
static uint32_t debugpos; |
|
|
|
|
|
|
|
void |
|
|
|
debug_printf(const char *format, ...) |
|
|
|
{ |
|
|
|
char buf[128]; |
|
|
|
char *pos; |
|
|
|
va_list args; |
|
|
|
uint32_t length; |
|
|
|
uint32_t cpy; |
|
|
|
|
|
|
|
va_start(args, format); |
|
|
|
length = vsnprintf(buf, sizeof buf, format, args); |
|
|
|
va_end(args); |
|
|
|
|
|
|
|
pos = &buf[0]; |
|
|
|
while (length) { |
|
|
|
cpy = MIN(length, sizeof debugbuf - debugpos); |
|
|
|
memcpy(&debugbuf[debugpos], pos, cpy); |
|
|
|
|
|
|
|
debugpos += cpy; |
|
|
|
pos += cpy; |
|
|
|
length -= cpy; |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |