Implement schedsleep() syscall to sleep a process for a given time
This commit is contained in:
@ -29,12 +29,11 @@ void pit_init(void) {
|
||||
uint32_t hz = 1000;
|
||||
uint32_t div = PIT_FREQ / hz;
|
||||
io_out8(PIT_CMD, PIT_CMD_BINARY | PIT_CMD_MODE3 | PIT_CMD_RW_BOTH | PIT_CMD_COUNTER0);
|
||||
io_out8(PIT_COUNTER0, div);
|
||||
io_out8(PIT_COUNTER0, div & 0xFF);
|
||||
io_out8(PIT_COUNTER0, div >> 8);
|
||||
}
|
||||
|
||||
void pit_wait(uint32_t ms) {
|
||||
uint32_t now = PIT_TICKS;
|
||||
++ms;
|
||||
while (PIT_TICKS - now < ms);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user