Exemplo n.º 1
0
void irq_install() {
    /* Enable interruptions */
    asm volatile("sti");
    /* IRQ0: timer */
    init_timer(50);
    /* IRQ1: keyboard */
    init_keyboard();
}
Exemplo n.º 2
0
DEFINE_THREAD_ROUTINE(KeyboardController, data)
{
  init_keyboard();
  update_keyboard();
  close_keyboard();  
  return (THREAD_RET) 0;

}
Exemplo n.º 3
0
void 
HariMain(void)
{
  boot_info_t* binfo = (boot_info_t*)ADR_BOOTINFO;
  char debug_info[64], mouse_cursor[256], keybuf[32];
  int mouse_x, mouse_y;

  init_gdt_idt();
  init_pic();
  io_sti();

  fifo_init(&g_keybuf, keybuf, 32);
  io_out8(PIC0_IMR, 0xf9);
  io_out8(PIC1_IMR, 0xef);

  init_keyboard();    /* initialize keyboard */

  init_palette();
  init_screen(binfo->vram, binfo->screen_x, binfo->screen_y);
  mouse_x = (binfo->screen_x - 16) / 2;
  mouse_y = (binfo->screen_y - 28 - 16) / 2;
  init_mouse_cursor8(mouse_cursor, COLOR8_848484);
  draw_block8_8(binfo->vram, binfo->screen_x, 16, 16, 
      mouse_x, mouse_y, mouse_cursor, 16);

  draw_font8_asc(binfo->vram, binfo->screen_x, 8, 8, 
      COLOR8_FFFFFF, "HELLO BOYS:");
  draw_font8_asc(binfo->vram, binfo->screen_x, 9, 9, 
      COLOR8_000000, "HELLO BOYS:");
  draw_font8_asc(binfo->vram, binfo->screen_x, 31, 31, 
      COLOR8_000000, "WELCOME TO THE LOVELY TOY-OS.");
  draw_font8_asc(binfo->vram, binfo->screen_x, 30, 30, 
      COLOR8_FFFFFF, "WELCOME TO THE LOVELY TOY-OS.");

  sprintf(debug_info, "screen=>{%d, %d}", binfo->screen_x, binfo->screen_y);
  draw_font8_asc(binfo->vram, binfo->screen_x, 16, 64, 
      COLOR8_FF0000, debug_info);

  enable_mouse();   /* enabled mouse */

  for ( ; ; ) {
    int data;

    io_cli();

    if (0 == fifo_size(&g_keybuf)) 
      io_stihlt();
    else {
      data = fifo_get(&g_keybuf);

      io_sti();
      sprintf(debug_info, "%02X", data);
      fill_box8(binfo->vram, binfo->screen_x, COLOR8_008484, 0, 16, 15, 31);
      draw_font8_asc(binfo->vram, binfo->screen_x, 
          0, 16, COLOR8_FFFFFF, debug_info);
    }
  }
}
Exemplo n.º 4
0
void main(void) {
    init_reg();
    unsigned int row, column;
    init_keyboard();
    while(1) {
        selectseg();
        writedec();
    }
}
Exemplo n.º 5
0
void initialize(u32int fg, u32int bg) {
	// Initialization calls
	update_settings(fg,bg);
	monitor_clear();
	init_descriptor_tables();
	asm("sti");
	init_keyboard();
	init_timer(1000);
}
Exemplo n.º 6
0
int main(int argc, char** argv)
{
  time_t t = time(NULL);
  struct tm *tms = localtime(&t);
  snprintf(logdir, sizeof(logdir), "%d-%02d-%02d-%02d-%02d-%02d",
           tms->tm_year+1900, tms->tm_mon+1, tms->tm_mday,
           tms->tm_hour     , tms->tm_min  , tms->tm_sec);
  printf("log directory: %s", logdir);
  mkdir(logdir, 0755);
  string motlog = logdir + string("/mot.txt");
  FILE *mot_log = fopen(motlog.c_str(), "w");
  if (!mot_log)
  {
    printf("couldn't open motor log\n");
    return 1;
  }
  mot = new IPDCMOT(ipdcmot_ip, 0, false);
  mot->set_pos_deg_blocking(left_scan_extent);
  usleep(500000);
  scan = new urg_laser_scan_t;
  if (start())
  {
    printf("bogus. couldn't start the laser.\n");
    return 1;
  }
  pthread_t urg_thread;
  pthread_create(&urg_thread, NULL, urg_thread_func, NULL);
  mot->set_patrol(left_scan_extent, right_scan_extent, 1.9, 1);
  init_keyboard();
  int count = 0;
  while (!bail && !_kbhit())
  {
    double pos;
    if (!mot->get_pos_blocking(&pos, NULL, 1))
    {
      printf("woah! couldn't get position\n");
      break;
    }
    if (mot->get_patrol_dir() < 0)
    {
      printf("scan complete\n");
      break;
    }
    ros::Time t = ros::Time::now();
    fprintf(mot_log, "%d.%09d %f\n", t.sec, t.nsec, pos);
    if (!(count++ % 100))
      printf("%f\t", pos);
  }
  printf("\n");
  mot->stop();
  fclose(mot_log);
  bail = true;
  pthread_join(urg_thread, NULL);
  stop();
  close_keyboard();
  return 0;
}
Exemplo n.º 7
0
PUBLIC int kernel_main()
{
    change();

    TASK*		p_task		= task_table;
    PROCESS*	p_proc		= proc_table;
    char*		p_task_stack	= task_stack + STACK_SIZE_TOTAL;
    u16		selector_ldt	= SELECTOR_LDT_FIRST;
    int i;
    for (i = 0; i < NR_TASKS; i++) {
        strcpy(p_proc->p_name, p_task->name);	// name of the process
        p_proc->pid = i;			// pid

        p_proc->ldt_sel = selector_ldt;

        memcpy(&p_proc->ldts[0], &gdt[SELECTOR_KERNEL_CS >> 3],
               sizeof(DESCRIPTOR));
        p_proc->ldts[0].attr1 = DA_C | PRIVILEGE_TASK << 5;
        memcpy(&p_proc->ldts[1], &gdt[SELECTOR_KERNEL_DS >> 3],
               sizeof(DESCRIPTOR));
        p_proc->ldts[1].attr1 = DA_DRW | PRIVILEGE_TASK << 5;
        p_proc->regs.cs	= ((8 * 0) & SA_RPL_MASK & SA_TI_MASK)
                          | SA_TIL | RPL_TASK;
        p_proc->regs.ds	= ((8 * 1) & SA_RPL_MASK & SA_TI_MASK)
                          | SA_TIL | RPL_TASK;
        p_proc->regs.es	= ((8 * 1) & SA_RPL_MASK & SA_TI_MASK)
                          | SA_TIL | RPL_TASK;
        p_proc->regs.fs	= ((8 * 1) & SA_RPL_MASK & SA_TI_MASK)
                          | SA_TIL | RPL_TASK;
        p_proc->regs.ss	= ((8 * 1) & SA_RPL_MASK & SA_TI_MASK)
                          | SA_TIL | RPL_TASK;
        p_proc->regs.gs	= (SELECTOR_KERNEL_GS & SA_RPL_MASK)
                          | RPL_TASK;

        p_proc->regs.eip = (u32)p_task->initial_eip;
        p_proc->regs.esp = (u32)p_task_stack;
        p_proc->regs.eflags = 0x1202; /* IF=1, IOPL=1 */

        p_task_stack -= p_task->stacksize;
        p_proc++;
        p_task++;
        selector_ldt += 1 << 3;
    }

    k_reenter = 0;
    ticks = 0;

    p_proc_ready	= proc_table;

    init_clock();
    init_keyboard();

    restart();

    while(1) {}
}
Exemplo n.º 8
0
Arquivo: kmain.c Projeto: rhtyd/tantra
uint32_t kmain(unsigned long magic, multiboot_info_t *mboot)
{
    if (magic != MULTIBOOT_BOOTLOADER_MAGIC)
    {
        return 0xD15EA5E;
    }

    // Intialize framebuffer
    init_fb();

    kprintf("\nKernel loading linear address = %x", loader);
    kprintf("\nGrub magic = %x", magic);

    if (mboot->flags & (1 << 2)) {
        kprintf("\nGrub cmdline = %s", (const char*)mboot->cmdline);
    }

    uint32_t availableMemory = 0;
    multiboot_memory_map_t *mmap = (multiboot_memory_map_t*) mboot->mmap_addr;
    while (mmap < (multiboot_memory_map_t*)(mboot->mmap_addr + mboot->mmap_length)) {
        kprintf("\n  memmap type=%x size=%xkb start_addr=%x end_addr=%x", mmap->type, mmap->len/1024, (uint32_t) mmap->addr, (uint32_t) mmap->addr + mmap->len);
        if (mmap->type == MULTIBOOT_MEMORY_AVAILABLE) {
            availableMemory += mmap->len;
        }
        mmap = (multiboot_memory_map_t*) ((uint32_t)mmap + mmap->size + sizeof(uint32_t));
    }
    kprintf("\nAvailable Physical Memory = %x kB", availableMemory);

    // Initialize descriptor tables
    init_descriptor_tables();

    // Initialize timer at 100hz
    init_timer(100);

    // Initialize keyboard
    init_keyboard();

    // Initialize paging
    init_paging(availableMemory);

    // Enable interrupts
    __asm__("sti");

    kprintf("\n> ");

    // Dummy interrupts to test ISRs
    //__asm__("int $0x03");
    //__asm__("int $0x04");

    // Test page fault
    //uint32_t *ptr = (uint32_t*) 0xDEADFA11;
    //uint32_t do_page_fault = *ptr;

    // 0xBADA55 now set on eax/rax register from C
    return 0xBADA55;
}
Exemplo n.º 9
0
void init_cli(void)
{
	//initialize the hardware
	init_leds();
	init_uart();
	init_info();
	init_keyboard();

	cli_set_prompt(CLI_PROMPT);
}
Exemplo n.º 10
0
int init_engine(SDL_GLContext *context, SDL_Window *window)
{
	int img_flags = IMG_INIT_PNG;
	if (!(IMG_Init(img_flags) & img_flags)) {
		printf("SD_image could not initialize! SDL_image Error: %s\n", IMG_GetError());
		return -1;
	}

	if (init_gl(context, window))
		return -1;

	if (init_glew())
		return -1;

	// if (init_effects(shader_programs, shader_infos, LENGTH(shader_programs))) {
	// 	printf("Something went wrong with shader program initialization!\n");
	// 	return -1;
	// }

	load_effects(
		effects.all,       LENGTH(effects.all),
		shader_file_paths, LENGTH(shader_file_paths),
		attribute_strings, LENGTH(attribute_strings),
		uniform_strings,   LENGTH(uniform_strings));

	open_simplex_noise(open_simplex_noise_seed, &osnctx);

	SDL_GameControllerEventState(SDL_ENABLE);
	/* Open the first available controller. */
	SDL_GameController *controller = NULL;
	for (int i = 0; i < SDL_NumJoysticks(); ++i) {
		printf("Testing controller %i\n", i);
		if (SDL_IsGameController(i)) {
			controller = SDL_GameControllerOpen(i);
			if (controller) {
				printf("Successfully opened controller %i\n", i);
				break;
			} else {
				printf("Could not open gamecontroller %i: %s\n", i, SDL_GetError());
			}
		} else {
			printf("Controller %i is not a controller?\n", i);
		}
	}

	init_keyboard();
	init_render(); //Located in render.c

	if (signal(SIGUSR1, reload_signal_handler) == SIG_ERR) {
		printf("An error occurred while setting a signal handler.\n");
	}

	return 0;
}
Exemplo n.º 11
0
int visitbbs(int m)
{
	int retcode;
	reset_history();
	init_keyboard();
	init_menu_system();
	retcode = visit_bbs(m);
	dropcarrier();
	fini_menu_system();
	fini_keyboard();
	return retcode;
}
Exemplo n.º 12
0
int kmain(multiboot_t *mboot_ptr)
{
  monitor_clear();
  
  printk("8888888888               d8b 888  .d88888b.   .d8888b.\n");
  printk("888                      Y8P 888 d88P\" \"Y88b d88P  Y88b\n");
  printk("888                          888 888     888 Y88b.\n");
  printk("8888888    88888b.d88b.  888 888 888     888  \"Y888b.\n");
  printk("888        888 \"888 \"88b 888 888 888     888     \"Y88b.\n");
  printk("888        888  888  888 888 888 888     888       \"888\n");
  printk("888        888  888  888 888 888 Y88b. .d88P Y88b  d88P\n");
  printk("8888888888 888  888  888 888 888  \"Y88888P\"   \"Y8888P\"\n");
  
  init_gdt ();
  init_idt ();
  init_keyboard();
  setup_x87_fpu ();
  init_timer (20);
  init_pmm (mboot_ptr->mem_upper);
  init_vmm ();
  init_heap ();

  // Find all the usable areas of memory and inform the physical memory manager about them.
  uint32_t i = mboot_ptr->mmap_addr;
  while (i < mboot_ptr->mmap_addr + mboot_ptr->mmap_length)
  {
    mmap_entry_t *me = (mmap_entry_t*) i;

    // Does this entry specify usable RAM?
    if (me->type == 1)
    {
      uint32_t j;
      // For every page in this entry, add to the free page stack.
      for (j = me->base_addr_low; j < me->base_addr_low+me->length_low; j += 0x1000)
      {
        pmm_free_page (j);
      }
    }

    // The multiboot specification is strange in this respect - the size member does not include "size" itself in its calculations,
    // so we must add sizeof (uint32_t).
    i += me->size + sizeof (uint32_t);
  }

  kernel_elf = elf_from_multiboot (mboot_ptr);

  asm volatile ("sti");

  panic ("Testing panic mechanism");
  for (;;);

  return 0xdeadbeef;
}
Exemplo n.º 13
0
void HariMain(void)
{
	struct BOOTINFO *binfo = (struct BOOTINFO *) ADR_BOOTINFO;
	char s[40], mcursor[256], keybuf[32], mousebuf[128];
	int mx, my, i;

	init_gdtidt();
	init_pic();
	io_sti(); /* IDT/PIC的初始化结束,开启CPU中断 */

	fifo8_init(&keyfifo, 32, keybuf);
	fifo8_init(&mousefifo, 128, mousebuf);
	io_out8(PIC0_IMR, 0xf9); /* 许可PIC1和键盘(11111001) */
	io_out8(PIC1_IMR, 0xef); /* 许可鼠标(11101111) */

	init_keyboard();

	init_palette();
	init_screen8(binfo->vram, binfo->scrnx, binfo->scrny);
	mx = (binfo->scrnx - 16) / 2;
	my = (binfo->scrny - 28 - 16) / 2;
	init_mouse_cursor8(mcursor, COL8_008484);
	putblock8_8(binfo->vram, binfo->scrnx, 16, 16, mx, my, mcursor, 16);
	sprintf(s, "(%d, %d)", mx, my);
	putfonts8_asc(binfo->vram, binfo->scrnx, 0, 0, COL8_FFFFFF, s);

	enable_mouse();

	for (;;) {
		io_cli();
		if (fifo8_status(&keyfifo) + fifo8_status(&mousefifo) == 0) {
			/* J
			char ss[10];
			sprintf(ss, "%c", "J");
			putfonts8_asc(binfo->vram, binfo->scrnx, 100, 100, COL8_FFFFFF, ss);
			*/
			io_stihlt();
		} else if (fifo8_status(&keyfifo) != 0) {
			i = fifo8_get(&keyfifo);
			io_sti();
			sprintf(s, "%02X", i);
			boxfill8(binfo->vram, binfo->scrnx, COL8_008484, 0, 16, 15, 31);
			putfonts8_asc(binfo->vram, binfo->scrnx, 0, 16, COL8_FFFFFF, s);
		} else if (fifo8_status(&mousefifo) != 0) {
			i = fifo8_get(&mousefifo);
			io_sti();
			sprintf(s, "%02X", i);
			boxfill8(binfo->vram, binfo->scrnx, COL8_008484, 32, 16, 47, 31);
			putfonts8_asc(binfo->vram, binfo->scrnx, 32, 16, COL8_FFFFFF, s);
		}
	}
}
Exemplo n.º 14
0
/**
 * <Ring 1> Main loop of task TTY.
 *****************************************************************************/
