There are 2 common principles how to get known about new data in card.
1) asynchronous – whenever the devices get data, it will interrupt line and will get know it in your ISR. Smarter devices support irq mitigation, which more or less means deferred interrupts unless there are more data or timeout elapsed – this is especially common in network devices, where interrupt overhead would be large on high speeds.
2) "synchronously" by timer – you setup a timer and "poll" the device even in the case, there are no data (you simply reschedule the timer). This is mostly useful for devices which generates interrupts at high rates, but do not support irq mitigation. Beside this, you may use this approach in the case you don't want (or must not – e.g. netconsole with data in opposite way) enable interrupts.
But when you enable interrupts, you must handle them, even if you don't want to do anything but returning IRQ_HANDLED in ISR (interrupt servicing routine – the function you register in request_irq).
Note that if you request shared interrupt, you also need to check, if the device really raised the interrupt you are handling.
2 comments:
Ty vole napis dalsi prispevek do blogu nebo se v praci unudim.
v praci mas pracovat a ne cist blogy, voe
Post a Comment