Skip to content

Commit

Permalink
To handle a keypress, we trigger the UART3 Interrupt
Browse files Browse the repository at this point in the history
  • Loading branch information
lupyuen committed Jan 20, 2024
1 parent 6b3e9c9 commit 3deaef2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions riscv_cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,7 @@ static void raise_exception2(RISCVCPUState *s, uint32_t cause,
static void raise_exception(RISCVCPUState *s, uint32_t cause)
{
printf("raise_exception: cause=%d\n", cause);////
printf("raise_exception: sleep\n"); sleep(1);////
raise_exception2(s, cause, 0);
}

Expand Down
4 changes: 2 additions & 2 deletions virtio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1334,8 +1334,8 @@ int virtio_console_write_data(VIRTIODevice *s, const uint8_t *buf, int buf_len)
//// To handle a keypress, we trigger the UART3 Interrupt.
//// TODO: Pass the keypress to VM Guest
printf("[%c]\n", buf[0]); ////
// s->int_status |= 1;
// set_irq(s->irq, 1);
s->int_status |= 1;
set_irq(s->irq, 1);

// TODO: Clear the interrupt after reading keypress
// set_irq(s->irq, 0);
Expand Down

0 comments on commit 3deaef2

Please sign in to comment.