cpu/avr8_common/include/cpu.h: Increase number of uart

The ATxmega can have up to 8 UARTs.  This increase from 2 up to 7 to
keep avr8_state flags with 8 bits wide.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
This commit is contained in:
Gerson Fernando Budke 2021-02-03 21:58:24 -03:00
parent fd36c626a3
commit 9081a3b7c7

View File

@ -63,6 +63,11 @@ extern "C"
#define AVR8_STATE_FLAG_ISR (0x80U) /**< In ISR */ #define AVR8_STATE_FLAG_ISR (0x80U) /**< In ISR */
#define AVR8_STATE_FLAG_UART0_TX (0x01U) /**< TX pending for UART 0 */ #define AVR8_STATE_FLAG_UART0_TX (0x01U) /**< TX pending for UART 0 */
#define AVR8_STATE_FLAG_UART1_TX (0x02U) /**< TX pending for UART 1 */ #define AVR8_STATE_FLAG_UART1_TX (0x02U) /**< TX pending for UART 1 */
#define AVR8_STATE_FLAG_UART2_TX (0x04U) /**< TX pending for UART 2 */
#define AVR8_STATE_FLAG_UART3_TX (0x08U) /**< TX pending for UART 3 */
#define AVR8_STATE_FLAG_UART4_TX (0x10U) /**< TX pending for UART 4 */
#define AVR8_STATE_FLAG_UART5_TX (0x20U) /**< TX pending for UART 5 */
#define AVR8_STATE_FLAG_UART6_TX (0x40U) /**< TX pending for UART 6 */
#define AVR8_STATE_FLAG_UART_TX(x) (0x01U << x) /**< TX pending for UART x */ #define AVR8_STATE_FLAG_UART_TX(x) (0x01U << x) /**< TX pending for UART x */
/** @} */ /** @} */
@ -77,14 +82,18 @@ extern "C"
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* 7 6 5 4 3 2 1 0 * 7 6 5 4 3 2 1 0
* +---+---+---+---+---+---+---+---+ * +---+---+---+---+---+---+---+---+
* |IRQ| unused |TX1|TX0| * |IRQ|TX6|TX5|TX4|TX3|TX2|TX1|TX0|
* +---+---+---+---+---+---+---+---+ * +---+---+---+---+---+---+---+---+
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* *
* | Label | Description | * | Label | Description |
* |:-------|:--------------------------------------------------------------| * |:-------|:--------------------------------------------------------------|
* | IRQ | This bit is set when in IRQ context | * | IRQ | This bit is set when in IRQ context |
* | unused | This bits are currently not used | * | TX6 | This bit is set when on UART6 TX is pending |
* | TX5 | This bit is set when on UART5 TX is pending |
* | TX4 | This bit is set when on UART4 TX is pending |
* | TX3 | This bit is set when on UART3 TX is pending |
* | TX2 | This bit is set when on UART2 TX is pending |
* | TX1 | This bit is set when on UART1 TX is pending | * | TX1 | This bit is set when on UART1 TX is pending |
* | TX0 | This bit is set when on UART0 TX is pending | * | TX0 | This bit is set when on UART0 TX is pending |
*/ */
@ -138,7 +147,13 @@ static inline void avr8_enter_isr(void)
static inline int avr8_is_uart_tx_pending(void) static inline int avr8_is_uart_tx_pending(void)
{ {
uint8_t state = avr8_get_state(); uint8_t state = avr8_get_state();
return (state & (AVR8_STATE_FLAG_UART0_TX | AVR8_STATE_FLAG_UART1_TX)); return (state & (AVR8_STATE_FLAG_UART0_TX
| AVR8_STATE_FLAG_UART1_TX
| AVR8_STATE_FLAG_UART2_TX
| AVR8_STATE_FLAG_UART3_TX
| AVR8_STATE_FLAG_UART4_TX
| AVR8_STATE_FLAG_UART5_TX
| AVR8_STATE_FLAG_UART6_TX));
} }
/** /**