|
@ -105,8 +105,6 @@ ring_buffer_r rx_buffer = { { 0 }, 0, 0 }; |
|
|
|
|
|
|
|
|
#if ENABLED(EMERGENCY_PARSER) |
|
|
#if ENABLED(EMERGENCY_PARSER) |
|
|
|
|
|
|
|
|
#include "../../module/stepper.h" |
|
|
|
|
|
|
|
|
|
|
|
// Currently looking for: M108, M112, M410
|
|
|
// Currently looking for: M108, M112, M410
|
|
|
// If you alter the parser please don't forget to update the capabilities in Conditionals_post.h
|
|
|
// If you alter the parser please don't forget to update the capabilities in Conditionals_post.h
|
|
|
|
|
|
|
|
@ -213,14 +211,14 @@ FORCE_INLINE void store_rxd_char() { |
|
|
else if (!++rx_dropped_bytes) ++rx_dropped_bytes; |
|
|
else if (!++rx_dropped_bytes) ++rx_dropped_bytes; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) |
|
|
#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) |
|
|
// calculate count of bytes stored into the RX buffer
|
|
|
// calculate count of bytes stored into the RX buffer
|
|
|
ring_buffer_pos_t rx_count = (ring_buffer_pos_t)(rx_buffer.head - rx_buffer.tail) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); |
|
|
ring_buffer_pos_t rx_count = (ring_buffer_pos_t)(rx_buffer.head - rx_buffer.tail) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); |
|
|
// Keep track of the maximum count of enqueued bytes
|
|
|
// Keep track of the maximum count of enqueued bytes
|
|
|
NOLESS(rx_max_enqueued, rx_count); |
|
|
NOLESS(rx_max_enqueued, rx_count); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if ENABLED(SERIAL_XON_XOFF) |
|
|
#if ENABLED(SERIAL_XON_XOFF) |
|
|
|
|
|
|
|
|
// for high speed transfers, we can use XON/XOFF protocol to do
|
|
|
// for high speed transfers, we can use XON/XOFF protocol to do
|
|
|
// software handshake and avoid overruns.
|
|
|
// software handshake and avoid overruns.
|
|
@ -263,11 +261,11 @@ FORCE_INLINE void store_rxd_char() { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
#endif // SERIAL_XON_XOFF
|
|
|
#endif // SERIAL_XON_XOFF
|
|
|
|
|
|
|
|
|
#if ENABLED(EMERGENCY_PARSER) |
|
|
#if ENABLED(EMERGENCY_PARSER) |
|
|
emergency_parser(c); |
|
|
emergency_parser(c); |
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#if TX_BUFFER_SIZE > 0 |
|
|
#if TX_BUFFER_SIZE > 0 |
|
@ -296,7 +294,7 @@ FORCE_INLINE void store_rxd_char() { |
|
|
HWUART->UART_IDR = UART_IDR_TXRDY; |
|
|
HWUART->UART_IDR = UART_IDR_TXRDY; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endif // TX_BUFFER_SIZE
|
|
|
#endif // TX_BUFFER_SIZE > 0
|
|
|
|
|
|
|
|
|
static void UART_ISR(void) { |
|
|
static void UART_ISR(void) { |
|
|
uint32_t status = HWUART->UART_SR; |
|
|
uint32_t status = HWUART->UART_SR; |
|
@ -427,15 +425,16 @@ void MarlinSerial::flush(void) { |
|
|
rx_buffer.head = rx_buffer.tail; |
|
|
rx_buffer.head = rx_buffer.tail; |
|
|
CRITICAL_SECTION_END; |
|
|
CRITICAL_SECTION_END; |
|
|
|
|
|
|
|
|
#if ENABLED(SERIAL_XON_XOFF) |
|
|
#if ENABLED(SERIAL_XON_XOFF) |
|
|
if ((xon_xoff_state & XON_XOFF_CHAR_MASK) == XOFF_CHAR) { |
|
|
if ((xon_xoff_state & XON_XOFF_CHAR_MASK) == XOFF_CHAR) { |
|
|
xon_xoff_state = XON_CHAR | XON_XOFF_CHAR_SENT; |
|
|
xon_xoff_state = XON_CHAR | XON_XOFF_CHAR_SENT; |
|
|
writeNoHandshake(XON_CHAR); |
|
|
writeNoHandshake(XON_CHAR); |
|
|
} |
|
|
} |
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#if TX_BUFFER_SIZE > 0 |
|
|
#if TX_BUFFER_SIZE > 0 |
|
|
|
|
|
|
|
|
uint8_t MarlinSerial::availableForWrite(void) { |
|
|
uint8_t MarlinSerial::availableForWrite(void) { |
|
|
CRITICAL_SECTION_START; |
|
|
CRITICAL_SECTION_START; |
|
|
const uint8_t h = tx_buffer.head, t = tx_buffer.tail; |
|
|
const uint8_t h = tx_buffer.head, t = tx_buffer.tail; |
|
|