PUBLIC void task_tty()
{
	TTY *	tty;
	MESSAGE msg;

	init_keyboard();

	for (tty = TTY_FIRST; tty < TTY_END; tty++)
		init_tty(tty);

	select_console(0);

	while (1) {
		for (tty = TTY_FIRST; tty < TTY_END; tty++) {
			do {
				tty_dev_read(tty);
				tty_dev_write(tty);
			} while (tty->ibuf_cnt);
		}

		send_recv(RECEIVE, ANY, &msg);

		int src = msg.source;
		assert(src != TASK_TTY);

		TTY* ptty = &tty_table[msg.DEVICE];

		switch (msg.type) {
		case DEV_OPEN:
			reset_msg(&msg);
			msg.type = SYSCALL_RET;
			send_recv(SEND, src, &msg);
			break;
		case DEV_READ:
			tty_do_read(ptty, &msg);
			break;
		case DEV_WRITE:
			tty_do_write(ptty, &msg);
			break;
		case HARD_INT:
			/**
			 * waked up by clock_handler -- a key was just pressed
			 * @see clock_handler() inform_int()
			 */
			key_pressed = 0;
			continue;
		default:
			dump_msg("TTY::unknown msg", &msg);
			break;
		}
	}
}
Exemplo n.º 15
0
int readch()
{
  char ch;
  init_keyboard();
  if( peek_character != -1 ) {
    ch = peek_character;
    peek_character = -1;
    return( ch );
  }
  read( 0, &ch, 1 );
  close_keyboard();
  return( ch );
}
Exemplo n.º 16
0
void x86_init()
{
	gdt_install();
	idt_install();
	isrs_install();
	apic_init();	/* apic */
	irq_install();
	
	console_init();
	
	timer_install();
	init_keyboard();
}
Exemplo n.º 17
0
keyboard_t * get_keyboard(void)
{
    static keyboard_t * key = NULL;

    if(key != NULL)
    {
        return key;
    }

    key = init_keyboard();

    return key;
}
Exemplo n.º 18
0
Arquivo: bitmap.c Projeto: dugoh/tcb
int bitmap_play(char * filename)
{
    char ch;

    if (fb_init())
    {
	printf ("Unable to init framebuffer device\n");
	return 2;
    }

    fb_pixel * bmp_buffer;

    if ((bmp_buffer = bitmap_load(filename)) == NULL)
    {
	fb_uninit();
	printf ("Error while reading bitmap\n");
	return 1;
    }

    fb_clear_screen(screen);

    bitmap_render(bmp_buffer);

    init_keyboard();

    ch=0;
    while (1)
    {
	if (!kbhit()) 
	{
	    ch = readch();
	    if (ch == KEY_ESC) break;
	    if (ch == KEY_UP && position_y >= JUMP_SIZE) position_y-=JUMP_SIZE;
	    if (ch == KEY_DOWN && fb_yres <= (bmp_info.bi_height-position_y-JUMP_SIZE)) position_y+=JUMP_SIZE;
	    if (ch == KEY_LEFT && position_x >= JUMP_SIZE) position_x-=JUMP_SIZE;
	    if (ch == KEY_RIGHT && fb_xres <= (bmp_info.bi_width-position_x-JUMP_SIZE)) position_x+=JUMP_SIZE;
	    ch = 0;
	    bitmap_render(bmp_buffer);
	}
    }

    close_keyboard();

    fflush(stdin);

    fb_clear_screen(screen);

    bitmap_free(bmp_buffer);
    fb_uninit();
    return 0;
}
Exemplo n.º 19
0
/*======================================================================*
                           task_tty
 *======================================================================*/
