Skip to content

Commit

Permalink
pit: fix initialization
Browse files Browse the repository at this point in the history
init_pit() should send first to the command port
the value for the chosen configuration, not 0. This 0 value
is due to an error in how the value is set using bits.

Signed-off-by: Daniele Ahmed <[email protected]>
Reported-By: Mathias Krause <[email protected]>
  • Loading branch information
82marbag committed Oct 8, 2021
1 parent 4431f14 commit 6a7b623
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/pit.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
void init_pit(uint8_t dst_cpus) {
printk("Initializing PIT\n");
outb(PIT_COMMAND_PORT,
PIT_CHANNEL_0 & PIT_ACCESS_MODE_LH & PIT_OP_MODE_RATE & PIT_BCD_MODE);
PIT_CHANNEL_0 | PIT_ACCESS_MODE_LH | PIT_OP_MODE_RATE | PIT_BCD_MODE);
outb(PIT_DATA_PORT_CH0, PIT_FREQUENCY & 0xFF); /* send low byte */
outb(PIT_DATA_PORT_CH0, (PIT_FREQUENCY & 0xFF00) >> 8); /* send high byte */
configure_isa_irq(PIT_IRQ, PIT_IRQ0_OFFSET, IOAPIC_DEST_MODE_PHYSICAL, dst_cpus);
Expand Down

0 comments on commit 6a7b623

Please sign in to comment.