Jump to content
  • 0

Linux Hardware Driver for Arty-Z7


deppenkaiser

Question

6 answers to this question

Recommended Posts

@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

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

@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

@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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...