c - How to manually cause an interrupt? -
i'm writing device driver virtual device in linux kernel. because virtual, may ask there command or technique manually cause interrupt test interrupt handler?
currently interrupt handler simple this:
static irqreturn_t interrupt_handler(int irq, void *dev_id){ printk(kern_alert "interrupt handler executed!\n"); return irq_handled; }
and called probe function:
static int probe (struct platform_device *pdev) { printk("-----------------------------------------probe called \n"); ret = misc_register(&mydevice); printk("-----------------------------------------got minor:%i\n",mydevice.minor); struct resource *r = platform_get_resource(pdev, ioresource_mem, 0); if(r == null) { printk("platform_get_resource failed\n"); return -enodev; } irq = platform_get_irq(pdev,0); if (irq < 0) { printk("platform_get_irq failed\n"); return -enodev; } printk("got irq =%d\n",irq); ret = request_irq(irq, interrupt_handler, irqf_disabled, pdev->name, null); printk("got irq, function returns %d\n.", ret); return ret; }
the virtual device defined in board as:
static struct resource mydevice_resources[] ={ [0] = { .start = 20, .end = 20, .flags = ioresource_irq }, [2] = { .start = 0xc0100000, .end = 0xc0200000, .flags = ioresource_mem } }; static struct platform_device mydevice = { .name = "mydevice", .id = 0, .num_resources = array_size(mydevice_resources), .resource = mydevice_resources };
and also, somehow predefined interrupt mydevice
20, probe function says receives interrupt 17.
i appreciate hint. thank you.
this close question. there no way manually issue interrupt. if using android's virtual machine, there're limited set of interrupts , signals can invoked virtually using console command. console open telnet localhost 5554
virtual machine.
Comments
Post a Comment