Skip to content

Commit

Permalink
bsp: cvitek: fix bug in setting PLIC_PRIORITY[n]
Browse files Browse the repository at this point in the history
description: In the bsp/cvitek/c906_little/board/interrupt.c, There is an issue with
setting the PLIC_PRIORITY[n].

analysis: PLIC_PRIORITY[n] each register corresponds to the priority of
a hardware interrupt number.

Solution: Each register is 4 bytes.
Multiply the total number of IRQs by 4 instead of dividing by 4.

Signed-off-by: Liu Gui <[email protected]>
  • Loading branch information
KennethLiu61 authored and Rbb666 committed Jan 16, 2025
1 parent 3790881 commit 95064ed
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bsp/cvitek/c906_little/board/interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void plic_init(void)
{
int i;

for (i = 0; i < IRQ_MAX_NR / 4; i = i + 4)
for (i = 0; i < IRQ_MAX_NR * 4; i = i + 4)
{
mmio_write_32(((uintptr_t) PLIC_PRIORITY0 + i), 0);
}
Expand Down

0 comments on commit 95064ed

Please sign in to comment.