Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

kernel.c File Reference

Generic routines for kernel. More...

#include <const.h>
#include <arch/i386.h>
#include <kernel/clock.h>
#include <kernel/console.h>
#include <kernel/keyboard.h>
#include <kernel/speaker.h>
#include <kernel/task.h>
#include <kernel/kernel.h>

Go to the source code of this file.

Functions

void error (const byte *msg)
 Report a critical error to the console.
Parameters:
msg  The message you want to display.
Warning:
If this routine is invoked by a task it will be killed.
PANIC: if this routine is invoked by the kernel the system will be halted!!!


void reboot ()
 Reboot the system using the keyboard CPU reset line.
Warning:
If it cannot reboot, the system will be halted.



Detailed Description

Generic routines for kernel.

Author:
Andrea Righi <drizzt@inwind.it>
Date:
Last update: 2003-08-23
Note:
Copyright (©) 2003 Andrea Righi

Definition in file kernel.c.


Function Documentation

void error const byte   msg
 

Report a critical error to the console.

Parameters:
msg  The message you want to display.
Warning:
If this routine is invoked by a task it will be killed.
PANIC: if this routine is invoked by the kernel the system will be halted!!!

Definition at line 27 of file kernel.c.

00028 {
00029         disable();
00030         beep();
00031         set_color(LIGHT_RED);
00032         kprintf("\n\rERROR: %s", msg);
00033         set_color(DEFAULT_COLOR);
00034         kprintf("\n\rTask [%s] (%i) killed!", get_pname(), get_pid());
00035 
00036         sched_leave_critical_region();
00037 
00038         // If the kernel has generated this error HALT the system!      //
00039         if (get_pid())
00040                 auto_kill( 1 );
00041         else
00042                 halt();
00043 }

void reboot  
 

Reboot the system using the keyboard CPU reset line.

Warning:
If it cannot reboot, the system will be halted.

Definition at line 48 of file kernel.c.

00049 {
00050         // Disable all interrupts                                       //
00051         disable();
00052 
00053         beep();
00054 
00055         set_color(DEFAULT_COLOR);
00056         kprintf("\n\r");
00057 
00058         // Reset system clock                                           //
00059         kprintf("Reset system clock...");
00060         stop_clock();
00061         set_color(GREEN);
00062         kprintf("\n                                     [ OK ]\n\r");
00063         set_color(DEFAULT_COLOR);
00064 
00065         kprintf("\n\rRebooting system...");
00066 
00067         // Pulse the CPU reset line                                     //
00068         keyb_wait();
00069         outportb(0x64, 0xFE);
00070 
00071         // If doesn't reboot => halt the system!                        //
00072         halt();
00073 }


Generated on Fri Feb 20 15:32:19 2004 for Minirighi by doxygen1.2.18