[PATCH rtems v2 02/12] bsps/imxrt: (Re-)Apply RTEMS patches to new lib
Christian Mauderer
christian.mauderer at embedded-brains.de
Tue May 9 12:10:49 UTC 2023
Reapply patches used in the old version of the NXP library and apply
patches necessary for the new version of the library.
---
.../devices/MIMXRT1052/fsl_device_registers.h | 3 +
.../MIMXRT1052/xip/fsl_flexspi_nor_boot.h | 4 +
.../devices/MIMXRT1166/fsl_device_registers.h | 3 +
.../MIMXRT1166/xip/fsl_flexspi_nor_boot.h | 4 +
.../mcux-sdk/drivers/common/fsl_common.h | 310 ++++++++++++++++++
.../mcux-sdk/drivers/lpuart/fsl_lpuart.c | 17 +
.../mcux-sdk/drivers/lpuart/fsl_lpuart.h | 4 +
.../imxrt/mcux-sdk/drivers/qtmr_1/fsl_qtmr.c | 40 +++
.../imxrt/mcux-sdk/drivers/qtmr_1/fsl_qtmr.h | 34 ++
9 files changed, 419 insertions(+)
diff --git a/bsps/arm/imxrt/mcux-sdk/devices/MIMXRT1052/fsl_device_registers.h b/bsps/arm/imxrt/mcux-sdk/devices/MIMXRT1052/fsl_device_registers.h
index 54caf43ca6..35e988f1b3 100644
--- a/bsps/arm/imxrt/mcux-sdk/devices/MIMXRT1052/fsl_device_registers.h
+++ b/bsps/arm/imxrt/mcux-sdk/devices/MIMXRT1052/fsl_device_registers.h
@@ -10,6 +10,9 @@
#ifndef __FSL_DEVICE_REGISTERS_H__
#define __FSL_DEVICE_REGISTERS_H__
+#ifdef __rtems__
+#include <bspopts.h>
+#endif /* __rtems__ */
/*
* Include the cpu specific register header files.
*
diff --git a/bsps/arm/imxrt/mcux-sdk/devices/MIMXRT1052/xip/fsl_flexspi_nor_boot.h b/bsps/arm/imxrt/mcux-sdk/devices/MIMXRT1052/xip/fsl_flexspi_nor_boot.h
index 38d5d1833e..5f81090890 100644
--- a/bsps/arm/imxrt/mcux-sdk/devices/MIMXRT1052/xip/fsl_flexspi_nor_boot.h
+++ b/bsps/arm/imxrt/mcux-sdk/devices/MIMXRT1052/xip/fsl_flexspi_nor_boot.h
@@ -10,9 +10,11 @@
#include <stdint.h>
#include "fsl_common.h"
+#ifndef __rtems__
#ifndef BOARD_FLASH_SIZE
#include "board.h"
#endif
+#endif /* __rtems__ */
/*! @name Driver version */
/*@{*/
@@ -108,11 +110,13 @@ typedef struct _boot_data_
#define FLASH_BASE FlexSPI_AMBA_BASE
#endif
+#ifndef __rtems__
#if defined(BOARD_FLASH_SIZE)
#define FLASH_SIZE BOARD_FLASH_SIZE
#else
#error "Please define macro BOARD_FLASH_SIZE"
#endif
+#endif /* __rtems__ */
#define PLUGIN_FLAG (uint32_t)0
/* External Variables */
diff --git a/bsps/arm/imxrt/mcux-sdk/devices/MIMXRT1166/fsl_device_registers.h b/bsps/arm/imxrt/mcux-sdk/devices/MIMXRT1166/fsl_device_registers.h
index a2a9ae8c82..4508d6634f 100644
--- a/bsps/arm/imxrt/mcux-sdk/devices/MIMXRT1166/fsl_device_registers.h
+++ b/bsps/arm/imxrt/mcux-sdk/devices/MIMXRT1166/fsl_device_registers.h
@@ -10,6 +10,9 @@
#ifndef __FSL_DEVICE_REGISTERS_H__
#define __FSL_DEVICE_REGISTERS_H__
+#ifdef __rtems__
+#include <bspopts.h>
+#endif /* __rtems__ */
/*
* Include the cpu specific register header files.
*
diff --git a/bsps/arm/imxrt/mcux-sdk/devices/MIMXRT1166/xip/fsl_flexspi_nor_boot.h b/bsps/arm/imxrt/mcux-sdk/devices/MIMXRT1166/xip/fsl_flexspi_nor_boot.h
index 6aeb096486..16c0c0a6be 100644
--- a/bsps/arm/imxrt/mcux-sdk/devices/MIMXRT1166/xip/fsl_flexspi_nor_boot.h
+++ b/bsps/arm/imxrt/mcux-sdk/devices/MIMXRT1166/xip/fsl_flexspi_nor_boot.h
@@ -10,9 +10,11 @@
#include <stdint.h>
#include "fsl_common.h"
+#ifndef __rtems__
#ifndef BOARD_FLASH_SIZE
#include "board.h"
#endif
+#endif /* __rtems__ */
/*! @name Driver version */
/*@{*/
@@ -133,11 +135,13 @@ typedef struct _boot_data_
#define FLASH_BASE FlexSPI1_ALIAS_BASE
#endif
+#ifndef __rtems__
#if defined(BOARD_FLASH_SIZE)
#define FLASH_SIZE BOARD_FLASH_SIZE
#else
#error "Please define macro BOARD_FLASH_SIZE"
#endif
+#endif /* __rtems__ */
#define PLUGIN_FLAG (uint32_t)0
/* External Variables */
diff --git a/bsps/arm/imxrt/mcux-sdk/drivers/common/fsl_common.h b/bsps/arm/imxrt/mcux-sdk/drivers/common/fsl_common.h
index 84c7f9d2f0..17eaadb84d 100644
--- a/bsps/arm/imxrt/mcux-sdk/drivers/common/fsl_common.h
+++ b/bsps/arm/imxrt/mcux-sdk/drivers/common/fsl_common.h
@@ -21,6 +21,10 @@
#include "fsl_device_registers.h"
+#ifdef __rtems__
+/* Usually provided by modern CMSIS */
+#define __STATIC_FORCEINLINE __attribute__((always_inline)) static inline
+#endif /* __rtems__ */
/*!
* @addtogroup ksdk_common
* @{
@@ -314,6 +318,312 @@ void SDK_Free(void *ptr);
*/
void SDK_DelayAtLeastUs(uint32_t delayTime_us, uint32_t coreClock_Hz);
+#ifdef __rtems__
+/* Prototypes for IRQHandlers */
+void ADMA_FLEXCAN0_INT_DriverIRQHandler(void);
+void ADMA_FLEXCAN1_INT_DriverIRQHandler(void);
+void ADMA_FLEXCAN2_INT_DriverIRQHandler(void);
+void ADMA_I2C0_INT_DriverIRQHandler(void);
+void ADMA_I2C1_INT_DriverIRQHandler(void);
+void ADMA_I2C2_INT_DriverIRQHandler(void);
+void ADMA_I2C3_INT_DriverIRQHandler(void);
+void ADMA_I2C4_INT_DriverIRQHandler(void);
+void ADMA_SAI0_INT_DriverIRQHandler(void);
+void ADMA_SAI1_INT_DriverIRQHandler(void);
+void ADMA_SAI2_INT_DriverIRQHandler(void);
+void ADMA_SAI3_INT_DriverIRQHandler(void);
+void ADMA_SAI4_INT_DriverIRQHandler(void);
+void ADMA_SAI5_INT_DriverIRQHandler(void);
+void ADMA_SPI0_INT_DriverIRQHandler(void);
+void ADMA_SPI1_INT_DriverIRQHandler(void);
+void ADMA_SPI2_INT_DriverIRQHandler(void);
+void ADMA_SPI3_INT_DriverIRQHandler(void);
+void ADMA_UART0_INT_DriverIRQHandler(void);
+void ADMA_UART1_INT_DriverIRQHandler(void);
+void ADMA_UART2_INT_DriverIRQHandler(void);
+void ADMA_UART3_INT_DriverIRQHandler(void);
+void ASRC_DriverIRQHandler(void);
+void AUDIO_SAI0_INT_DriverIRQHandler(void);
+void AUDIO_SAI1_INT_DriverIRQHandler(void);
+void AUDIO_SAI2_INT_DriverIRQHandler(void);
+void AUDIO_SAI3_INT_DriverIRQHandler(void);
+void AUDIO_SAI6_INT_DriverIRQHandler(void);
+void AUDIO_SAI7_INT_DriverIRQHandler(void);
+void CAN0_DriverIRQHandler(void);
+void CAN1_DriverIRQHandler(void);
+void CAN2_DriverIRQHandler(void);
+void CAN3_DriverIRQHandler(void);
+void CAN4_DriverIRQHandler(void);
+void CDOG_DriverIRQHandler(void);
+void CONNECTIVITY_ENET0_FRAME0_EVENT_INT_DriverIRQHandler(void);
+void CONNECTIVITY_ENET0_FRAME1_INT_DriverIRQHandler(void);
+void CONNECTIVITY_ENET0_FRAME2_INT_DriverIRQHandler(void);
+void CONNECTIVITY_ENET0_TIMER_INT_DriverIRQHandler(void);
+void CONNECTIVITY_ENET1_FRAME0_EVENT_INT_DriverIRQHandler(void);
+void CONNECTIVITY_ENET1_FRAME1_INT_DriverIRQHandler(void);
+void CONNECTIVITY_ENET1_FRAME2_INT_DriverIRQHandler(void);
+void CONNECTIVITY_ENET1_TIMER_INT_DriverIRQHandler(void);
+void CONNECTIVITY_EQOS_INT_DriverIRQHandler(void);
+void CSI0_DriverIRQHandler(void);
+void CSI_DriverIRQHandler(void);
+void DMA0_04_DriverIRQHandler(void);
+void DMA0_08_DriverIRQHandler(void);
+void DMA0_0_4_DriverIRQHandler(void);
+void DMA0_10_14_DriverIRQHandler(void);
+void DMA0_11_15_DriverIRQHandler(void);
+void DMA0_15_DriverIRQHandler(void);
+void DMA0_16_20_DriverIRQHandler(void);
+void DMA0_17_21_DriverIRQHandler(void);
+void DMA0_18_22_DriverIRQHandler(void);
+void DMA0_19_23_DriverIRQHandler(void);
+void DMA0_19_DriverIRQHandler(void);
+void DMA0_1_5_DriverIRQHandler(void);
+void DMA0_210_DriverIRQHandler(void);
+void DMA0_24_28_DriverIRQHandler(void);
+void DMA0_25_29_DriverIRQHandler(void);
+void DMA0_26_30_DriverIRQHandler(void);
+void DMA0_26_DriverIRQHandler(void);
+void DMA0_27_31_DriverIRQHandler(void);
+void DMA0_2_6_DriverIRQHandler(void);
+void DMA0_311_DriverIRQHandler(void);
+void DMA0_37_DriverIRQHandler(void);
+void DMA0_3_7_DriverIRQHandler(void);
+void DMA0_412_DriverIRQHandler(void);
+void DMA0_513_DriverIRQHandler(void);
+void DMA0_614_DriverIRQHandler(void);
+void DMA0_715_DriverIRQHandler(void);
+void DMA0_8_12_DriverIRQHandler(void);
+void DMA0_9_13_DriverIRQHandler(void);
+void DMA0_DMA16_DriverIRQHandler(void);
+void DMA0_DMA16_DriverIRQHandler(void);
+void DMA0_DriverIRQHandler(void);
+void DMA10_DMA26_DriverIRQHandler(void);
+void DMA10_DMA26_DriverIRQHandler(void);
+void DMA10_DriverIRQHandler(void);
+void DMA11_DMA27_DriverIRQHandler(void);
+void DMA11_DMA27_DriverIRQHandler(void);
+void DMA11_DriverIRQHandler(void);
+void DMA12_DMA28_DriverIRQHandler(void);
+void DMA12_DMA28_DriverIRQHandler(void);
+void DMA12_DriverIRQHandler(void);
+void DMA13_DMA29_DriverIRQHandler(void);
+void DMA13_DMA29_DriverIRQHandler(void);
+void DMA13_DriverIRQHandler(void);
+void DMA14_DMA30_DriverIRQHandler(void);
+void DMA14_DMA30_DriverIRQHandler(void);
+void DMA14_DriverIRQHandler(void);
+void DMA15_DMA31_DriverIRQHandler(void);
+void DMA15_DMA31_DriverIRQHandler(void);
+void DMA15_DriverIRQHandler(void);
+void DMA16_DriverIRQHandler(void);
+void DMA17_DriverIRQHandler(void);
+void DMA18_DriverIRQHandler(void);
+void DMA19_DriverIRQHandler(void);
+void DMA1_04_DriverIRQHandler(void);
+void DMA1_04_DriverIRQHandler(void);
+void DMA1_08_DriverIRQHandler(void);
+void DMA1_15_DriverIRQHandler(void);
+void DMA1_15_DriverIRQHandler(void);
+void DMA1_19_DriverIRQHandler(void);
+void DMA1_210_DriverIRQHandler(void);
+void DMA1_26_DriverIRQHandler(void);
+void DMA1_26_DriverIRQHandler(void);
+void DMA1_311_DriverIRQHandler(void);
+void DMA1_37_DriverIRQHandler(void);
+void DMA1_37_DriverIRQHandler(void);
+void DMA1_412_DriverIRQHandler(void);
+void DMA1_513_DriverIRQHandler(void);
+void DMA1_614_DriverIRQHandler(void);
+void DMA1_715_DriverIRQHandler(void);
+void DMA1_DMA17_DriverIRQHandler(void);
+void DMA1_DMA17_DriverIRQHandler(void);
+void DMA1_DriverIRQHandler(void);
+void DMA20_DriverIRQHandler(void);
+void DMA21_DriverIRQHandler(void);
+void DMA22_DriverIRQHandler(void);
+void DMA23_DriverIRQHandler(void);
+void DMA24_DriverIRQHandler(void);
+void DMA25_DriverIRQHandler(void);
+void DMA26_DriverIRQHandler(void);
+void DMA27_DriverIRQHandler(void);
+void DMA28_DriverIRQHandler(void);
+void DMA29_DriverIRQHandler(void);
+void DMA2_DMA18_DriverIRQHandler(void);
+void DMA2_DMA18_DriverIRQHandler(void);
+void DMA2_DriverIRQHandler(void);
+void DMA30_DriverIRQHandler(void);
+void DMA31_DriverIRQHandler(void);
+void DMA3_DMA19_DriverIRQHandler(void);
+void DMA3_DMA19_DriverIRQHandler(void);
+void DMA3_DriverIRQHandler(void);
+void DMA4_DMA20_DriverIRQHandler(void);
+void DMA4_DMA20_DriverIRQHandler(void);
+void DMA4_DriverIRQHandler(void);
+void DMA5_DMA21_DriverIRQHandler(void);
+void DMA5_DMA21_DriverIRQHandler(void);
+void DMA5_DriverIRQHandler(void);
+void DMA6_DMA22_DriverIRQHandler(void);
+void DMA6_DMA22_DriverIRQHandler(void);
+void DMA6_DriverIRQHandler(void);
+void DMA7_DMA23_DriverIRQHandler(void);
+void DMA7_DMA23_DriverIRQHandler(void);
+void DMA7_DriverIRQHandler(void);
+void DMA8_DMA24_DriverIRQHandler(void);
+void DMA8_DMA24_DriverIRQHandler(void);
+void DMA8_DriverIRQHandler(void);
+void DMA9_DMA25_DriverIRQHandler(void);
+void DMA9_DMA25_DriverIRQHandler(void);
+void DMA9_DriverIRQHandler(void);
+void DMA_FLEXCAN0_INT_DriverIRQHandler(void);
+void DMA_FLEXCAN1_INT_DriverIRQHandler(void);
+void DMA_FLEXCAN2_INT_DriverIRQHandler(void);
+void DMA_I2C0_INT_DriverIRQHandler(void);
+void DMA_I2C1_INT_DriverIRQHandler(void);
+void DMA_I2C2_INT_DriverIRQHandler(void);
+void DMA_I2C3_INT_DriverIRQHandler(void);
+void DMA_I2C4_INT_DriverIRQHandler(void);
+void DMA_SPI0_INT_DriverIRQHandler(void);
+void DMA_SPI1_INT_DriverIRQHandler(void);
+void DMA_SPI2_INT_DriverIRQHandler(void);
+void DMA_SPI3_INT_DriverIRQHandler(void);
+void DMA_UART0_INT_DriverIRQHandler(void);
+void DMA_UART1_INT_DriverIRQHandler(void);
+void DMA_UART2_INT_DriverIRQHandler(void);
+void DMA_UART3_INT_DriverIRQHandler(void);
+void DMA_UART4_INT_DriverIRQHandler(void);
+void ENET1_1588_Timer_DriverIRQHandler(void);
+void ENET1_DriverIRQHandler(void);
+void ENET1_MAC0_Rx_Tx_Done1_DriverIRQHandler(void);
+void ENET1_MAC0_Rx_Tx_Done2_DriverIRQHandler(void);
+void ENET2_1588_Timer_DriverIRQHandler(void);
+void ENET2_DriverIRQHandler(void);
+void ENET_1588_Timer_DriverIRQHandler(void);
+void ENET_1G_1588_Timer_DriverIRQHandler(void);
+void ENET_1G_DriverIRQHandler(void);
+void ENET_1G_MAC0_Tx_Rx_1_DriverIRQHandler(void);
+void ENET_1G_MAC0_Tx_Rx_2_DriverIRQHandler(void);
+void ENET_DriverIRQHandler(void);
+void ENET_Error_DriverIRQHandler(void);
+void ENET_MAC0_Rx_Tx_Done1_DriverIRQHandler(void);
+void ENET_MAC0_Rx_Tx_Done2_DriverIRQHandler(void);
+void ENET_QOS_DriverIRQHandler(void);
+void ENET_Receive_DriverIRQHandler(void);
+void ENET_Transmit_DriverIRQHandler(void);
+void FLEXIO0_DriverIRQHandler(void);
+void FLEXIO1_DriverIRQHandler(void);
+void FLEXIO2_DriverIRQHandler(void);
+void FLEXIO3_DriverIRQHandler(void);
+void FLEXIO_DriverIRQHandler(void);
+void FLEXSPI0_DriverIRQHandler(void);
+void FLEXSPI0_FLEXSPI1_DriverIRQHandler(void);
+void FLEXSPI1_DriverIRQHandler(void);
+void FLEXSPI_DriverIRQHandler(void);
+void I2S0_DriverIRQHandler(void);
+void I2S0_Rx_DriverIRQHandler(void);
+void I2S0_Tx_DriverIRQHandler(void);
+void I2S1_DriverIRQHandler(void);
+void I2S1_Rx_DriverIRQHandler(void);
+void I2S1_Tx_DriverIRQHandler(void);
+void I2S2_DriverIRQHandler(void);
+void I2S2_Rx_DriverIRQHandler(void);
+void I2S2_Tx_DriverIRQHandler(void);
+void I2S3_DriverIRQHandler(void);
+void I2S3_Rx_DriverIRQHandler(void);
+void I2S3_Tx_DriverIRQHandler(void);
+void I2S4_DriverIRQHandler(void);
+void I2S4_Rx_DriverIRQHandler(void);
+void I2S4_Tx_DriverIRQHandler(void);
+void I2S56_DriverIRQHandler(void);
+void I2S56_Rx_DriverIRQHandler(void);
+void I2S56_Tx_DriverIRQHandler(void);
+void I2S5_DriverIRQHandler(void);
+void I2S5_Rx_DriverIRQHandler(void);
+void I2S5_Tx_DriverIRQHandler(void);
+void I2S6_DriverIRQHandler(void);
+void I2S6_Rx_DriverIRQHandler(void);
+void I2S6_Tx_DriverIRQHandler(void);
+void LPI2C0_DriverIRQHandler(void);
+void LPI2C1_DriverIRQHandler(void);
+void LPI2C2_DriverIRQHandler(void);
+void LPI2C3_DriverIRQHandler(void);
+void LPI2C4_DriverIRQHandler(void);
+void LPI2C5_DriverIRQHandler(void);
+void LPI2C6_DriverIRQHandler(void);
+void LPSPI0_DriverIRQHandler(void);
+void LPSPI1_DriverIRQHandler(void);
+void LPSPI2_DriverIRQHandler(void);
+void LPSPI3_DriverIRQHandler(void);
+void LPSPI4_DriverIRQHandler(void);
+void LPSPI5_DriverIRQHandler(void);
+void LPUART0_DriverIRQHandler(void);
+void LPUART0_LPUART1_DriverIRQHandler(void);
+void LPUART0_LPUART1_RX_DriverIRQHandler(void);
+void LPUART0_LPUART1_TX_DriverIRQHandler(void);
+void LPUART0_RX_DriverIRQHandler(void);
+void LPUART0_TX_DriverIRQHandler(void);
+void LPUART10_DriverIRQHandler(void);
+void LPUART10_RX_DriverIRQHandler(void);
+void LPUART10_TX_DriverIRQHandler(void);
+void LPUART11_DriverIRQHandler(void);
+void LPUART11_RX_DriverIRQHandler(void);
+void LPUART11_TX_DriverIRQHandler(void);
+void LPUART12_DriverIRQHandler(void);
+void LPUART12_RX_DriverIRQHandler(void);
+void LPUART12_TX_DriverIRQHandler(void);
+void LPUART1_DriverIRQHandler(void);
+void LPUART1_RX_DriverIRQHandler(void);
+void LPUART1_TX_DriverIRQHandler(void);
+void LPUART2_DriverIRQHandler(void);
+void LPUART2_RX_DriverIRQHandler(void);
+void LPUART2_TX_DriverIRQHandler(void);
+void LPUART3_DriverIRQHandler(void);
+void LPUART3_RX_DriverIRQHandler(void);
+void LPUART3_TX_DriverIRQHandler(void);
+void LPUART4_DriverIRQHandler(void);
+void LPUART4_RX_DriverIRQHandler(void);
+void LPUART4_TX_DriverIRQHandler(void);
+void LPUART5_DriverIRQHandler(void);
+void LPUART5_RX_DriverIRQHandler(void);
+void LPUART5_TX_DriverIRQHandler(void);
+void LPUART6_DriverIRQHandler(void);
+void LPUART6_RX_DriverIRQHandler(void);
+void LPUART6_TX_DriverIRQHandler(void);
+void LPUART7_DriverIRQHandler(void);
+void LPUART7_RX_DriverIRQHandler(void);
+void LPUART7_TX_DriverIRQHandler(void);
+void LPUART8_DriverIRQHandler(void);
+void LPUART8_RX_DriverIRQHandler(void);
+void LPUART8_TX_DriverIRQHandler(void);
+void LPUART9_DriverIRQHandler(void);
+void LPUART9_RX_DriverIRQHandler(void);
+void LPUART9_TX_DriverIRQHandler(void);
+void LSIO_OCTASPI0_INT_DriverIRQHandler(void);
+void LSIO_OCTASPI1_INT_DriverIRQHandler(void);
+void M4_0_LPI2C_DriverIRQHandler(void);
+void M4_0_LPUART_DriverIRQHandler(void);
+void M4_1_LPI2C_DriverIRQHandler(void);
+void M4_1_LPUART_DriverIRQHandler(void);
+void M4_LPI2C_DriverIRQHandler(void);
+void M4_LPUART_DriverIRQHandler(void);
+void MIPI_DSI_DriverIRQHandler(void);
+void PDM_EVENT_DriverIRQHandler(void);
+void PDM_HWVAD_ERROR_DriverIRQHandler(void);
+void PDM_HWVAD_EVENT_DriverIRQHandler(void);
+void SAI0_DriverIRQHandler(void);
+void SAI1_DriverIRQHandler(void);
+void SAI2_DriverIRQHandler(void);
+void SAI3_DriverIRQHandler(void);
+void SAI3_RX_DriverIRQHandler(void);
+void SAI3_TX_DriverIRQHandler(void);
+void SAI4_DriverIRQHandler(void);
+void SAI5_DriverIRQHandler(void);
+void SAI6_DriverIRQHandler(void);
+void SPDIF_DriverIRQHandler(void);
+void UART2_FLEXIO_DriverIRQHandler(void);
+void USDHC0_DriverIRQHandler(void);
+void USDHC1_DriverIRQHandler(void);
+void USDHC2_DriverIRQHandler(void);
+#endif /* __rtems__ */
#if defined(__cplusplus)
}
#endif
diff --git a/bsps/arm/imxrt/mcux-sdk/drivers/lpuart/fsl_lpuart.c b/bsps/arm/imxrt/mcux-sdk/drivers/lpuart/fsl_lpuart.c
index 7369dc42a9..e847de6bb0 100644
--- a/bsps/arm/imxrt/mcux-sdk/drivers/lpuart/fsl_lpuart.c
+++ b/bsps/arm/imxrt/mcux-sdk/drivers/lpuart/fsl_lpuart.c
@@ -274,7 +274,11 @@ static void LPUART_ReadNonBlocking(LPUART_Type *base, uint8_t *data, size_t leng
* retval kStatus_LPUART_BaudrateNotSupport Baudrate is not support in current clock source.
* retval kStatus_Success LPUART initialize succeed
*/
+#ifndef __rtems__
status_t LPUART_Init(LPUART_Type *base, const lpuart_config_t *config, uint32_t srcClock_Hz)
+#else /* __rtems__ */
+status_t LPUART_Init(LPUART_Type *base, const lpuart_config_t *config, uint32_t srcClock_Hz, bool do_reset)
+#endif /* __rtems__ */
{
assert(NULL != config);
assert(0U < config->baudRate_Bps);
@@ -320,6 +324,7 @@ status_t LPUART_Init(LPUART_Type *base, const lpuart_config_t *config, uint32_t
}
}
+#ifndef __rtems__
/* Check to see if actual baud rate is within 3% of desired baud rate
* based on the best calculate OSR value */
if (baudDiff > ((config->baudRate_Bps / 100U) * 3U))
@@ -328,6 +333,12 @@ status_t LPUART_Init(LPUART_Type *base, const lpuart_config_t *config, uint32_t
status = kStatus_LPUART_BaudrateNotSupport;
}
else
+#else /* __rtems__ */
+ /*
+ * Better to have any baudrate then none. With this change, the function can
+ * not fail any more.
+ */
+#endif /* __rtems__ */
{
#if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
@@ -343,7 +354,13 @@ status_t LPUART_Init(LPUART_Type *base, const lpuart_config_t *config, uint32_t
#if defined(FSL_FEATURE_LPUART_HAS_GLOBAL) && FSL_FEATURE_LPUART_HAS_GLOBAL
/*Reset all internal logic and registers, except the Global Register */
+#ifndef __rtems__
LPUART_SoftwareReset(base);
+#else /* __rtems__ */
+ if (do_reset) {
+ LPUART_SoftwareReset(base);
+ }
+#endif /* __rtems__ */
#else
/* Disable LPUART TX RX before setting. */
base->CTRL &= ~(LPUART_CTRL_TE_MASK | LPUART_CTRL_RE_MASK);
diff --git a/bsps/arm/imxrt/mcux-sdk/drivers/lpuart/fsl_lpuart.h b/bsps/arm/imxrt/mcux-sdk/drivers/lpuart/fsl_lpuart.h
index 72fadfd201..14409ae6e1 100644
--- a/bsps/arm/imxrt/mcux-sdk/drivers/lpuart/fsl_lpuart.h
+++ b/bsps/arm/imxrt/mcux-sdk/drivers/lpuart/fsl_lpuart.h
@@ -389,7 +389,11 @@ static inline void LPUART_SoftwareReset(LPUART_Type *base)
* @retval kStatus_LPUART_BaudrateNotSupport Baudrate is not support in current clock source.
* @retval kStatus_Success LPUART initialize succeed
*/
+#ifndef __rtems__
status_t LPUART_Init(LPUART_Type *base, const lpuart_config_t *config, uint32_t srcClock_Hz);
+#else /* __rtems__ */
+status_t LPUART_Init(LPUART_Type *base, const lpuart_config_t *config, uint32_t srcClock_Hz, bool do_reset);
+#endif /* __rtems__ */
/*!
* @brief Deinitializes a LPUART instance.
diff --git a/bsps/arm/imxrt/mcux-sdk/drivers/qtmr_1/fsl_qtmr.c b/bsps/arm/imxrt/mcux-sdk/drivers/qtmr_1/fsl_qtmr.c
index 9bb3fa7386..a4e393896b 100644
--- a/bsps/arm/imxrt/mcux-sdk/drivers/qtmr_1/fsl_qtmr.c
+++ b/bsps/arm/imxrt/mcux-sdk/drivers/qtmr_1/fsl_qtmr.c
@@ -6,6 +6,11 @@
*/
#include "fsl_qtmr.h"
+#ifdef __rtems__
+#include <bsp.h>
+#include <bsp/irq.h>
+#include <libfdt.h>
+#endif /* __rtems__ */
/* Component ID definition, used by tools. */
#ifndef FSL_COMPONENT_ID
@@ -58,6 +63,41 @@ static uint32_t QTMR_GetInstance(TMR_Type *base)
return instance;
}
+#ifdef __rtems__
+TMR_Type *QTMR_get_regs_from_fdt(const void *fdt, int node)
+{
+ int rv;
+ TMR_Type *regs;
+
+ rv = fdt_node_check_compatible(fdt, node, "nxp,imxrt-qtimer");
+ if (rv != 0) {
+ return NULL;
+ }
+ regs = imx_get_reg_of_node(fdt, node);
+ return regs;
+}
+
+rtems_vector_number QTMR_get_IRQ_from_fdt(const void *fdt, int node)
+{
+ int rv;
+ rtems_vector_number irq;
+
+ rv = fdt_node_check_compatible(fdt, node, "nxp,imxrt-qtimer");
+ if (rv != 0) {
+ return BSP_INTERRUPT_VECTOR_INVALID;
+ }
+ irq = imx_get_irq_of_node(fdt, node, 0);
+ return irq;
+}
+
+uint32_t QTMR_get_src_clk(TMR_Type *base)
+{
+ (void) base;
+
+ return CLOCK_GetFreq(kCLOCK_IpgClk);
+}
+
+#endif /* __rtems__ */
/*!
* brief Ungates the Quad Timer clock and configures the peripheral for basic operation.
*
diff --git a/bsps/arm/imxrt/mcux-sdk/drivers/qtmr_1/fsl_qtmr.h b/bsps/arm/imxrt/mcux-sdk/drivers/qtmr_1/fsl_qtmr.h
index ec5d727e08..0b45dace35 100644
--- a/bsps/arm/imxrt/mcux-sdk/drivers/qtmr_1/fsl_qtmr.h
+++ b/bsps/arm/imxrt/mcux-sdk/drivers/qtmr_1/fsl_qtmr.h
@@ -8,6 +8,9 @@
#define _FSL_QTMR_H_
#include "fsl_common.h"
+#ifdef __rtems__
+#include <rtems.h>
+#endif /* __rtems__ */
/*!
* @addtogroup qtmr
@@ -191,6 +194,37 @@ extern "C" {
* @name Initialization and deinitialization
* @{
*/
+#ifdef __rtems__
+/*!
+ * @brief Return the timer base based on a FDT node.
+ *
+ * @param fdt Pointer to the fdt
+ * @param node The FDT node
+ *
+ * @return Pointer to the timer. NULL on error (for example if node isn't
+ * compatible).
+ */
+TMR_Type *QTMR_get_regs_from_fdt(const void *fdt, int node);
+
+/*!
+ * @brief Return the timer IRQ vector based on a FDT node.
+ *
+ * @param fdt Pointer to the fdt
+ * @param node The FDT node
+ *
+ * @return IRQ vector number. BSP_INTERRUPT_VECTOR_INVALID on error.
+ */
+rtems_vector_number QTMR_get_IRQ_from_fdt(const void *fdt, int node);
+
+/*!
+ * @brief Return the clock source frequency of the quad timer.
+ *
+ * @param base Quad Timer peripheral base address.
+ *
+ * @return Clock frequency value in hertz.
+ */
+uint32_t QTMR_get_src_clk(TMR_Type *base);
+#endif /* __rtems__ */
/*!
* @brief Ungates the Quad Timer clock and configures the peripheral for basic operation.
--
2.35.3
More information about the devel
mailing list