Skip to content

Commit

Permalink
WIP trace logging tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
tlyu committed Dec 8, 2022
1 parent 05604e8 commit c63f96c
Showing 1 changed file with 35 additions and 4 deletions.
39 changes: 35 additions & 4 deletions cores/arduino/USBCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,14 +583,45 @@ USBCore_::USBCore_()
void USBCore_::logEP(char kind, uint8_t ep, char dir, size_t len)
{
#ifdef USBCORE_TRACE
usbd_ep_ram *btable_ep = (usbd_ep_ram *)(USBD_RAM + 2 * (BTABLE_OFFSET & 0xFFF8));
auto rxcnt = &btable_ep[0].rx_count;
Serial1.print(USBD_EPxCS(ep), 16);
Serial1.print(kind);
Serial1.print(ep);
Serial1.print(dir);
Serial1.print(len);
#if 0
Serial1.print(' ');
Serial1.print(USBD_EPxCS(ep), 16);
Serial1.print('(');
Serial1.print(*rxcnt & EPRCNT_CNT);
Serial1.print(')');
delayMicroseconds(100);
Serial1.print(' ');
Serial1.println(USBD_EPxCS(ep), 16);
Serial1.flush();
Serial1.print(USBD_EPxCS(ep), 16);
Serial1.print('(');
Serial1.print(*rxcnt & EPRCNT_CNT);
Serial1.print(')');
delayMicroseconds(100);
Serial1.print(' ');
Serial1.print(USBD_EPxCS(ep), 16);
Serial1.print('(');
Serial1.print(*rxcnt & EPRCNT_CNT);
Serial1.print(')');
delayMicroseconds(100);
Serial1.print(' ');
Serial1.print(USBD_EPxCS(ep), 16);
Serial1.print('(');
Serial1.print(*rxcnt & EPRCNT_CNT);
Serial1.print(')');
delayMicroseconds(100);
#endif
Serial1.print(' ');
Serial1.print(USBD_EPxCS(ep), 16);
Serial1.print('(');
Serial1.print(*rxcnt & EPRCNT_CNT);
Serial1.println(')');
// Serial1.flush();
#endif
}

Expand All @@ -604,15 +635,15 @@ void USBCore_::hexDump(char prefix, const uint8_t *buf, size_t len)
Serial1.print(' ');
}
Serial1.println();
Serial1.flush();
// Serial1.flush();
#endif
}

void USBCore_::logStatus(const char *status)
{
#ifdef USBCORE_TRACE
Serial1.println(status);
Serial1.flush();
// Serial1.flush();
#endif
}

Expand Down

0 comments on commit c63f96c

Please sign in to comment.