06-25-2014 06:42 AM
I'm using the microzed board and I have different source of interrupts (buttons and custom IP) connected to the IRQ_F2P port of my Zynq and I would like to associate a function for each source of interrupts in my C program on Linux. How I can do that ?
06-27-2014 12:56 PM
You will need to write your own driver, or use 'UIO', Userspace I/O subsystem.
You will need to add a device in your DTS with compatible set to "generic-uio" and set the interrupts value correctly.
06-29-2014 11:23 PM
It is not possible from linux to interact with the GIC block of the Zynq in order to detect interrupt ? Because in my design I have some interrupt from input of the FPGA and theses inputs are directly connected to GIC block and I have some interrupt from custom IP. With custom IP I can use UIO but for other interrupts how I can detect the interrupt ?
06-30-2014 12:47 AM
I think don't quite understand your question.
Of course you can get interrupts from the GIC in Linux. Delivering interrupts to the PS is the reason the GIC exists, so it would be rather strange if it weren't possible to do just that.
Maybe this answers your real question:
You cannot really handle interrupts in a user space program. Interrupts must be handled in kernel context, something only a driver can do. The "uio" driver provides a generic mechanism to translate an interrupt into a file handle operation, so that user space can react in a way that closely resembles the behaviour.
06-30-2014 01:15 AM
My understanding of the UIO driver is that I wirte in the device tree the address of the IP block, the different interrupts generated by the IP that are connected to GIC and also some other things. After the UIO driver allows me to write to the IP and also translate my interrupts into a file. Is it true ? (I have already try to use the UIO driver. I'm able to communicate with the IP but not to handle interrupt).
Now when the interrupt doesn't come from an IP, I can't write in the device tree the address of the IP because it doen't exist. So I can't use the UIO driver for managing interrupt coming from an input port for instance. So in that case how I can manage my interrupt. I must write my own driver or there is an driver to configure the GIC in order to tranlsate the interrupts into a file.
07-01-2014 11:47 PM
My IP is used to spy the communication between a reader and a smartcard (ISO 7816). The IP is divided into two parts: the first part intercepts the data from the reader (slave part) and the second one sends the data to the smartcard (master part). All data pass through the ARM core in order to decode them. The IP generates different interrupts like "cold reset detected", "warm reset detected", "new data received", "data send ended", etc . it also owns 5 registers used to configure the speed of the communication and to check the status of the IP. All interrupts are connected to GIC and the IP communicates with the ARM through the AXI port.
07-08-2014 06:53 AM
Looks like the kind of device that really needs a driver.
Note that instead of using 5 interrupts, you could also use one interrupt and a mask register that contains a bitset for the events that have fired. You can make that register zero itself and clear the interrupt status after a read, which avoids race conditions.
I suggest learning to walk before running - start with a simple driver that only does a part of what you want.
This is the "bible" for driver development. It isn't rocket science...