Compilation fixes in debug mode

This commit is contained in:
Pol Henarejos 2022-05-29 03:33:40 +02:00
parent e0bff38384
commit 8bb47e7979
No known key found for this signature in database
GPG key ID: C0095B7870A4CCD3
2 changed files with 5 additions and 19 deletions

View file

@ -106,6 +106,10 @@
#define CFG_TUD_VENDOR_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
#define CFG_TUD_VENDOR_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
#include "pico/types.h"
static inline uint16_t tu_u32_high16(uint32_t ui32) { return (uint16_t) (ui32 >> 16); }
static inline uint16_t tu_u32_low16 (uint32_t ui32) { return (uint16_t) (ui32 & 0x0000ffffu); }
#ifdef __cplusplus
}

View file

@ -48,27 +48,9 @@ uint32_t usb_write_offset(uint16_t len, uint16_t offset) {
return MIN(w_len, pkt_max);
}
#define DEBUG_PAYLOAD(p,s) { \
printf("Payload %s (%d bytes):\r\n", #p,s);\
for (int i = 0; i < s; i += 16) {\
printf("%07Xh : ",(unsigned int)(i+p));\
for (int j = 0; j < 16; j++) {\
if (j < s-i) printf("%02X ",(p)[i+j]);\
else printf(" ");\
if (j == 7) printf(" ");\
} printf(": "); \
for (int j = 0; j < MIN(16,s-i); j++) {\
printf("%c",(p)[i+j] == 0x0a || (p)[i+j] == 0x0d ? '\\' : (p)[i+j]);\
if (j == 7) printf(" ");\
}\
printf("\r\n");\
} printf("\r\n"); \
}
uint32_t usb_write_flush() {
if (w_len > 0 && tud_vendor_write_available() > 0) {
printf("w_len %d %d %ld\r\n",w_len,tx_r_offset,tud_vendor_write_available());
//printf("w_len %d %d %ld\r\n",w_len,tx_r_offset,tud_vendor_write_available());
tud_vendor_write(tx_buffer+tx_r_offset, MIN(w_len, 64));
tx_r_offset += MIN(w_len, 64);
w_len -= MIN(w_len, 64);