diff --git a/teensy3/serial1.c b/teensy3/serial1.c index ab32d3cc9..154b1f2e2 100644 --- a/teensy3/serial1.c +++ b/teensy3/serial1.c @@ -79,14 +79,20 @@ static volatile uint8_t transmitting = 0; #define rts_assert() *(rts_pin+8) = rts_mask; #define rts_deassert() *(rts_pin+4) = rts_mask; #endif -#if SERIAL1_TX_BUFFER_SIZE > 255 +#if SERIAL1_TX_BUFFER_SIZE > 65535 +static volatile uint32_t tx_buffer_head = 0; +static volatile uint32_t tx_buffer_tail = 0; +#elif SERIAL1_TX_BUFFER_SIZE > 255 static volatile uint16_t tx_buffer_head = 0; static volatile uint16_t tx_buffer_tail = 0; #else static volatile uint8_t tx_buffer_head = 0; static volatile uint8_t tx_buffer_tail = 0; #endif -#if SERIAL1_RX_BUFFER_SIZE > 255 +#if SERIAL1_RX_BUFFER_SIZE > 65535 +static volatile uint32_t rx_buffer_head = 0; +static volatile uint32_t rx_buffer_tail = 0; +#elif SERIAL1_RX_BUFFER_SIZE > 255 static volatile uint16_t rx_buffer_head = 0; static volatile uint16_t rx_buffer_tail = 0; #else diff --git a/teensy3/serial2.c b/teensy3/serial2.c index 679d6eaa6..78deab7ba 100644 --- a/teensy3/serial2.c +++ b/teensy3/serial2.c @@ -78,14 +78,20 @@ static volatile uint8_t transmitting = 0; #define rts_assert() *(rts_pin+8) = rts_mask; #define rts_deassert() *(rts_pin+4) = rts_mask; #endif -#if SERIAL2_TX_BUFFER_SIZE > 255 +#if SERIAL2_TX_BUFFER_SIZE > 65535 +static volatile uint32_t tx_buffer_head = 0; +static volatile uint32_t tx_buffer_tail = 0; +#elif SERIAL2_TX_BUFFER_SIZE > 255 static volatile uint16_t tx_buffer_head = 0; static volatile uint16_t tx_buffer_tail = 0; #else static volatile uint8_t tx_buffer_head = 0; static volatile uint8_t tx_buffer_tail = 0; #endif -#if SERIAL2_RX_BUFFER_SIZE > 255 +#if SERIAL2_RX_BUFFER_SIZE > 65535 +static volatile uint32_t rx_buffer_head = 0; +static volatile uint32_t rx_buffer_tail = 0; +#elif SERIAL2_RX_BUFFER_SIZE > 255 static volatile uint16_t rx_buffer_head = 0; static volatile uint16_t rx_buffer_tail = 0; #else diff --git a/teensy3/serial3.c b/teensy3/serial3.c index f7e6c8234..b72b20bf7 100644 --- a/teensy3/serial3.c +++ b/teensy3/serial3.c @@ -79,14 +79,20 @@ static volatile uint8_t transmitting = 0; #define rts_assert() *(rts_pin+8) = rts_mask; #define rts_deassert() *(rts_pin+4) = rts_mask; #endif -#if SERIAL3_TX_BUFFER_SIZE > 255 +#if SERIAL3_TX_BUFFER_SIZE > 65535 +static volatile uint32_t tx_buffer_head = 0; +static volatile uint32_t tx_buffer_tail = 0; +#elif SERIAL3_TX_BUFFER_SIZE > 255 static volatile uint16_t tx_buffer_head = 0; static volatile uint16_t tx_buffer_tail = 0; #else static volatile uint8_t tx_buffer_head = 0; static volatile uint8_t tx_buffer_tail = 0; #endif -#if SERIAL3_RX_BUFFER_SIZE > 255 +#if SERIAL3_RX_BUFFER_SIZE > 65535 +static volatile uint32_t rx_buffer_head = 0; +static volatile uint32_t rx_buffer_tail = 0; +#elif SERIAL3_RX_BUFFER_SIZE > 255 static volatile uint16_t rx_buffer_head = 0; static volatile uint16_t rx_buffer_tail = 0; #else diff --git a/teensy3/serial4.c b/teensy3/serial4.c index 715139898..b6efefd6c 100644 --- a/teensy3/serial4.c +++ b/teensy3/serial4.c @@ -70,14 +70,20 @@ static volatile uint8_t *transmit_pin=NULL; static volatile uint8_t *rts_pin=NULL; #define rts_assert() *rts_pin = 0 #define rts_deassert() *rts_pin = 1 -#if SERIAL4_TX_BUFFER_SIZE > 255 +#if SERIAL4_TX_BUFFER_SIZE > 65535 +static volatile uint32_t tx_buffer_head = 0; +static volatile uint32_t tx_buffer_tail = 0; +#elif SERIAL4_TX_BUFFER_SIZE > 255 static volatile uint16_t tx_buffer_head = 0; static volatile uint16_t tx_buffer_tail = 0; #else static volatile uint8_t tx_buffer_head = 0; static volatile uint8_t tx_buffer_tail = 0; #endif -#if SERIAL4_RX_BUFFER_SIZE > 255 +#if SERIAL4_RX_BUFFER_SIZE > 65535 +static volatile uint32_t rx_buffer_head = 0; +static volatile uint32_t rx_buffer_tail = 0; +#elif SERIAL4_RX_BUFFER_SIZE > 255 static volatile uint16_t rx_buffer_head = 0; static volatile uint16_t rx_buffer_tail = 0; #else diff --git a/teensy3/serial5.c b/teensy3/serial5.c index 9bc1c03e9..e07162918 100644 --- a/teensy3/serial5.c +++ b/teensy3/serial5.c @@ -70,14 +70,20 @@ static volatile uint8_t *transmit_pin=NULL; static volatile uint8_t *rts_pin=NULL; #define rts_assert() *rts_pin = 0 #define rts_deassert() *rts_pin = 1 -#if SERIAL5_TX_BUFFER_SIZE > 255 +#if SERIAL5_TX_BUFFER_SIZE > 65535 +static volatile uint32_t tx_buffer_head = 0; +static volatile uint32_t tx_buffer_tail = 0; +#elif SERIAL5_TX_BUFFER_SIZE > 255 static volatile uint16_t tx_buffer_head = 0; static volatile uint16_t tx_buffer_tail = 0; #else static volatile uint8_t tx_buffer_head = 0; static volatile uint8_t tx_buffer_tail = 0; #endif -#if SERIAL5_RX_BUFFER_SIZE > 255 +#if SERIAL5_RX_BUFFER_SIZE > 65535 +static volatile uint32_t rx_buffer_head = 0; +static volatile uint32_t rx_buffer_tail = 0; +#elif SERIAL5_RX_BUFFER_SIZE > 255 static volatile uint16_t rx_buffer_head = 0; static volatile uint16_t rx_buffer_tail = 0; #else diff --git a/teensy3/serial6.c b/teensy3/serial6.c index a7b26a3f8..bdde8d23a 100644 --- a/teensy3/serial6.c +++ b/teensy3/serial6.c @@ -70,14 +70,20 @@ static volatile uint8_t *transmit_pin=NULL; static volatile uint8_t *rts_pin=NULL; #define rts_assert() *rts_pin = 0 #define rts_deassert() *rts_pin = 1 -#if SERIAL6_TX_BUFFER_SIZE > 255 +#if SERIAL6_TX_BUFFER_SIZE > 65535 +static volatile uint32_t tx_buffer_head = 0; +static volatile uint32_t tx_buffer_tail = 0; +#elif SERIAL6_TX_BUFFER_SIZE > 255 static volatile uint16_t tx_buffer_head = 0; static volatile uint16_t tx_buffer_tail = 0; #else static volatile uint8_t tx_buffer_head = 0; static volatile uint8_t tx_buffer_tail = 0; #endif -#if SERIAL6_RX_BUFFER_SIZE > 255 +#if SERIAL6_RX_BUFFER_SIZE > 65535 +static volatile uint32_t rx_buffer_head = 0; +static volatile uint32_t rx_buffer_tail = 0; +#elif SERIAL6_RX_BUFFER_SIZE > 255 static volatile uint16_t rx_buffer_head = 0; static volatile uint16_t rx_buffer_tail = 0; #else