Beispiel #1
0
Datei: irq.c Projekt: cirline/ct
/**
 * irq_clear_pending - clear the irq pending
 * @channel: same as irq_init() channel
 */
void irq_clear_pending(unsigned int channel)
{
	switch(irq_class(channel)) {
		case ic_timer:
			timer_clear_pending(irq_minor(channel));
			break;
	}
}
static int __init  irq_init(void)
{

	int ret;

	printk(KERN_ALERT "~~~~~~~~~~~~~~~~~~~~~~~~~~~~  IRQ -  Driver inserted ... hai ~~~~~~~~~~~~~~~~~~~~~~~~~~~ \n");
	memset(&switch_interrupt,0,sizeof(switch_interrupt));

	ret=request_irq (12, (irq_handler_t) my_isr, IRQF_SHARED, "mouse_irq", (void *)(my_isr));

        if (irq_cdev() < 0)       //function to create device nodes
                goto fail_1;

        if (irq_class() < 0)      //function to create class
                goto fail_2;

        //own_attr();

/*
//----------------netlink-----------------------------       

nl_sk=netlink_kernel_create(&init_net, NETLINK_USER, 0,hello_nl_recv_msg, NULL, THIS_MODULE);  
    if(!nl_sk)  
    {   
            printk(KERN_ALERT "Error creating socket.\n");  
            return -10;  
    }  

//----------------------------------------------------   
*/

	usr_mode_app();


        return 0;

fail_2:
        cdev_del(&switch_interrupt.cdev_own);
        unregister_chrdev_region(switch_interrupt.devt, 1);

fail_1:
        return -1;

}
Beispiel #3
0
Datei: irq.c Projekt: cirline/ct
/**
 * irq_init - set interrupt service routine
 *
 * @channel: irq channel, define in irq.h
 * @func: isr function
 */
int irq_init(unsigned int channel, irq_func_t func)
{
	pr_info("IRF(%x) address 0x%p\n", channel, func);
	switch(irq_class(channel)) {
		case ic_ext:
			irq_set_ext(irq_minor(channel), func);
			break;
		case ic_timer:
			irq_set_timer(irq_minor(channel), func);
			break;
		case ic_uart:
			irq_set_uart(irq_minor(channel), func);
			break;
		default:
			pr_err("unknown irq channel class! 0x%p\n", channel);
			break;
	}

	return 0;
}