Ejemplo n.º 1
0
void modules_init() {
	screen_init();

	status("initializing keyboard");
	keyboard_init();
	statusDone();
}
Ejemplo n.º 2
0
void VL_Startup()
{
	myint mode;
	
	vga_init(); /* TODO: maybe move into main or such? */
	
	if (MS_CheckParm("x2")) {
		mode = G640x400x256;
		vwidth = 640;
		vheight = 400;
	} else {
		mode = G320x200x256;
		vwidth = 320;
		vheight = 200;
	}

	if (gfxbuf == NULL) 
		gfxbuf = malloc(vwidth * vheight * 1);
		
	if (vga_hasmode(mode) == 0) 
		Quit("vga_hasmode failed!");
			
	if (vga_setmode(mode) != 0)
		Quit("vga_setmode failed!");
		
	if ((mode != G320x200x256) && (vga_setlinearaddressing() == -1))
		Quit("vga_setlinearaddressing failed!");
		
 	graphmem = vga_getgraphmem();
 	
 	keyboard_init();
	keyboard_seteventhandler(keyboard_handlerx);
}
Ejemplo n.º 3
0
Archivo: main.c Proyecto: doopai/gh60
int main(void)
{
    setup_mcu();
    keyboard_setup();
    setup_usb();
    sei();
    /* init modules */
    serial_init();
    keyboard_init();
    host_set_driver(&lufa_driver);
#ifdef SLEEP_LED_ENABLE
    sleep_led_init();
#endif
    print("Keyboard start.\n");
    while (1) {
        while (USB_DeviceState == DEVICE_STATE_Suspended) {
            print("[s]");
            matrix_power_down();
            suspend_power_down();
            if (USB_Device_RemoteWakeupEnabled && suspend_wakeup_condition()) {
                    USB_Device_SendRemoteWakeup();
            }
        }

        keyboard_task();

#if !defined(INTERRUPT_CONTROL_ENDPOINT)
        USB_USBTask();
#endif
    }
}
Ejemplo n.º 4
0
void kmain(multiboot_info_t* mbt, unsigned int magic)
{
    if (magic != MULTIBOOT_BOOTLOADER_MAGIC)
        return;

    graphics_init();

    /* Core modules */
    gdt_init();
    idt_init();
    irq_init();
    isr_init();
    
    /* Kernel heap */
    heap_init();
    
    /* Drivers */
    timer_init();
    tasking_init();
    keyboard_init();
    
    /* Let the games begin */
    set_interrupts(ENABLED);
    
    kprintf("Running kernel tests...\n\n");
    test_kmalloc_kfree();
    test_list();
    test_tasking();
    kprintf("\nDone with kernel tests.\n");
    
    for (;;);
}
Ejemplo n.º 5
0
void main(void)
{
	unsigned char tmp;	
	unsigned char x = 0;
	
	P1_4 = 1;

	//P1_4 = 0;
	fb_init();
	keyboard_init();
	EA = 1;	 // enable global interrupts

	clearDisplay();
	drawRectangle(0,0,13,19);

	
	while(1) {
		/*	
		tmp = readBuf();

		if(tmp == 0x34) 
		{ 
			if(x == 0){
				setPx(2,2);
				x = 1;	
			}
			else {
				clearPx(2,2);
				x = 0;
			}
		}
		*/
	}	
}
Ejemplo n.º 6
0
int main(void)
{
	/* NOTE! 这些初始化函数的位置别随便改动! */
	trap_init();	/* 在设置其他中断之前 */
	console_init();	/* 需打印的在这之后 */
	keyboard_init();
	hd_init();		/* 需读磁盘的放其后 */
/*	graph_init(); */
	mem_init();
	sched_init();
	buff_init();	/* 在内存初始化之后 */
	inode_init();
	file_table_init();
	debug_init();
	sti();
	super_init(0);	/* 开中断之后 */
	files_init();

/*	unsigned short color = rgb_to_565color(255,255,255);
	draw_rect(0, 0, 800, 600, color, 1); */

	move_to_user_mode();

	/*
	 * 进程0马上execve(),替换掉用户态空间,这样进程0就
	 * 可以写时复制了。注意此时原来的用户态堆栈也被丢弃
	 * 了,换成了新堆栈。更多参见内存管理。
	 */
	if(!execve("/init"))
		printf("main: execve init-process failed.\n");
Ejemplo n.º 7
0
void kmain(void)
{
    //bsod();

    intr_disable();
    
    idt_init();
    pic_init();

    console_init();
    if (keyboard_init())
        goto error;

    kprintf("kernel86\n");

    intr_enable();

    shell_do();

error:
    kprintf("error");
    while (1)
        ;
    
}
Ejemplo n.º 8
0
/* Main thread
 */
int main(void) {
  /* ChibiOS/RT init */
  halInit();
  chSysInit();

  // TESTING
  // chThdCreateStatic(waBlinkerThread, sizeof(waBlinkerThread), NORMALPRIO, blinkerThread, NULL);

  hook_early_init();

  /* Init USB */
  init_usb_driver(&USB_DRIVER);

  /* init printf */
  init_printf(NULL,sendchar_pf);

  /* Wait until the USB is active */
  while(USB_DRIVER.state != USB_ACTIVE)
    chThdSleepMilliseconds(50);

  /* Do need to wait here!
   * Otherwise the next print might start a transfer on console EP
   * before the USB is completely ready, which sometimes causes
   * HardFaults.
   */
  chThdSleepMilliseconds(50);

  print("USB configured.\n");

  /* init TMK modules */
  keyboard_init();
  host_set_driver(&chibios_driver);

#ifdef SLEEP_LED_ENABLE
  sleep_led_init();
#endif

  print("Keyboard start.\n");

  hook_late_init();

  /* Main loop */
  while(true) {

    if(USB_DRIVER.state == USB_SUSPENDED) {
      print("[s]");
      while(USB_DRIVER.state == USB_SUSPENDED) {
        hook_usb_suspend_loop();
      }
      /* Woken up */
      // variables have been already cleared
      send_keyboard_report();
#ifdef MOUSEKEY_ENABLE
      mousekey_send();
#endif /* MOUSEKEY_ENABLE */
    }

    keyboard_task();
  }
}
Ejemplo n.º 9
0
static int _qdgdfv_startup(void)
{
    vga_init();

    _qdgdfv_scale = 1;

    /* only 320x200 supported by now */
    _qdgdfv_screen_x_size = 320;
    _qdgdfv_screen_y_size = 200;

    vga_setmode(G320x200x256);

    _qdgdfv_set_palette();

    keyboard_init();

    keyboard_translatekeys(TRANSLATE_CURSORKEYS);

    _qdgdfv_virtual_screen = (unsigned char *)
        qdgdfv_malloc(_qdgdfv_screen_x_size * _qdgdfv_screen_y_size);

    qdgdfv_clear_virtual_screen();

    /* svgalib runs always fullscreen */
    _qdgdfv_full_screen = 1;

    qdgdfv_logger("qdgdfv_startup", "SVGALIB driver startup");

    return 1;
}
Ejemplo n.º 10
0
int main(void)
{
    // set for 16 MHz clock
    CPU_PRESCALE(0);

    // Initialize the USB, and then wait for the host to set configuration.
    // If the Teensy is powered without a PC connected to the USB port,
    // this will wait forever.
    usb_init();
    while (!usb_configured()) /* wait */ ;

    keyboard_init();
    host_set_driver(pjrc_driver());
#ifdef SLEEP_LED_ENABLE
    sleep_led_init();
#endif
    while (1) {
        while (suspend) {
            suspend_power_down();
            if (remote_wakeup && suspend_wakeup_condition()) {
                usb_remote_wakeup();
            }
        }

        keyboard_task(); 
    }
}
Ejemplo n.º 11
0
Archivo: kernel.c Proyecto: ajxs/jxos
void kernel_init(boot_info_t bootInfo) {
	tty_init();

	multiboot_init(bootInfo.multiboot_magic, bootInfo.multiboot_addr);
	if(a20_enable()) {
		serial_writestring(1, "A20 enable failed - triggering panic\n");
		kernel_panic();
	};
	gdt_install();
	idt_install();
	irq_install();
	_protected_mode_init();

	paging_init();
	_paging_enable();

	PIC_init();
	serial_init();
	keyboard_init();
	timer_init();

	serial_writestring(1, "End kernel_init\n");

	kernel_main();
};
Ejemplo n.º 12
0
void main(void)
{
	unsigned char difficulty = 0;
	unsigned char input = 0;
	P1_4 = 1;

	/* init hardware */
	fb_init();
	keyboard_init();
	EA = 1;	 // enable global interrupts

	/* show our startdisplay */
	display_start(difficulty);
	
	while(1) {
		input = readBuf();
		/* change difficulty which results in changing speed */
		if(input == SHIFT_KEY) {
			difficulty++;
			if(difficulty > 2) {
				difficulty = 0;
			}
			display_start(difficulty);
		}
		/* start game with space */
		if(input == SPACE_KEY) {
			clearDisplay();
			start_game(15000 - difficulty*5000);
			display_start(difficulty);
		}
	}	
}
Ejemplo n.º 13
0
/*
	This is the main routine for the NativeOS Kernel. It will start the
	system and jump to user mode so that the init process can run.
	At the moment no information is gathered from multiboot but I expect
	this to change in the near future.

	Multiboot will provide two arguments here: one is the magic number,
	which must be 0x2BADB002, and the other one is the data structure with
	information that might be required for some things.
*/
void kmain(unsigned int magic_number, multiboot_info_t *multiboot_ptr)
{
	gdt_init();
	idt_init();

	int i;
	for (i = 0; i < 16; i++)
		idt_set_handler(i, &bsod);

	/* Set up the core drivers. */
	VGACon_Init();
	keyboard_init();
	timer_init();

	/* Check that the magic code is valid. */
	if (magic_number != 0x2BADB002) {
		kpanic(0x88, "Wrong magic number");
	}

    unsigned int memory_amount = count_memory(multiboot_ptr);
    frames_init(memory_amount);

	printk("Starting NativeOS...\n");
	
	for(;;);
}
Ejemplo n.º 14
0
Archivo: main.c Proyecto: huig-/SED
/*--- codigo de la funcion ---*/
int Main(void){

	char *pt_str = str;
	leds_off();
	sys_init(); // inicializacion de la placa, interrupciones, puertos
	Eint4567_init();
	keyboard_init();
	Uart_Init(115200); // inicializacion de la Uart
	Uart_Config(); // configuración de interrupciones y buffers

	while(1){
		*pt_str = Uart_Getch1(); // leer caracter
		if(pt_str[0] == 'L'){
			led1_on();
			led2_off();
		} else if (pt_str[0] == 'R'){
			led2_on();
			led1_off();
		}

		else  {
			D8Led_symbol(pt_str[0]-'0');
		}
	}
}
Ejemplo n.º 15
0
int kernel_main() {
    graphics_init();
    console_init();

    console_printf("video: %d x %d\n", video_xres, video_yres, video_xbytes);
    console_printf("kernel: %d bytes\n", kernel_size);

    memory_init();
    interrupt_init();
    rtc_init();
    clock_init();
    keyboard_init();

    /*
    process_init() is a big step.  This initializes the process table, but also gives us our own process structure, private stack, and enables paging.  Now we can do complex things like wait upon events.
    */
    process_init();

    mouse_init();
    ata_init();

    console_printf("\nNUNYA READY:\n");

    cmd_line_init();

    while(1) {
        cmd_line_show_prompt();
        cmd_line_attempt(keyboard_read_str());
    }

    return 0;
}
Ejemplo n.º 16
0
int main(void) {
    // Initialize LED, sound and the program button pins.
    maximite_init();

    // Initial setup of the I/O ports.
    AD1PCFG = 0xFFFF;               // Default all pins to digital.
    mJTAGPortEnable(0);             // Turn off JTAG.

    // Setup the CPU.
    // System config performance.
    SYSTEMConfigPerformance(CLOCKFREQ);
    // Fix the peripheral bus to the main clock speed.
    mOSCSetPBDIV(OSC_PB_DIV_1);

    INTEnableSystemMultiVectoredInt();  // Allow vectored interrupts.

    usb_init();
    keyboard_init();       // Initialise and startup the keyboard routines.

    rk86_video_init();     // Start the video state machine.

    delay_us(1000);
    while (keyboard_inkey() != -1);

    i8080_pic32_run();

    panic(PANIC_EMULATION_TERMINATED);

    return 0;
}
Ejemplo n.º 17
0
void init()
{
gdt_init();
idt_init();
paging_init();
timer_init(50);
keyboard_init();
}
Ejemplo n.º 18
0
void notmain() {
  gpio_init();
  led_init();
  timer_init();
  fb_init();
  keyboard_init();
  while (1) {led_toggle();}
}
Ejemplo n.º 19
0
int main(void)
{
    bool suspended = false;
#if USB_COUNT_SOF
    uint16_t last_timer = timer_read();
#endif
#if !defined(__AVR_ATmega32__)
    CLKPR = 0x80, CLKPR = 0;
#endif
#ifndef PS2_USE_USART
    uart_init(UART_BAUD_RATE);
#endif

    keyboard_init();
    host_set_driver(vusb_driver());

    debug("initForUsbConnectivity()\n");
    initForUsbConnectivity();

    debug("main loop\n");
    while (1) {
#if USB_COUNT_SOF
        if (usbSofCount != 0) {
            suspended = false;
            usbSofCount = 0;
            last_timer = timer_read();
        } else {
            // Suspend when no SOF in 3ms-10ms(7.1.7.4 Suspending of USB1.1)
            if (timer_elapsed(last_timer) > 5) {
                suspended = true;
/*
                uart_putchar('S');
                _delay_ms(1);
                cli();
                set_sleep_mode(SLEEP_MODE_PWR_DOWN);
                sleep_enable();
                sleep_bod_disable();
                sei();
                sleep_cpu();
                sleep_disable();
                _delay_ms(10);
                uart_putchar('W');
*/
            }
        }
#endif
        if (!suspended) {
            usbPoll();

            // TODO: configuration process is incosistent. it sometime fails.
            // To prevent failing to configure NOT scan keyboard during configuration
            if (usbConfiguration && usbInterruptIsReady()) {
                keyboard_task();
            }
            vusb_transfer_keyboard();
        }
    }
}
Ejemplo n.º 20
0
void kernel_main(void) {
	kernel_clear_screen();
	display_terminal_login_message();

	idt_init();
	keyboard_init();

	while(1);
}
Ejemplo n.º 21
0
void init(void) {
  usb_init();
  while(!usb_configured());
  keyboard_init();
  mod_keys = 0;
  for(uint8_t k = 0; k < NKEY; k++)
    key[k].bounce = key[k].pressed = 0x00;
  sei();
}
Ejemplo n.º 22
0
// Initialize hardware
void init()
{
	// Disable the watchdog timer
	*AT91C_WDTC_WDMR = AT91C_WDTC_WDDIS;
	
	lcd_init();
	keyboard_init();
	
	lcd_print_int(0);
}
Ejemplo n.º 23
0
/*负责初始化所有模块 */
void init_all() {
   put_str("init_all\n");
   idt_init();	     // 初始化中断
   mem_init();	     // 初始化内存管理系统
   thread_init();    // 初始化线程相关结构
   timer_init();     // 初始化PIT
   console_init();   // 控制台初始化最好放在开中断之前
   keyboard_init();  // 键盘初始化
   tss_init();       // tss初始化
}
Ejemplo n.º 24
0
Archivo: init.c Proyecto: zswek/bitch
void dev_init(void) {
    
    //console_init();
    
    keyboard_init();
    
    set_input_mode(2);
    
    disk_init();
    
}
Ejemplo n.º 25
0
static INITCALL console_init() {
    register_bus(&console_bus, "console");
    register_driver(&console_driver);

    vram_init(con_global);
    keyboard_init(con_global);

    con_global->device.bus = &console_bus;

    return 0;
}
Ejemplo n.º 26
0
void console_init(void)
{
#ifdef CONFIG_VIDEO_CONSOLE
	video_console_init();
#endif
#ifdef CONFIG_SERIAL_CONSOLE
	serial_init();
#endif
#ifdef CONFIG_PC_KEYBOARD
	keyboard_init();
#endif
}
Ejemplo n.º 27
0
int main(void)
{
    // set for 16 MHz clock
    CPU_PRESCALE(0);

    // Initialize the USB, and then wait for the host to set configuration.
    // If the Teensy is powered without a PC connected to the USB port,
    // this will wait forever.
    usb_init();
    while (!usb_configured()) /* wait */ ;

    print_set_sendchar(sendchar);

    keyboard_init();
    host_set_driver(pjrc_driver());
#ifdef SLEEP_LED_ENABLE
    sleep_led_init();
#endif

    while (1) {

		uint32_t mtl_time = timer_read32();
		for ( int i = 0; i < 1000; i++ ) {

			/*print( "Main loop: i = " );*/
			/*phex( (uint8_t) ( i >> 8 ) & 0xff );*/
			/*phex( (uint8_t) ( i >> 0 ) & 0xff );*/
			/*print( "\n" );*/

        while (suspend) {
            suspend_power_down();
            if (remote_wakeup && suspend_wakeup_condition()) {
                usb_remote_wakeup();
            }
        }

        keyboard_task(); 

		}
		mtl_time = timer_elapsed32( mtl_time );
		// No TP: 247 ms
		// TP full: 10820 ms
		// No usb report: same as TP full
//		print( "Time for 1,000 keyboard_tasks: " );
//		phex( (uint8_t) ( mtl_time >> 24 ) & 0xff );
//		phex( (uint8_t) ( mtl_time >> 16 ) & 0xff );
//		phex( (uint8_t) ( mtl_time >>  8 ) & 0xff );
//		phex( (uint8_t) ( mtl_time >>  0 ) & 0xff );
//		print( "\n" );
	}


}
Ejemplo n.º 28
0
Archivo: main.c Proyecto: friker92/sed
/*--- codigo de funciones ---*/
void Main(void)
{
	/* Inicializar controladores */
	sys_init(); // Inicializacion de la placa, interrupciones y puertos
	// Inicializacion del temporizador
	// Inicialización del teclado matricial
	keyboard_init();
	/* Establecer valor inicial de los LEDs */
	leds_off();
	led1_on();
	while (1); // espera
}
Ejemplo n.º 29
0
void
keyboard_event(void) {
	/* TODO: Fetch the scancode and update the key states. */
	int now_key = in_byte(0x60);
	if (now_key == key_code) return;
	key_code = now_key;
	if (!get_init) keyboard_init();
	if (key_code & 0x80)
		key_state[key_mapping[key_code & 0x7f]] = KEY_STATE_RELEASE;
	else
		key_state[key_mapping[key_code]] = KEY_STATE_PRESS;
}
Ejemplo n.º 30
0
static void
test_keyboard_keypress_key_not_found()
{
  unsigned char expected_keyports[8] = {
    0xff, 0xff, 0xff, 0xff,
    0xff, 0xff, 0xff, 0xff
  };

  keyboard_init();
  keyboard_keypress(0xff);
  check_keyports(expected_keyports);
}