Espresso 0.0.2c
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
#include <port_io.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <scheduler.h>
|
||||
|
||||
#include <drivers/pit.h>
|
||||
|
||||
|
||||
@ -14,12 +16,14 @@ volatile uint64_t pit_ticks = 0;
|
||||
bool pit_initialized = false;
|
||||
|
||||
void pit_init(void)
|
||||
{
|
||||
{
|
||||
printf("pit_initialized addr = %x\n", &pit_initialized);
|
||||
|
||||
#ifdef _DEBUG
|
||||
printf("[ PIT ] Initializing the PIT...\n");
|
||||
#endif
|
||||
|
||||
uint16_t divisor = (uint16_t)1193;
|
||||
uint16_t divisor = (uint16_t) 1193;
|
||||
|
||||
/* Send command byte */
|
||||
outb(PIT_COMMAND, 0x36); /* Channel 0, low/high byte, mode 3 (square wave), binary */
|
||||
@ -35,9 +39,10 @@ void pit_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void pit_handler(void)
|
||||
registers_t* pit_handler(registers_t* regs)
|
||||
{
|
||||
pit_ticks++;
|
||||
return regs;
|
||||
}
|
||||
|
||||
void pit_sleep(uint64_t ms)
|
||||
@ -48,3 +53,14 @@ void pit_sleep(uint64_t ms)
|
||||
asm volatile ("hlt");
|
||||
}
|
||||
}
|
||||
|
||||
/*void pit_sleep(uint64_t ms)
|
||||
{
|
||||
extern task_t* current_task;
|
||||
|
||||
current_task->wakeup_tick = pit_ticks + ms;
|
||||
current_task->state = TASK_SLEEPING;
|
||||
|
||||
asm volatile("int $32");*/ /* force reschedule immediately */
|
||||
/*}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user