mirror of
https://github.com/tailix/kernel.git
synced 2024-10-30 12:03:52 -04:00
Sleep 3 secs
This commit is contained in:
parent
eb3874fbcd
commit
243f93c8d9
1 changed files with 14 additions and 4 deletions
18
arch/main.c
18
arch/main.c
|
@ -12,6 +12,10 @@
|
||||||
|
|
||||||
static struct KernelMQ_Info kinfo;
|
static struct KernelMQ_Info kinfo;
|
||||||
|
|
||||||
|
#define TIMER_FREQ 50
|
||||||
|
|
||||||
|
static unsigned long ticks = 0;
|
||||||
|
|
||||||
static void on_timer();
|
static void on_timer();
|
||||||
|
|
||||||
void main(const struct KernelMQ_Info *const kinfo_ptr)
|
void main(const struct KernelMQ_Info *const kinfo_ptr)
|
||||||
|
@ -72,18 +76,24 @@ void main(const struct KernelMQ_Info *const kinfo_ptr)
|
||||||
paging_mapkernel(&kinfo);
|
paging_mapkernel(&kinfo);
|
||||||
paging_load();
|
paging_load();
|
||||||
|
|
||||||
|
timer_initialize(TIMER_FREQ);
|
||||||
|
timer_register_handler(on_timer);
|
||||||
|
|
||||||
|
while (ticks < TIMER_FREQ * 3) {}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < kinfo.modules_count; ++i) {
|
for (unsigned int i = 0; i < kinfo.modules_count; ++i) {
|
||||||
tasks_switch_to_user(kinfo.modules[i].base);
|
tasks_switch_to_user(kinfo.modules[i].base);
|
||||||
}
|
}
|
||||||
|
|
||||||
timer_register_handler(on_timer);
|
|
||||||
timer_initialize(50);
|
|
||||||
|
|
||||||
logger_warn_from("main", "Nothing to do.");
|
logger_warn_from("main", "Nothing to do.");
|
||||||
logger_fail_from("main", "Halt.");
|
logger_fail_from("main", "Halt.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void on_timer()
|
void on_timer()
|
||||||
{
|
{
|
||||||
logger_info_from("main", "Timer tick.");
|
if (ticks % TIMER_FREQ == 0) {
|
||||||
|
logger_info_from("main", "Timer tick %u.", ticks);
|
||||||
|
}
|
||||||
|
|
||||||
|
++ticks;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue