[pso] Tema 2 Linux - Alocare IRQs & inregistrare handler

Horia Geanta pso@cursuri.cs.pub.ro
Thu, 31 Mar 2005 16:24:42 +0300


Nu-mi imi este clar care este momentul in care se aloca irq-urile
pentru driver si se face inregistrarea handler-ului.

    Citez din Linux Device Drivers (capitolul 10): 

"A module is expected to request an interrupt channel (or IRQ, for
interrupt request) before using it and to release it when
finished.[...] The interrupt handler can be installed either at driver
initialization or when the device is first opened. Although installing
the interrupt handler from within the module's initialization function
might sound like a good idea, it often isn't, especially if your
device does not share interrupts. Because the number of interrupt
lines is limited, you don't want to waste them. You can easily end up
with more devices in your computer than there are interrupts. If a
module requests an IRQ at initialization, it
prevents any other driver from using the interrupt, even if the device
holding it is
never used. Requesting the interrupt at device open, on the other
hand, allows some
sharing of resources."

       Intreb deoarece am experimentat cu driverele de serial din
Linux (serial_core.ko + 8250.ko) si daca nu le dau parametri (==>
folosesc IRQ-uri nepartajabile in mod implicit) :
       La   cat /proc/interrupts nu apar IRQ3 si/sau IRQ4 "in use"
       La   cat /dev/ttyS0 si apoi cat /proc/interrupts (in alta
consola), apare IRQ3 si/sau 4
     
      Din test rezulta ca trebuie alocate imediat dupa incarcarea
modulului (in functia data parametru lui module_init), dar asa este
corect in general ?