separating: there will be libk and libc

This commit is contained in:
2025-01-07 15:23:14 +01:00
parent b3687d20ee
commit a8582ba343
32 changed files with 29 additions and 31 deletions

38
drivers/timer.c Normal file
View File

@@ -0,0 +1,38 @@
// Programmable Interval Timer channel 0 driver
// Author: xamidev
// Licensed under the Unlicense. See the repo below.
// https://github.com/xamidev/blankos
#include "../kernel/system.h"
#include "../libk/stdio.h"
volatile unsigned long global_ticks = 0;
void timer_handler()
{
global_ticks++;
if (global_ticks % 20 == 0)
{
draw_cursor(white);
} else if (global_ticks % 20 == 10) {
erase_cursor();
}
}
void timer_install()
{
irq_install_handler(0, timer_handler);
printf("[timer] initialized, starting g_ticks...\n");
}
void delay(int ticks)
{
unsigned long eticks;
eticks = global_ticks + ticks;
while (global_ticks < eticks);
}
int uptime()
{
return global_ticks;
}