diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-07-20 10:57:59 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2018-07-25 10:07:43 +0200 |
commit | 6b9ef097c3f41d4ec371218e7f2e50774c9d3573 (patch) | |
tree | cbf6a2dc99a09dc6a84b55e9efc3502239377bbf /bsps/riscv | |
parent | riscv: Use wfi instruction for idle task (diff) | |
download | rtems-6b9ef097c3f41d4ec371218e7f2e50774c9d3573.tar.bz2 |
riscv: Add CLINT and PLIC support
The CLINT and PLIC need some per-processor state.
Update #3433.
Diffstat (limited to 'bsps/riscv')
-rw-r--r-- | bsps/riscv/riscv/clock/clockdrv.c | 9 | ||||
-rw-r--r-- | bsps/riscv/riscv/headers.am | 4 | ||||
-rw-r--r-- | bsps/riscv/riscv/include/dev/irq/clint.h | 53 |
3 files changed, 4 insertions, 62 deletions
diff --git a/bsps/riscv/riscv/clock/clockdrv.c b/bsps/riscv/riscv/clock/clockdrv.c index 1420e312a4..677823c4c8 100644 --- a/bsps/riscv/riscv/clock/clockdrv.c +++ b/bsps/riscv/riscv/clock/clockdrv.c @@ -33,6 +33,7 @@ */ #include <rtems/timecounter.h> +#include <rtems/score/cpuimpl.h> #include <rtems/score/riscv-utility.h> #include <bsp/fatal.h> @@ -40,8 +41,6 @@ #include <bsp/irq.h> #include <bsp/riscv.h> -#include <dev/irq/clint.h> - #include <libfdt.h> /* This is defined in dev/clock/clockimpl.h */ @@ -49,7 +48,7 @@ void Clock_isr(void *arg); typedef struct { struct timecounter base; - volatile clint_regs *clint; + volatile RISCV_CLINT_regs *clint; } riscv_timecounter; static riscv_timecounter riscv_clock_tc; @@ -58,7 +57,7 @@ static uint32_t riscv_clock_interval; static void riscv_clock_at_tick(riscv_timecounter *tc) { - volatile clint_regs *clint; + volatile RISCV_CLINT_regs *clint; uint64_t cmp; clint = tc->clint; @@ -94,7 +93,7 @@ static void riscv_clock_handler_install(void) static uint32_t riscv_clock_get_timecount(struct timecounter *base) { riscv_timecounter *tc; - volatile clint_regs *clint; + volatile RISCV_CLINT_regs *clint; tc = (riscv_timecounter *) base; clint = tc->clint; diff --git a/bsps/riscv/riscv/headers.am b/bsps/riscv/riscv/headers.am index eafde2cd63..a5a9410662 100644 --- a/bsps/riscv/riscv/headers.am +++ b/bsps/riscv/riscv/headers.am @@ -10,10 +10,6 @@ include_bsp_HEADERS = include_bsp_HEADERS += ../../../../../../bsps/riscv/riscv/include/bsp/irq.h include_bsp_HEADERS += ../../../../../../bsps/riscv/riscv/include/bsp/riscv.h -include_dev_irqdir = $(includedir)/dev/irq -include_dev_irq_HEADERS = -include_dev_irq_HEADERS += ../../../../../../bsps/riscv/riscv/include/dev/irq/clint.h - include_dev_serialdir = $(includedir)/dev/serial include_dev_serial_HEADERS = include_dev_serial_HEADERS += ../../../../../../bsps/riscv/riscv/include/dev/serial/htif.h diff --git a/bsps/riscv/riscv/include/dev/irq/clint.h b/bsps/riscv/riscv/include/dev/irq/clint.h deleted file mode 100644 index 6be3145eb4..0000000000 --- a/bsps/riscv/riscv/include/dev/irq/clint.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2018 embedded brains GmbH - * - * 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 AUTHOR 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 AUTHOR 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 <stdint.h> - -#ifndef DEV_IRQ_CLINT_H -#define DEV_IRQ_CLINT_H - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -typedef struct { - uint32_t msip[4096]; - union { - uint64_t val_64; - uint32_t val_32[2]; - } mtimecmp[2048]; - uint32_t reserved_8000[4094]; - union { - uint64_t val_64; - uint32_t val_32[2]; - } mtime; - uint32_t reserved_c000[4096]; -} clint_regs; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* DEV_IRQ_CLINT_H */ |