diff options
Diffstat (limited to 'bsps/arm')
-rw-r--r-- | bsps/arm/include/dev/irq/arm-gic-arch.h | 23 | ||||
-rw-r--r-- | bsps/arm/raspberrypi/clock/clockdrv.c | 94 | ||||
-rw-r--r-- | bsps/arm/raspberrypi/include/bsp/irq.h | 28 | ||||
-rw-r--r-- | bsps/arm/raspberrypi/irq/irq.c | 23 | ||||
-rw-r--r-- | bsps/arm/xen/include/bsp/irq.h | 2 | ||||
-rw-r--r-- | bsps/arm/xilinx-zynq/console/console-config.c | 49 | ||||
-rw-r--r-- | bsps/arm/xilinx-zynq/console/console-init.c | 20 | ||||
-rw-r--r-- | bsps/arm/xilinx-zynq/console/debug-console.c | 90 | ||||
-rw-r--r-- | bsps/arm/xilinx-zynq/include/bsp.h | 4 | ||||
-rw-r--r-- | bsps/arm/xilinx-zynq/start/bspreset.c | 6 | ||||
-rw-r--r-- | bsps/arm/xilinx-zynqmp-rpu/console/console-config.c | 57 | ||||
-rw-r--r-- | bsps/arm/xilinx-zynqmp-rpu/include/bsp.h | 5 | ||||
-rw-r--r-- | bsps/arm/xilinx-zynqmp-rpu/include/bsp/irq.h | 1 | ||||
-rw-r--r-- | bsps/arm/xilinx-zynqmp/console/console-config.c | 57 | ||||
-rw-r--r-- | bsps/arm/xilinx-zynqmp/include/bsp.h | 2 |
15 files changed, 81 insertions, 380 deletions
diff --git a/bsps/arm/include/dev/irq/arm-gic-arch.h b/bsps/arm/include/dev/irq/arm-gic-arch.h index c9931be61a..f6c8b5d426 100644 --- a/bsps/arm/include/dev/irq/arm-gic-arch.h +++ b/bsps/arm/include/dev/irq/arm-gic-arch.h @@ -3,9 +3,10 @@ /** * @file * - * @ingroup RTEMSBSPsARMShared + * @ingroup DevIRQGIC * - * @brief ARM-specific IRQ handlers. + * @brief This header file provides interfaces of the ARM Generic Interrupt + * Controller (GIC) support specific to the Arm architecture. */ /* @@ -44,12 +45,20 @@ extern "C" { #endif -static inline void arm_interrupt_handler_dispatch(rtems_vector_number vector) +/** + * @addtogroup DevIRQGIC + * + * @{ + */ + +static inline uint32_t arm_interrupt_enable_interrupts(void) { - uint32_t psr = _ARMV4_Status_irq_enable(); - bsp_interrupt_handler_dispatch(vector); + return _ARMV4_Status_irq_enable(); +} - _ARMV4_Status_restore(psr); +static inline void arm_interrupt_restore_interrupts(uint32_t status) +{ + _ARMV4_Status_restore(status); } static inline void arm_interrupt_facility_set_exception_handler(void) @@ -60,6 +69,8 @@ static inline void arm_interrupt_facility_set_exception_handler(void) */ } +/** @} */ + #ifdef __cplusplus } #endif diff --git a/bsps/arm/raspberrypi/clock/clockdrv.c b/bsps/arm/raspberrypi/clock/clockdrv.c deleted file mode 100644 index bb8490d03a..0000000000 --- a/bsps/arm/raspberrypi/clock/clockdrv.c +++ /dev/null @@ -1,94 +0,0 @@ -/** - * @file - * - * @ingroup RTEMSDriverClockImpl - * - * @brief This source file contains the implementation of the BCM2835 Clock - * Driver. - */ - -/* - * Copyright (c) 2013 Alan Cudmore - * Copyright (c) 2016 Pavel Pisa - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * - * http://www.rtems.org/license/LICENSE - * -*/ - -#include <rtems.h> -#include <bsp.h> -#include <bsp/irq.h> -#include <bsp/irq-generic.h> -#include <bsp/raspberrypi.h> -#include <rtems/timecounter.h> - -static struct timecounter raspberrypi_tc; - -static uint32_t raspberrypi_clock_get_timecount(struct timecounter *tc) -{ - return BCM2835_REG(BCM2835_GPU_TIMER_CLO); -} - -static void raspberrypi_clock_at_tick(void) -{ - uint32_t act_val; - uint32_t next_cmp = BCM2835_REG(BCM2835_GPU_TIMER_C3); - next_cmp += rtems_configuration_get_microseconds_per_tick(); - BCM2835_REG(BCM2835_GPU_TIMER_C3) = next_cmp; - act_val = BCM2835_REG(BCM2835_GPU_TIMER_CLO); - - /* - * Clear interrupt only if there is time left to the next tick. - * If time of the next tick has already passed then interrupt - * request stays active and fires immediately after current tick - * processing is finished. - */ - if ((int32_t)(next_cmp - act_val) > 0) - BCM2835_REG(BCM2835_GPU_TIMER_CS) = BCM2835_GPU_TIMER_CS_M3; -} - -static void raspberrypi_clock_handler_install_isr( - rtems_interrupt_handler clock_isr -) -{ - rtems_status_code sc = RTEMS_SUCCESSFUL; - - sc = rtems_interrupt_handler_install( - BCM2835_IRQ_ID_GPU_TIMER_M3, - "Clock", - RTEMS_INTERRUPT_UNIQUE, - clock_isr, - NULL - ); - if ( sc != RTEMS_SUCCESSFUL ) { - rtems_fatal_error_occurred(0xdeadbeef); - } -} - -static void raspberrypi_clock_initialize_hardware(void) -{ - uint32_t next_cmp = BCM2835_REG(BCM2835_GPU_TIMER_CLO); - next_cmp += rtems_configuration_get_microseconds_per_tick(); - BCM2835_REG(BCM2835_GPU_TIMER_C3) = next_cmp; - BCM2835_REG(BCM2835_GPU_TIMER_CS) = BCM2835_GPU_TIMER_CS_M3; - - raspberrypi_tc.tc_get_timecount = raspberrypi_clock_get_timecount; - raspberrypi_tc.tc_counter_mask = 0xffffffff; - raspberrypi_tc.tc_frequency = 1000000; /* 1 MHz */ - raspberrypi_tc.tc_quality = RTEMS_TIMECOUNTER_QUALITY_CLOCK_DRIVER; - rtems_timecounter_install(&raspberrypi_tc); -} - -#define Clock_driver_support_at_tick(arg) raspberrypi_clock_at_tick() - -#define Clock_driver_support_initialize_hardware() raspberrypi_clock_initialize_hardware() - -#define Clock_driver_support_install_isr(clock_isr) \ - raspberrypi_clock_handler_install_isr(clock_isr) - -#define CLOCK_DRIVER_USE_ONLY_BOOT_PROCESSOR 1 - -#include "../../../shared/dev/clock/clockimpl.h" diff --git a/bsps/arm/raspberrypi/include/bsp/irq.h b/bsps/arm/raspberrypi/include/bsp/irq.h index 6801b01d84..895b268dfe 100644 --- a/bsps/arm/raspberrypi/include/bsp/irq.h +++ b/bsps/arm/raspberrypi/include/bsp/irq.h @@ -22,12 +22,6 @@ #ifndef ASM #include <rtems.h> -#include <rtems/irq.h> -#include <rtems/irq-extension.h> - -#if defined(RTEMS_SMP) -#include <rtems/score/processormask.h> -#endif /** * @defgroup raspberrypi_interrupt Interrrupt Support @@ -78,27 +72,5 @@ #define BSP_IRQ_COUNT (BCM2835_INTC_TOTAL_IRQ) -#if defined(RTEMS_SMP) -static inline rtems_status_code bsp_interrupt_set_affinity( - rtems_vector_number vector, - const Processor_mask *affinity -) -{ - (void) vector; - (void) affinity; - return RTEMS_UNSATISFIED; -} - -static inline rtems_status_code bsp_interrupt_get_affinity( - rtems_vector_number vector, - Processor_mask *affinity -) -{ - (void) vector; - _Processor_mask_From_index( affinity, 0 ); - return RTEMS_UNSATISFIED; -} -#endif - #endif /* ASM */ #endif /* LIBBSP_ARM_RASPBERRYPI_IRQ_H */ diff --git a/bsps/arm/raspberrypi/irq/irq.c b/bsps/arm/raspberrypi/irq/irq.c index 30e10e5aec..7177cd2c05 100644 --- a/bsps/arm/raspberrypi/irq/irq.c +++ b/bsps/arm/raspberrypi/irq/irq.c @@ -19,7 +19,6 @@ #include <rtems/score/armv4.h> #include <bsp.h> -#include <bsp/irq.h> #include <bsp/irq-generic.h> #include <bsp/raspberrypi.h> #include <bsp/linker-symbols.h> @@ -207,6 +206,28 @@ rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector) return RTEMS_SUCCESSFUL; } +#if defined(RTEMS_SMP) +rtems_status_code bsp_interrupt_get_affinity( + rtems_vector_number vector, + Processor_mask *affinity +) +{ + (void) vector; + _Processor_mask_From_index( affinity, 0 ); + return RTEMS_UNSATISFIED; +} + +rtems_status_code bsp_interrupt_set_affinity( + rtems_vector_number vector, + const Processor_mask *affinity +) +{ + (void) vector; + (void) affinity; + return RTEMS_UNSATISFIED; +} +#endif + void bsp_interrupt_handler_default(rtems_vector_number vector) { printk("spurious interrupt: %" PRIdrtems_vector_number "\n", vector); diff --git a/bsps/arm/xen/include/bsp/irq.h b/bsps/arm/xen/include/bsp/irq.h index 58ce78ffd2..e64fde3037 100644 --- a/bsps/arm/xen/include/bsp/irq.h +++ b/bsps/arm/xen/include/bsp/irq.h @@ -40,7 +40,7 @@ extern "C" { #endif /* __cplusplus */ -#define BSP_INTERRUPT_VECTOR_COUNT 1024 +#define BSP_INTERRUPT_VECTOR_COUNT 1019 /* Xen guest interrupts */ #define GUEST_TIMER_VIRT_PPI 27 diff --git a/bsps/arm/xilinx-zynq/console/console-config.c b/bsps/arm/xilinx-zynq/console/console-config.c deleted file mode 100644 index d22ceb557d..0000000000 --- a/bsps/arm/xilinx-zynq/console/console-config.c +++ /dev/null @@ -1,49 +0,0 @@ -/* SPDX-License-Identifier: BSD-2-Clause */ - -/** - * @file - * - * @ingroup RTEMSBSPsARMZynq - * - * @brief This source file contains the definition of ::zynq_uart_instances. - */ - -/* - * Copyright (C) 2013, 2017 embedded brains GmbH & Co. KG - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <bsp/irq.h> -#include <dev/serial/zynq-uart.h> - -zynq_uart_context zynq_uart_instances[2] = { - { - .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER( "Zynq UART 0" ), - .regs = (volatile struct zynq_uart *) 0xe0000000, - .irq = ZYNQ_IRQ_UART_0 - }, { - .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER( "Zynq UART 1" ), - .regs = (volatile struct zynq_uart *) 0xe0001000, - .irq = ZYNQ_IRQ_UART_1 - } -}; diff --git a/bsps/arm/xilinx-zynq/console/console-init.c b/bsps/arm/xilinx-zynq/console/console-init.c index 72fa27da11..2018aaa710 100644 --- a/bsps/arm/xilinx-zynq/console/console-init.c +++ b/bsps/arm/xilinx-zynq/console/console-init.c @@ -29,7 +29,22 @@ #include <rtems/termiostypes.h> #include <bsp.h> +#include <bsp/bootcard.h> +#include <bsp/irq.h> #include <dev/serial/zynq-uart.h> +#include <dev/serial/zynq-uart-regs.h> + +static zynq_uart_context zynq_uart_instances[2] = { + { + .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER( "Zynq UART 0" ), + .regs = (volatile zynq_uart *) ZYNQ_UART_0_BASE_ADDR, + .irq = ZYNQ_IRQ_UART_0 + }, { + .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER( "Zynq UART 1" ), + .regs = (volatile zynq_uart *) ZYNQ_UART_1_BASE_ADDR, + .irq = ZYNQ_IRQ_UART_1 + } +}; rtems_status_code console_initialize( rtems_device_major_number major, @@ -42,6 +57,7 @@ rtems_status_code console_initialize( rtems_termios_initialize(); for (i = 0; i < RTEMS_ARRAY_SIZE(zynq_uart_instances); ++i) { + zynq_uart_context *ctx = &zynq_uart_instances[i]; char uart[] = "/dev/ttySX"; uart[sizeof(uart) - 2] = (char) ('0' + i); @@ -49,10 +65,10 @@ rtems_status_code console_initialize( &uart[0], &zynq_uart_handler, NULL, - &zynq_uart_instances[i].base + &ctx->base ); - if (i == BSP_CONSOLE_MINOR) { + if (ctx->regs == (zynq_uart *) ZYNQ_UART_KERNEL_IO_BASE_ADDR) { link(&uart[0], CONSOLE_DEVICE_NAME); } } diff --git a/bsps/arm/xilinx-zynq/console/debug-console.c b/bsps/arm/xilinx-zynq/console/debug-console.c deleted file mode 100644 index d398ca7988..0000000000 --- a/bsps/arm/xilinx-zynq/console/debug-console.c +++ /dev/null @@ -1,90 +0,0 @@ -/* SPDX-License-Identifier: BSD-2-Clause */ - -/** - * @file - * - * @ingroup RTEMSBSPsARMZynq - * - * @brief This source file contains the definition of ::BSP_output_char and - * ::BSP_poll_char. - */ - -/* - * Copyright (C) 2013, 2017 embedded brains GmbH & Co. KG - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include <rtems/bspIo.h> -#include <rtems/sysinit.h> - -#include <bsp.h> -#include <dev/serial/zynq-uart.h> - -#include <bspopts.h> - -static void zynq_debug_console_out(char c) -{ - rtems_termios_device_context *base = - &zynq_uart_instances[BSP_CONSOLE_MINOR].base; - - zynq_uart_write_polled(base, c); -} - -static void zynq_debug_console_early_init(char c); - -static void zynq_debug_console_init(void) -{ - rtems_termios_device_context *base = - &zynq_uart_instances[BSP_CONSOLE_MINOR].base; - - if (BSP_output_char != zynq_debug_console_early_init) { - return; - } - - zynq_uart_initialize(base); - BSP_output_char = zynq_debug_console_out; -} - -static void zynq_debug_console_early_init(char c) -{ - zynq_debug_console_init(); - zynq_debug_console_out(c); -} - -static int zynq_debug_console_in(void) -{ - rtems_termios_device_context *base = - &zynq_uart_instances[BSP_CONSOLE_MINOR].base; - - return zynq_uart_read_polled(base); -} - -BSP_output_char_function_type BSP_output_char = zynq_debug_console_early_init; - -BSP_polling_getchar_function_type BSP_poll_char = zynq_debug_console_in; - -RTEMS_SYSINIT_ITEM( - zynq_debug_console_init, - RTEMS_SYSINIT_BSP_START, - RTEMS_SYSINIT_ORDER_LAST_BUT_5 -); diff --git a/bsps/arm/xilinx-zynq/include/bsp.h b/bsps/arm/xilinx-zynq/include/bsp.h index 3311a99b50..151e603812 100644 --- a/bsps/arm/xilinx-zynq/include/bsp.h +++ b/bsps/arm/xilinx-zynq/include/bsp.h @@ -54,7 +54,7 @@ #include <bsp/default-initial-extension.h> #include <bsp/start.h> -#include <dev/serial/zynq-uart.h> +#include <dev/serial/zynq-uart-zynq.h> #ifdef __cplusplus extern "C" { @@ -74,8 +74,6 @@ extern "C" { #define BSP_ARM_L2C_310_ID 0x410000c8 -extern zynq_uart_context zynq_uart_instances[2]; - /** * @brief Zynq specific set up of the MMU. * diff --git a/bsps/arm/xilinx-zynq/start/bspreset.c b/bsps/arm/xilinx-zynq/start/bspreset.c index f8cc3b6999..b6cf09ba02 100644 --- a/bsps/arm/xilinx-zynq/start/bspreset.c +++ b/bsps/arm/xilinx-zynq/start/bspreset.c @@ -35,14 +35,16 @@ #include <bsp.h> #include <bsp/bootcard.h> -#include <dev/serial/zynq-uart.h> +#include <dev/serial/zynq-uart-regs.h> void bsp_reset(void) { + volatile zynq_uart *regs = + (volatile zynq_uart *) ZYNQ_UART_KERNEL_IO_BASE_ADDR; volatile uint32_t *slcr_unlock = (volatile uint32_t *) 0xf8000008; volatile uint32_t *pss_rst_ctrl = (volatile uint32_t *) 0xf8000200; - zynq_uart_reset_tx_flush(&zynq_uart_instances[BSP_CONSOLE_MINOR]); + zynq_uart_reset_tx_flush(regs); while (true) { *slcr_unlock = 0xdf0d; diff --git a/bsps/arm/xilinx-zynqmp-rpu/console/console-config.c b/bsps/arm/xilinx-zynqmp-rpu/console/console-config.c index f52e008f2b..db03d1e9f3 100644 --- a/bsps/arm/xilinx-zynqmp-rpu/console/console-config.c +++ b/bsps/arm/xilinx-zynqmp-rpu/console/console-config.c @@ -32,22 +32,22 @@ #include <rtems/console.h> #include <rtems/bspIo.h> -#include <rtems/sysinit.h> #include <rtems/termiostypes.h> #include <bsp/irq.h> #include <dev/serial/zynq-uart.h> +#include <dev/serial/zynq-uart-regs.h> #include <bspopts.h> static zynq_uart_context zynqmp_uart_instances[2] = { { .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER( "Zynq UART 0" ), - .regs = (volatile struct zynq_uart *) 0xff000000, + .regs = (volatile zynq_uart *) ZYNQ_UART_0_BASE_ADDR, .irq = ZYNQMP_IRQ_UART_0 }, { .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER( "Zynq UART 1" ), - .regs = (volatile struct zynq_uart *) 0xff010000, + .regs = (volatile zynq_uart *) ZYNQ_UART_1_BASE_ADDR, .irq = ZYNQMP_IRQ_UART_1 } }; @@ -61,6 +61,7 @@ rtems_status_code console_initialize( size_t i; for (i = 0; i < RTEMS_ARRAY_SIZE(zynqmp_uart_instances); ++i) { + zynq_uart_context *ctx = &zynqmp_uart_instances[i]; char uart[] = "/dev/ttySX"; uart[sizeof(uart) - 2] = (char) ('0' + i); @@ -68,10 +69,10 @@ rtems_status_code console_initialize( &uart[0], &zynq_uart_handler, NULL, - &zynqmp_uart_instances[i].base + &ctx->base ); - if (i == BSP_CONSOLE_MINOR) { + if (ctx->regs == (zynq_uart *) ZYNQ_UART_KERNEL_IO_BASE_ADDR) { link(&uart[0], CONSOLE_DEVICE_NAME); } } @@ -81,49 +82,5 @@ rtems_status_code console_initialize( void zynqmp_debug_console_flush(void) { - zynq_uart_reset_tx_flush(&zynqmp_uart_instances[BSP_CONSOLE_MINOR]); + zynq_uart_reset_tx_flush((zynq_uart *) ZYNQ_UART_KERNEL_IO_BASE_ADDR); } - -static void zynqmp_debug_console_out(char c) -{ - rtems_termios_device_context *base = - &zynqmp_uart_instances[BSP_CONSOLE_MINOR].base; - - zynq_uart_write_polled(base, c); -} - -static void zynqmp_debug_console_init(void) -{ - rtems_termios_device_context *base = - &zynqmp_uart_instances[BSP_CONSOLE_MINOR].base; - - zynq_uart_initialize(base); - BSP_output_char = zynqmp_debug_console_out; -} - -static void zynqmp_debug_console_early_init(char c) -{ - rtems_termios_device_context *base = - &zynqmp_uart_instances[BSP_CONSOLE_MINOR].base; - - zynq_uart_initialize(base); - zynqmp_debug_console_out(c); -} - -static int zynqmp_debug_console_in(void) -{ - rtems_termios_device_context *base = - &zynqmp_uart_instances[BSP_CONSOLE_MINOR].base; - - return zynq_uart_read_polled(base); -} - -BSP_output_char_function_type BSP_output_char = zynqmp_debug_console_early_init; - -BSP_polling_getchar_function_type BSP_poll_char = zynqmp_debug_console_in; - -RTEMS_SYSINIT_ITEM( - zynqmp_debug_console_init, - RTEMS_SYSINIT_BSP_START, - RTEMS_SYSINIT_ORDER_LAST_BUT_5 -); diff --git a/bsps/arm/xilinx-zynqmp-rpu/include/bsp.h b/bsps/arm/xilinx-zynqmp-rpu/include/bsp.h index e386bd4b26..70ad4f3c57 100644 --- a/bsps/arm/xilinx-zynqmp-rpu/include/bsp.h +++ b/bsps/arm/xilinx-zynqmp-rpu/include/bsp.h @@ -59,7 +59,8 @@ #include <bsp/default-initial-extension.h> #include <bsp/start.h> -#include <peripheral_maps/xilinx_zynqmp.h> + +#include <dev/serial/zynq-uart-zynqmp.h> #ifdef __cplusplus extern "C" { @@ -74,8 +75,6 @@ extern "C" { #define BSP_ARM_A9MPCORE_GT_BASE 0 -#define BSP_SELECTED_TTC_ADDR ZYNQMP_TTC0 - /** * @brief Zynq UltraScale+ MPSoC specific set up of the MMU. * diff --git a/bsps/arm/xilinx-zynqmp-rpu/include/bsp/irq.h b/bsps/arm/xilinx-zynqmp-rpu/include/bsp/irq.h index a65e5404f0..51aa613cdd 100644 --- a/bsps/arm/xilinx-zynqmp-rpu/include/bsp/irq.h +++ b/bsps/arm/xilinx-zynqmp-rpu/include/bsp/irq.h @@ -51,7 +51,6 @@ extern "C" { #endif /* __cplusplus */ -#define BSP_SELECTED_TTC_IRQ ZYNQMP_IRQ_TTC_0_0 #define BSP_INTERRUPT_VECTOR_COUNT 188 /** @} */ diff --git a/bsps/arm/xilinx-zynqmp/console/console-config.c b/bsps/arm/xilinx-zynqmp/console/console-config.c index eadd7f11a2..550e930415 100644 --- a/bsps/arm/xilinx-zynqmp/console/console-config.c +++ b/bsps/arm/xilinx-zynqmp/console/console-config.c @@ -32,22 +32,22 @@ #include <rtems/console.h> #include <rtems/bspIo.h> -#include <rtems/sysinit.h> #include <rtems/termiostypes.h> #include <bsp/irq.h> #include <dev/serial/zynq-uart.h> +#include <dev/serial/zynq-uart-regs.h> #include <bspopts.h> static zynq_uart_context zynqmp_uart_instances[2] = { { .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER( "Zynq UART 0" ), - .regs = (volatile struct zynq_uart *) 0xff000000, + .regs = (volatile zynq_uart *) ZYNQ_UART_0_BASE_ADDR, .irq = ZYNQMP_IRQ_UART_0 }, { .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER( "Zynq UART 1" ), - .regs = (volatile struct zynq_uart *) 0xff010000, + .regs = (volatile zynq_uart *) ZYNQ_UART_1_BASE_ADDR, .irq = ZYNQMP_IRQ_UART_1 } }; @@ -63,6 +63,7 @@ rtems_status_code console_initialize( rtems_termios_initialize(); for (i = 0; i < RTEMS_ARRAY_SIZE(zynqmp_uart_instances); ++i) { + zynq_uart_context *ctx = &zynqmp_uart_instances[i]; char uart[] = "/dev/ttySX"; uart[sizeof(uart) - 2] = (char) ('0' + i); @@ -70,10 +71,10 @@ rtems_status_code console_initialize( &uart[0], &zynq_uart_handler, NULL, - &zynqmp_uart_instances[i].base + &ctx->base ); - if (i == BSP_CONSOLE_MINOR) { + if (ctx->regs == (zynq_uart *) ZYNQ_UART_KERNEL_IO_BASE_ADDR) { link(&uart[0], CONSOLE_DEVICE_NAME); } } @@ -83,49 +84,5 @@ rtems_status_code console_initialize( void zynqmp_debug_console_flush(void) { - zynq_uart_reset_tx_flush(&zynqmp_uart_instances[BSP_CONSOLE_MINOR]); + zynq_uart_reset_tx_flush((zynq_uart *) ZYNQ_UART_KERNEL_IO_BASE_ADDR); } - -static void zynqmp_debug_console_out(char c) -{ - rtems_termios_device_context *base = - &zynqmp_uart_instances[BSP_CONSOLE_MINOR].base; - - zynq_uart_write_polled(base, c); -} - -static void zynqmp_debug_console_init(void) -{ - rtems_termios_device_context *base = - &zynqmp_uart_instances[BSP_CONSOLE_MINOR].base; - - zynq_uart_initialize(base); - BSP_output_char = zynqmp_debug_console_out; -} - -static void zynqmp_debug_console_early_init(char c) -{ - rtems_termios_device_context *base = - &zynqmp_uart_instances[BSP_CONSOLE_MINOR].base; - - zynq_uart_initialize(base); - zynqmp_debug_console_out(c); -} - -static int zynqmp_debug_console_in(void) -{ - rtems_termios_device_context *base = - &zynqmp_uart_instances[BSP_CONSOLE_MINOR].base; - - return zynq_uart_read_polled(base); -} - -BSP_output_char_function_type BSP_output_char = zynqmp_debug_console_early_init; - -BSP_polling_getchar_function_type BSP_poll_char = zynqmp_debug_console_in; - -RTEMS_SYSINIT_ITEM( - zynqmp_debug_console_init, - RTEMS_SYSINIT_BSP_START, - RTEMS_SYSINIT_ORDER_LAST_BUT_5 -); diff --git a/bsps/arm/xilinx-zynqmp/include/bsp.h b/bsps/arm/xilinx-zynqmp/include/bsp.h index a08a5feee9..cdc37b79a4 100644 --- a/bsps/arm/xilinx-zynqmp/include/bsp.h +++ b/bsps/arm/xilinx-zynqmp/include/bsp.h @@ -60,6 +60,8 @@ #include <bsp/default-initial-extension.h> #include <bsp/start.h> +#include <dev/serial/zynq-uart-zynqmp.h> + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ |