summaryrefslogtreecommitdiff
path: root/riscv.c
diff options
context:
space:
mode:
authorJiri Gaisler <jiri@gaisler.se>2021-04-11 20:20:15 +0200
committerJiri Gaisler <jiri@gaisler.se>2021-06-10 22:04:11 +0200
commit88914409e05680b1bf0731f6a2abb6716fb2020f (patch)
tree5e258c8978535f7a0ef63142848ddcb2e487b2e0 /riscv.c
parent73267b6a278293b795502193869efda25b2f2a42 (diff)
Added simple RISC-V PLIC functionality for NS16550 interrupt
* RTEMS spconsole01 test now passes
Diffstat (limited to 'riscv.c')
-rw-r--r--riscv.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/riscv.c b/riscv.c
index 6d8fa98..b36fa1e 100644
--- a/riscv.c
+++ b/riscv.c
@@ -201,7 +201,9 @@ rv32_check_lirq (int cpu)
if (sregs[cpu].mstatus & MSTATUS_MIE)
{
tmpirq = sregs[cpu].mip & sregs[cpu].mie;
- if (tmpirq & MIP_MSIP)
+ if (tmpirq & MIP_MEIP)
+ ext_irl[cpu] = 0x1b;
+ else if (tmpirq & MIP_MSIP)
ext_irl[cpu] = 0x13;
else if (tmpirq & MIP_MTIP)
ext_irl[cpu] = 0x17;
@@ -2080,7 +2082,8 @@ riscv_execute_trap (sregs)
}
if (((sregs->trap >= 16) && (sregs->trap < 32))
- || ((sregs->trap == 0x23) || (sregs->trap == 0x27)))
+ || ((sregs->trap == 0x23) || (sregs->trap == 0x27)
+ || (sregs->trap == 0x2b)))
{
sregs->mcause &= 0x1f; // filter trap cause
sregs->mcause |= 0x80000000; // indicate async interrupt
@@ -2093,6 +2096,8 @@ riscv_execute_trap (sregs)
sregs->mip &= ~MIP_MSIP;
if (sregs->trap == 0x27)
sregs->mip &= ~MIP_MTIP;
+ if (sregs->trap == 0x2b)
+ sregs->mip &= ~MIP_MEIP;
// save mstatus.mie in mstatus.mpie
sregs->mstatus |= (sregs->mstatus << 4) & MSTATUS_MPIE;