aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/TIVA/LLD
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/ports/TIVA/LLD')
-rw-r--r--os/hal/ports/TIVA/LLD/GPIO/driver.mk4
-rw-r--r--os/hal/ports/TIVA/LLD/GPIO/hal_ext_lld.c981
-rw-r--r--os/hal/ports/TIVA/LLD/GPIO/hal_ext_lld.h523
-rw-r--r--os/hal/ports/TIVA/LLD/GPIO/hal_pal_lld.c850
-rw-r--r--os/hal/ports/TIVA/LLD/GPIO/hal_pal_lld.h496
-rw-r--r--os/hal/ports/TIVA/LLD/GPTM/hal_st_lld.c46
-rw-r--r--os/hal/ports/TIVA/LLD/I2C/hal_i2c_lld.c9
-rw-r--r--os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.c2
-rw-r--r--os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.h2
-rw-r--r--os/hal/ports/TIVA/LLD/UART/driver.mk4
-rw-r--r--os/hal/ports/TIVA/LLD/UART/hal_uart_lld.c826
-rw-r--r--os/hal/ports/TIVA/LLD/UART/hal_uart_lld.h471
12 files changed, 2512 insertions, 1702 deletions
diff --git a/os/hal/ports/TIVA/LLD/GPIO/driver.mk b/os/hal/ports/TIVA/LLD/GPIO/driver.mk
index 121ef57..486fe73 100644
--- a/os/hal/ports/TIVA/LLD/GPIO/driver.mk
+++ b/os/hal/ports/TIVA/LLD/GPIO/driver.mk
@@ -2,12 +2,8 @@ ifeq ($(USE_SMART_BUILD),yes)
ifneq ($(findstring HAL_USE_PAL TRUE,$(HALCONF)),)
PLATFORMSRC += $(CHIBIOS_CONTRIB)/os/hal/ports/TIVA/LLD/GPIO/hal_pal_lld.c
endif
-ifneq ($(findstring HAL_USE_EXT TRUE,$(HALCONF)),)
-PLATFORMSRC += $(CHIBIOS_CONTRIB)/os/hal/ports/TIVA/LLD/GPIO/hal_ext_lld.c
-endif
else
PLATFORMSRC += $(CHIBIOS_CONTRIB)/os/hal/ports/TIVA/LLD/GPIO/hal_pal_lld.c
-PLATFORMSRC += $(CHIBIOS_CONTRIB)/os/hal/ports/TIVA/LLD/GPIO/hal_ext_lld.c
endif
PLATFORMINC += $(CHIBIOS_CONTRIB)/os/hal/ports/TIVA/LLD/GPIO
diff --git a/os/hal/ports/TIVA/LLD/GPIO/hal_ext_lld.c b/os/hal/ports/TIVA/LLD/GPIO/hal_ext_lld.c
deleted file mode 100644
index 40f06f9..0000000
--- a/os/hal/ports/TIVA/LLD/GPIO/hal_ext_lld.c
+++ /dev/null
@@ -1,981 +0,0 @@
-/*
- Copyright (C) 2014..2017 Marco Veeneman
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-/**
- * @file GPIO/hal_ext_lld.c
- * @brief Tiva EXT subsystem low level driver source.
- *
- * @addtogroup EXT
- * @{
- */
-
-#include "hal.h"
-
-#if HAL_USE_EXT || defined(__DOXYGEN__)
-
-/*===========================================================================*/
-/* Driver local definitions. */
-/*===========================================================================*/
-
-/**
- * @brief Generic interrupt serving code for multiple pins per interrupt
- * handler.
- */
-#define ext_lld_serve_port_interrupt(gpio, start) \
- do { \
- uint32_t mis = HWREG(gpio + GPIO_O_MIS); \
- \
- HWREG(gpio + GPIO_O_ICR) = mis; \
- \
- if (mis & (1 << 0)) { \
- EXTD1.config->channels[start + 0].cb(&EXTD1, start + 0); \
- } \
- if (mis & (1 << 1)) { \
- EXTD1.config->channels[start + 1].cb(&EXTD1, start + 1); \
- } \
- if (mis & (1 << 2)) { \
- EXTD1.config->channels[start + 2].cb(&EXTD1, start + 2); \
- } \
- if (mis & (1 << 3)) { \
- EXTD1.config->channels[start + 3].cb(&EXTD1, start + 3); \
- } \
- if (mis & (1 << 4)) { \
- EXTD1.config->channels[start + 4].cb(&EXTD1, start + 4); \
- } \
- if (mis & (1 << 5)) { \
- EXTD1.config->channels[start + 5].cb(&EXTD1, start + 5); \
- } \
- if (mis & (1 << 6)) { \
- EXTD1.config->channels[start + 6].cb(&EXTD1, start + 6); \
- } \
- if (mis & (1 << 7)) { \
- EXTD1.config->channels[start + 7].cb(&EXTD1, start + 7); \
- } \
- } while (0);
-
-/**
- * @brief Generic interrupt serving code for single pin per interrupt
- * handler.
- */
-#define ext_lld_serve_pin_interrupt(gpiop, start, pin) \
- do { \
- gpiop->ICR = (1 << pin); \
- EXTD1.config->channels[start].cb(&EXTD1, start); \
- } while (0);
-
-/*===========================================================================*/
-/* Driver exported variables. */
-/*===========================================================================*/
-
-/**
- * @brief EXTD1 driver identifier.
- */
-EXTDriver EXTD1;
-
-/*===========================================================================*/
-/* Driver local variables and types. */
-/*===========================================================================*/
-
-const ioportid_t gpio_table[] =
-{
-#if TIVA_HAS_GPIOA
- GPIOA,
-#endif
-#if TIVA_HAS_GPIOB
- GPIOB,
-#endif
-#if TIVA_HAS_GPIOC
- GPIOC,
-#endif
-#if TIVA_HAS_GPIOD
- GPIOD,
-#endif
-#if TIVA_HAS_GPIOE
- GPIOE,
-#endif
-#if TIVA_HAS_GPIOF
- GPIOF,
-#endif
-#if TIVA_HAS_GPIOG
- GPIOG,
-#endif
-#if TIVA_HAS_GPIOH
- GPIOH,
-#endif
-#if TIVA_HAS_GPIOJ
- GPIOJ,
-#endif
-#if TIVA_HAS_GPIOK
- GPIOK,
-#endif
-#if TIVA_HAS_GPIOL
- GPIOL,
-#endif
-#if TIVA_HAS_GPIOM
- GPIOM,
-#endif
-#if TIVA_HAS_GPION
- GPION,
-#endif
-#if TIVA_HAS_GPIOP
- GPIOP,
-#endif
-#if TIVA_HAS_GPIOQ
- GPIOQ,
-#endif
-#if TIVA_HAS_GPIOR
- GPIOR,
-#endif
-#if TIVA_HAS_GPIOS
- GPIOS,
-#endif
-#if TIVA_HAS_GPIOT
- GPIOT,
-#endif
-};
-
-/*===========================================================================*/
-/* Driver local functions. */
-/*===========================================================================*/
-
-/**
- * @brief Enables GPIO IRQ sources.
- *
- * @notapi
- */
-static void ext_lld_irq_enable(void)
-{
-#if TIVA_HAS_GPIOA
- nvicEnableVector(TIVA_GPIOA_NUMBER, TIVA_EXT_GPIOA_IRQ_PRIORITY);
-#endif
-#if TIVA_HAS_GPIOB
- nvicEnableVector(TIVA_GPIOB_NUMBER, TIVA_EXT_GPIOB_IRQ_PRIORITY);
-#endif
-#if TIVA_HAS_GPIOC
- nvicEnableVector(TIVA_GPIOC_NUMBER, TIVA_EXT_GPIOC_IRQ_PRIORITY);
-#endif
-#if TIVA_HAS_GPIOD
- nvicEnableVector(TIVA_GPIOD_NUMBER, TIVA_EXT_GPIOD_IRQ_PRIORITY);
-#endif
-#if TIVA_HAS_GPIOE
- nvicEnableVector(TIVA_GPIOE_NUMBER, TIVA_EXT_GPIOE_IRQ_PRIORITY);
-#endif
-#if TIVA_HAS_GPIOF
- nvicEnableVector(TIVA_GPIOF_NUMBER, TIVA_EXT_GPIOF_IRQ_PRIORITY);
-#endif
-#if TIVA_HAS_GPIOG
- nvicEnableVector(TIVA_GPIOG_NUMBER, TIVA_EXT_GPIOG_IRQ_PRIORITY);
-#endif
-#if TIVA_HAS_GPIOH
- nvicEnableVector(TIVA_GPIOH_NUMBER, TIVA_EXT_GPIOH_IRQ_PRIORITY);
-#endif
-#if TIVA_HAS_GPIOJ
- nvicEnableVector(TIVA_GPIOJ_NUMBER, TIVA_EXT_GPIOJ_IRQ_PRIORITY);
-#endif
-#if TIVA_HAS_GPIOK
- nvicEnableVector(TIVA_GPIOK_NUMBER, TIVA_EXT_GPIOK_IRQ_PRIORITY);
-#endif
-#if TIVA_HAS_GPIOL
- nvicEnableVector(TIVA_GPIOL_NUMBER, TIVA_EXT_GPIOL_IRQ_PRIORITY);
-#endif
-#if TIVA_HAS_GPIOM
- nvicEnableVector(TIVA_GPIOM_NUMBER, TIVA_EXT_GPIOM_IRQ_PRIORITY);
-#endif
-#if TIVA_HAS_GPION
- nvicEnableVector(TIVA_GPION_NUMBER, TIVA_EXT_GPION_IRQ_PRIORITY);
-#endif
-#if TIVA_HAS_GPIOP
- nvicEnableVector(TIVA_GPIOP0_NUMBER, TIVA_EXT_GPIOP0_IRQ_PRIORITY);
- nvicEnableVector(TIVA_GPIOP1_NUMBER, TIVA_EXT_GPIOP1_IRQ_PRIORITY);
- nvicEnableVector(TIVA_GPIOP2_NUMBER, TIVA_EXT_GPIOP2_IRQ_PRIORITY);
- nvicEnableVector(TIVA_GPIOP3_NUMBER, TIVA_EXT_GPIOP3_IRQ_PRIORITY);
- nvicEnableVector(TIVA_GPIOP4_NUMBER, TIVA_EXT_GPIOP4_IRQ_PRIORITY);
- nvicEnableVector(TIVA_GPIOP5_NUMBER, TIVA_EXT_GPIOP5_IRQ_PRIORITY);
- nvicEnableVector(TIVA_GPIOP6_NUMBER, TIVA_EXT_GPIOP6_IRQ_PRIORITY);
- nvicEnableVector(TIVA_GPIOP7_NUMBER, TIVA_EXT_GPIOP7_IRQ_PRIORITY);
-#endif
-#if TIVA_HAS_GPIOQ
- nvicEnableVector(TIVA_GPIOQ0_NUMBER, TIVA_EXT_GPIOQ0_IRQ_PRIORITY);
- nvicEnableVector(TIVA_GPIOQ1_NUMBER, TIVA_EXT_GPIOQ1_IRQ_PRIORITY);
- nvicEnableVector(TIVA_GPIOQ2_NUMBER, TIVA_EXT_GPIOQ2_IRQ_PRIORITY);
- nvicEnableVector(TIVA_GPIOQ3_NUMBER, TIVA_EXT_GPIOQ3_IRQ_PRIORITY);
- nvicEnableVector(TIVA_GPIOQ4_NUMBER, TIVA_EXT_GPIOQ4_IRQ_PRIORITY);
- nvicEnableVector(TIVA_GPIOQ5_NUMBER, TIVA_EXT_GPIOQ5_IRQ_PRIORITY);
- nvicEnableVector(TIVA_GPIOQ6_NUMBER, TIVA_EXT_GPIOQ6_IRQ_PRIORITY);
- nvicEnableVector(TIVA_GPIOQ7_NUMBER, TIVA_EXT_GPIOQ7_IRQ_PRIORITY);
-#endif
-#if TIVA_HAS_GPIOR
- nvicEnableVector(TIVA_GPIOR_NUMBER, TIVA_EXT_GPIOR_IRQ_PRIORITY);
-#endif
-#if TIVA_HAS_GPIOS
- nvicEnableVector(TIVA_GPIOS_NUMBER, TIVA_EXT_GPIOS_IRQ_PRIORITY);
-#endif
-#if TIVA_HAS_GPIOT
- nvicEnableVector(TIVA_GPIOT_NUMBER, TIVA_EXT_GPIOT_IRQ_PRIORITY);
-#endif
-}
-
-/**
- * @brief Disables GPIO IRQ sources.
- *
- * @notapi
- */
-static void ext_lld_irq_disable(void)
-{
-#if TIVA_HAS_GPIOA
- nvicDisableVector(TIVA_GPIOA_NUMBER);
-#endif
-#if TIVA_HAS_GPIOB
- nvicDisableVector(TIVA_GPIOB_NUMBER);
-#endif
-#if TIVA_HAS_GPIOC
- nvicDisableVector(TIVA_GPIOC_NUMBER);
-#endif
-#if TIVA_HAS_GPIOD
- nvicDisableVector(TIVA_GPIOD_NUMBER);
-#endif
-#if TIVA_HAS_GPIOE
- nvicDisableVector(TIVA_GPIOE_NUMBER);
-#endif
-#if TIVA_HAS_GPIOF
- nvicDisableVector(TIVA_GPIOF_NUMBER);
-#endif
-#if TIVA_HAS_GPIOG
- nvicDisableVector(TIVA_GPIOG_NUMBER);
-#endif
-#if TIVA_HAS_GPIOH
- nvicDisableVector(TIVA_GPIOH_NUMBER);
-#endif
-#if TIVA_HAS_GPIOJ
- nvicDisableVector(TIVA_GPIOJ_NUMBER);
-#endif
-#if TIVA_HAS_GPIOK
- nvicDisableVector(TIVA_GPIOK_NUMBER);
-#endif
-#if TIVA_HAS_GPIOL
- nvicDisableVector(TIVA_GPIOL_NUMBER);
-#endif
-#if TIVA_HAS_GPIOM
- nvicDisableVector(TIVA_GPIOM_NUMBER);
-#endif
-#if TIVA_HAS_GPION
- nvicDisableVector(TIVA_GPION_NUMBER);
-#endif
-#if TIVA_HAS_GPIOP
- nvicDisableVector(TIVA_GPIOP0_NUMBER);
- nvicDisableVector(TIVA_GPIOP1_NUMBER);
- nvicDisableVector(TIVA_GPIOP2_NUMBER);
- nvicDisableVector(TIVA_GPIOP3_NUMBER);
- nvicDisableVector(TIVA_GPIOP4_NUMBER);
- nvicDisableVector(TIVA_GPIOP5_NUMBER);
- nvicDisableVector(TIVA_GPIOP6_NUMBER);
- nvicDisableVector(TIVA_GPIOP7_NUMBER);
-#endif
-#if TIVA_HAS_GPIOQ
- nvicDisableVector(TIVA_GPIOQ0_NUMBER);
- nvicDisableVector(TIVA_GPIOQ1_NUMBER);
- nvicDisableVector(TIVA_GPIOQ2_NUMBER);
- nvicDisableVector(TIVA_GPIOQ3_NUMBER);
- nvicDisableVector(TIVA_GPIOQ4_NUMBER);
- nvicDisableVector(TIVA_GPIOQ5_NUMBER);
- nvicDisableVector(TIVA_GPIOQ6_NUMBER);
- nvicDisableVector(TIVA_GPIOQ7_NUMBER);
-#endif
-#if TIVA_HAS_GPIOR
- nvicDisableVector(TIVA_GPIOR_NUMBER);
-#endif
-#if TIVA_HAS_GPIOS
- nvicDisableVector(TIVA_GPIOS_NUMBER);
-#endif
-#if TIVA_HAS_GPIOT
- nvicDisableVector(TIVA_GPIOT_NUMBER);
-#endif
-}
-
-/*===========================================================================*/
-/* Driver interrupt handlers. */
-/*===========================================================================*/
-
-#if TIVA_HAS_GPIOA || defined(__DOXYGEN__)
-/**
- * @brief GPIOA interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOA_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_port_interrupt(GPIOA, 0);
-
- OSAL_IRQ_EPILOGUE();
-}
-#endif
-
-#if TIVA_HAS_GPIOB || defined(__DOXYGEN__)
-/**
- * @brief GPIOB interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOB_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_port_interrupt(GPIOB, 8);
-
- OSAL_IRQ_EPILOGUE();
-}
-#endif
-
-#if TIVA_HAS_GPIOC || defined(__DOXYGEN__)
-/**
- * @brief GPIOC interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOC_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_port_interrupt(GPIOC, 16);
-
- OSAL_IRQ_EPILOGUE();
-}
-#endif
-
-#if TIVA_HAS_GPIOD || defined(__DOXYGEN__)
-/**
- * @brief GPIOD interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOD_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_port_interrupt(GPIOD, 24);
-
- OSAL_IRQ_EPILOGUE();
-}
-#endif
-
-#if TIVA_HAS_GPIOE || defined(__DOXYGEN__)
-/**
- * @brief GPIOE interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOE_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_port_interrupt(GPIOE, 32);
-
- OSAL_IRQ_EPILOGUE();
-}
-#endif
-
-#if TIVA_HAS_GPIOF || defined(__DOXYGEN__)
-/**
- * @brief GPIOF interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOF_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_port_interrupt(GPIOF, 40);
-
- OSAL_IRQ_EPILOGUE();
-}
-#endif
-
-#if TIVA_HAS_GPIOG || defined(__DOXYGEN__)
-/**
- * @brief GPIOG interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOG_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_port_interrupt(&GPIOG, 48);
-
- OSAL_IRQ_EPILOGUE();
-}
-#endif
-
-#if TIVA_HAS_GPIOH || defined(__DOXYGEN__)
-/**
- * @brief GPIOH interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOH_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_port_interrupt(&GPIOH, 56);
-
- OSAL_IRQ_EPILOGUE();
-}
-#endif
-
-#if TIVA_HAS_GPIOJ || defined(__DOXYGEN__)
-/**
- * @brief GPIOJ interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOJ_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_port_interrupt(&GPIOJ, 64);
-
- OSAL_IRQ_EPILOGUE();
-}
-#endif
-
-#if TIVA_HAS_GPIOK || defined(__DOXYGEN__)
-/**
- * @brief GPIOK interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOK_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_port_interrupt(&GPIOK, 72);
-
- OSAL_IRQ_EPILOGUE();
-}
-#endif
-
-#if TIVA_HAS_GPIOL || defined(__DOXYGEN__)
-/**
- * @brief GPIOL interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOL_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_port_interrupt(&GPIOL, 80);
-
- OSAL_IRQ_EPILOGUE();
-}
-#endif
-
-#if TIVA_HAS_GPIOM || defined(__DOXYGEN__)
-/**
- * @brief GPIOM interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOM_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_port_interrupt(&GPIOM, 88);
-
- OSAL_IRQ_EPILOGUE();
-}
-#endif
-
-#if TIVA_HAS_GPION || defined(__DOXYGEN__)
-/**
- * @brief GPION interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPION_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_port_interrupt(&GPION, 96);
-
- OSAL_IRQ_EPILOGUE();
-}
-#endif
-
-#if TIVA_HAS_GPIOP || defined(__DOXYGEN__)
-/**
- * @brief GPIOP0 interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOP0_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_pin_interrupt(&GPIOP, 104, 0);
-
- OSAL_IRQ_EPILOGUE();
-}
-
-/**
- * @brief GPIOP1 interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOP1_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_pin_interrupt(&GPIOP, 105, 1);
-
- OSAL_IRQ_EPILOGUE();
-}
-
-/**
- * @brief GPIOP2 interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOP2_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_pin_interrupt(&GPIOP, 106, 2);
-
- OSAL_IRQ_EPILOGUE();
-}
-
-/**
- * @brief GPIOP3 interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOP3_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_pin_interrupt(&GPIOP, 107, 3);
-
- OSAL_IRQ_EPILOGUE();
-}
-
-/**
- * @brief GPIOP4 interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOP4_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_pin_interrupt(&GPIOP, 108, 4);
-
- OSAL_IRQ_EPILOGUE();
-}
-
-/**
- * @brief GPIOP5 interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOP5_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_pin_interrupt(&GPIOP, 109, 5);
-
- OSAL_IRQ_EPILOGUE();
-}
-
-/**
- * @brief GPIOP6 interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOP6_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_pin_interrupt(&GPIOP, 110, 6);
-
- OSAL_IRQ_EPILOGUE();
-}
-
-/**
- * @brief GPIOP7 interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOP7_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_pin_interrupt(&GPIOP, 111, 7);
-
- OSAL_IRQ_EPILOGUE();
-}
-#endif
-
-#if TIVA_HAS_GPIOQ || defined(__DOXYGEN__)
-/**
- * @brief GPIOQ0 interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOQ0_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_pin_interrupt(&GPIOQ, 112, 0);
-
- OSAL_IRQ_EPILOGUE();
-}
-
-/**
- * @brief GPIOQ1 interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOQ1_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_pin_interrupt(&GPIOQ, 113, 1);
-
- OSAL_IRQ_EPILOGUE();
-}
-
-/**
- * @brief GPIOQ2 interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOQ2_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_pin_interrupt(&GPIOQ, 114, 2);
-
- OSAL_IRQ_EPILOGUE();
-}
-
-/**
- * @brief GPIOQ3 interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOQ3_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_pin_interrupt(&GPIOQ, 115, 3);
-
- OSAL_IRQ_EPILOGUE();
-}
-
-/**
- * @brief GPIOQ4 interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOQ4_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_pin_interrupt(&GPIOQ, 116, 4);
-
- OSAL_IRQ_EPILOGUE();
-}
-
-/**
- * @brief GPIOQ5 interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOQ5_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_pin_interrupt(&GPIOQ, 117, 5);
-
- OSAL_IRQ_EPILOGUE();
-}
-
-/**
- * @brief GPIOQ6 interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOQ6_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_pin_interrupt(&GPIOQ, 118, 6);
-
- OSAL_IRQ_EPILOGUE();
-}
-
-/**
- * @brief GPIOQ7 interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOQ7_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_pin_interrupt(&GPIOQ, 119, 7);
-
- OSAL_IRQ_EPILOGUE();
-}
-#endif
-
-#if TIVA_HAS_GPIOR || defined(__DOXYGEN__)
-/**
- * @brief GPIOR interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOR_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_port_interrupt(&GPIOR, 120);
-
- OSAL_IRQ_EPILOGUE();
-}
-#endif
-
-#if TIVA_HAS_GPIOS || defined(__DOXYGEN__)
-/**
- * @brief GPIOS interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOS_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_port_interrupt(&GPIOS, 128);
-
- OSAL_IRQ_EPILOGUE();
-}
-#endif
-
-#if TIVA_HAS_GPIOT || defined(__DOXYGEN__)
-/**
- * @brief GPIOT interrupt handler.
- *
- * @isr
- */
-OSAL_IRQ_HANDLER(TIVA_GPIOT_HANDLER)
-{
- OSAL_IRQ_PROLOGUE();
-
- ext_lld_serve_port_interrupt(&GPIOT, 132);
-
- OSAL_IRQ_EPILOGUE();
-}
-#endif
-
-/*===========================================================================*/
-/* Driver exported functions. */
-/*===========================================================================*/
-
-/**
- * @brief Low level EXT driver initialization.
- *
- * @notapi
- */
-void ext_lld_init(void)
-{
- extObjectInit(&EXTD1);
-}
-
-/**
- * @brief Configures and activates the EXT peripheral.
- *
- * @param[in] extp pointer to the @p EXTDriver object
- *
- * @notapi
- */
-void ext_lld_start(EXTDriver *extp)
-{
- uint8_t i;
-
- if (extp->state == EXT_STOP) {
- ext_lld_irq_enable();
- }
-
- /* Configuration of automatic channels.*/
- for (i = 0; i < EXT_MAX_CHANNELS; i++) {
- if (extp->config->channels[i].mode & EXT_CH_MODE_AUTOSTART) {
- ext_lld_channel_enable(extp, i);
- }
- else {
- ext_lld_channel_disable(extp, i);
- }
- }
-}
-
-/**
- * @brief Deactivates the EXT peripheral.
- *
- * @param[in] extp pointer to the @p EXTDriver object
- *
- * @notapi
- */
-void ext_lld_stop(EXTDriver *extp)
-{
- if (extp->state == EXT_ACTIVE) {
- ext_lld_irq_disable();
- }
-
-#if TIVA_HAS_GPIOA
- HWREG(GPIOA + GPIO_O_IM) = 0;
-#endif
-#if TIVA_HAS_GPIOB
- HWREG(GPIOB + GPIO_O_IM) = 0;
-#endif
-#if TIVA_HAS_GPIOC
- HWREG(GPIOC + GPIO_O_IM) = 0;
-#endif
-#if TIVA_HAS_GPIOD
- HWREG(GPIOD + GPIO_O_IM) = 0;
-#endif
-#if TIVA_HAS_GPIOE
- HWREG(GPIOE + GPIO_O_IM) = 0;
-#endif
-#if TIVA_HAS_GPIOF
- HWREG(GPIOF + GPIO_O_IM) = 0;
-#endif
-#if TIVA_HAS_GPIOG
- HWREG(GPIOG + GPIO_O_IM) = 0;
-#endif
-#if TIVA_HAS_GPIOH
- HWREG(GPIOH + GPIO_O_IM) = 0;
-#endif
-#if TIVA_HAS_GPIOJ
- HWREG(GPIOJ + GPIO_O_IM) = 0;
-#endif
-#if TIVA_HAS_GPIOK
- HWREG(GPIOK + GPIO_O_IM) = 0;
-#endif
-#if TIVA_HAS_GPIOL
- HWREG(GPIOL + GPIO_O_IM) = 0;
-#endif
-#if TIVA_HAS_GPIOM
- HWREG(GPIOM + GPIO_O_IM) = 0;
-#endif
-#if TIVA_HAS_GPION
- HWREG(GPION + GPIO_O_IM) = 0;
-#endif
-#if TIVA_HAS_GPIOP
- HWREG(GPIOP + GPIO_O_IM) = 0;
-#endif
-#if TIVA_HAS_GPIOQ
- HWREG(GPIOQ + GPIO_O_IM) = 0;
-#endif
-#if TIVA_HAS_GPIOR
- HWREG(GPIOR + GPIO_O_IM) = 0;
-#endif
-#if TIVA_HAS_GPIOS
- HWREG(GPIOS + GPIO_O_IM) = 0;
-#endif
-#if TIVA_HAS_GPIOT
- HWREG(GPIOT + GPIO_O_IM) = 0;
-#endif
-}
-
-/**
- * @brief Enables an EXT channel.
- *
- * @param[in] extp pointer to the @p EXTDriver object
- * @param[in] channel channel to be enabled
- *
- * @notapi
- */
-void ext_lld_channel_enable(EXTDriver *extp, expchannel_t channel)
-{
- uint32_t gpio;
- uint8_t pin;
- uint32_t im;
-
- pin = channel & 0x07;
- gpio = gpio_table[channel >> 3];
-
- /* Disable interrupts */
- im = HWREG(gpio + GPIO_O_IM);
- HWREG(gpio + GPIO_O_IM) = 0;
-
- /* Configure pin to be edge-sensitive.*/
- HWREG(gpio + GPIO_O_IS) &= ~(1 << pin);
-
- /* Programming edge registers.*/
- if ((extp->config->channels[channel].mode & EXT_CH_MODE_EDGES_MASK) ==
- EXT_CH_MODE_BOTH_EDGES) {
- HWREG(gpio + GPIO_O_IBE) |= (1 << pin);
- }
- else if ((extp->config->channels[channel].mode & EXT_CH_MODE_EDGES_MASK) ==
- EXT_CH_MODE_FALLING_EDGE) {
- HWREG(gpio + GPIO_O_IBE) &= ~(1 << pin);
- HWREG(gpio + GPIO_O_IEV) &= ~(1 << pin);
- }
- else if ((extp->config->channels[channel].mode & EXT_CH_MODE_EDGES_MASK) ==
- EXT_CH_MODE_RISING_EDGE) {
- HWREG(gpio + GPIO_O_IBE) &= ~(1 << pin);
- HWREG(gpio + GPIO_O_IEV) |= (1 << pin);
- }
-
- /* Programming interrupt and event registers.*/
- if ((extp->config->channels[channel].cb != NULL) &&
- ((extp->config->channels[channel].mode & EXT_CH_MODE_EDGES_MASK) !=
- EXT_CH_MODE_DISABLED)) {
- im |= (1 << pin);
- }
- else {
- im &= ~(1 << pin);
- }
-
- /* Restore interrupts */
- HWREG(gpio + GPIO_O_IM) = im;
-}
-
-/**
- * @brief Disables an EXT channel.
- *
- * @param[in] extp pointer to the @p EXTDriver object
- * @param[in] channel channel to be disabled
- *
- * @notapi
- */
-void ext_lld_channel_disable(EXTDriver *extp, expchannel_t channel)
-{
- (void)extp;
- uint32_t gpio;
- uint8_t pin;
-
- pin = channel & 0x07;
- gpio = gpio_table[channel >> 3];
-
- HWREG(gpio + GPIO_O_IM) &= ~(1 << pin);
-}
-
-#endif /* HAL_USE_EXT */
-
-/** @} */
diff --git a/os/hal/ports/TIVA/LLD/GPIO/hal_ext_lld.h b/os/hal/ports/TIVA/LLD/GPIO/hal_ext_lld.h
deleted file mode 100644
index 731f455..0000000
--- a/os/hal/ports/TIVA/LLD/GPIO/hal_ext_lld.h
+++ /dev/null
@@ -1,523 +0,0 @@
-/*
- Copyright (C) 2014..2017 Marco Veeneman
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-*/
-
-/**
- * @file GPIO/hal_ext_lld.h
- * @brief Tiva EXT subsystem low level driver header.
- *
- * @addtogroup EXT
- * @{
- */
-
-#ifndef HAL_EXT_LLD_H
-#define HAL_EXT_LLD_H
-
-#if HAL_USE_EXT || defined(__DOXYGEN__)
-
-/*===========================================================================*/
-/* Driver constants. */
-/*===========================================================================*/
-
-/**
- * @brief Number of EXT per port.
- */
-#define EXT_MAX_CHANNELS TIVA_GPIO_PINS
-
-/*===========================================================================*/
-/* Driver pre-compile time settings. */
-/*===========================================================================*/
-
-/**
- * @name Configuration options
- * @{
- */
-/**
- * @brief GPIOA interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOA_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOA_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOB interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOB_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOB_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOC interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOC_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOC_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOD interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOD_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOD_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOE interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOE_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOE_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOF interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOF_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOF_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOG interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOG_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOG_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOH interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOH_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOH_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOJ interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOJ_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOJ_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOK interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOK_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOK_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOL interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOL_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOL_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOM interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOM_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOM_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPION interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPION_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPION_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOP0 interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOP0_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOP0_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOP1 interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOP1_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOP1_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOP2 interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOP2_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOP2_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOP3 interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOP3_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOP3_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOP4 interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOP4_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOP4_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOP5 interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOP5_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOP5_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOP6 interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOP6_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOP6_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOP7 interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOP7_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOP7_IRQ_PRIORITY 3
-#endif
-/** @} */
-
-/**
- * @brief GPIOQ0 interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOQ0_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOQ0_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOQ1 interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOQ1_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOQ1_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOQ2 interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOQ2_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOQ2_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOQ3 interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOQ3_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOQ3_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOQ4 interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOQ4_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOQ4_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOQ5 interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOQ5_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOQ5_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOQ6 interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOQ6_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOQ6_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOQ7 interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOQ7_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOQ7_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOR interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOR_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOR_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOS interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOS_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOS_IRQ_PRIORITY 3
-#endif
-
-/**
- * @brief GPIOT interrupt priority level setting.
- */
-#if !defined(TIVA_EXT_GPIOT_IRQ_PRIORITY) || defined(__DOXYGEN__)
-#define TIVA_EXT_GPIOT_IRQ_PRIORITY 3
-#endif
-/** @} */
-
-/*===========================================================================*/
-/* Derived constants and error checks. */
-/*===========================================================================*/
-
-#if TIVA_HAS_GPIOA && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOA_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOA"
-#endif
-
-#if TIVA_HAS_GPIOB && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOB_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOB"
-#endif
-
-#if TIVA_HAS_GPIOC && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOC_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOC"
-#endif
-
-#if TIVA_HAS_GPIOD && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOD_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOD"
-#endif
-
-#if TIVA_HAS_GPIOE && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOE_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOE"
-#endif
-
-#if TIVA_HAS_GPIOF && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOF_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOF"
-#endif
-
-#if TIVA_HAS_GPIOG && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOG_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOG"
-#endif
-
-#if TIVA_HAS_GPIOH && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOH_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOH"
-#endif
-
-#if TIVA_HAS_GPIOJ && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOJ_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOJ"
-#endif
-
-#if TIVA_HAS_GPIOK && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOK_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOK"
-#endif
-
-#if TIVA_HAS_GPIOL && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOL_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOL"
-#endif
-
-#if TIVA_HAS_GPIOM && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOM_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOM"
-#endif
-
-#if TIVA_HAS_GPION && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPION_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPION"
-#endif
-
-#if TIVA_HAS_GPIOP0 && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOP0_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOP0"
-#endif
-
-#if TIVA_HAS_GPIOP1 && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOP1_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOP1"
-#endif
-
-#if TIVA_HAS_GPIOP2 && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOP2_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOP2"
-#endif
-
-#if TIVA_HAS_GPIOP3 && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOP3_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOP3"
-#endif
-
-#if TIVA_HAS_GPIOP4 && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOP4_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOP4"
-#endif
-
-#if TIVA_HAS_GPIOP5 && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOP5_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOP5"
-#endif
-
-#if TIVA_HAS_GPIOP6 && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOP6_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOP6"
-#endif
-
-#if TIVA_HAS_GPIOP7 && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOP7_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOP7"
-#endif
-
-#if TIVA_HAS_GPIOQ0 && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOQ0_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOQ0"
-#endif
-
-#if TIVA_HAS_GPIOQ1 && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOQ1_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOQ1"
-#endif
-
-#if TIVA_HAS_GPIOQ2 && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOQ2_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOQ2"
-#endif
-
-#if TIVA_HAS_GPIOQ3 && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOQ3_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOQ3"
-#endif
-
-#if TIVA_HAS_GPIOQ4 && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOQ4_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOQ4"
-#endif
-
-#if TIVA_HAS_GPIOQ5 && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOQ5_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOQ5"
-#endif
-
-#if TIVA_HAS_GPIOQ6 && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOQ6_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOQ6"
-#endif
-
-#if TIVA_HAS_GPIOQ7 && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOQ7_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOQ7"
-#endif
-
-#if TIVA_HAS_GPIOR && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOR_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOR"
-#endif
-
-#if TIVA_HAS_GPIOS && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOS_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOS"
-#endif
-
-#if TIVA_HAS_GPIOT && \
- !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_EXT_GPIOT_IRQ_PRIORITY)
-#error "Invalid IRQ priority assigned to GPIOT"
-#endif
-
-/*===========================================================================*/
-/* Driver data structures and types. */
-/*===========================================================================*/
-
-/**
- * @brief EXT channel identifier.
- */
-typedef uint32_t expchannel_t;
-
-/**
- * @brief Type of an EXT generic notification callback.
- *
- * @param[in] extp pointer to the @p EXPDriver object triggering the
- * callback
- */
-typedef void (*extcallback_t)(EXTDriver *extp, expchannel_t channel);
-
-/**
- * @brief Channel configuration structure.
- */
-typedef struct {
- /**
- * @brief Channel mode.
- */
- uint32_t mode;
- /**
- * @brief Channel callback.
- */
- extcallback_t cb;
-} EXTChannelConfig;
-
-/**
- * @brief Driver configuration structure.
- * @note It could be empty on some architectures.
- */
-typedef struct {
- /**
- * @brief Channel configurations.
- */
- EXTChannelConfig channels[EXT_MAX_CHANNELS];
- /* End of the mandatory fields.*/
-} EXTConfig;
-
-/**
- * @brief Structure representing an EXT driver.
- */
-struct EXTDriver {
- /**
- * @brief Driver state.
- */
- extstate_t state;
- /**
- * @brief Current configuration data.
- */
- const EXTConfig *config;
- /* End of the mandatory fields.*/
-};
-
-/*===========================================================================*/
-/* Driver macros. */
-/*===========================================================================*/
-
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
-
-#if !defined(__DOXYGEN__)
-extern EXTDriver EXTD1;
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
- void ext_lld_init(void);
- void ext_lld_start(EXTDriver *extp);
- void ext_lld_stop(EXTDriver *extp);
- void ext_lld_channel_enable(EXTDriver *extp, expchannel_t channel);
- void ext_lld_channel_disable(EXTDriver *extp, expchannel_t channel);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* HAL_USE_EXT */
-
-#endif /* HAL_EXT_LLD_H */
-
-/** @} */
diff --git a/os/hal/ports/TIVA/LLD/GPIO/hal_pal_lld.c b/os/hal/ports/TIVA/LLD/GPIO/hal_pal_lld.c
index 41fb3cd..7a222e4 100644
--- a/os/hal/ports/TIVA/LLD/GPIO/hal_pal_lld.c
+++ b/os/hal/ports/TIVA/LLD/GPIO/hal_pal_lld.c
@@ -32,196 +32,121 @@
#if TIVA_HAS_GPIOA || defined(__DOXYGEN__)
#define GPIOA_BIT (1 << 0)
-#if TIVA_GPIO_GPIOA_USE_AHB && defined(TM4C123x)
-#define GPIOA_AHB_BIT (1 << 0)
-#else
-#define GPIOA_AHB_BIT 0
-#endif
#else
#define GPIOA_BIT 0
-#define GPIOA_AHB_BIT 0
#endif
#if TIVA_HAS_GPIOB || defined(__DOXYGEN__)
#define GPIOB_BIT (1 << 1)
-#if TIVA_GPIO_GPIOB_USE_AHB && defined(TM4C123x)
-#define GPIOB_AHB_BIT (1 << 1)
-#else
-#define GPIOB_AHB_BIT 0
-#endif
#else
#define GPIOB_BIT 0
-#define GPIOB_AHB_BIT 0
#endif
#if TIVA_HAS_GPIOC || defined(__DOXYGEN__)
#define GPIOC_BIT (1 << 2)
-#if TIVA_GPIO_GPIOC_USE_AHB && defined(TM4C123x)
-#define GPIOC_AHB_BIT (1 << 2)
-#else
-#define GPIOC_AHB_BIT 0
-#endif
#else
#define GPIOC_BIT 0
-#define GPIOC_AHB_BIT 0
#endif
#if TIVA_HAS_GPIOD || defined(__DOXYGEN__)
#define GPIOD_BIT (1 << 3)
-#if TIVA_GPIO_GPIOD_USE_AHB && defined(TM4C123x)
-#define GPIOD_AHB_BIT (1 << 3)
-#else
-#define GPIOD_AHB_BIT 0
-#endif
#else
#define GPIOD_BIT 0
-#define GPIOD_AHB_BIT 0
#endif
#if TIVA_HAS_GPIOE || defined(__DOXYGEN__)
#define GPIOE_BIT (1 << 4)
-#if TIVA_GPIO_GPIOE_USE_AHB && defined(TM4C123x)
-#define GPIOE_AHB_BIT (1 << 4)
-#else
-#define GPIOE_AHB_BIT 0
-#endif
#else
#define GPIOE_BIT 0
-#define GPIOE_AHB_BIT 0
#endif
#if TIVA_HAS_GPIOF || defined(__DOXYGEN__)
#define GPIOF_BIT (1 << 5)
-#if TIVA_GPIO_GPIOF_USE_AHB && defined(TM4C123x)
-#define GPIOF_AHB_BIT (1 << 5)
-#else
-#define GPIOF_AHB_BIT 0
-#endif
#else
#define GPIOF_BIT 0
-#define GPIOF_AHB_BIT 0
#endif
#if TIVA_HAS_GPIOG || defined(__DOXYGEN__)
#define GPIOG_BIT (1 << 6)
-#if TIVA_GPIO_GPIOG_USE_AHB && defined(TM4C123x)
-#define GPIOG_AHB_BIT (1 << 6)
-#else
-#define GPIOG_AHB_BIT 0
-#endif
#else
#define GPIOG_BIT 0
-#define GPIOG_AHB_BIT 0
#endif
#if TIVA_HAS_GPIOH || defined(__DOXYGEN__)
#define GPIOH_BIT (1 << 7)
-#if TIVA_GPIO_GPIOH_USE_AHB && defined(TM4C123x)
-#define GPIOH_AHB_BIT (1 << 7)
-#else
-#define GPIOH_AHB_BIT 0
-#endif
#else
#define GPIOH_BIT 0
-#define GPIOH_AHB_BIT 0
#endif
#if TIVA_HAS_GPIOJ || defined(__DOXYGEN__)
#define GPIOJ_BIT (1 << 8)
-#if TIVA_GPIO_GPIOJ_USE_AHB && defined(TM4C123x)
-#define GPIOJ_AHB_BIT (1 << 8)
-#else
-#define GPIOJ_AHB_BIT 0
-#endif
#else
#define GPIOJ_BIT 0
-#define GPIOJ_AHB_BIT 0
#endif
#if TIVA_HAS_GPIOK || defined(__DOXYGEN__)
#define GPIOK_BIT (1 << 9)
-#define GPIOK_AHB_BIT (1 << 9)
#else
#define GPIOK_BIT 0
-#define GPIOK_AHB_BIT 0
#endif
#if TIVA_HAS_GPIOL || defined(__DOXYGEN__)
#define GPIOL_BIT (1 << 10)
-#define GPIOL_AHB_BIT (1 << 10)
#else
#define GPIOL_BIT 0
-#define GPIOL_AHB_BIT 0
#endif
#if TIVA_HAS_GPIOM || defined(__DOXYGEN__)
#define GPIOM_BIT (1 << 11)
-#define GPIOM_AHB_BIT (1 << 11)
#else
#define GPIOM_BIT 0
-#define GPIOM_AHB_BIT 0
#endif
#if TIVA_HAS_GPION || defined(__DOXYGEN__)
#define GPION_BIT (1 << 12)
-#define GPION_AHB_BIT (1 << 12)
#else
#define GPION_BIT 0
-#define GPION_AHB_BIT 0
#endif
#if TIVA_HAS_GPIOP || defined(__DOXYGEN__)
#define GPIOP_BIT (1 << 13)
-#define GPIOP_AHB_BIT (1 << 13)
#else
#define GPIOP_BIT 0
-#define GPIOP_AHB_BIT 0
#endif
#if TIVA_HAS_GPIOQ || defined(__DOXYGEN__)
#define GPIOQ_BIT (1 << 14)
-#define GPIOQ_AHB_BIT (1 << 14)
#else
#define GPIOQ_BIT 0
-#define GPIOQ_AHB_BIT 0
#endif
#if TIVA_HAS_GPIOR || defined(__DOXYGEN__)
#define GPIOR_BIT (1 << 15)
-#define GPIOR_AHB_BIT (1 << 15)
#else
#define GPIOR_BIT 0
-#define GPIOR_AHB_BIT 0
#endif
#if TIVA_HAS_GPIOS || defined(__DOXYGEN__)
#define GPIOS_BIT (1 << 16)
-#define GPIOS_AHB_BIT (1 << 16)
#else
#define GPIOS_BIT 0
-#define GPIOS_AHB_BIT 0
#endif
#if TIVA_HAS_GPIOT || defined(__DOXYGEN__)
#define GPIOT_BIT (1 << 17)
-#define GPIOT_AHB_BIT (1 << 17)
#else
#define GPIOT_BIT 0
-#define GPIOT_AHB_BIT 0
#endif
#define RCGCGPIO_MASK (GPIOA_BIT | GPIOB_BIT | GPIOC_BIT | GPIOD_BIT | \
GPIOE_BIT | GPIOF_BIT | GPIOG_BIT | GPIOH_BIT | \
GPIOJ_BIT | GPIOK_BIT | GPIOL_BIT | GPIOM_BIT | \
GPION_BIT | GPIOP_BIT | GPIOQ_BIT | GPIOR_BIT | \
- GPIOS_BIT | GPIOR_BIT)
+ GPIOS_BIT | GPIOT_BIT)
-#define GPIOHBCTL_MASK (GPIOA_AHB_BIT | GPIOB_AHB_BIT | GPIOC_AHB_BIT | \
- GPIOD_AHB_BIT | GPIOE_AHB_BIT | GPIOF_AHB_BIT | \
- GPIOG_AHB_BIT | GPIOH_AHB_BIT | GPIOJ_AHB_BIT | \
- GPIOK_AHB_BIT | GPIOL_AHB_BIT | GPIOM_AHB_BIT | \
- GPION_AHB_BIT | GPIOP_AHB_BIT | GPIOQ_AHB_BIT | \
- GPIOR_AHB_BIT | GPIOS_AHB_BIT | GPIOT_AHB_BIT)
+#define GPIOHBCTL_MASK (GPIOA_BIT | GPIOB_BIT | GPIOC_BIT | GPIOD_BIT | \
+ GPIOE_BIT | GPIOF_BIT | GPIOG_BIT | GPIOH_BIT | \
+ GPIOJ_BIT)
#define GPIOC_JTAG_MASK (0x0F)
#define GPIOD_NMI_MASK (0x80)
@@ -231,6 +156,11 @@
/* Driver exported variables. */
/*===========================================================================*/
+/**
+ * @brief Event records for all GPIO channels.
+ */
+palevent_t _pal_events[TIVA_GPIO_PINS];
+
/*===========================================================================*/
/* Driver local variables and types. */
/*===========================================================================*/
@@ -276,10 +206,608 @@ static void gpio_unlock(ioportid_t port, ioportmask_t mask)
HWREG(port + GPIO_O_CR) = mask;
}
+#if PAL_USE_CALLBACKS || PAL_USE_WAIT
+/**
+ * @brief Enables GPIO IRQ sources.
+ */
+static void gpio_irq_enable(void)
+{
+#if TIVA_HAS_GPIOA
+ nvicEnableVector(TIVA_GPIOA_NUMBER, TIVA_PAL_GPIOA_IRQ_PRIORITY);
+#endif
+#if TIVA_HAS_GPIOB
+ nvicEnableVector(TIVA_GPIOB_NUMBER, TIVA_PAL_GPIOB_IRQ_PRIORITY);
+#endif
+#if TIVA_HAS_GPIOC
+ nvicEnableVector(TIVA_GPIOC_NUMBER, TIVA_PAL_GPIOC_IRQ_PRIORITY);
+#endif
+#if TIVA_HAS_GPIOD
+ nvicEnableVector(TIVA_GPIOD_NUMBER, TIVA_PAL_GPIOD_IRQ_PRIORITY);
+#endif
+#if TIVA_HAS_GPIOE
+ nvicEnableVector(TIVA_GPIOE_NUMBER, TIVA_PAL_GPIOE_IRQ_PRIORITY);
+#endif
+#if TIVA_HAS_GPIOF
+ nvicEnableVector(TIVA_GPIOF_NUMBER, TIVA_PAL_GPIOF_IRQ_PRIORITY);
+#endif
+#if TIVA_HAS_GPIOG
+ nvicEnableVector(TIVA_GPIOG_NUMBER, TIVA_PAL_GPIOG_IRQ_PRIORITY);
+#endif
+#if TIVA_HAS_GPIOH
+ nvicEnableVector(TIVA_GPIOH_NUMBER, TIVA_PAL_GPIOH_IRQ_PRIORITY);
+#endif
+#if TIVA_HAS_GPIOJ
+ nvicEnableVector(TIVA_GPIOJ_NUMBER, TIVA_PAL_GPIOJ_IRQ_PRIORITY);
+#endif
+#if TIVA_HAS_GPIOK
+ nvicEnableVector(TIVA_GPIOK_NUMBER, TIVA_PAL_GPIOK_IRQ_PRIORITY);
+#endif
+#if TIVA_HAS_GPIOL
+ nvicEnableVector(TIVA_GPIOL_NUMBER, TIVA_PAL_GPIOL_IRQ_PRIORITY);
+#endif
+#if TIVA_HAS_GPIOM
+ nvicEnableVector(TIVA_GPIOM_NUMBER, TIVA_PAL_GPIOM_IRQ_PRIORITY);
+#endif
+#if TIVA_HAS_GPION
+ nvicEnableVector(TIVA_GPION_NUMBER, TIVA_PAL_GPION_IRQ_PRIORITY);
+#endif
+#if TIVA_HAS_GPIOP
+ nvicEnableVector(TIVA_GPIOP0_NUMBER, TIVA_PAL_GPIOP0_IRQ_PRIORITY);
+ nvicEnableVector(TIVA_GPIOP1_NUMBER, TIVA_PAL_GPIOP1_IRQ_PRIORITY);
+ nvicEnableVector(TIVA_GPIOP2_NUMBER, TIVA_PAL_GPIOP2_IRQ_PRIORITY);
+ nvicEnableVector(TIVA_GPIOP3_NUMBER, TIVA_PAL_GPIOP3_IRQ_PRIORITY);
+ nvicEnableVector(TIVA_GPIOP4_NUMBER, TIVA_PAL_GPIOP4_IRQ_PRIORITY);
+ nvicEnableVector(TIVA_GPIOP5_NUMBER, TIVA_PAL_GPIOP5_IRQ_PRIORITY);
+ nvicEnableVector(TIVA_GPIOP6_NUMBER, TIVA_PAL_GPIOP6_IRQ_PRIORITY);
+ nvicEnableVector(TIVA_GPIOP7_NUMBER, TIVA_PAL_GPIOP7_IRQ_PRIORITY);
+#endif
+#if TIVA_HAS_GPIOQ
+ nvicEnableVector(TIVA_GPIOQ0_NUMBER, TIVA_PAL_GPIOQ0_IRQ_PRIORITY);
+ nvicEnableVector(TIVA_GPIOQ1_NUMBER, TIVA_PAL_GPIOQ1_IRQ_PRIORITY);
+ nvicEnableVector(TIVA_GPIOQ2_NUMBER, TIVA_PAL_GPIOQ2_IRQ_PRIORITY);
+ nvicEnableVector(TIVA_GPIOQ3_NUMBER, TIVA_PAL_GPIOQ3_IRQ_PRIORITY);
+ nvicEnableVector(TIVA_GPIOQ4_NUMBER, TIVA_PAL_GPIOQ4_IRQ_PRIORITY);
+ nvicEnableVector(TIVA_GPIOQ5_NUMBER, TIVA_PAL_GPIOQ5_IRQ_PRIORITY);
+ nvicEnableVector(TIVA_GPIOQ6_NUMBER, TIVA_PAL_GPIOQ6_IRQ_PRIORITY);
+ nvicEnableVector(TIVA_GPIOQ7_NUMBER, TIVA_PAL_GPIOQ7_IRQ_PRIORITY);
+#endif
+#if TIVA_HAS_GPIOR
+ nvicEnableVector(TIVA_GPIOR_NUMBER, TIVA_PAL_GPIOR_IRQ_PRIORITY);
+#endif
+#if TIVA_HAS_GPIOS
+ nvicEnableVector(TIVA_GPIOS_NUMBER, TIVA_PAL_GPIOS_IRQ_PRIORITY);
+#endif
+#if TIVA_HAS_GPIOT
+ nvicEnableVector(TIVA_GPIOT_NUMBER, TIVA_PAL_GPIOT_IRQ_PRIORITY);
+#endif
+}
+#endif
+
+#define gpio_serve_irq(mask, pin, channel) { \
+ \
+ if ((mask) & (1U << (pin))) { \
+ _pal_isr_code(channel); \
+ } \
+}
+
+/**
+ * @brief Generic interrupt serving code for multiple pins per interrupt
+ * handler.
+ */
+#define ext_lld_serve_port_interrupt(gpio, start) \
+ do { \
+ uint32_t mis = HWREG(gpio + GPIO_O_MIS); \
+ \
+ HWREG(gpio + GPIO_O_ICR) = mis; \
+ \
+ gpio_serve_irq(mis, 0, start + 0); \
+ gpio_serve_irq(mis, 1, start + 1); \
+ gpio_serve_irq(mis, 2, start + 2); \
+ gpio_serve_irq(mis, 3, start + 3); \
+ gpio_serve_irq(mis, 4, start + 4); \
+ gpio_serve_irq(mis, 5, start + 5); \
+ gpio_serve_irq(mis, 6, start + 6); \
+ gpio_serve_irq(mis, 7, start + 7); \
+ } while (0);
+
+/**
+ * @brief Generic interrupt serving code for single pin per interrupt
+ * handler.
+ */
+#define ext_lld_serve_pin_interrupt(gpio, start, pin) \
+ do { \
+ HWREG(gpio + GPIO_O_ICR) = (1 << pin); \
+ gpio_serve_irq((1 << pin), pin, start) \
+ } while (0);
+
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
+#if TIVA_HAS_GPIOA || defined(__DOXYGEN__)
+/**
+ * @brief GPIOA interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOA_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_port_interrupt(GPIOA, 0);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_HAS_GPIOB || defined(__DOXYGEN__)
+/**
+ * @brief GPIOB interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOB_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_port_interrupt(GPIOB, 8);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_HAS_GPIOC || defined(__DOXYGEN__)
+/**
+ * @brief GPIOC interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOC_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_port_interrupt(GPIOC, 16);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_HAS_GPIOD || defined(__DOXYGEN__)
+/**
+ * @brief GPIOD interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOD_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_port_interrupt(GPIOD, 24);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_HAS_GPIOE || defined(__DOXYGEN__)
+/**
+ * @brief GPIOE interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOE_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_port_interrupt(GPIOE, 32);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_HAS_GPIOF || defined(__DOXYGEN__)
+/**
+ * @brief GPIOF interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOF_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_port_interrupt(GPIOF, 40);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_HAS_GPIOG || defined(__DOXYGEN__)
+/**
+ * @brief GPIOG interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOG_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_port_interrupt(GPIOG, 48);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_HAS_GPIOH || defined(__DOXYGEN__)
+/**
+ * @brief GPIOH interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOH_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_port_interrupt(GPIOH, 56);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_HAS_GPIOJ || defined(__DOXYGEN__)
+/**
+ * @brief GPIOJ interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOJ_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_port_interrupt(GPIOJ, 64);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_HAS_GPIOK || defined(__DOXYGEN__)
+/**
+ * @brief GPIOK interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOK_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_port_interrupt(GPIOK, 72);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_HAS_GPIOL || defined(__DOXYGEN__)
+/**
+ * @brief GPIOL interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOL_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_port_interrupt(GPIOL, 80);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_HAS_GPIOM || defined(__DOXYGEN__)
+/**
+ * @brief GPIOM interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOM_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_port_interrupt(GPIOM, 88);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_HAS_GPION || defined(__DOXYGEN__)
+/**
+ * @brief GPION interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPION_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_port_interrupt(GPION, 96);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_HAS_GPIOP || defined(__DOXYGEN__)
+/**
+ * @brief GPIOP0 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOP0_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_pin_interrupt(GPIOP, 104, 0);
+
+ OSAL_IRQ_EPILOGUE();
+}
+
+/**
+ * @brief GPIOP1 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOP1_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_pin_interrupt(GPIOP, 105, 1);
+
+ OSAL_IRQ_EPILOGUE();
+}
+
+/**
+ * @brief GPIOP2 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOP2_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_pin_interrupt(GPIOP, 106, 2);
+
+ OSAL_IRQ_EPILOGUE();
+}
+
+/**
+ * @brief GPIOP3 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOP3_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_pin_interrupt(GPIOP, 107, 3);
+
+ OSAL_IRQ_EPILOGUE();
+}
+
+/**
+ * @brief GPIOP4 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOP4_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_pin_interrupt(GPIOP, 108, 4);
+
+ OSAL_IRQ_EPILOGUE();
+}
+
+/**
+ * @brief GPIOP5 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOP5_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_pin_interrupt(GPIOP, 109, 5);
+
+ OSAL_IRQ_EPILOGUE();
+}
+
+/**
+ * @brief GPIOP6 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOP6_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_pin_interrupt(GPIOP, 110, 6);
+
+ OSAL_IRQ_EPILOGUE();
+}
+
+/**
+ * @brief GPIOP7 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOP7_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_pin_interrupt(GPIOP, 111, 7);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_HAS_GPIOQ || defined(__DOXYGEN__)
+/**
+ * @brief GPIOQ0 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOQ0_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_pin_interrupt(GPIOQ, 112, 0);
+
+ OSAL_IRQ_EPILOGUE();
+}
+
+/**
+ * @brief GPIOQ1 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOQ1_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_pin_interrupt(GPIOQ, 113, 1);
+
+ OSAL_IRQ_EPILOGUE();
+}
+
+/**
+ * @brief GPIOQ2 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOQ2_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_pin_interrupt(GPIOQ, 114, 2);
+
+ OSAL_IRQ_EPILOGUE();
+}
+
+/**
+ * @brief GPIOQ3 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOQ3_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_pin_interrupt(GPIOQ, 115, 3);
+
+ OSAL_IRQ_EPILOGUE();
+}
+
+/**
+ * @brief GPIOQ4 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOQ4_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_pin_interrupt(GPIOQ, 116, 4);
+
+ OSAL_IRQ_EPILOGUE();
+}
+
+/**
+ * @brief GPIOQ5 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOQ5_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_pin_interrupt(GPIOQ, 117, 5);
+
+ OSAL_IRQ_EPILOGUE();
+}
+
+/**
+ * @brief GPIOQ6 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOQ6_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_pin_interrupt(GPIOQ, 118, 6);
+
+ OSAL_IRQ_EPILOGUE();
+}
+
+/**
+ * @brief GPIOQ7 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOQ7_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_pin_interrupt(GPIOQ, 119, 7);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_HAS_GPIOR || defined(__DOXYGEN__)
+/**
+ * @brief GPIOR interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOR_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_port_interrupt(GPIOR, 120);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_HAS_GPIOS || defined(__DOXYGEN__)
+/**
+ * @brief GPIOS interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOS_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_port_interrupt(GPIOS, 128);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_HAS_GPIOT || defined(__DOXYGEN__)
+/**
+ * @brief GPIOT interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_GPIOT_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ ext_lld_serve_port_interrupt(GPIOT, 132);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
@@ -294,6 +822,14 @@ static void gpio_unlock(ioportid_t port, ioportmask_t mask)
*/
void _pal_lld_init(const PALConfig *config)
{
+#if PAL_USE_CALLBACKS || PAL_USE_WAIT || defined(__DOXYGEN__)
+ unsigned i;
+
+ for (i = 0; i < TIVA_GPIO_PINS; i++) {
+ _pal_init_event(i);
+ }
+#endif
+
/*
* Enables all GPIO clocks.
*/
@@ -366,6 +902,9 @@ void _pal_lld_init(const PALConfig *config)
#if TIVA_HAS_GPIOT || defined(__DOXYGEN__)
gpio_init(GPIOT, &config->PTData);
#endif
+#if PAL_USE_CALLBACKS || PAL_USE_WAIT
+ gpio_irq_enable();
+#endif
}
/**
@@ -436,6 +975,159 @@ void _pal_lld_setgroupmode(ioportid_t port, ioportmask_t mask, iomode_t mode)
}
}
+#if PAL_USE_CALLBACKS || PAL_USE_WAIT || defined(__DOXYGEN__)
+/**
+ * @brief Pad event enable.
+ * @note Programming an unknown or unsupported mode is silently ignored.
+ *
+ * @param[in] port port identifier
+ * @param[in] pad pad number within the port
+ * @param[in] mode pad event mode
+ *
+ * @notapi
+ */
+void _pal_lld_enablepadevent(ioportid_t port,
+ iopadid_t pad,
+ ioeventmode_t mode)
+{
+ //uint8_t portidx;
+ uint32_t padmask;
+
+ //portidx = (((uint32_t)port - (uint32_t)GPIOA) >> 12) & 0x1FU;
+ padmask = (1 << pad);
+
+ /* Disable interrupt before changing edge configuration.*/
+ HWREG(port + GPIO_O_IM) &= ~padmask;
+
+ /* Configure pin to be edge-sensitive.*/
+ HWREG(port + GPIO_O_IS) &= ~(1 << pad);
+
+ /* Configure edges */
+ switch(mode & PAL_EVENT_MODE_EDGES_MASK) {
+ case PAL_EVENT_MODE_BOTH_EDGES:
+ HWREG(port + GPIO_O_IBE) |= padmask;
+ break;
+ case PAL_EVENT_MODE_RISING_EDGE:
+ HWREG(port + GPIO_O_IBE) &= ~padmask;
+ HWREG(port + GPIO_O_IEV) &= ~padmask;
+ break;
+ case PAL_EVENT_MODE_FALLING_EDGE:
+ HWREG(port + GPIO_O_IBE) &= ~padmask;
+ HWREG(port + GPIO_O_IEV) |= padmask;
+ break;
+ default:
+ /* Interrupt is already disabled */
+ break;
+ }
+
+ if (mode & PAL_EVENT_MODE_EDGES_MASK) {
+ /* Enable interrupt for this pad */
+ HWREG(port + GPIO_O_IM) |= padmask;
+ }
+}
+
+/**
+ * @brief Pad event disable.
+ * @details This function disables previously programmed event callbacks.
+ *
+ * @param[in] port port identifier
+ * @param[in] pad pad number within the port
+ *
+ * @notapi
+ */
+void _pal_lld_disablepadevent(ioportid_t port, iopadid_t pad)
+{
+ uint8_t portidx;
+ uint8_t eventidx;
+
+ portidx = (((uint32_t)port - (uint32_t)GPIOA) >> 12) & 0x1FU;
+
+ eventidx = portidx * 8 + pad;
+
+ HWREG(port + GPIO_O_IM) &= ~(1 << pad);
+
+#if PAL_USE_CALLBACKS || PAL_USE_WAIT
+ /* Callback cleared and/or thread reset.*/
+ _pal_clear_event(eventidx);
+#endif
+}
+
+/**
+ * @brief Disables GPIO IRQ sources.
+ */
+void pal_lld_disable_irqs(void)
+{
+#if TIVA_HAS_GPIOA
+ nvicDisableVector(TIVA_GPIOA_NUMBER);
+#endif
+#if TIVA_HAS_GPIOB
+ nvicDisableVector(TIVA_GPIOB_NUMBER);
+#endif
+#if TIVA_HAS_GPIOC
+ nvicDisableVector(TIVA_GPIOC_NUMBER);
+#endif
+#if TIVA_HAS_GPIOD
+ nvicDisableVector(TIVA_GPIOD_NUMBER);
+#endif
+#if TIVA_HAS_GPIOE
+ nvicDisableVector(TIVA_GPIOE_NUMBER);
+#endif
+#if TIVA_HAS_GPIOF
+ nvicDisableVector(TIVA_GPIOF_NUMBER);
+#endif
+#if TIVA_HAS_GPIOG
+ nvicDisableVector(TIVA_GPIOG_NUMBER);
+#endif
+#if TIVA_HAS_GPIOH
+ nvicDisableVector(TIVA_GPIOH_NUMBER);
+#endif
+#if TIVA_HAS_GPIOJ
+ nvicDisableVector(TIVA_GPIOJ_NUMBER);
+#endif
+#if TIVA_HAS_GPIOK
+ nvicDisableVector(TIVA_GPIOK_NUMBER);
+#endif
+#if TIVA_HAS_GPIOL
+ nvicDisableVector(TIVA_GPIOL_NUMBER);
+#endif
+#if TIVA_HAS_GPIOM
+ nvicDisableVector(TIVA_GPIOM_NUMBER);
+#endif
+#if TIVA_HAS_GPION
+ nvicDisableVector(TIVA_GPION_NUMBER);
+#endif
+#if TIVA_HAS_GPIOP
+ nvicDisableVector(TIVA_GPIOP0_NUMBER);
+ nvicDisableVector(TIVA_GPIOP1_NUMBER);
+ nvicDisableVector(TIVA_GPIOP2_NUMBER);
+ nvicDisableVector(TIVA_GPIOP3_NUMBER);
+ nvicDisableVector(TIVA_GPIOP4_NUMBER);
+ nvicDisableVector(TIVA_GPIOP5_NUMBER);
+ nvicDisableVector(TIVA_GPIOP6_NUMBER);
+ nvicDisableVector(TIVA_GPIOP7_NUMBER);
+#endif
+#if TIVA_HAS_GPIOQ
+ nvicDisableVector(TIVA_GPIOQ0_NUMBER);
+ nvicDisableVector(TIVA_GPIOQ1_NUMBER);
+ nvicDisableVector(TIVA_GPIOQ2_NUMBER);
+ nvicDisableVector(TIVA_GPIOQ3_NUMBER);
+ nvicDisableVector(TIVA_GPIOQ4_NUMBER);
+ nvicDisableVector(TIVA_GPIOQ5_NUMBER);
+ nvicDisableVector(TIVA_GPIOQ6_NUMBER);
+ nvicDisableVector(TIVA_GPIOQ7_NUMBER);
+#endif
+#if TIVA_HAS_GPIOR
+ nvicDisableVector(TIVA_GPIOR_NUMBER);
+#endif
+#if TIVA_HAS_GPIOS
+ nvicDisableVector(TIVA_GPIOS_NUMBER);
+#endif
+#if TIVA_HAS_GPIOT
+ nvicDisableVector(TIVA_GPIOT_NUMBER);
+#endif
+}
+#endif /* PAL_USE_CALLBACKS || PAL_USE_WAIT */
+
#endif /* HAL_USE_PAL */
/**
diff --git a/os/hal/ports/TIVA/LLD/GPIO/hal_pal_lld.h b/os/hal/ports/TIVA/LLD/GPIO/hal_pal_lld.h
index cf14bfb..e884a92 100644
--- a/os/hal/ports/TIVA/LLD/GPIO/hal_pal_lld.h
+++ b/os/hal/ports/TIVA/LLD/GPIO/hal_pal_lld.h
@@ -329,157 +329,267 @@ typedef uint32_t iomode_t;
typedef uint32_t ioline_t;
/**
+ * @brief Type of an event mode.
+ */
+typedef uint32_t ioeventmode_t;
+
+/**
* @brief Port Identifier.
*/
typedef uint32_t ioportid_t;
+/**
+ * @brief Type of an pad identifier.
+ */
+typedef uint32_t iopadid_t;
+
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
-#if defined(TM4C123x)
+/**
+ * @name Configuration options
+ * @{
+ */
+/**
+ * @brief GPIOA interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOA_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOA_IRQ_PRIORITY 3
+#endif
/**
- * @brief GPIOA AHB enable switch.
- * @details When set to @p TRUE the AHB bus is used to access GPIOA. When set
- * to @p FALSE the APB bus is used to access GPIOA.
+ * @brief GPIOB interrupt priority level setting.
*/
-#if !defined(TIVA_GPIO_GPIOA_USE_AHB) || defined(__DOXYGEN__)
-#define TIVA_GPIO_GPIOA_USE_AHB TRUE
+#if !defined(TIVA_PAL_GPIOB_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOB_IRQ_PRIORITY 3
#endif
/**
- * @brief GPIOB AHB enable switch.
- * @details When set to @p TRUE the AHB bus is used to access GPIOB. When set
- * to @p FALSE the APB bus is used to access GPIOB.
+ * @brief GPIOC interrupt priority level setting.
*/
-#if !defined(TIVA_GPIO_GPIOB_USE_AHB) || defined(__DOXYGEN__)
-#define TIVA_GPIO_GPIOB_USE_AHB TRUE
+#if !defined(TIVA_PAL_GPIOC_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOC_IRQ_PRIORITY 3
#endif
/**
- * @brief GPIOC AHB enable switch.
- * @details When set to @p TRUE the AHB bus is used to access GPIOC. When set
- * to @p FALSE the APB bus is used to access GPIOC.
+ * @brief GPIOD interrupt priority level setting.
*/
-#if !defined(TIVA_GPIO_GPIOC_USE_AHB) || defined(__DOXYGEN__)
-#define TIVA_GPIO_GPIOC_USE_AHB TRUE
+#if !defined(TIVA_PAL_GPIOD_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOD_IRQ_PRIORITY 3
#endif
/**
- * @brief GPIOD AHB enable switch.
- * @details When set to @p TRUE the AHB bus is used to access GPIOD. When set
- * to @p FALSE the APB bus is used to access GPIOD.
+ * @brief GPIOE interrupt priority level setting.
*/
-#if !defined(TIVA_GPIO_GPIOD_USE_AHB) || defined(__DOXYGEN__)
-#define TIVA_GPIO_GPIOD_USE_AHB TRUE
+#if !defined(TIVA_PAL_GPIOE_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOE_IRQ_PRIORITY 3
#endif
/**
- * @brief GPIOE AHB enable switch.
- * @details When set to @p TRUE the AHB bus is used to access GPIOE. When set
- * to @p FALSE the APB bus is used to access GPIOE.
+ * @brief GPIOF interrupt priority level setting.
*/
-#if !defined(TIVA_GPIO_GPIOE_USE_AHB) || defined(__DOXYGEN__)
-#define TIVA_GPIO_GPIOE_USE_AHB TRUE
+#if !defined(TIVA_PAL_GPIOF_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOF_IRQ_PRIORITY 3
#endif
/**
- * @brief GPIOF AHB enable switch.
- * @details When set to @p TRUE the AHB bus is used to access GPIOF. When set
- * to @p FALSE the APB bus is used to access GPIOF.
+ * @brief GPIOG interrupt priority level setting.
*/
-#if !defined(TIVA_GPIO_GPIOF_USE_AHB) || defined(__DOXYGEN__)
-#define TIVA_GPIO_GPIOF_USE_AHB TRUE
+#if !defined(TIVA_PAL_GPIOG_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOG_IRQ_PRIORITY 3
#endif
/**
- * @brief GPIOG AHB enable switch.
- * @details When set to @p TRUE the AHB bus is used to access GPIOG. When set
- * to @p FALSE the APB bus is used to access GPIOG.
+ * @brief GPIOH interrupt priority level setting.
*/
-#if !defined(TIVA_GPIO_GPIOG_USE_AHB) || defined(__DOXYGEN__)
-#define TIVA_GPIO_GPIOG_USE_AHB TRUE
+#if !defined(TIVA_PAL_GPIOH_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOH_IRQ_PRIORITY 3
#endif
/**
- * @brief GPIOH AHB enable switch.
- * @details When set to @p TRUE the AHB bus is used to access GPIOH. When set
- * to @p FALSE the APB bus is used to access GPIOH.
+ * @brief GPIOJ interrupt priority level setting.
*/
-#if !defined(TIVA_GPIO_GPIOH_USE_AHB) || defined(__DOXYGEN__)
-#define TIVA_GPIO_GPIOH_USE_AHB TRUE
+#if !defined(TIVA_PAL_GPIOJ_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOJ_IRQ_PRIORITY 3
#endif
/**
- * @brief GPIOJ AHB enable switch.
- * @details When set to @p TRUE the AHB bus is used to access GPIOJ. When set
- * to @p FALSE the APB bus is used to access GPIOJ.
+ * @brief GPIOK interrupt priority level setting.
*/
-#if !defined(TIVA_GPIO_GPIOJ_USE_AHB) || defined(__DOXYGEN__)
-#define TIVA_GPIO_GPIOJ_USE_AHB TRUE
+#if !defined(TIVA_PAL_GPIOK_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOK_IRQ_PRIORITY 3
#endif
+/**
+ * @brief GPIOL interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOL_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOL_IRQ_PRIORITY 3
#endif
-/*===========================================================================*/
-/* Derived constants and error checks. */
-/*===========================================================================*/
+/**
+ * @brief GPIOM interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOM_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOM_IRQ_PRIORITY 3
+#endif
-#if TIVA_GPIO_GPIOA_USE_AHB && defined(TM4C123x)
-#define GPIOA GPIO_PORTA_AHB_BASE
-#else
-#define GPIOA GPIO_PORTA_BASE
+/**
+ * @brief GPION interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPION_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPION_IRQ_PRIORITY 3
#endif
-#if TIVA_GPIO_GPIOB_USE_AHB && defined(TM4C123x)
-#define GPIOB GPIO_PORTB_AHB_BASE
-#else
-#define GPIOB GPIO_PORTB_BASE
+/**
+ * @brief GPIOP0 interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOP0_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOP0_IRQ_PRIORITY 3
#endif
-#if TIVA_GPIO_GPIOC_USE_AHB && defined(TM4C123x)
-#define GPIOC GPIO_PORTC_AHB_BASE
-#else
-#define GPIOC GPIO_PORTC_BASE
+/**
+ * @brief GPIOP1 interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOP1_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOP1_IRQ_PRIORITY 3
#endif
-#if TIVA_GPIO_GPIOD_USE_AHB && defined(TM4C123x)
-#define GPIOD GPIO_PORTD_AHB_BASE
-#else
-#define GPIOD GPIO_PORTD_BASE
+/**
+ * @brief GPIOP2 interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOP2_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOP2_IRQ_PRIORITY 3
#endif
-#if TIVA_GPIO_GPIOE_USE_AHB && defined(TM4C123x)
-#define GPIOE GPIO_PORTE_AHB_BASE
-#else
-#define GPIOE GPIO_PORTE_BASE
+/**
+ * @brief GPIOP3 interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOP3_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOP3_IRQ_PRIORITY 3
#endif
-#if TIVA_GPIO_GPIOF_USE_AHB && defined(TM4C123x)
-#define GPIOF GPIO_PORTF_AHB_BASE
-#else
-#define GPIOF GPIO_PORTF_BASE
+/**
+ * @brief GPIOP4 interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOP4_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOP4_IRQ_PRIORITY 3
#endif
-#if TIVA_GPIO_GPIOG_USE_AHB && defined(TM4C123x)
-#define GPIOG GPIO_PORTG_AHB_BASE
-#else
-#define GPIOG GPIO_PORTG_BASE
+/**
+ * @brief GPIOP5 interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOP5_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOP5_IRQ_PRIORITY 3
#endif
-#if TIVA_GPIO_GPIOH_USE_AHB && defined(TM4C123x)
-#define GPIOH GPIO_PORTH_AHB_BASE
-#else
-#define GPIOH GPIO_PORTH_BASE
+/**
+ * @brief GPIOP6 interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOP6_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOP6_IRQ_PRIORITY 3
#endif
-#if TIVA_GPIO_GPIOJ_USE_AHB && defined(TM4C123x)
-#define GPIOJ GPIO_PORTJ_AHB_BASE
-#else
-#define GPIOJ GPIO_PORTJ_BASE
+/**
+ * @brief GPIOP7 interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOP7_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOP7_IRQ_PRIORITY 3
#endif
+/** @} */
+/**
+ * @brief GPIOQ0 interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOQ0_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOQ0_IRQ_PRIORITY 3
+#endif
+
+/**
+ * @brief GPIOQ1 interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOQ1_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOQ1_IRQ_PRIORITY 3
+#endif
+
+/**
+ * @brief GPIOQ2 interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOQ2_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOQ2_IRQ_PRIORITY 3
+#endif
+
+/**
+ * @brief GPIOQ3 interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOQ3_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOQ3_IRQ_PRIORITY 3
+#endif
+
+/**
+ * @brief GPIOQ4 interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOQ4_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOQ4_IRQ_PRIORITY 3
+#endif
+
+/**
+ * @brief GPIOQ5 interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOQ5_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOQ5_IRQ_PRIORITY 3
+#endif
+
+/**
+ * @brief GPIOQ6 interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOQ6_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOQ6_IRQ_PRIORITY 3
+#endif
+
+/**
+ * @brief GPIOQ7 interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOQ7_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOQ7_IRQ_PRIORITY 3
+#endif
+
+/**
+ * @brief GPIOR interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOR_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOR_IRQ_PRIORITY 3
+#endif
+
+/**
+ * @brief GPIOS interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOS_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOS_IRQ_PRIORITY 3
+#endif
+
+/**
+ * @brief GPIOT interrupt priority level setting.
+ */
+#if !defined(TIVA_PAL_GPIOT_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_PAL_GPIOT_IRQ_PRIORITY 3
+#endif
+/** @} */
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+#define GPIOA GPIO_PORTA_AHB_BASE
+#define GPIOB GPIO_PORTB_AHB_BASE
+#define GPIOC GPIO_PORTC_AHB_BASE
+#define GPIOD GPIO_PORTD_AHB_BASE
+#define GPIOE GPIO_PORTE_AHB_BASE
+#define GPIOF GPIO_PORTF_AHB_BASE
+#define GPIOG GPIO_PORTG_AHB_BASE
+#define GPIOH GPIO_PORTH_AHB_BASE
+#define GPIOJ GPIO_PORTJ_AHB_BASE
#define GPIOK GPIO_PORTK_BASE
#define GPIOL GPIO_PORTL_BASE
#define GPIOM GPIO_PORTM_BASE
@@ -490,6 +600,166 @@ typedef uint32_t ioportid_t;
#define GPIOS GPIO_PORTS_BASE
#define GPIOT GPIO_PORTT_BASE
+#if TIVA_HAS_GPIOA && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOA_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOA"
+#endif
+
+#if TIVA_HAS_GPIOB && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOB_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOB"
+#endif
+
+#if TIVA_HAS_GPIOC && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOC_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOC"
+#endif
+
+#if TIVA_HAS_GPIOD && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOD_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOD"
+#endif
+
+#if TIVA_HAS_GPIOE && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOE_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOE"
+#endif
+
+#if TIVA_HAS_GPIOF && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOF_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOF"
+#endif
+
+#if TIVA_HAS_GPIOG && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOG_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOG"
+#endif
+
+#if TIVA_HAS_GPIOH && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOH_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOH"
+#endif
+
+#if TIVA_HAS_GPIOJ && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOJ_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOJ"
+#endif
+
+#if TIVA_HAS_GPIOK && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOK_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOK"
+#endif
+
+#if TIVA_HAS_GPIOL && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOL_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOL"
+#endif
+
+#if TIVA_HAS_GPIOM && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOM_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOM"
+#endif
+
+#if TIVA_HAS_GPION && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPION_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPION"
+#endif
+
+#if TIVA_HAS_GPIOP && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOP0_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOP0"
+#endif
+
+#if TIVA_HAS_GPIOP && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOP1_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOP1"
+#endif
+
+#if TIVA_HAS_GPIOP && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOP2_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOP2"
+#endif
+
+#if TIVA_HAS_GPIOP && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOP3_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOP3"
+#endif
+
+#if TIVA_HAS_GPIOP && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOP4_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOP4"
+#endif
+
+#if TIVA_HAS_GPIOP && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOP5_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOP5"
+#endif
+
+#if TIVA_HAS_GPIOP && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOP6_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOP6"
+#endif
+
+#if TIVA_HAS_GPIOP && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOP7_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOP7"
+#endif
+
+#if TIVA_HAS_GPIOQ && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOQ0_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOQ0"
+#endif
+
+#if TIVA_HAS_GPIOQ && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOQ1_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOQ1"
+#endif
+
+#if TIVA_HAS_GPIOQ && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOQ2_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOQ2"
+#endif
+
+#if TIVA_HAS_GPIOQ && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOQ3_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOQ3"
+#endif
+
+#if TIVA_HAS_GPIOQ && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOQ4_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOQ4"
+#endif
+
+#if TIVA_HAS_GPIOQ && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOQ5_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOQ5"
+#endif
+
+#if TIVA_HAS_GPIOQ && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOQ6_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOQ6"
+#endif
+
+#if TIVA_HAS_GPIOQ && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOQ7_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOQ7"
+#endif
+
+#if TIVA_HAS_GPIOR && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOR_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOR"
+#endif
+
+#if TIVA_HAS_GPIOS && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOS_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOS"
+#endif
+
+#if TIVA_HAS_GPIOT && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_PAL_GPIOT_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to GPIOT"
+#endif
+
/*===========================================================================*/
/* I/O Ports Identifiers. */
/*===========================================================================*/
@@ -761,7 +1031,7 @@ typedef uint32_t ioportid_t;
* @notapi
*/
#define pal_lld_writepad(port, pad, bit) \
- (HWREG((port) + (GPIO_O_DATA + ((1 << (pad)) << 2))) = (bit))
+ (HWREG((port) + (GPIO_O_DATA + ((1 << (pad)) << 2))) = 1 << (bit))
/**
* @brief Sets a pad logical state to @p PAL_HIGH.
@@ -791,12 +1061,59 @@ typedef uint32_t ioportid_t;
#define pal_lld_clearpad(port, pad) \
(HWREG((port) + (GPIO_O_DATA + ((1 << (pad)) << 2))) = 0)
+/**
+ * @brief Pad event enable.
+ * @note Programming an unknown or unsupported mode is silently ignored.
+ *
+ * @param[in] port port identifier
+ * @param[in] pad pad number within the port
+ * @param[in] mode pad event mode
+ *
+ * @notapi
+ */
+#define pal_lld_enablepadevent(port, pad, mode) \
+ _pal_lld_enablepadevent(port, pad, mode)
+
+/**
+ * @brief Pad event disable.
+ * @details This function disables previously programmed event callbacks.
+ *
+ * @param[in] port port identifier
+ * @param[in] pad pad number within the port
+ *
+ * @notapi
+ */
+#define pal_lld_disablepadevent(port, pad) \
+ _pal_lld_disablepadevent(port, pad)
+
+/**
+ * @brief Returns a PAL event structure associated to a pad.
+ *
+ * @param[in] port port identifier
+ * @param[in] pad pad number within the port
+ *
+ * @notapi
+ */
+#define pal_lld_get_pad_event(port, pad) \
+ &_pal_events[((((((uint32_t)port - (uint32_t)GPIOA) >> 12) & 0x1FU) * 8) + pad)];
+
+/**
+ * @brief Returns a PAL event structure associated to a line.
+ *
+ * @param[in] line line identifier
+ *
+ * @notapi
+ */
+#define pal_lld_get_line_event(line) \
+ &_pal_events[((((((uint32_t)PAL_PORT(line) - (uint32_t)GPIOA) >> 12) & 0x1FU) * 8) + PAL_PAD(line))]
+
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
#if !defined(__DOXYGEN__)
extern const PALConfig pal_default_config;
+extern palevent_t _pal_events[TIVA_GPIO_PINS];
#endif
#ifdef __cplusplus
@@ -806,6 +1123,13 @@ extern "C" {
void _pal_lld_setgroupmode(ioportid_t port,
ioportmask_t mask,
iomode_t mode);
+#if PAL_USE_CALLBACKS || PAL_USE_WAIT
+ void _pal_lld_enablepadevent(ioportid_t port,
+ iopadid_t pad,
+ ioeventmode_t mode);
+ void _pal_lld_disablepadevent(ioportid_t port, iopadid_t pad);
+ void pal_lld_disable_irqs(void);
+#endif
#ifdef __cplusplus
}
#endif
diff --git a/os/hal/ports/TIVA/LLD/GPTM/hal_st_lld.c b/os/hal/ports/TIVA/LLD/GPTM/hal_st_lld.c
index baa7112..0f9576a 100644
--- a/os/hal/ports/TIVA/LLD/GPTM/hal_st_lld.c
+++ b/os/hal/ports/TIVA/LLD/GPTM/hal_st_lld.c
@@ -37,32 +37,32 @@
#if TIVA_ST_TIMER_NUMBER == 0
#define ST_HANDLER TIVA_WGPT0A_HANDLER
#define ST_NUMBER TIVA_WGPT0A_NUMBER
-#define ST_ENABLE_CLOCK() (SYSCTL->RCGCWTIMER |= (1 << 0))
-#define ST_WAIT_CLOCK() while (!(SYSCTL->PRWTIMER & (1 << 0)))
+#define ST_ENABLE_CLOCK() (HWREG(SYSCTL_RCGCWTIMER) |= (1 << 0))
+#define ST_WAIT_CLOCK() while (!(HWREG(SYSCTL_PRWTIMER) & (1 << 0)))
#elif TIVA_ST_TIMER_NUMBER == 1
#define ST_HANDLER TIVA_WGPT1A_HANDLER
#define ST_NUMBER TIVA_WGPT1A_NUMBER
-#define ST_ENABLE_CLOCK() (SYSCTL->RCGCWTIMER |= (1 << 1))
-#define ST_WAIT_CLOCK() while (!(SYSCTL->PRWTIMER & (1 << 1)))
+#define ST_ENABLE_CLOCK() (HWREG(SYSCTL_RCGCWTIMER) |= (1 << 1))
+#define ST_WAIT_CLOCK() while (!(HWREG(SYSCTL_PRWTIMER) & (1 << 1)))
#elif TIVA_ST_TIMER_NUMBER == 2
#define ST_HANDLER TIVA_WGPT2A_HANDLER
#define ST_NUMBER TIVA_WGPT2A_NUMBER
-#define ST_ENABLE_CLOCK() (SYSCTL->RCGCWTIMER |= (1 << 2))
-#define ST_WAIT_CLOCK() while (!(SYSCTL->PRWTIMER & (1 << 2)))
+#define ST_ENABLE_CLOCK() (HWREG(SYSCTL_RCGCWTIMER) |= (1 << 2))
+#define ST_WAIT_CLOCK() while (!(HWREG(SYSCTL_PRWTIMER) & (1 << 2)))
#elif TIVA_ST_TIMER_NUMBER == 3
#define ST_HANDLER TIVA_WGPT3A_HANDLER
#define ST_NUMBER TIVA_WGPT3A_NUMBER
-#define ST_ENABLE_CLOCK() (SYSCTL->RCGCWTIMER |= (1 << 3))
-#define ST_WAIT_CLOCK() while (!(SYSCTL->PRWTIMER & (1 << 3)))
+#define ST_ENABLE_CLOCK() (HWREG(SYSCTL_RCGCWTIMER) |= (1 << 3))
+#define ST_WAIT_CLOCK() while (!(HWREG(SYSCTL_PRWTIMER) & (1 << 3)))
#elif TIVA_ST_TIMER_NUMBER == 4
#define ST_HANDLER TIVA_WGPT4A_HANDLER
#define ST_NUMBER TIVA_WGPT4A_NUMBER
-#define ST_ENABLE_CLOCK() (SYSCTL->RCGCWTIMER |= (1 << 4))
-#define ST_WAIT_CLOCK() while (!(SYSCTL->PRWTIMER & (1 << 4)))
+#define ST_ENABLE_CLOCK() (HWREG(SYSCTL_RCGCWTIMER) |= (1 << 4))
+#define ST_WAIT_CLOCK() while (!(HWREG(SYSCTL_PRWTIMER) & (1 << 4)))
#elif TIVA_ST_TIMER_NUMBER == 5
#define ST_HANDLER TIVA_WGPT5A_HANDLER
@@ -74,7 +74,7 @@
#error "TIVA_ST_USE_TIMER specifies an unsupported timer"
#endif
-#if (ST_CLOCK_SRC / OSAL_ST_FREQUENCY) - 1 > 0xFFFF
+#if (TIVA_SYSCLK / OSAL_ST_FREQUENCY) - 1 > 0xFFFF
#error "the selected ST frequency is not obtainable because TIM timer prescaler limits"
#endif
@@ -83,38 +83,38 @@
#if TIVA_ST_TIMER_NUMBER == 0
#define ST_HANDLER TIVA_GPT0A_HANDLER
#define ST_NUMBER TIVA_GPT0A_NUMBER
-#define ST_ENABLE_CLOCK() (SYSCTL->RCGCTIMER |= (1 << 0))
-#define ST_WAIT_CLOCK() while (!(SYSCTL->PRTIMER & (1 << 0)))
+#define ST_ENABLE_CLOCK() (HWREG(SYSCTL_RCGCTIMER) |= (1 << 0))
+#define ST_WAIT_CLOCK() while (!(HWREG(SYSCTL_PRTIMER) & (1 << 0)))
#elif TIVA_ST_TIMER_NUMBER == 1
#define ST_HANDLER TIVA_GPT1A_HANDLER
#define ST_NUMBER TIVA_GPT1A_NUMBER
-#define ST_ENABLE_CLOCK() (SYSCTL->RCGCTIMER |= (1 << 1))
-#define ST_WAIT_CLOCK() while (!(SYSCTL->PRTIMER & (1 << 1)))
+#define ST_ENABLE_CLOCK() (HWREG(SYSCTL_RCGCTIMER) |= (1 << 1))
+#define ST_WAIT_CLOCK() while (!(HWREG(SYSCTL_PRTIMER) & (1 << 1)))
#elif TIVA_ST_TIMER_NUMBER == 2
#define ST_HANDLER TIVA_GPT2A_HANDLER
#define ST_NUMBER TIVA_GPT2A_NUMBER
-#define ST_ENABLE_CLOCK() (SYSCTL->RCGCTIMER |= (1 << 2))
-#define ST_WAIT_CLOCK() while (!(SYSCTL->PRTIMER & (1 << 2)))
+#define ST_ENABLE_CLOCK() (HWREG(SYSCTL_RCGCTIMER) |= (1 << 2))
+#define ST_WAIT_CLOCK() while (!(HWREG(SYSCTL_PRTIMER) & (1 << 2)))
#elif TIVA_ST_TIMER_NUMBER == 3
#define ST_HANDLER TIVA_GPT3A_HANDLER
#define ST_NUMBER TIVA_GPT3A_NUMBER
-#define ST_ENABLE_CLOCK() (SYSCTL->RCGCTIMER |= (1 << 3))
-#define ST_WAIT_CLOCK() while (!(SYSCTL->PRTIMER & (1 << 3)))
+#define ST_ENABLE_CLOCK() (HWREG(SYSCTL_RCGCTIMER) |= (1 << 3))
+#define ST_WAIT_CLOCK() while (!(HWREG(SYSCTL_PRTIMER) & (1 << 3)))
#elif TIVA_ST_TIMER_NUMBER == 4
#define ST_HANDLER TIVA_GPT4A_HANDLER
#define ST_NUMBER TIVA_GPT4A_NUMBER
-#define ST_ENABLE_CLOCK() (SYSCTL->RCGCTIMER |= (1 << 4))
-#define ST_WAIT_CLOCK() while (!(SYSCTL->PRTIMER & (1 << 4)))
+#define ST_ENABLE_CLOCK() (HWREG(SYSCTL_RCGCTIMER) |= (1 << 4))
+#define ST_WAIT_CLOCK() while (!(HWREG(SYSCTL_PRTIMER) & (1 << 4)))
#elif TIVA_ST_TIMER_NUMBER == 5
#define ST_HANDLER TIVA_GPT5A_HANDLER
#define ST_NUMBER TIVA_GPT5A_NUMBER
-#define ST_ENABLE_CLOCK() (SYSCTL->RCGCTIMER |= (1 << 5))
-#define ST_WAIT_CLOCK() while (!(SYSCTL->PRTIMER & (1 << 5)))
+#define ST_ENABLE_CLOCK() (HWREG(SYSCTL_RCGCTIMER) |= (1 << 5))
+#define ST_WAIT_CLOCK() while (!(HWREG(SYSCTL_PRTIMER) & (1 << 5)))
#else
#error "TIVA_ST_USE_TIMER specifies an unsupported timer"
diff --git a/os/hal/ports/TIVA/LLD/I2C/hal_i2c_lld.c b/os/hal/ports/TIVA/LLD/I2C/hal_i2c_lld.c
index fd7395f..7ba7bad 100644
--- a/os/hal/ports/TIVA/LLD/I2C/hal_i2c_lld.c
+++ b/os/hal/ports/TIVA/LLD/I2C/hal_i2c_lld.c
@@ -778,7 +778,7 @@ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr,
/* Calculating the time window for the timeout on the busy bus condition.*/
start = osalOsGetSystemTimeX();
- end = start + OSAL_MS2ST(TIVA_I2C_BUSY_TIMEOUT);
+ end = start + OSAL_MS2I(TIVA_I2C_BUSY_TIMEOUT);
/* Waits until BUSY flag is reset or, alternatively, for a timeout
condition.*/
@@ -792,7 +792,7 @@ msg_t i2c_lld_master_receive_timeout(I2CDriver *i2cp, i2caddr_t addr,
/* If the system time went outside the allowed window then a timeout
condition is returned.*/
- if (!osalOsIsTimeWithinX(osalOsGetSystemTimeX(), start, end))
+ if (!osalTimeIsInRangeX(osalOsGetSystemTimeX(), start, end))
return MSG_TIMEOUT;
osalSysUnlock();
@@ -852,7 +852,7 @@ msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr,
/* Calculating the time window for the timeout on the busy bus condition.*/
start = osalOsGetSystemTimeX();
- end = start + OSAL_MS2ST(TIVA_I2C_BUSY_TIMEOUT);
+ end = start + OSAL_MS2I(TIVA_I2C_BUSY_TIMEOUT);
/* Waits until BUSY flag is reset or, alternatively, for a timeout
condition.*/
@@ -866,7 +866,8 @@ msg_t i2c_lld_master_transmit_timeout(I2CDriver *i2cp, i2caddr_t addr,
/* If the system time went outside the allowed window then a timeout
condition is returned.*/
- if (!osalOsIsTimeWithinX(osalOsGetSystemTimeX(), start, end))
+ if (!osalTimeIsInRangeX(osalOsGetSystemTimeX(), start, end))
+
return MSG_TIMEOUT;
osalSysUnlock();
diff --git a/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.c b/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.c
index 126959f..2255110 100644
--- a/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.c
+++ b/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.c
@@ -258,7 +258,7 @@ void spi_lld_start(SPIDriver *spip)
nvicEnableVector(TIVA_SSI1_NUMBER, TIVA_SPI_SSI1_IRQ_PRIORITY);
}
#endif
-#if TIVASPI_USE_SSI2
+#if TIVA_SPI_USE_SSI2
if (&SPID2 == spip) {
bool b;
b = udmaChannelAllocate(spip->dmarxnr);
diff --git a/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.h b/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.h
index 4dcf6db..c93c189 100644
--- a/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.h
+++ b/os/hal/ports/TIVA/LLD/SSI/hal_spi_lld.h
@@ -156,7 +156,7 @@
#error "Invalid IRQ priority assigned to SSI2"
#endif
-#if TM4C123x_SPI_USE_SSI3 && \
+#if TIVA_SPI_USE_SSI3 && \
!OSAL_IRQ_IS_VALID_PRIORITY(TIVA_SPI_SSI3_IRQ_PRIORITY)
#error "Invalid IRQ priority assigned to SSI3"
#endif
diff --git a/os/hal/ports/TIVA/LLD/UART/driver.mk b/os/hal/ports/TIVA/LLD/UART/driver.mk
index e23dc82..e42f34a 100644
--- a/os/hal/ports/TIVA/LLD/UART/driver.mk
+++ b/os/hal/ports/TIVA/LLD/UART/driver.mk
@@ -2,8 +2,12 @@ ifeq ($(USE_SMART_BUILD),yes)
ifneq ($(findstring HAL_USE_SERIAL TRUE,$(HALCONF)),)
PLATFORMSRC += $(CHIBIOS_CONTRIB)/os/hal/ports/TIVA/LLD/UART/hal_serial_lld.c
endif
+ifneq ($(findstring HAL_USE_UART TRUE,$(HALCONF)),)
+PLATFORMSRC += $(CHIBIOS_CONTRIB)/os/hal/ports/TIVA/LLD/UART/hal_uart_lld.c
+endif
else
PLATFORMSRC += $(CHIBIOS_CONTRIB)/os/hal/ports/TIVA/LLD/UART/hal_serial_lld.c
+PLATFORMSRC += $(CHIBIOS_CONTRIB)/os/hal/ports/TIVA/LLD/UART/hal_uart_lld.c
endif
PLATFORMINC += $(CHIBIOS_CONTRIB)/os/hal/ports/TIVA/LLD/UART
diff --git a/os/hal/ports/TIVA/LLD/UART/hal_uart_lld.c b/os/hal/ports/TIVA/LLD/UART/hal_uart_lld.c
new file mode 100644
index 0000000..374ea6d
--- /dev/null
+++ b/os/hal/ports/TIVA/LLD/UART/hal_uart_lld.c
@@ -0,0 +1,826 @@
+/*
+ Copyright (C) 2014..2017 Marco Veeneman
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/**
+ * @file UART/hal_uart_lld.c
+ * @brief Tiva low level UART driver code.
+ *
+ * @addtogroup UART
+ * @{
+ */
+
+#include "hal.h"
+
+#if HAL_USE_UART || defined(__DOXYGEN__)
+
+/*===========================================================================*/
+/* Driver local definitions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver exported variables. */
+/*===========================================================================*/
+
+/** @brief UART0 UART driver identifier.*/
+#if TIVA_UART_USE_UART0 || defined(__DOXYGEN__)
+UARTDriver UARTD1;
+#endif
+
+/** @brief UART1 UART driver identifier.*/
+#if TIVA_UART_USE_UART1 || defined(__DOXYGEN__)
+UARTDriver UARTD2;
+#endif
+
+/** @brief UART2 UART driver identifier.*/
+#if TIVA_UART_USE_UART2 || defined(__DOXYGEN__)
+UARTDriver UARTD3;
+#endif
+
+/** @brief UART3 UART driver identifier.*/
+#if TIVA_UART_USE_UART3 || defined(__DOXYGEN__)
+UARTDriver UARTD4;
+#endif
+
+/** @brief UART4 UART driver identifier.*/
+#if TIVA_UART_USE_UART4 || defined(__DOXYGEN__)
+UARTDriver UARTD5;
+#endif
+
+/** @brief UART5 UART driver identifier.*/
+#if TIVA_UART_USE_UART5 || defined(__DOXYGEN__)
+UARTDriver UARTD6;
+#endif
+
+/** @brief UART6 UART driver identifier.*/
+#if TIVA_UART_USE_UART6 || defined(__DOXYGEN__)
+UARTDriver UARTD7;
+#endif
+
+/** @brief UART7 UART driver identifier.*/
+#if TIVA_UART_USE_UART7 || defined(__DOXYGEN__)
+UARTDriver UARTD8;
+#endif
+
+/*===========================================================================*/
+/* Driver local variables and types. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver local functions. */
+/*===========================================================================*/
+
+/**
+ * @brief Status bits translation.
+ *
+ * @param[in] err UART LSR register value
+ *
+ * @return The error flags.
+ */
+static uartflags_t translate_errors(uint32_t err)
+{
+ uartflags_t sts = 0;
+
+ if (err & UART_MIS_FEMIS)
+ sts |= UART_FRAMING_ERROR;
+ if (err & UART_MIS_PEMIS)
+ sts |= UART_PARITY_ERROR;
+ if (err & UART_MIS_BEMIS)
+ sts |= UART_BREAK_DETECTED;
+ if (err & UART_MIS_OEMIS)
+ sts |= UART_OVERRUN_ERROR;
+
+ return sts;
+}
+
+/**
+ * @brief Puts the receiver in the UART_RX_IDLE state.
+ *
+ * @param[in] uartp pointer to the @p UARTDriver object
+ */
+static void uart_enter_rx_idle_loop(UARTDriver *uartp)
+{
+ tiva_udma_table_entry_t *primary = udmaControlTable.primary;
+
+ dmaChannelDisable(uartp->dmarxnr);
+
+ /* Configure for 8-bit transfers.*/
+ primary[uartp->dmarxnr].srcendp = (void *)(uartp->uart + UART_O_DR);
+ primary[uartp->dmarxnr].dstendp = (volatile void *)&uartp->rxbuf;
+ primary[uartp->dmarxnr].chctl = UDMA_CHCTL_DSTSIZE_8 | UDMA_CHCTL_DSTINC_8 |
+ UDMA_CHCTL_SRCSIZE_8 | UDMA_CHCTL_SRCINC_NONE |
+ UDMA_CHCTL_ARBSIZE_4 |
+ UDMA_CHCTL_XFERSIZE(1) |
+ UDMA_CHCTL_XFERMODE_BASIC;
+
+ dmaChannelSingleBurst(uartp->dmarxnr);
+ dmaChannelPrimary(uartp->dmarxnr);
+ dmaChannelPriorityDefault(uartp->dmarxnr);
+ dmaChannelEnableRequest(uartp->dmarxnr);
+
+ /* Enable DMA channel, transfer starts immediately.*/
+ dmaChannelEnable(uartp->dmarxnr);
+}
+
+/**
+ * @brief UART de-initialization.
+ *
+ * @param[in] uartp pointer to the @p UARTDriver object
+ */
+static void uart_stop(UARTDriver *uartp)
+{
+ /* Stops RX and TX DMA channels.*/
+ dmaChannelDisable(uartp->dmarxnr);
+ dmaChannelDisable(uartp->dmatxnr);
+
+ /* Stops USART operations.*/
+ HWREG(uartp->uart + UART_O_CTL) &= ~UART_CTL_UARTEN;
+}
+
+/**
+ * @brief UART initialization.
+ *
+ * @param[in] uartp pointer to a @p UARTDriver object
+ */
+static void uart_init(UARTDriver *uartp)
+{
+ uint32_t u = uartp->uart;
+ const UARTConfig *config = uartp->config;
+ uint32_t brd;
+ uint32_t speed = config->speed;
+ uint32_t clock_source;
+
+ if (uartp->config->ctl & UART_CTL_HSE) {
+ /* High speed mode is enabled, half the baud rate to compensate
+ * for high speed mode.*/
+ speed = (speed + 1) / 2;
+ }
+
+ if ((config->cc & UART_CC_CS_M) == UART_CC_CS_SYSCLK) {
+ /* UART is clocked using the SYSCLK.*/
+ clock_source = TIVA_SYSCLK * 8;
+ }
+ else {
+ /* UART is clocked using the PIOSC.*/
+ clock_source = 16000000 * 8;
+ }
+
+ /* Calculate the baud rate divisor */
+ brd = ((clock_source / speed) + 1) / 2;
+
+ /* Disable UART.*/
+ HWREG(u + UART_O_CTL) &= ~UART_CTL_UARTEN;
+
+ /* Set baud rate.*/
+ HWREG(u + UART_O_IBRD) = brd / 64;
+ HWREG(u + UART_O_FBRD) = brd % 64;
+
+ /* Line control/*/
+ HWREG(u + UART_O_LCRH) = config->lcrh;
+
+ /* Select clock source.*/
+ HWREG(u + UART_O_CC) = config->cc & UART_CC_CS_M;
+
+ /* FIFO configuration.*/
+ HWREG(u + UART_O_IFLS) = config->ifls & (UART_IFLS_RX_M | UART_IFLS_TX_M);
+
+ /* Enable interrupts.*/
+ HWREG(u + UART_O_IM) = UART_IM_TXIM | UART_IM_OEIM | UART_IM_BEIM | UART_IM_PEIM | UART_IM_FEIM;
+
+ /* Enable DMA for the UART */
+ HWREG(u + UART_O_DMACTL) = UART_DMACTL_TXDMAE | UART_DMACTL_RXDMAE | UART_DMACTL_DMAERR;
+
+ /* Note that some bits are enforced.*/
+ HWREG(u + UART_O_CTL) = config->ctl | UART_CTL_RXE | UART_CTL_TXE | UART_CTL_UARTEN | UART_CTL_EOT;
+
+ /* Starting the receiver idle loop.*/
+ uart_enter_rx_idle_loop(uartp);
+}
+
+/**
+ * @brief UART common service routine.
+ *
+ * @param[in] uartp pointer to the @p UARTDriver object
+ */
+static void uart_serve_interrupt(UARTDriver *uartp)
+{
+ uint32_t dmachis = HWREG(UDMA_CHIS);
+ uint32_t mis = HWREG(uartp->uart + UART_O_MIS);
+
+ if (mis & UART_MIS_TXMIS) {
+ /* End of transfer */
+ _uart_tx2_isr_code(uartp);
+ }
+
+ if (mis & (UART_MIS_OEMIS | UART_MIS_BEMIS | UART_MIS_PEMIS | UART_MIS_FEMIS)) {
+ /* Error occurred */
+ _uart_rx_error_isr_code(uartp, translate_errors(mis));
+ }
+
+ if (dmachis & (1 << uartp->dmarxnr)) {
+ if (uartp->rxstate == UART_RX_IDLE) {
+ /* Receiver in idle state, a callback is generated, if enabled, for each
+ received character and then the driver stays in the same state.*/
+ _uart_rx_idle_code(uartp);
+ uart_enter_rx_idle_loop(uartp);
+ }
+ else {
+ /* Receiver in active state, a callback is generated, if enabled, after
+ a completed transfer.*/
+ _uart_rx_complete_isr_code(uartp);
+ }
+ }
+
+ if (dmachis & (1 << uartp->dmatxnr)) {
+ /* A callback is generated, if enabled, after a completed transfer.*/
+ _uart_tx1_isr_code(uartp);
+ }
+}
+
+/*===========================================================================*/
+/* Driver interrupt handlers. */
+/*===========================================================================*/
+
+#if TIVA_UART_USE_UART0 || defined(__DOXYGEN__)
+#if !defined(TIVA_UART0_HANDLER)
+#error "TIVA_UART0_HANDLER not defined"
+#endif
+/**
+ * @brief UART0 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_UART0_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ uart_serve_interrupt(&UARTD1);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_UART_USE_UART1 || defined(__DOXYGEN__)
+#if !defined(TIVA_UART1_HANDLER)
+#error "TIVA_UART1_HANDLER not defined"
+#endif
+/**
+ * @brief UART1 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_UART1_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ uart_serve_interrupt(&UARTD2);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_UART_USE_UART2 || defined(__DOXYGEN__)
+#if !defined(TIVA_UART2_HANDLER)
+#error "TIVA_UART2_HANDLER not defined"
+#endif
+/**
+ * @brief UART2 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_UART2_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ uart_serve_interrupt(&UARTD3);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_UART_USE_UART3 || defined(__DOXYGEN__)
+#if !defined(TIVA_UART3_HANDLER)
+#error "TIVA_UART3_HANDLER not defined"
+#endif
+/**
+ * @brief UART3 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_UART3_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ uart_serve_interrupt(&UARTD4);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_UART_USE_UART4 || defined(__DOXYGEN__)
+#if !defined(TIVA_UART4_HANDLER)
+#error "TIVA_UART4_HANDLER not defined"
+#endif
+/**
+ * @brief UART4 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_UART4_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ uart_serve_interrupt(&UARTD5);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_UART_USE_UART5 || defined(__DOXYGEN__)
+#if !defined(TIVA_UART5_HANDLER)
+#error "TIVA_UART5_HANDLER not defined"
+#endif
+/**
+ * @brief UART5 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_UART5_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ uart_serve_interrupt(&UARTD6);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_UART_USE_UART6 || defined(__DOXYGEN__)
+#if !defined(TIVA_UART6_HANDLER)
+#error "TIVA_UART6_HANDLER not defined"
+#endif
+/**
+ * @brief UART6 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_UART6_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ uart_serve_interrupt(&UARTD7);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+#if TIVA_UART_USE_UART7 || defined(__DOXYGEN__)
+#if !defined(TIVA_UART7_HANDLER)
+#error "TIVA_UART7_HANDLER not defined"
+#endif
+/**
+ * @brief UART7 interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(TIVA_UART7_HANDLER)
+{
+ OSAL_IRQ_PROLOGUE();
+
+ uart_serve_interrupt(&UARTD8);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif
+
+/*===========================================================================*/
+/* Driver exported functions. */
+/*===========================================================================*/
+
+/**
+ * @brief Low level UART driver initialization.
+ *
+ * @notapi
+ */
+void uart_lld_init(void)
+{
+#if TIVA_UART_USE_UART0
+ uartObjectInit(&UARTD1);
+ UARTD1.uart = UART0_BASE;
+ UARTD1.dmarxnr = TIVA_UART_UART0_RX_UDMA_CHANNEL;
+ UARTD1.dmatxnr = TIVA_UART_UART0_TX_UDMA_CHANNEL;
+ UARTD1.rxchnmap = TIVA_UART_UART0_RX_UDMA_MAPPING;
+ UARTD1.txchnmap = TIVA_UART_UART0_TX_UDMA_MAPPING;
+#endif
+#if TIVA_UART_USE_UART1
+ uartObjectInit(&UARTD2);
+ UARTD2.uart = UART1_BASE;
+ UARTD2.dmarxnr = TIVA_UART_UART1_RX_UDMA_CHANNEL;
+ UARTD2.dmatxnr = TIVA_UART_UART1_TX_UDMA_CHANNEL;
+ UARTD2.rxchnmap = TIVA_UART_UART1_RX_UDMA_MAPPING;
+ UARTD2.txchnmap = TIVA_UART_UART1_TX_UDMA_MAPPING;
+#endif
+#if TIVA_UART_USE_UART2
+ uartObjectInit(&UARTD3);
+ UARTD2.uart = UART2_BASE;
+ UARTD2.dmarxnr = TIVA_UART_UART2_RX_UDMA_CHANNEL;
+ UARTD2.dmatxnr = TIVA_UART_UART2_TX_UDMA_CHANNEL;
+ UARTD2.rxchnmap = TIVA_UART_UART2_RX_UDMA_MAPPING;
+ UARTD2.txchnmap = TIVA_UART_UART2_TX_UDMA_MAPPING;
+#endif
+#if TIVA_UART_USE_UART3
+ uartObjectInit(&UARTD4);
+ UARTD4.uart = UART3_BASE;
+ UARTD4.dmarxnr = TIVA_UART_UART3_RX_UDMA_CHANNEL;
+ UARTD4.dmatxnr = TIVA_UART_UART3_TX_UDMA_CHANNEL;
+ UARTD4.rxchnmap = TIVA_UART_UART3_RX_UDMA_MAPPING;
+ UARTD4.txchnmap = TIVA_UART_UART3_TX_UDMA_MAPPING;
+#endif
+#if TIVA_UART_USE_UART4
+ uartObjectInit(&UARTD5);
+ UARTD5.uart = UART4_BASE;
+ UARTD5.dmarxnr = TIVA_UART_UART4_RX_UDMA_CHANNEL;
+ UARTD5.dmatxnr = TIVA_UART_UART4_TX_UDMA_CHANNEL;
+ UARTD5.rxchnmap = TIVA_UART_UART4_RX_UDMA_MAPPING;
+ UARTD5.txchnmap = TIVA_UART_UART4_TX_UDMA_MAPPING;
+#endif
+#if TIVA_UART_USE_UART5
+ uartObjectInit(&UARTD6);
+ UARTD6.uart = UART5_BASE;
+ UARTD6.dmarxnr = TIVA_UART_UART5_RX_UDMA_CHANNEL;
+ UARTD6.dmatxnr = TIVA_UART_UART5_TX_UDMA_CHANNEL;
+ UARTD6.rxchnmap = TIVA_UART_UART5_RX_UDMA_MAPPING;
+ UARTD6.txchnmap = TIVA_UART_UART5_TX_UDMA_MAPPING;
+#endif
+#if TIVA_UART_USE_UART6
+ uartObjectInit(&UARTD7);
+ UARTD7.uart = UART6_BASE;
+ UARTD7.dmarxnr = TIVA_UART_UART6_RX_UDMA_CHANNEL;
+ UARTD7.dmatxnr = TIVA_UART_UART6_TX_UDMA_CHANNEL;
+ UARTD7.rxchnmap = TIVA_UART_UART6_RX_UDMA_MAPPING;
+ UARTD7.txchnmap = TIVA_UART_UART6_TX_UDMA_MAPPING;
+#endif
+#if TIVA_UART_USE_UART7
+ uartObjectInit(&UARTD8);
+ UARTD8.uart = UART7_BASE;
+ UARTD8.dmarxnr = TIVA_UART_UART7_RX_UDMA_CHANNEL;
+ UARTD8.dmatxnr = TIVA_UART_UART7_TX_UDMA_CHANNEL;
+ UARTD8.rxchnmap = TIVA_UART_UART7_RX_UDMA_MAPPING;
+ UARTD8.txchnmap = TIVA_UART_UART7_TX_UDMA_MAPPING;
+#endif
+}
+
+/**
+ * @brief Configures and activates the UART peripheral.
+ *
+ * @param[in] uartp pointer to the @p UARTDriver object
+ *
+ * @notapi
+ */
+void uart_lld_start(UARTDriver *uartp) {
+
+ if (uartp->state == UART_STOP) {
+#if TIVA_UART_USE_UART0
+ if (&UARTD1 == uartp) {
+ bool b;
+ b = udmaChannelAllocate(uartp->dmarxnr);
+ osalDbgAssert(!b, "channel already allocated");
+ b = udmaChannelAllocate(uartp->dmatxnr);
+ osalDbgAssert(!b, "channel already allocated");
+
+ HWREG(SYSCTL_RCGCUART) |= (1 << 0);
+
+ while (!(HWREG(SYSCTL_PRUART) & (1 << 0)))
+ ;
+
+ nvicEnableVector(TIVA_UART0_NUMBER, TIVA_UART_UART0_PRIORITY);
+ }
+#endif
+#if TIVA_UART_USE_UART1
+ if (&UARTD2 == uartp) {
+ bool b;
+ b = udmaChannelAllocate(uartp->dmarxnr);
+ osalDbgAssert(!b, "channel already allocated");
+ b = udmaChannelAllocate(uartp->dmatxnr);
+ osalDbgAssert(!b, "channel already allocated");
+
+ HWREG(SYSCTL_RCGCUART) |= (1 << 1);
+
+ while (!(HWREG(SYSCTL_PRUART) & (1 << 1)))
+ ;
+
+ nvicEnableVector(TIVA_UART1_NUMBER, TIVA_UART_UART1_PRIORITY);
+ }
+#endif
+#if TIVA_UART_USE_UART2
+ if (&UARTD3 == uartp) {
+ bool b;
+ b = udmaChannelAllocate(uartp->dmarxnr);
+ osalDbgAssert(!b, "channel already allocated");
+ b = udmaChannelAllocate(uartp->dmatxnr);
+ osalDbgAssert(!b, "channel already allocated");
+
+ HWREG(SYSCTL_RCGCUART) |= (1 << 2);
+
+ while (!(HWREG(SYSCTL_PRUART) & (1 << 2)))
+ ;
+
+ nvicEnableVector(TIVA_UART2_NUMBER, TIVA_UART_UART2_PRIORITY);
+ }
+#endif
+#if TIVA_UART_USE_UART3
+ if (&UARTD4 == uartp) {
+ bool b;
+ b = udmaChannelAllocate(uartp->dmarxnr);
+ osalDbgAssert(!b, "channel already allocated");
+ b = udmaChannelAllocate(uartp->dmatxnr);
+ osalDbgAssert(!b, "channel already allocated");
+
+ HWREG(SYSCTL_RCGCUART) |= (1 << 3);
+
+ while (!(HWREG(SYSCTL_PRUART) & (1 << 3)))
+ ;
+
+ nvicEnableVector(TIVA_UART3_NUMBER, TIVA_UART_UART3_PRIORITY);
+ }
+#endif
+#if TIVA_UART_USE_UART4
+ if (&UARTD5 == uartp) {
+ bool b;
+ b = udmaChannelAllocate(uartp->dmarxnr);
+ osalDbgAssert(!b, "channel already allocated");
+ b = udmaChannelAllocate(uartp->dmatxnr);
+ osalDbgAssert(!b, "channel already allocated");
+
+ HWREG(SYSCTL_RCGCUART) |= (1 << 4);
+
+ while (!(HWREG(SYSCTL_PRUART) & (1 << 4)))
+ ;
+
+ nvicEnableVector(TIVA_UART4_NUMBER, TIVA_UART_UART4_PRIORITY);
+ }
+#endif
+#if TIVA_UART_USE_UART5
+ if (&UARTD6 == uartp) {
+ bool b;
+ b = udmaChannelAllocate(uartp->dmarxnr);
+ osalDbgAssert(!b, "channel already allocated");
+ b = udmaChannelAllocate(uartp->dmatxnr);
+ osalDbgAssert(!b, "channel already allocated");
+
+ HWREG(SYSCTL_RCGCUART) |= (1 << 5);
+
+ while (!(HWREG(SYSCTL_PRUART) & (1 << 5)))
+ ;
+
+ nvicEnableVector(TIVA_UART5_NUMBER, TIVA_UART_UART5_PRIORITY);
+ }
+#endif
+#if TIVA_UART_USE_UART6
+ if (&UARTD7 == uartp) {
+ bool b;
+ b = udmaChannelAllocate(uartp->dmarxnr);
+ osalDbgAssert(!b, "channel already allocated");
+ b = udmaChannelAllocate(uartp->dmatxnr);
+ osalDbgAssert(!b, "channel already allocated");
+
+ HWREG(SYSCTL_RCGCUART) |= (1 << 6);
+
+ while (!(HWREG(SYSCTL_PRUART) & (1 << 6)))
+ ;
+
+ nvicEnableVector(TIVA_UART6_NUMBER, TIVA_UART_UART6_PRIORITY);
+ }
+#endif
+#if TIVA_UART_USE_UART7
+ if (&UARTD8 == uartp) {
+ bool b;
+ b = udmaChannelAllocate(uartp->dmarxnr);
+ osalDbgAssert(!b, "channel already allocated");
+ b = udmaChannelAllocate(uartp->dmatxnr);
+ osalDbgAssert(!b, "channel already allocated");
+
+ HWREG(SYSCTL_RCGCUART) |= (1 << 7);
+
+ while (!(HWREG(SYSCTL_PRUART) & (1 << 7)))
+ ;
+
+ nvicEnableVector(TIVA_UART7_NUMBER, TIVA_UART_UART7_PRIORITY);
+ }
+#endif
+
+ uartp->rxbuf = 0;
+
+ HWREG(UDMA_CHMAP0 + (uartp->dmarxnr / 8) * 4) |= (uartp->rxchnmap << (uartp->dmarxnr % 8));
+ HWREG(UDMA_CHMAP0 + (uartp->dmatxnr / 8) * 4) |= (uartp->txchnmap << (uartp->dmatxnr % 8));
+ }
+
+ uartp->rxstate = UART_RX_IDLE;
+ uartp->txstate = UART_TX_IDLE;
+ uart_init(uartp);
+}
+
+/**
+ * @brief Deactivates the UART peripheral.
+ *
+ * @param[in] uartp pointer to the @p UARTDriver object
+ *
+ * @notapi
+ */
+void uart_lld_stop(UARTDriver *uartp) {
+
+ if (uartp->state == UART_READY) {
+ uart_stop(uartp);
+ udmaChannelRelease(uartp->dmarxnr);
+ udmaChannelRelease(uartp->dmatxnr);
+
+#if TIVA_UART_USE_UART0
+ if (&UARTD1 == uartp) {
+ HWREG(SYSCTL_RCGCUART) &= ~(1 << 0);
+ return;
+ }
+#endif
+#if TIVA_UART_USE_UART1
+ if (&UARTD2 == uartp) {
+ HWREG(SYSCTL_RCGCUART) &= ~(1 << 1);
+ return;
+ }
+#endif
+#if TIVA_UART_USE_UART2
+ if (&UARTD3 == uartp) {
+ HWREG(SYSCTL_RCGCUART) &= ~(1 << 2);
+ return;
+ }
+#endif
+#if TIVA_UART_USE_UART3
+ if (&UARTD4 == uartp) {
+ HWREG(SYSCTL_RCGCUART) &= ~(1 << 3);
+ return;
+ }
+#endif
+#if TIVA_UART_USE_UART4
+ if (&UARTD5 == uartp) {
+ HWREG(SYSCTL_RCGCUART) &= ~(1 << 4);
+ return;
+ }
+#endif
+#if TIVA_UART_USE_UART5
+ if (&UARTD6 == uartp) {
+ HWREG(SYSCTL_RCGCUART) &= ~(1 << 5);
+ return;
+ }
+#endif
+#if TIVA_UART_USE_UART6
+ if (&UARTD7 == uartp) {
+ HWREG(SYSCTL_RCGCUART) &= ~(1 << 6);
+ return;
+ }
+#endif
+#if TIVA_UART_USE_UART7
+ if (&UARTD8 == uartp) {
+ HWREG(SYSCTL_RCGCUART) &= ~(1 << 7);
+ return;
+ }
+#endif
+ }
+}
+
+/**
+ * @brief Starts a transmission on the UART peripheral.
+ * @note The buffers are organized as uint8_t arrays for data sizes below
+ * or equal to 8 bits else it is organized as uint16_t arrays.
+ *
+ * @param[in] uartp pointer to the @p UARTDriver object
+ * @param[in] n number of data frames to send
+ * @param[in] txbuf the pointer to the transmit buffer
+ *
+ * @notapi
+ */
+void uart_lld_start_send(UARTDriver *uartp, size_t n, const void *txbuf)
+{
+ tiva_udma_table_entry_t *primary = udmaControlTable.primary;
+
+ /* TODO: This assert should be moved to the dma helper driver */
+ osalDbgAssert((uint32_t)txbuf >= SRAM_BASE, "txbuf should be in SRAM region.");
+
+ dmaChannelDisable(uartp->dmatxnr);
+
+ /* Configure for 8-bit transfers.*/
+ primary[uartp->dmatxnr].srcendp = (volatile void *)txbuf+n-1;
+ primary[uartp->dmatxnr].dstendp = (void *)(uartp->uart + UART_O_DR);
+ primary[uartp->dmatxnr].chctl = UDMA_CHCTL_DSTSIZE_8 | UDMA_CHCTL_DSTINC_NONE |
+ UDMA_CHCTL_SRCSIZE_8 | UDMA_CHCTL_SRCINC_8 |
+ UDMA_CHCTL_ARBSIZE_4 |
+ UDMA_CHCTL_XFERSIZE(n) |
+ UDMA_CHCTL_XFERMODE_BASIC;
+
+ dmaChannelSingleBurst(uartp->dmatxnr);
+ dmaChannelPrimary(uartp->dmatxnr);
+ dmaChannelPriorityDefault(uartp->dmatxnr);
+ dmaChannelEnableRequest(uartp->dmatxnr);
+
+ /* Enable DMA channel, transfer starts immediately.*/
+ dmaChannelEnable(uartp->dmatxnr);
+}
+
+/**
+ * @brief Stops any ongoing transmission.
+ * @note Stopping a transmission also suppresses the transmission callbacks.
+ *
+ * @param[in] uartp pointer to the @p UARTDriver object
+ *
+ * @return The number of data frames not transmitted by the
+ * stopped transmit operation.
+ *
+ * @notapi
+ */
+size_t uart_lld_stop_send(UARTDriver *uartp)
+{
+ tiva_udma_table_entry_t *primary = udmaControlTable.primary;
+ uint16_t left;
+
+ dmaChannelDisable(uartp->dmatxnr);
+
+ left = ((primary[uartp->dmatxnr].chctl & UDMA_CHCTL_XFERSIZE_M) + 1) >> 4;
+
+ return left;
+}
+
+/**
+ * @brief Starts a receive operation on the UART peripheral.
+ * @note The buffers are organized as uint8_t arrays for data sizes below
+ * or equal to 8 bits else it is organized as uint16_t arrays.
+ *
+ * @param[in] uartp pointer to the @p UARTDriver object
+ * @param[in] n number of data frames to send
+ * @param[out] rxbuf the pointer to the receive buffer
+ *
+ * @notapi
+ */
+void uart_lld_start_receive(UARTDriver *uartp, size_t n, void *rxbuf)
+{
+ tiva_udma_table_entry_t *primary = udmaControlTable.primary;
+
+ /* TODO: This assert should be moved to the dma helper driver */
+ osalDbgAssert((uint32_t)rxbuf >= SRAM_BASE, "rxbuf should be in SRAM region.");
+
+ dmaChannelDisable(uartp->dmarxnr);
+
+ /* Configure for 8-bit transfers.*/
+ primary[uartp->dmarxnr].srcendp = (void *)(uartp->uart + UART_O_DR);
+ primary[uartp->dmarxnr].dstendp = (volatile void *)rxbuf+n-1;
+ primary[uartp->dmarxnr].chctl = UDMA_CHCTL_DSTSIZE_8 | UDMA_CHCTL_DSTINC_8 |
+ UDMA_CHCTL_SRCSIZE_8 | UDMA_CHCTL_SRCINC_NONE |
+ UDMA_CHCTL_ARBSIZE_4 |
+ UDMA_CHCTL_XFERSIZE(n) |
+ UDMA_CHCTL_XFERMODE_BASIC;
+
+ dmaChannelSingleBurst(uartp->dmarxnr);
+ dmaChannelPrimary(uartp->dmarxnr);
+ dmaChannelPriorityDefault(uartp->dmarxnr);
+ dmaChannelEnableRequest(uartp->dmarxnr);
+
+ /* Enable DMA channel, transfer starts immediately.*/
+ dmaChannelEnable(uartp->dmarxnr);
+}
+
+/**
+ * @brief Stops any ongoing receive operation.
+ * @note Stopping a receive operation also suppresses the receive callbacks.
+ *
+ * @param[in] uartp pointer to the @p UARTDriver object
+ *
+ * @return The number of data frames not received by the
+ * stopped receive operation.
+ *
+ * @notapi
+ */
+size_t uart_lld_stop_receive(UARTDriver *uartp)
+{
+ tiva_udma_table_entry_t *primary = udmaControlTable.primary;
+ uint16_t left;
+
+ dmaChannelDisable(uartp->dmatxnr);
+
+ left = ((primary[uartp->dmatxnr].chctl & UDMA_CHCTL_XFERSIZE_M) + 1) >> 4;
+
+ uart_enter_rx_idle_loop(uartp);
+
+ return left;
+}
+
+#endif /* HAL_USE_UART */
+
+/** @} */
diff --git a/os/hal/ports/TIVA/LLD/UART/hal_uart_lld.h b/os/hal/ports/TIVA/LLD/UART/hal_uart_lld.h
new file mode 100644
index 0000000..1dc743b
--- /dev/null
+++ b/os/hal/ports/TIVA/LLD/UART/hal_uart_lld.h
@@ -0,0 +1,471 @@
+/*
+ Copyright (C) 2014..2017 Marco Veeneman
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/**
+ * @file UART/hal_uart_lld.h
+ * @brief Tiva low level UART driver header.
+ *
+ * @addtogroup UART
+ * @{
+ */
+
+#ifndef HAL_UART_LLD_H
+#define HAL_UART_LLD_H
+
+#if HAL_USE_UART || defined(__DOXYGEN__)
+
+/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver pre-compile time settings. */
+/*===========================================================================*/
+
+/**
+ * @name Configuration options
+ * @{
+ */
+/**
+ * @brief UART driver on UART0 enable switch.
+ * @details If set to @p TRUE the support for UART0 is included.
+ * @note The default is @p FALSE.
+ */
+#if !defined(TIVA_UART_USE_UART0) || defined(__DOXYGEN__)
+#define TIVA_UART_USE_UART0 FALSE
+#endif
+
+/**
+ * @brief UART driver on UART1 enable switch.
+ * @details If set to @p TRUE the support for UART1 is included.
+ * @note The default is @p FALSE.
+ */
+#if !defined(TIVA_UART_USE_UART1) || defined(__DOXYGEN__)
+#define TIVA_UART_USE_UART1 FALSE
+#endif
+
+/**
+ * @brief UART driver on UART2 enable switch.
+ * @details If set to @p TRUE the support for UART2 is included.
+ * @note The default is @p FALSE.
+ */
+#if !defined(TIVA_UART_USE_UART2) || defined(__DOXYGEN__)
+#define TIVA_UART_USE_UART2 FALSE
+#endif
+
+/**
+ * @brief UART driver on UART3 enable switch.
+ * @details If set to @p TRUE the support for UART3 is included.
+ * @note The default is @p FALSE.
+ */
+#if !defined(TIVA_UART_USE_UART3) || defined(__DOXYGEN__)
+#define TIVA_UART_USE_UART3 FALSE
+#endif
+
+/**
+ * @brief UART driver on UART4 enable switch.
+ * @details If set to @p TRUE the support for UART4 is included.
+ * @note The default is @p FALSE.
+ */
+#if !defined(TIVA_UART_USE_UART4) || defined(__DOXYGEN__)
+#define TIVA_UART_USE_UART4 FALSE
+#endif
+
+/**
+ * @brief UART driver on UART5 enable switch.
+ * @details If set to @p TRUE the support for UART5 is included.
+ * @note The default is @p FALSE.
+ */
+#if !defined(TIVA_UART_USE_UART5) || defined(__DOXYGEN__)
+#define TIVA_UART_USE_UART5 FALSE
+#endif
+
+/**
+ * @brief UART driver on UART6 enable switch.
+ * @details If set to @p TRUE the support for UART6 is included.
+ * @note The default is @p FALSE.
+ */
+#if !defined(TIVA_UART_USE_UART6) || defined(__DOXYGEN__)
+#define TIVA_UART_USE_UART6 FALSE
+#endif
+
+/**
+ * @brief UART driver on UART7 enable switch.
+ * @details If set to @p TRUE the support for UART7 is included.
+ * @note The default is @p FALSE.
+ */
+#if !defined(TIVA_UART_USE_UART7) || defined(__DOXYGEN__)
+#define TIVA_UART_USE_UART7 FALSE
+#endif
+
+/**
+ * @brief UART0 interrupt priority level setting.
+ */
+#if !defined(TIVA_UART_UART0_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_UART_UART0_IRQ_PRIORITY 5
+#endif
+
+/**
+ * @brief UART1 interrupt priority level setting.
+ */
+#if !defined(TIVA_UART_UART1_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_UART_UART1_IRQ_PRIORITY 5
+#endif
+
+/**
+ * @brief UART2 interrupt priority level setting.
+ */
+#if !defined(TIVA_UART_UART2_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_UART_UART2_IRQ_PRIORITY 5
+#endif
+
+/**
+ * @brief UART3 interrupt priority level setting.
+ */
+#if !defined(TIVA_UART_UART3_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_UART_UART3_IRQ_PRIORITY 5
+#endif
+
+/**
+ * @brief UART4 interrupt priority level setting.
+ */
+#if !defined(TIVA_UART_UART4_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_UART_UART4_IRQ_PRIORITY 5
+#endif
+
+/**
+ * @brief UART5 interrupt priority level setting.
+ */
+#if !defined(TIVA_UART_UART5_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_UART_UART5_IRQ_PRIORITY 5
+#endif
+
+/**
+ * @brief UART6 interrupt priority level setting.
+ */
+#if !defined(TIVA_UART_UART6_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_UART_UART6_IRQ_PRIORITY 5
+#endif
+
+/**
+ * @brief UART7 interrupt priority level setting.
+ */
+#if !defined(TIVA_UART_UART7_IRQ_PRIORITY) || defined(__DOXYGEN__)
+#define TIVA_UART_UART7_IRQ_PRIORITY 5
+#endif
+/** @} */
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+#if TIVA_UART_USE_UART0 && !TIVA_HAS_UART0
+#error "UART0 not present in the selected device"
+#endif
+
+#if TIVA_UART_USE_UART1 && !TIVA_HAS_UART1
+#error "UART1 not present in the selected device"
+#endif
+
+#if TIVA_UART_USE_UART2 && !TIVA_HAS_UART2
+#error "UART2 not present in the selected device"
+#endif
+
+#if TIVA_UART_USE_UART3 && !TIVA_HAS_UART3
+#error "UART3 not present in the selected device"
+#endif
+
+#if TIVA_UART_USE_UART4 && !TIVA_HAS_UART4
+#error "UART4 not present in the selected device"
+#endif
+
+#if TIVA_UART_USE_UART5 && !TIVA_HAS_UART5
+#error "UART5 not present in the selected device"
+#endif
+
+#if TIVA_UART_USE_UART6 && !TIVA_HAS_UART6
+#error "UART6 not present in the selected device"
+#endif
+
+#if TIVA_UART_USE_UART7 && !TIVA_HAS_UART7
+#error "UART7 not present in the selected device"
+#endif
+
+#if !TIVA_UART_USE_UART0 && !TIVA_UART_USE_UART1 && !TIVA_UART_USE_UART2 && \
+ !TIVA_UART_USE_UART3 && !TIVA_UART_USE_UART4 && !TIVA_UART_USE_UART5 && \
+ !TIVA_UART_USE_UART6 && !TIVA_UART_USE_UART7
+#error "UART driver activated but no UART peripheral assigned"
+#endif
+
+#if TIVA_UART_USE_UART0 && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_UART_UART0_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to UART0"
+#endif
+
+#if TIVA_UART_USE_UART1 && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_UART_UART1_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to UART1"
+#endif
+
+#if TIVA_UART_USE_UART2 && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_UART_UART2_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to UART2"
+#endif
+
+#if TIVA_UART_USE_UART3 && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_UART_UART3_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to UART3"
+#endif
+
+#if TIVA_UART_USE_UART4 && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_UART_UART4_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to UART4"
+#endif
+
+#if TIVA_UART_USE_UART5 && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_UART_UART5_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to UART5"
+#endif
+
+#if TIVA_UART_USE_UART6 && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_UART_UART6_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to UART6"
+#endif
+
+#if TIVA_UART_USE_UART7 && \
+ !OSAL_IRQ_IS_VALID_PRIORITY(TIVA_UART_UART7_IRQ_PRIORITY)
+#error "Invalid IRQ priority assigned to UART7"
+#endif
+
+#if !defined(TIVA_UDMA_REQUIRED)
+#define TIVA_UDMA_REQUIRED
+#endif
+
+/*===========================================================================*/
+/* Driver data structures and types. */
+/*===========================================================================*/
+
+/**
+ * @brief UART driver condition flags type.
+ */
+typedef uint32_t uartflags_t;
+
+/**
+ * @brief Structure representing an UART driver.
+ */
+typedef struct UARTDriver UARTDriver;
+
+/**
+ * @brief Generic UART notification callback type.
+ *
+ * @param[in] uartp pointer to the @p UARTDriver object
+ */
+typedef void (*uartcb_t)(UARTDriver *uartp);
+
+/**
+ * @brief Character received UART notification callback type.
+ *
+ * @param[in] uartp pointer to the @p UARTDriver object
+ * @param[in] c received character
+ */
+typedef void (*uartccb_t)(UARTDriver *uartp, uint16_t c);
+
+/**
+ * @brief Receive error UART notification callback type.
+ *
+ * @param[in] uartp pointer to the @p UARTDriver object
+ * @param[in] e receive error mask
+ */
+typedef void (*uartecb_t)(UARTDriver *uartp, uartflags_t e);
+
+/**
+ * @brief Driver configuration structure.
+ * @note It could be empty on some architectures.
+ */
+typedef struct {
+ /**
+ * @brief End of transmission buffer callback.
+ */
+ uartcb_t txend1_cb;
+ /**
+ * @brief Physical end of transmission callback.
+ */
+ uartcb_t txend2_cb;
+ /**
+ * @brief Receive buffer filled callback.
+ */
+ uartcb_t rxend_cb;
+ /**
+ * @brief Character received while out if the @p UART_RECEIVE state.
+ */
+ uartccb_t rxchar_cb;
+ /**
+ * @brief Receive error callback.
+ */
+ uartecb_t rxerr_cb;
+ /* End of the mandatory fields.*/
+ /**
+ * @brief Bit rate.
+ */
+ uint32_t speed;
+ /* End of the mandatory fields. */
+ /**
+ * @brief Initialization value for the CTL register.
+ */
+ uint16_t ctl;
+ /**
+ * @brief Initialization value for the LCRH register.
+ */
+ uint8_t lcrh;
+ /**
+ * @brief Initialization value for the IFLS register.
+ */
+ uint8_t ifls;
+ /**
+ * @brief Initialization value for the CC register.
+ */
+ uint8_t cc;
+} UARTConfig;
+
+/**
+ * @brief Structure representing an UART driver.
+ */
+struct UARTDriver {
+ /**
+ * @brief Driver state.
+ */
+ uartstate_t state;
+ /**
+ * @brief Transmitter state.
+ */
+ uarttxstate_t txstate;
+ /**
+ * @brief Receiver state.
+ */
+ uartrxstate_t rxstate;
+ /**
+ * @brief Current configuration data.
+ */
+ const UARTConfig *config;
+#if (UART_USE_WAIT == TRUE) || defined(__DOXYGEN__)
+ /**
+ * @brief Synchronization flag for transmit operations.
+ */
+ bool early;
+ /**
+ * @brief Waiting thread on RX.
+ */
+ thread_reference_t threadrx;
+ /**
+ * @brief Waiting thread on TX.
+ */
+ thread_reference_t threadtx;
+#endif /* UART_USE_WAIT */
+#if (UART_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__)
+ /**
+ * @brief Mutex protecting the peripheral.
+ */
+ mutex_t mutex;
+#endif /* UART_USE_MUTUAL_EXCLUSION */
+#if defined(UART_DRIVER_EXT_FIELDS)
+ UART_DRIVER_EXT_FIELDS
+#endif
+ /* End of the mandatory fields.*/
+ /**
+ * @brief Pointer to the UART registers block.
+ */
+ uint32_t uart;
+ /**
+ * @brief Receive DMA channel number.
+ */
+ uint8_t dmarxnr;
+ /**
+ * @brief Transmit DMA channel number.
+ */
+ uint8_t dmatxnr;
+ /**
+ * @brief Receive DMA channel map.
+ */
+ uint8_t rxchnmap;
+ /**
+ * @brief Transmit DMA channel map.
+ */
+ uint8_t txchnmap;
+ /**
+ * @brief Default receive buffer while into @p UART_RX_IDLE state.
+ */
+ volatile uint16_t rxbuf;
+};
+
+/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
+#if TIVA_UART_USE_UART0 && !defined(__DOXYGEN__)
+extern UARTDriver UARTD1;
+#endif
+
+#if TIVA_UART_USE_UART1 && !defined(__DOXYGEN__)
+extern UARTDriver UARTD2;
+#endif
+
+#if TIVA_UART_USE_UART2 && !defined(__DOXYGEN__)
+extern UARTDriver UARTD3;
+#endif
+
+#if TIVA_UART_USE_UART3 && !defined(__DOXYGEN__)
+extern UARTDriver UARTD4;
+#endif
+
+#if TIVA_UART_USE_UART4 && !defined(__DOXYGEN__)
+extern UARTDriver UARTD5;
+#endif
+
+#if TIVA_UART_USE_UART5 && !defined(__DOXYGEN__)
+extern UARTDriver UARTD6;
+#endif
+
+#if TIVA_UART_USE_UART6 && !defined(__DOXYGEN__)
+extern UARTDriver UARTD7;
+#endif
+
+#if TIVA_UART_USE_UART7 && !defined(__DOXYGEN__)
+extern UARTDriver UARTD8;
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void uart_lld_init(void);
+ void uart_lld_start(UARTDriver *uartp);
+ void uart_lld_stop(UARTDriver *uartp);
+ void uart_lld_start_send(UARTDriver *uartp, size_t n, const void *txbuf);
+ size_t uart_lld_stop_send(UARTDriver *uartp);
+ void uart_lld_start_receive(UARTDriver *uartp, size_t n, void *rxbuf);
+ size_t uart_lld_stop_receive(UARTDriver *uartp);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* HAL_USE_UART */
+
+#endif /* HAL_UART_LLD_H */
+
+/** @} */