Add hidden Serial overflow debug options
This commit is contained in:
@ -98,6 +98,14 @@
|
||||
uint8_t rx_dropped_bytes = 0;
|
||||
#endif
|
||||
|
||||
#if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS)
|
||||
uint8_t rx_buffer_overruns = 0;
|
||||
#endif
|
||||
|
||||
#if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS)
|
||||
uint8_t rx_framing_errors = 0;
|
||||
#endif
|
||||
|
||||
#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
|
||||
ring_buffer_pos_t rx_max_enqueued = 0;
|
||||
#endif
|
||||
@ -308,6 +316,19 @@
|
||||
|
||||
// Acknowledge errors
|
||||
if ((status & UART_SR_OVRE) || (status & UART_SR_FRAME)) {
|
||||
|
||||
#if ENABLED(SERIAL_STATS_DROPPED_RX)
|
||||
if (status & UART_SR_OVRE && !++rx_dropped_bytes) --rx_dropped_bytes;
|
||||
#endif
|
||||
|
||||
#if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS)
|
||||
if (status & UART_SR_OVRE && !++rx_buffer_overruns) --rx_buffer_overruns;
|
||||
#endif
|
||||
|
||||
#if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS)
|
||||
if (status & UART_SR_FRAME && !++rx_framing_errors) --rx_framing_errors;
|
||||
#endif
|
||||
|
||||
// TODO: error reporting outside ISR
|
||||
HWUART->UART_CR = UART_CR_RSTSTA;
|
||||
}
|
||||
|
@ -70,6 +70,14 @@
|
||||
extern uint8_t rx_dropped_bytes;
|
||||
#endif
|
||||
|
||||
#if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS)
|
||||
extern uint8_t rx_buffer_overruns;
|
||||
#endif
|
||||
|
||||
#if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS)
|
||||
extern uint8_t rx_framing_errors;
|
||||
#endif
|
||||
|
||||
#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
|
||||
extern ring_buffer_pos_t rx_max_enqueued;
|
||||
#endif
|
||||
@ -91,6 +99,14 @@ public:
|
||||
FORCE_INLINE static uint32_t dropped() { return rx_dropped_bytes; }
|
||||
#endif
|
||||
|
||||
#if ENABLED(SERIAL_STATS_RX_BUFFER_OVERRUNS)
|
||||
FORCE_INLINE static uint32_t buffer_overruns() { return rx_buffer_overruns; }
|
||||
#endif
|
||||
|
||||
#if ENABLED(SERIAL_STATS_RX_FRAMING_ERRORS)
|
||||
FORCE_INLINE static uint32_t framing_errors() { return rx_framing_errors; }
|
||||
#endif
|
||||
|
||||
#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED)
|
||||
FORCE_INLINE static ring_buffer_pos_t rxMaxEnqueued() { return rx_max_enqueued; }
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user