03-23-2018 09:21 AM
I am just learning how to write interrupt handlers for fabric to processor interrupts (IRQ_F2P). I was trying to follow this example:
https://www.xilinx.com/support/answers/62363.html
The example source code has these kinds of includes:
#include <linux/kernel.h> #include <linux/module.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/platform_device.h> #include <linux/slab.h>
But I am unsure how to get these libraries included into my SDK project. I am getting "linux/module.h: No such file or directory".
I am doing my software programming using Xilinx SDK running on a Windows Host.
03-27-2018 08:35 AM
#include <linux/kernel.h> #include <linux/module.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/platform_device.h> #include <linux/slab.h>
These are all linux kernel includes which you would use if making a kernel driver. IMO it's not TOO tricky to make a very simple kernel driver since the boilerplate initialization code is done for you. See UG1144 on how to do this with petalinux (see section "Adding Custom Modules").
If you just want the headers you could download petalinux and "find . -name irq.h" in the source folder.
Best
03-23-2018 10:51 PM
03-24-2018 05:03 AM
My app will be run in user space, but I'm not really sure if I need to do something special in kernel space. I just want to be able to write a user space linux c/c++ app that can respond to a IRQ_F2P interrupt in a high priority, asynchronous manner (just typical interrupt behavior). The IP module that is driving the IRQ_F2P is a custom IP, but I believe that I have modified the pl.dtsi file properly to achieve this (I added "interrupt-parent = < &gic >;" and "interrupts = < 0 61 4>;")
I'm not opposed to using UIO Framework. I'm just having trouble finding a good guide on how to do this, with C code example included.
I did search the sdk install folder, with no luck. If you do find the exact paths, let me know and I'll look again, or at least try to figure out why I don't have the same files.
03-24-2018 09:31 AM
If you create a new kernel module (driver) in petalinux it is initialized with example code that uses interrupts.
Also, you can take a look at code I wrote for the xilinx stream fifo IP block which uses interrupts:
https://github.com/jacobfeder/axisfifo
If you write a simple kernel driver for responding to interrupts, then you will need to figure out how to send signals to userland in response to the interrupt.
03-26-2018 12:29 AM - edited 03-26-2018 12:30 AM
I am using under windows
..../Xilinx/SDK/2017.4/gnu/aarch32/nt/gcc-arm-linux-gnueabi/arm-linux-gnueabihf/libc/usr/include
.../Xilinx/SDK/2017.4/gnu/aarch32/nt/gcc-arm-linux-gnueabi/arm-linux-gnueabihf/include/c++/6.2.1
to include the headers...
the UIO framework is by magnitudes simpler to do (and esp to maintain) than doing your own kernel space IRQ handler...
steps are:
build driver into your petalinux (petalinux-config -c kernel -> drivers -> UIO -> uio_pdrv_genirq (the one with genirc irq handling
next: fiddle your device tree, so device node has compatible="generic-uio" and linux know to bind the uio driver to your device
open your device at /dev/uioX, map the memeory and use read / write calls to handle irq
you find more detailed info to each stept on myny posts in this forum
see eso chapter 4 here
https://www.osadl.org/fileadmin/dam/interface/docbook/howtos/uio-howto.pdf
or here starting slide 16 with code
https://elinux.org/images/b/b0/Uio080417celfelc08.pdf
and many more. that will give you exactly that you are looking for without much hassle
please accept solution if you find it is
03-26-2018 07:01 AM
03-27-2018 12:37 AM
03-27-2018 08:35 AM
#include <linux/kernel.h> #include <linux/module.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/platform_device.h> #include <linux/slab.h>
These are all linux kernel includes which you would use if making a kernel driver. IMO it's not TOO tricky to make a very simple kernel driver since the boilerplate initialization code is done for you. See UG1144 on how to do this with petalinux (see section "Adding Custom Modules").
If you just want the headers you could download petalinux and "find . -name irq.h" in the source folder.
Best
06-12-2020 06:23 AM
I'm pretty new to the Vivado environments and I want to use interrupts for PL to PS DMA in Linux application, and I can find "/linux/interrupt.h" files in SDK also.
Building Petalinux kernel module seems to overkill to develop an application. Is there any way faster than building petalinux every try? Because every petalinux building took 5 minutes at least.
06-12-2020 08:27 AM - edited 06-12-2020 02:39 PM
Hi @yasin.kagan,
1. If we are talking about user space level applications, it can be even user space level DMA driver.
I answered a similar question some days ago and it is marked as Solution.
You don't need to build petalinux for your every try. Instead you need to debug it by using Xilins SDK.
Same thing is possible for Petalinux and Bare Metal.
About Petalinux you need an Ip Address(I prefer to set it static) and you need to check first connection, then you can easily Debug your applications similarly to PC softwares.
You can follow instructions from that link.
2. About catching interrupts from PL side on Petalinux, I can recommend you to use a well-known userspace level driver, that located on git. I tested it it can perform 380MB/s dublex. If this speed is not enough for you, then kernel level driver sould be better solution for you.
Because kernel level development can be painful as you mentioned.
If you are new on Vivado e.t.c. I strongly recommend to you, using a DMA Reference Design. DMA is a really tricky development. Otherwise you need to invest really more time.
Saban
<------------------------------------------------------------------------------>
if(solves_problem) mark_as_solution <= 1 else if(helpful) Kudo <= Kudo + 1