deppenkaiser Posted January 17, 2018 Share Posted January 17, 2018 I wish to access own ip-cores while i'am using Linux on the Arty-Z7 board. What is the general workflow to write a Linux-Hardware-Driver for the Arty-Plattform? Do you have any examples? Thank you... Link to comment Share on other sites More sharing options...
morsucci Posted January 17, 2018 Share Posted January 17, 2018 @deppenkaiser You could absolutely write a custom linux hardware driver to access your own IP cores from linux. However, if you have never written a linux hardware driver before, this is probably not a great idea. The linux hardware driver system can be quite challenging if you have never been exposed to it. Probably the simplest option is to declare your IP hardware as a "generic-uio" device to the kernel. From that point you can mmap the hardware into virtual memory and then control your hardware using direct access of registers from a user-space program. I have some examples of UIO devices and how to use them posted here. In that folder, you can see code that will mmap UIO hardware into your virtual memory and then there are UIO implementations using this for PWM and GPIO IP cores. Let me know if you have any questions and if you need examples of setting up your ip-core as a generic-uio device. Regards, Mitchell Link to comment Share on other sites More sharing options...
deppenkaiser Posted January 18, 2018 Author Share Posted January 18, 2018 Hello @morsucci, this is what i'am looking for, but i have an other problem too: How can i receive hw interrupts? Is there a way to use a kernel event system, or must i poll a register which "knows" about the occurrence of an interrupt? How do i tell the Linux kernel, that i have a Register with a given address (for mmap), must i use "petalinux"? Or can i configure Linux without building an own Linux image? Thank you... Link to comment Share on other sites More sharing options...
morsucci Posted January 19, 2018 Share Posted January 19, 2018 @deppenkaiser if you read the documentation for the UIO drivers, you will see that they allow for HW interrupts from the PL. The easiest way to do this is to create an interrupt register in your custom IP. I believe that the kernel event system supports UIO devices. As far as Linux is concerned, if you decide to use Petalinux, which allows you to build your own custom images, we can support you in that. However, if you should choose a different sort of linux build, we will be less helpful as we do not have as many resources or as much knowledge concerning other build systems. Check out this link here about uio devices. Link to comment Share on other sites More sharing options...
deppenkaiser Posted January 22, 2018 Author Share Posted January 22, 2018 Hello @morsucci, the documentation says "Each UIO device is accessed through a device file and several sysfs attribute files.". Who gives Linux this "files"? I think, that i need such files, which are fit to my self written Hardware (IP-Cores). Is this true? Thank you... Link to comment Share on other sites More sharing options...
jpeyron Posted January 23, 2018 Share Posted January 23, 2018 Hi @deppenkaiser, @morsucci is out of the office for a couple of days and will respond when they are back in the office. thank you, Jon Link to comment Share on other sites More sharing options...
morsucci Posted February 1, 2018 Share Posted February 1, 2018 @deppenkaiser Notification of UIO devices to the Linux Kernel is done through the device tree. When you list a UIO device in the device tree, as the kernel is booting up, it sees this hardware. The kernel then knows to create a sysFS interface for the uio device. This includes created a file in /dev/UIO* and also in /sys/class/uio. Thus, the kernel does all the work for you of setting up the file system for the UIO devices just by reading your device tree. Regards, Mitchell Link to comment Share on other sites More sharing options...
Question
deppenkaiser
I wish to access own ip-cores while i'am using Linux on the Arty-Z7 board. What is the general workflow to write a Linux-Hardware-Driver for the Arty-Plattform?
Do you have any examples?
Thank you...
Link to comment
Share on other sites
6 answers to this question
Recommended Posts
Archived
This topic is now archived and is closed to further replies.