diff options
Diffstat (limited to 'bsps/riscv/griscv')
-rw-r--r-- | bsps/riscv/griscv/clock/clockdrv.c | 39 | ||||
-rw-r--r-- | bsps/riscv/griscv/console/console.c | 27 | ||||
-rw-r--r-- | bsps/riscv/griscv/console/printk_support.c | 48 | ||||
-rw-r--r-- | bsps/riscv/griscv/include/amba.h | 25 | ||||
-rw-r--r-- | bsps/riscv/griscv/include/bsp.h | 6 | ||||
-rw-r--r-- | bsps/riscv/griscv/include/bsp/irq.h | 15 | ||||
-rw-r--r-- | bsps/riscv/griscv/irq/irq.c | 3 | ||||
-rw-r--r-- | bsps/riscv/griscv/start/bsp_fatal_halt.c | 2 | ||||
-rw-r--r-- | bsps/riscv/griscv/start/bspsmp.c | 2 | ||||
-rw-r--r-- | bsps/riscv/griscv/start/bspstart.c | 2 |
10 files changed, 120 insertions, 49 deletions
diff --git a/bsps/riscv/griscv/clock/clockdrv.c b/bsps/riscv/griscv/clock/clockdrv.c index 4cf15fe4f8..3174bae468 100644 --- a/bsps/riscv/griscv/clock/clockdrv.c +++ b/bsps/riscv/griscv/clock/clockdrv.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* * Clock Tick Device Driver * @@ -13,16 +15,33 @@ * COPYRIGHT (c) 2004. * Gaisler Research. * - * Copyright (c) 2014, 2018 embedded brains GmbH + * Copyright (C) 2014, 2018 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. * - * 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. + * 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.h> #include <amba.h> -#include <bsp/irq.h> +#include <bsp/irq-generic.h> #include <bspopts.h> #include <bsp/fatal.h> #include <rtems/rtems/intr.h> @@ -187,7 +206,13 @@ CPU_Counter_ticks _CPU_Counter_read( void ) { unsigned long timec; - __asm__ volatile ( "csrr %0, time" : "=&r" ( timec ) ); + __asm__ volatile ( + ".option push\n" + ".option arch, +zicsr\n" + "csrr %0, time\n" + ".option pop" : + "=&r" ( timec ) + ); return timec; } @@ -195,7 +220,7 @@ CPU_Counter_ticks _CPU_Counter_read( void ) #define Clock_driver_support_initialize_hardware() \ grlib_clock_initialize() -#define Clock_driver_timecounter_tick() grlib_tc_do_tick() +#define Clock_driver_timecounter_tick(arg) grlib_tc_do_tick() #include "../../../shared/dev/clock/clockimpl.h" diff --git a/bsps/riscv/griscv/console/console.c b/bsps/riscv/griscv/console/console.c index c0e19cddfe..0627be5ee3 100644 --- a/bsps/riscv/griscv/console/console.c +++ b/bsps/riscv/griscv/console/console.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* * This file contains the TTY driver for the GRLIB APBUART * @@ -10,9 +12,26 @@ * COPYRIGHT (c) 2004. * Gaisler Research. * - * 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. + * 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. */ /* Define CONSOLE_USE_INTERRUPTS to enable APBUART interrupt handling instead @@ -63,7 +82,7 @@ static int find_matching_apbuart(struct ambapp_dev *dev, int index, void *arg) struct ambapp_apb_info *apb = (struct ambapp_apb_info *)dev->devinfo; /* Extract needed information of one APBUART */ - apbuarts[uarts].regs = (struct apbuart_regs *)apb->start; + apbuarts[uarts].regs = (apbuart *)apb->start; apbuarts[uarts].irq = apb->common.irq; /* Get APBUART core frequency, it is assumed that it is the same * as Bus frequency where the UART is situated diff --git a/bsps/riscv/griscv/console/printk_support.c b/bsps/riscv/griscv/console/printk_support.c index f232203520..f3af16be4d 100644 --- a/bsps/riscv/griscv/console/printk_support.c +++ b/bsps/riscv/griscv/console/printk_support.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /* * This file contains the TTY driver for the GRLIb APBUART * @@ -10,9 +12,26 @@ * COPYRIGHT (c) 2011. * Aeroflex Gaisler. * - * 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. + * 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.h> @@ -24,9 +43,10 @@ #include <stdio.h> #include <grlib/apbuart.h> #include <grlib/ambapp.h> +#include <grlib/io.h> int grlib_debug_uart_index __attribute__((weak)) = 0; -struct apbuart_regs *grlib_debug_uart = NULL; +apbuart *grlib_debug_uart = NULL; /* Before UART driver has registered (or when no UART is available), calls to * printk that gets to bsp_out_char() will be filling data into the @@ -68,13 +88,17 @@ static void bsp_debug_uart_init(void) VENDOR_GAISLER, GAISLER_APBUART, ambapp_find_by_idx, (void *)&i); if (adev) { + uint32_t ctrl; + /* Found a matching debug console, initialize debug uart if present * for printk */ apb = (struct ambapp_apb_info *)adev->devinfo; - grlib_debug_uart = (struct apbuart_regs *)apb->start; - grlib_debug_uart->ctrl |= APBUART_CTRL_RE | APBUART_CTRL_TE; - grlib_debug_uart->status = 0; + grlib_debug_uart = (apbuart *)apb->start; + ctrl = grlib_load_32(&grlib_debug_uart->ctrl); + ctrl |= APBUART_CTRL_RE | APBUART_CTRL_TE; + grlib_store_32(&grlib_debug_uart->ctrl, ctrl); + grlib_store_32(&grlib_debug_uart->status, 0); } } @@ -88,10 +112,14 @@ RTEMS_SYSINIT_ITEM( static void bsp_out_char(char c) { if (grlib_debug_uart == NULL) { + uint32_t ctrl; + /* Try to assign standard UART address to debug driver to pass some tests */ - grlib_debug_uart = (struct apbuart_regs *) 0x80000100; - grlib_debug_uart->ctrl |= APBUART_CTRL_RE | APBUART_CTRL_TE; - grlib_debug_uart->status = 0; + grlib_debug_uart = (apbuart *) 0x80000100; + ctrl = grlib_load_32(&grlib_debug_uart->ctrl); + ctrl |= APBUART_CTRL_RE | APBUART_CTRL_TE; + grlib_store_32(&grlib_debug_uart->ctrl, ctrl); + grlib_store_32(&grlib_debug_uart->status, 0); /* Local debug buffer when UART driver has not registered */ /* pre_printk_dbgbuf[pre_printk_pos++] = c; diff --git a/bsps/riscv/griscv/include/amba.h b/bsps/riscv/griscv/include/amba.h index 292660d5c1..cff3a53d9e 100644 --- a/bsps/riscv/griscv/include/amba.h +++ b/bsps/riscv/griscv/include/amba.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * @@ -12,9 +14,26 @@ * COPYRIGHT (c) 2004. * Gaisler Research * - * 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. + * 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. */ #ifndef __AMBA_H__ diff --git a/bsps/riscv/griscv/include/bsp.h b/bsps/riscv/griscv/include/bsp.h index 9d6fb2a16f..a0aec4f130 100644 --- a/bsps/riscv/griscv/include/bsp.h +++ b/bsps/riscv/griscv/include/bsp.h @@ -69,12 +69,6 @@ extern "C" { /* Maximum supported APBUARTs by BSP */ #define BSP_NUMBER_OF_TERMIOS_PORTS 8 -/* GRLIB driver functions */ - -extern void BSP_shared_interrupt_mask(int irq); -extern void BSP_shared_interrupt_clear(int irq); -extern void BSP_shared_interrupt_unmask(int irq); - /* * Network driver configuration for greth */ diff --git a/bsps/riscv/griscv/include/bsp/irq.h b/bsps/riscv/griscv/include/bsp/irq.h index 634fee4d01..43ee019620 100644 --- a/bsps/riscv/griscv/include/bsp/irq.h +++ b/bsps/riscv/griscv/include/bsp/irq.h @@ -7,7 +7,7 @@ */ /* - * Copyright (c) 2018 embedded brains GmbH + * Copyright (c) 2018 embedded brains GmbH & Co. KG * * Copyright (c) 2015 University of York. * Hesham Almatary <hesham@alumni.york.ac.uk> @@ -40,9 +40,6 @@ #ifndef ASM #include <bsp.h> -#include <rtems/irq.h> -#include <rtems/irq-extension.h> -#include <rtems/score/processormask.h> #define RISCV_INTERRUPT_VECTOR_SOFTWARE 0 @@ -56,16 +53,6 @@ #define BSP_INTERRUPT_VECTOR_COUNT RISCV_INTERRUPT_VECTOR_EXTERNAL(RISCV_MAXIMUM_EXTERNAL_INTERRUPTS) -rtems_status_code bsp_interrupt_set_affinity( - rtems_vector_number vector, - const Processor_mask *affinity -); - -rtems_status_code bsp_interrupt_get_affinity( - rtems_vector_number vector, - Processor_mask *affinity -); - #endif /* ASM */ #endif /* LIBBSP_RISCV_GRISCV_IRQ_H */ diff --git a/bsps/riscv/griscv/irq/irq.c b/bsps/riscv/griscv/irq/irq.c index ea19797565..12af7d7b3d 100644 --- a/bsps/riscv/griscv/irq/irq.c +++ b/bsps/riscv/griscv/irq/irq.c @@ -7,7 +7,7 @@ */ /* - * Copyright (c) 2018 embedded brains GmbH + * Copyright (c) 2018 embedded brains GmbH & Co. KG * * Copyright (c) 2015 University of York. * Hesham Almatary <hesham@alumni.york.ac.uk> @@ -34,7 +34,6 @@ * SUCH DAMAGE. */ -#include <bsp/irq.h> #include <bsp/fatal.h> #include <bsp/irq-generic.h> #include <amba.h> diff --git a/bsps/riscv/griscv/start/bsp_fatal_halt.c b/bsps/riscv/griscv/start/bsp_fatal_halt.c index 5b1eed3e8f..8af9b37709 100644 --- a/bsps/riscv/griscv/start/bsp_fatal_halt.c +++ b/bsps/riscv/griscv/start/bsp_fatal_halt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 embedded brains GmbH + * Copyright (c) 2018 embedded brains GmbH & Co. KG * * Copyright (c) 2015 University of York. * Hesham Almatary <hesham@alumni.york.ac.uk> diff --git a/bsps/riscv/griscv/start/bspsmp.c b/bsps/riscv/griscv/start/bspsmp.c index 0e5fd9903b..0c75c25c2b 100644 --- a/bsps/riscv/griscv/start/bspsmp.c +++ b/bsps/riscv/griscv/start/bspsmp.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 embedded brains GmbH + * Copyright (c) 2018 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions diff --git a/bsps/riscv/griscv/start/bspstart.c b/bsps/riscv/griscv/start/bspstart.c index 26c214caac..62813a1c28 100644 --- a/bsps/riscv/griscv/start/bspstart.c +++ b/bsps/riscv/griscv/start/bspstart.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 embedded brains GmbH + * Copyright (c) 2018 embedded brains GmbH & Co. KG * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions |