Wait() problem
Posted: Sun Aug 07, 2005 1:25 am
Well when CTRL+ALT+DEL is pressed the function below is fired. It should print a message warning of reboot in 10 seconds, switch the virtural console to console 1, wait 10 seconds, and print a reboot message and finally reboot, but it doesnt do that.
It simply prints the message, switches the virtual console and sits there. Doing nothing. Never reboots. never even prints the reboot message. Any ideas?
Ok..first the control alt del function:
now for the timer function:
It simply prints the message, switches the virtual console and sits there. Doing nothing. Never reboots. never even prints the reboot message. Any ideas?
Ok..first the control alt del function:
Code: Select all
void CTRLATLDEL()
{
//function fired when CTRL ALT DEL is pressed. waits 10 seconds...then reboots.
vc_printf("Rebooting in 10 Seconds....",1);
switch_vc(1);
wait(10);
vc_printf("Rebooting...",1);
reboot();
vc_printf("You should not see this message.",1);
Code: Select all
int timer_ticks = 0;
//IRQ errr 0 Handler:
void timer_handler(struct regs *r)
{
// Add 1 to our ticks used by things in TIMER.C (GLOBAL eventualy??? UNIVERSAL??? LOLNO)
timer_ticks++;
}
//Wait function:
void wait(int seconds)
{
unsigned long end_ticks;
unsigned long my_ticks;
my_ticks = seconds * 18; //multiply the seconds times 18 because of the ibm dudes on drugs back when they made that value.
end_ticks = timer_ticks + my_ticks; //figuer out how what our ending value for ticks will be.
while(timer_ticks < end_ticks); //do nothing until the elapsed time has passed.
}
void timer_install()
{
//install the IRQ handler for IRQ0
irq_install_handler(0, timer_handler);
}