In my bare-mental examples, I want to trap into external interrupt while there is a keystroke.
I read the riscv-privileged-v1.10 and SiFive U54 Core Complex Manual to learn external interrupt and PLIC. I think that only after initialing PLIC can it trap into external interrupt if there is a keystroke.
So I init PLIC as follow.
// Pseudocode
//set MIE of mstatus
asm volatile ("li t0, 0x8; csrw mstatus, t0");
// set MEIE bit of MIE
asm volatile ("li t0, 0x800; csrw mie, t0");
// set the priority of all interrupt sources to 1
plic_priority = PLIC_PRIORITY_BASE_ADDR;
for(int i=0; i<127; ++i)
plic_priority[i] = 1;
// enable all interrupt sources
plic_enable = PLIC_ENABLE_BASE_ADDR;
for(int i=0; i<127; ++i)
plic_enable[i] = 1;
// permit all interrupt sources
plic_threshold = PLIC_THRESHOLD_BASE_ADDR;
*plic_threshold = 0;
But I fail to trap into external interrupt while knocking on the keyboard.
Do I miss something or I got this completely wrong?
Thx
In my bare-mental examples, I want to trap into external interrupt while there is a keystroke.
I read the
riscv-privileged-v1.10
andSiFive U54 Core Complex Manual
to learn external interrupt and PLIC. I think that only after initialingPLIC
can it trap into external interrupt if there is a keystroke.So I init PLIC as follow.
But I fail to trap into external interrupt while knocking on the keyboard. Do I miss something or I got this completely wrong? Thx