PUBLIC void task_tty()
{
	TTY*	p_tty;
	MSG 	msg;

	init_keyboard();

	for (p_tty=TTY_FIRST;p_tty<TTY_END;p_tty++) {
		init_tty(p_tty);
	}

	select_console(0);

	//清屏
	clear(TTY_FIRST);

	//欢迎信息
	printf("X-Tinix.\n");
	printf("X-Tinix: TTY(TASK) loaded.\n");
	
	//就绪消息
	_send(PID_SERVICE_PROC ,MSG_TYPE_TTY_READY);
	_recv(MSG_TYPE_PROC_READY);
	_send(PID_SERVICE_SHELL,MSG_TYPE_TTY_READY);

	//监听消息
	while (1) {

		if(recv(ANY_MSG_SRC,&msg)!=-1){
			SHELL_MSG shell_msg;
			memcpy(&shell_msg,msg.msg,sizeof(SHELL_MSG));
			switch(msg.type){
				case MSG_TYPE_SHELL:
					tty_write(TTY_FIRST+shell_msg.tty,shell_msg.command,strlen(shell_msg.command));
					break;
				case MSG_TYPE_TTY_CLEAR:
					p_tty = TTY_FIRST + shell_msg.tty;
					clear(p_tty);
					break;
				default:
					break;
			}
		}
		for (p_tty=TTY_FIRST;p_tty<TTY_END;p_tty++) {
			tty_do_read(p_tty);
			//tty_do_write(p_tty);
		}
		//clean work
		memset(&msg,0x0,sizeof(MSG));
	}
}
Exemplo n.º 20
0
int main(int argc, char* argv[]) {
    /*X10I BOARD*/
    void *xBoard;
    Authenticate x15Authenticate;
    BYTE fittedBoard;

    /* initialise the firefly device */
    xBoard = XlineInitBoard();
    if (xBoard == NULL) {
        return ( XlineExit("initialisation failed.", xBoard, &x15Authenticate, 1));
    }
    /* Determine which board type is fitted, and unlock the IO security accordingly */


    XlineGetFittedBoard(xBoard, &fittedBoard);

    if (fittedBoard == X10I_BOARD)
        UnlockX10c(xBoard);
    else
        return ( XlineExit("unknown board fitted.", xBoard, &x15Authenticate, 1));

    printf("success.\n\n");

#ifdef X10_LINUX_BUILD
    InitialiseConsole();
#endif
    printf("Bismillah start X10i jogging. \n\n");



    int charkey = 0;
    run_menu();
    init_keyboard();


    for (;;) {
        if (keyboard_hit()) {
            charkey = read_charkey();
            printf("You hit keyboard key: char = %c or int = %d \n", charkey, charkey);
            cmd_interpreter(xBoard,charkey);
        } //END IF
    } // END FOR



    close_keyboard();
    printf("Alhamdulillah. finish Raspberry Pi jogging. \n\n");

    return ( XlineExit("Leaving program.", xBoard, &x15Authenticate, 0));

}
Exemplo n.º 21
0
Arquivo: kmain.c Projeto: seanzzz/SOS
void kmain(void) {
  init_descriptor_tables();
  init_keyboard(0);
  screen_clear();

  // initialise_paging();
  screen_set_char_attr(0x07);
  welcome();
  // init_timer(10);
  __asm__ __volatile__ ("sti");

  // begin user process here...
  while (1) {}
}
Exemplo n.º 22
0
Arquivo: tty.c Projeto: zzt93/Exercise
void task_tty()
{
        struct Tty *p_tty;
        init_keyboard();
        for (p_tty = tty_table; p_tty < tty_table + NR_CONSOLES; p_tty++)
                init_tty(p_tty);
        select_console(0);
        while(1) {
                for (p_tty = tty_table; p_tty < tty_table + NR_CONSOLES; p_tty++) {
                        tty_do_read(p_tty);
                        tty_do_write(p_tty);
                }
        }
}
Exemplo n.º 23
0
    void
