Skip to content

Commit

Permalink
Merge pull request #19 from yanjiew1/changable-serial-irq
Browse files Browse the repository at this point in the history
Make IRQ number of serial device changable
  • Loading branch information
jserv authored Jun 17, 2023
2 parents ce6ac24 + 5e27b71 commit aa08a08
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static void serial_update_irq(serial_dev_t *s)
priv->iir = iir | 0xc0;

/* FIXME: the return error of vm_irq_line should be handled */
vm_irq_line(container_of(s, vm_t, serial), SERIAL_IRQ,
vm_irq_line(container_of(s, vm_t, serial), s->irq_num,
iir == UART_IIR_NO_INT ? 0 /* inactive */ : 1 /* active */);
}

Expand Down Expand Up @@ -231,6 +231,7 @@ int serial_init(serial_dev_t *s, struct bus *bus)
.priv = (void *) &serial_dev_priv,
.main_tid = pthread_self(),
.infd = STDIN_FILENO,
.irq_num = SERIAL_IRQ,
};
pthread_create(&s->worker_tid, NULL, (void *) serial_thread, (void *) s);

Expand Down
1 change: 1 addition & 0 deletions src/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct serial_dev {
pthread_t main_tid, worker_tid;
int infd; /* file descriptor for serial input */
struct dev dev;
int irq_num;
};

void serial_console(serial_dev_t *s);
Expand Down

0 comments on commit aa08a08

Please sign in to comment.