Altera_Forum
Honored Contributor
14 years agoI/o irq
Hello my system has two CPUs- CPU1 w/ linux and cpu2 w/o linux. I want to handle an IRQ inside CPU1 Linux generated by CPU2 when it writes to a PIO . [cpu1]---[cpu2]
Obviously, when in an ISR, the device driver has no knowledge at all about user space memory.
In the ISR the driver will communicate information between the hardware and a buffer allocated in Kernel space (allocated by the driver in the initialization function). When a user program accesses the driver (read/write/ioctrl), the driver can transfer the buffer content from/to user space. Alternative: the driver can offer doing a memory mapped file for the user space. Once allocated, same can be accessed by the driver and by the user space program. Of course here synchronizing issues can easily arise. To have the driver inform the user space program that an interrupt has happened, blocking read, select(), or epoll() can be used. If the user program needs to do other stuff while waiting for the interrupt to happen, besides select() or (more versatile) epoll(), you can simply use blocking read in a thread (spawned via TThreadlib) or another process (e.g. spawned via fork() (no additional executable file necessary). I suppose signals (a kind of user space interrupt) can be used, too, but I have no decent knowledge about this. -Michael