예제 #1
0
static void __init floppy_init(void)
{
	uint8_t v;

	/* Install handler for IRQ6 */
	set_irq_handler(6, floppy_isr, NULL);
	irq_on(6);

	dprintk("floppy: resetting floppy controllers\n");
	floppy_reset(dprts);

	floppy_send(dprts, CMD_VERSION);
	v = floppy_recv(dprts);
	if ( v == 0x80 ) {
		printk("floppy: NEC765 controller detected\n");
	}else{
		printk("floppy: enhanced controller detected (0x%x)\n", v);
	}

	/* Reset disk-change flag */
	inb(dprts->dir);

	blkdev_add(&floppy0);

}
예제 #2
0
파일: serio.c 프로젝트: gdarcy/scaraOS
static void serio_driver_init(void)
{
    printk("serio: com1 initialised\n");
    outb(COM1 + 1, 1);

    set_irq_handler(4, serio_isr);
    irq_on(4);
}
예제 #3
0
파일: main.c 프로젝트: reijnden/rho
/*
 * Called from boot.S, after global constructor
 */
void kernel_main(multiboot_info *mbt)
{
	/*
	 * second argument is an 8 bit flag. low bit sets verbosity.
	 */
	boot_info(mbt,MB_DRIVE | MB_DEV);
	printf ("Setting up Global Descriptor Table... ");
	gdt_install();
	puts ("OK");
	printf ("Setting up Interrupt Descriptor Table... ");
	idt_install();
	puts ("OK");
	printf ("Setting up IRQ... ");
	irq_install();
	puts ("OK");
	printf ("Configuring system clock... ");
	timer_install(100);
	puts ("OK");
	printf ("Enabling keyboard... ");
	keyboard_install();
	puts ("OK");
	printf ("Enabling interrupts... ");
	irq_enable();
	if (irq_on()) {
		puts ("OK");
	} else {
		abort();
	}
	/*
	 * Testing cr0 register
	 */
	uint32_t _cr0 = cr0();
	printf("PE (Protection Enabled, lowest bit of cr0 register) set? 0x%lx, %s\n",
			_cr0,_cr0&0x00000001?"yes":"no");

	printf("Rho version %d.%d.%d booted\n",RHO_MAJOR,RHO_MINOR,RHO_PATCH);
	checkAllBuses();
	/*
	 * Wait until interrupted
	 */
//	mem_inspect(1024,1536);
	while ( 1 ) {
		/*
		 * Update the cursos position
		 */
		upd_c();
		/*
		 * Wait for interrupts
		 */
		irq_wait();
	}
	/* */
}
예제 #4
0
void check_tasklets(void)
{
    int i;
    if (n_tasklets == 0)
        return;
    irq_off();
    for (i = 0; i < MAX_TASKLETS; i++) {
        if (tasklet_array[i].exe) {
            tasklet_array[i].exe(tasklet_array[i].arg);
            tasklet_array[i].exe = NULL;
            tasklet_array[i].arg = NULL;
            n_tasklets--;
        }
    }
    irq_on();
}
예제 #5
0
파일: tasklet.c 프로젝트: Maldus512/frosted
void check_tasklets(void)
{
    struct tasklet *t, *n;
    irq_off();
    t = tasklet_list_head;
    tasklet_list_head = NULL;
    tasklet_list_tail = NULL;
    irq_on();
    while(t) {
        n = t->next;
        if (t->exe) {
            t->exe(t->arg);
        }
        //memset(t, 0x0a, sizeof(struct tasklet)); /* For testing... */
        kfree(t);
        t = n;
    }
}
예제 #6
0
void tasklet_add(void (*exe)(void*), void *arg)
{
    int i;
    if (!task_in_syscall())
	    irq_off();
    for (i = 0; i < MAX_TASKLETS; i++) {
        if (!tasklet_array[i].exe) {
            tasklet_array[i].exe = exe;
            tasklet_array[i].arg = arg;
            n_tasklets++;
            if (n_tasklets > max_tasklets)
                max_tasklets = n_tasklets;
	    if (!task_in_syscall())
		    irq_on();
            return;
        }
    }
    while(1) { /* Too many tasklets. */; }

}
예제 #7
0
파일: tasklet.c 프로젝트: Maldus512/frosted
void tasklet_add(void (*exe)(void*), void *arg)
{
    struct tasklet *t, *x;
    irq_off();
    t = kalloc(sizeof(struct tasklet));
    x = tasklet_list_tail;
    if  (!t)
        return;
    t->exe = exe;
    t->arg = arg;
    t->next = NULL;
    if (!x) {
        tasklet_list_head = t;
        tasklet_list_tail = t;
    } else {
        x->next = t;
        tasklet_list_tail = t;
    }
    systick_counter_enable();
    irq_on();
}