init_3270()
{
#if	defined(unix)
    HaveInput = 0;
    sigiocount = 0;
#endif	/* defined(unix) */
    Sent3270TerminalType = 0;
    Ifrontp = Ibackp = Ibuf;
    init_ctlr();		/* Initialize some things */
    init_keyboard();
    init_screen();
    init_system();
}
Exemplo n.º 24
0
int main(int argc, char **argv)
{
    struct 	sigaction   handler;
	char	num[100];
	int		n = 0;

    // Set Interrrupt Signal Handler
	memset(&handler, 0, sizeof(struct sigaction));
    handler.sa_handler = SignalCatcher;
    sigfillset(&handler.sa_mask);
	sigaction(SIGINT, &handler, 0);
    sigaction(SIGTERM, &handler, 0);

    tcgetattr(0, &oldtio);
    init_keyboard();

	for(;!m_bExitSignalPending;)
	{
		display_menu();

		memset(num, 0, 100);
        n = readch();
		printf("\r\n");

		switch(n) {
		  case '0' :	
			   m_bExitSignalPending = 1;
			   break;

		  case '1' :
               if(m_bFirmwareInstalled) break;
			   printf("\r\n");
               system("/usr/bin/tftp -g -r factoryInstall 192.168.10.20");
               system("chmod +x /tmp/factoryInstall");
               system("/tmp/factoryInstall factory");
			   printf("\r\n");
			   break;

		  case '2' :
               if(!m_bFirmwareInstalled) break;
			   system("/app/sw/hwtest");
			   break;
		}
	}

    close_keyboard();

	return 0;
}
Exemplo n.º 25
0
Arquivo: main.c Projeto: douzh/mydisk
/*======================================================================*
                            tinix_main
 *======================================================================*/
