mirror of https://gerrit.osmocom.org/simtrace2
minor: improve trace output
the USB trace now respects the global setting. the verbosity is also decreased, not showing USB activity unless debugging. this also saves some space. the reset cause is now printed. the strings increase the bootloader size, but it already exceeded the 16 kB limit when trace level is set to info. Change-Id: I9ba08d4bb4f188f6e7a202ea86acb7a42a2054f3
This commit is contained in:
parent
198c3fb21b
commit
75a5f224c0
|
@ -257,11 +257,24 @@ extern int main(void)
|
|||
"=============================================================================\n\r",
|
||||
manifest_revision, manifest_board);
|
||||
|
||||
TRACE_INFO("Chip ID: 0x%08x (Ext 0x%08x)\n\r", CHIPID->CHIPID_CIDR, CHIPID->CHIPID_EXID);
|
||||
#if (TRACE_LEVEL >= TRACE_LEVEL_INFO)
|
||||
TRACE_INFO("Chip ID: 0x%08lx (Ext 0x%08lx)\n\r", CHIPID->CHIPID_CIDR, CHIPID->CHIPID_EXID);
|
||||
TRACE_INFO("Serial Nr. %08x-%08x-%08x-%08x\n\r",
|
||||
g_unique_id[0], g_unique_id[1],
|
||||
g_unique_id[2], g_unique_id[3]);
|
||||
TRACE_INFO("Reset Cause: 0x%lx\n\r", reset_cause);
|
||||
static const char* reset_causes[] = {
|
||||
"general reset (first power-up reset)",
|
||||
"backup reset (return from backup mode)",
|
||||
"watchdog reset (watchdog fault occurred)",
|
||||
"software reset (processor reset required by the software)",
|
||||
"user reset (NRST pin detected low)",
|
||||
};
|
||||
if (reset_cause < ARRAY_SIZE(reset_causes)) {
|
||||
TRACE_INFO("Reset Cause: %s\n\r", reset_causes[reset_cause]);
|
||||
} else {
|
||||
TRACE_INFO("Reset Cause: 0x%lx\n\r", (RSTC->RSTC_SR & RSTC_SR_RSTTYP_Msk) >> RSTC_SR_RSTTYP_Pos);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (TRACE_LEVEL >= TRACE_LEVEL_INFO)
|
||||
/* Find out why we are in the DFU bootloader, and not the main application */
|
||||
|
|
|
@ -45,11 +45,6 @@
|
|||
* Headers
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef TRACE_LEVEL
|
||||
#undef TRACE_LEVEL
|
||||
#endif
|
||||
#define TRACE_LEVEL TRACE_LEVEL_WARNING
|
||||
|
||||
#include "chip.h"
|
||||
#include "USBD_HAL.h"
|
||||
#include <usb/device/dfu/dfu.h>
|
||||
|
@ -1138,7 +1133,7 @@ void USBD_IrqHandler(void)
|
|||
/* Resume (Wakeup) */
|
||||
if ((status & (UDP_ISR_WAKEUP | UDP_ISR_RXRSM)) != 0) {
|
||||
|
||||
TRACE_INFO_WP("Res ");
|
||||
TRACE_DEBUG_WP("Res ");
|
||||
/* Clear and disable resume interrupts */
|
||||
UDP->UDP_ICR = UDP_ICR_WAKEUP | UDP_ICR_RXRSM | UDP_ICR_RXSUSP;
|
||||
UDP->UDP_IDR = UDP_IDR_WAKEUP | UDP_IDR_RXRSM;
|
||||
|
@ -1150,7 +1145,7 @@ void USBD_IrqHandler(void)
|
|||
This interrupt is always treated last (hence the '==') */
|
||||
if (status == UDP_ISR_RXSUSP) {
|
||||
|
||||
TRACE_INFO_WP("Susp ");
|
||||
TRACE_DEBUG_WP("Susp ");
|
||||
/* Enable wakeup */
|
||||
UDP->UDP_IER = UDP_IER_WAKEUP | UDP_IER_RXRSM;
|
||||
/* Acknowledge interrupt */
|
||||
|
@ -1161,7 +1156,7 @@ void USBD_IrqHandler(void)
|
|||
/* End of bus reset */
|
||||
else if ((status & UDP_ISR_ENDBUSRES) != 0) {
|
||||
|
||||
TRACE_INFO_WP("EoBRes ");
|
||||
TRACE_DEBUG_WP("EoBRes ");
|
||||
|
||||
#if defined(BOARD_USB_DFU)
|
||||
#if defined(APPLICATION_dfu)
|
||||
|
@ -1202,7 +1197,7 @@ void USBD_IrqHandler(void)
|
|||
|
||||
if (status != 0) {
|
||||
|
||||
TRACE_INFO_WP("\n\r - ");
|
||||
TRACE_DEBUG_WP("\n\r - ");
|
||||
}
|
||||
}
|
||||
eptnum++;
|
||||
|
@ -1211,7 +1206,7 @@ void USBD_IrqHandler(void)
|
|||
|
||||
/* Toggle LED back to its previous state */
|
||||
TRACE_DEBUG_WP("!");
|
||||
TRACE_INFO_WP("\n\r");
|
||||
TRACE_DEBUG_WP("\n\r");
|
||||
if (USBD_GetState() >= USBD_STATE_POWERED) {
|
||||
|
||||
//LED_Clear(USBD_LEDUSB);
|
||||
|
@ -1361,7 +1356,7 @@ uint8_t USBD_HAL_ConfigureEP(const USBEndpointDescriptor *pDescriptor)
|
|||
UDP->UDP_IER = (1 << bEndpoint);
|
||||
}
|
||||
|
||||
TRACE_INFO_WP("CfgEp%d ", bEndpoint);
|
||||
TRACE_DEBUG_WP("CfgEp%d ", bEndpoint);
|
||||
return bEndpoint;
|
||||
}
|
||||
|
||||
|
@ -1529,7 +1524,7 @@ void USBD_HAL_RemoteWakeUp(void)
|
|||
UDP_EnableUsbClock();
|
||||
UDP_EnableTransceiver();
|
||||
|
||||
TRACE_INFO_WP("RWUp ");
|
||||
TRACE_DEBUG_WP("RWUp ");
|
||||
|
||||
// Activates a remote wakeup (edge on ESR), then clear ESR
|
||||
UDP->UDP_GLB_STAT |= UDP_GLB_STAT_ESR;
|
||||
|
|
|
@ -85,7 +85,7 @@ static void __dfufunc handle_getstate(void)
|
|||
{
|
||||
uint8_t u8 = g_dfu->state;
|
||||
|
||||
TRACE_DEBUG("handle_getstate(%u)\n\r", g_dfu->state);
|
||||
TRACE_DEBUG("handle_getstate(%ld)\n\r", g_dfu->state);
|
||||
|
||||
USBD_Write(0, (char *)&u8, sizeof(u8), NULL, 0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue