Example #1
0
void HariMain(){
	int *buf_clock;
	char *s;
	struct FIFO32 fifo_clock;
	struct CLOCK *clock;
	struct TASK *task_keyboard, *task_mouse, *task_rtc;
	int count = 0;

	init_all();
	
	buf_clock = (int *) memman_alloc(memman, 40);
	s = (char *) memman_alloc(memman, 40);
	
	fifo32_init(&fifo_clock, 10, buf_clock);
	clock = clock_alloc();
	clock_init(clock, &fifo_clock, 1);
	clock_set_time(clock, 100);
	

	io_sti();

	task_run(first_task(), 2);

	task_keyboard = task_alloc();
	task_keyboard->tss.esp = memman_alloc_4k(memman, 64 * 1024) + 64 * 1024;
	task_keyboard->tss.eip = (int) &keyboard;
	task_keyboard->tss.es = 1 * 8;
	task_keyboard->tss.cs = 2 * 8;
	task_keyboard->tss.ss = 1 * 8;
	task_keyboard->tss.ds = 1 * 8;
	task_keyboard->tss.fs = 1 * 8;
	task_keyboard->tss.gs = 1 * 8;
	task_run(task_keyboard, 2);

	task_mouse = task_alloc();
	task_mouse->tss.esp = memman_alloc_4k(memman, 64 * 1024) + 64 * 1024;
	task_mouse->tss.eip = (int) &mouse;
	task_mouse->tss.es = 1 * 8;
	task_mouse->tss.cs = 2 * 8;
	task_mouse->tss.ss = 1 * 8;
	task_mouse->tss.ds = 1 * 8;
	task_mouse->tss.fs = 1 * 8;
	task_mouse->tss.gs = 1 * 8;
	task_run(task_mouse, 2);
	
	task_rtc = task_alloc();
	task_rtc->tss.esp = memman_alloc_4k(memman, 64 * 1024) + 64 * 1024;
	task_rtc->tss.eip = (int) &sysclock_task;
	task_rtc->tss.es = 1 * 8;
	task_rtc->tss.cs = 2 * 8;
	task_rtc->tss.ss = 1 * 8;
	task_rtc->tss.ds = 1 * 8;
	task_rtc->tss.fs = 1 * 8;
	task_rtc->tss.gs = 1 * 8;
	task_run(task_rtc, 2);

	for(;;){
		if(fifo32_status(&fifo_clock) != 0){
			panic_i(count += fifo32_get(&fifo_clock));
			clock_set_time(clock, 10);
		}
	}
}
Example #2
0
void begin_sch(){
  curr_task = removeq(&ready);
  init_timer();
  first_task();
}