46 lines
1.3 KiB
C
46 lines
1.3 KiB
C
|
|
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
clock.c
|
|
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
Forrest Yu, 2005
|
|
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
|
|
|
|
#include "type.h"
|
|
#include "const.h"
|
|
#include "protect.h"
|
|
#include "string.h"
|
|
#include "proc.h"
|
|
#include "global.h"
|
|
#include "proto.h"
|
|
|
|
|
|
/*======================================================================*
|
|
clock_handler
|
|
*======================================================================*/
|
|
void clock_handler(int irq)
|
|
{
|
|
ticks++;
|
|
|
|
/* There is two stages - in kernel intializing or in process running.
|
|
* Some operation shouldn't be valid in kernel intializing stage.
|
|
* added by xw, 18/6/1
|
|
*/
|
|
if(kernel_initial == 1){
|
|
return;
|
|
}
|
|
irq = 0;
|
|
p_proc_current->task.ticks--;
|
|
sys_wakeup(&ticks);
|
|
}
|
|
|
|
/*======================================================================*
|
|
milli_delay
|
|
*======================================================================*/
|
|
void milli_delay(int milli_sec)
|
|
{
|
|
int t = get_ticks();
|
|
|
|
while(((get_ticks() - t) * 1000 / HZ) < milli_sec) {}
|
|
}
|
|
|