PUBLIC int tinix_main()
{
	disp_str("-----\"tinix_main\" begins-----\n");

	TASK*		p_task		= task_table;
	PROCESS*	p_proc		= proc_table;
	char*		p_task_stack	= task_stack + STACK_SIZE_TOTAL;
	t_16		selector_ldt	= SELECTOR_LDT_FIRST;
	int i;
	for(i=0;i<NR_TASKS;i++){
		strcpy(p_proc->name, p_task->name);	// name of the process
		p_proc->pid	= i;			// pid

		p_proc->ldt_sel	= selector_ldt;
		memcpy(&p_proc->ldts[0], &gdt[SELECTOR_KERNEL_CS >> 3], sizeof(DESCRIPTOR));
		p_proc->ldts[0].attr1 = DA_C | PRIVILEGE_TASK << 5;	// change the DPL
		memcpy(&p_proc->ldts[1], &gdt[SELECTOR_KERNEL_DS >> 3], sizeof(DESCRIPTOR));
		p_proc->ldts[1].attr1 = DA_DRW | PRIVILEGE_TASK << 5;	// change the DPL
		p_proc->regs.cs		= ((8 * 0) & SA_RPL_MASK & SA_TI_MASK) | SA_TIL | RPL_TASK;
		p_proc->regs.ds		= ((8 * 1) & SA_RPL_MASK & SA_TI_MASK) | SA_TIL | RPL_TASK;
		p_proc->regs.es		= ((8 * 1) & SA_RPL_MASK & SA_TI_MASK) | SA_TIL | RPL_TASK;
		p_proc->regs.fs		= ((8 * 1) & SA_RPL_MASK & SA_TI_MASK) | SA_TIL | RPL_TASK;
		p_proc->regs.ss		= ((8 * 1) & SA_RPL_MASK & SA_TI_MASK) | SA_TIL | RPL_TASK;
		p_proc->regs.gs		= (SELECTOR_KERNEL_GS & SA_RPL_MASK) | RPL_TASK;
		p_proc->regs.eip	= (t_32)p_task->initial_eip;
		p_proc->regs.esp	= (t_32)p_task_stack;
		p_proc->regs.eflags	= 0x1202;	// IF=1, IOPL=1, bit 2 is always 1.

		p_task_stack -= p_task->stacksize;
		p_proc++;
		p_task++;
		selector_ldt += 1 << 3;
	}
	proc_table[0].ticks = proc_table[0].priority = 15;
	proc_table[1].ticks = proc_table[1].priority =  5;
	proc_table[2].ticks = proc_table[2].priority =  3;

	k_reenter	= 0;
	ticks		= 0;

	p_proc_ready	= proc_table;
	
	init_clock();
	init_keyboard();

	restart();

	while(1){}
}
Exemplo n.º 26
0
int main() {
    int ch = 0;
    init_keyboard();

    while (ch != 'q') {
        printf("looping\n");
        sleep(1);
        if (kbhit()) {
            ch = readch();
            printf("You hit '%c'\n", ch);
        }
    }
    close_keyboard();
    return 0;
}
Exemplo n.º 27
0
int main()
{
    char ch;

    init_keyboard();
    init_game(1);

    do {
        ch = readch();
        printf("%c %d\n", ch, ch);
    } while (ch != 'q');

    close_keyboard();
    return 0;
}
Exemplo n.º 28
0
void kernel_main()
{
    /* Initialize terminal interface */
    terminal_initialize();

    init_idt();
    init_pic();
    init_keyboard();
    /* Accept Intterupt now */
    asm volatile("sti");
    printf("VOID-OS Operating System 0.01\n\n");
    printf("void-os$ ");
    for(;;) {
            asm("hlt");
    }
}
Exemplo n.º 29
0
int main()
{
	int ch = 0;

	init_keyboard();
	while(ch != 'q'){
		printf("looping\n");
		sleep(1);
		if(kbhit()){
			ch = readch();
			printf("you hit %c\n",ch);
		}
	}
	close_keyboard();
	exit(0);
}
Exemplo n.º 30
0
Arquivo: main.c Projeto: monaka/B-Free
/*
 * keyboard デバイスドライバの main 関数
 *
 * この関数は、デバイスドライバ立ち上げ時に一回だけ実行する。
 *
 */
start ()
{
  extern char	version[];

  /* 
   * 要求受信用のポートの作成
   */
  init_keyboard ();

  /*
   * 立ち上げメッセージ
   */
  dbg_printf ("keyboard driver started. receive port is %d\n", recvport);

  main_loop ();
}