UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Adventurer
Adventurer
2,154 Views
Registered: ‎05-15-2018

How to develop a user space application to write and read from AXI-LITE SLAVe.

Jump to solution

Hello Experts, 

 

I am pretty new to OS concepts and device drivers, hence I am struggling to find a method to develop a userspace application to write/read from an AXI Slave register.

 

I have developed a video streaming system, and it has all the PL logic working, now I want to add control lines to the passthrough, these control lines shall come from the AXI Lite, as shown in the image below.

AXI_CustomBlock.png

 

 

I also have this custom AXI lite IP block (my_function) developed here. I know how to write a bare metal SDK application to derive a .elf file and drive these control lines, but here there is a dependency (the passthrough app is a userspace app) and I want to integrate this control feature into the same app.

 

Could you please provide any valid tutorials on developing user spaces apps that could access these AXILIte slave address.

What drivers I would need in this, what changes do I need to make to the embedded petalinux build.

0 Kudos
1 Solution

Accepted Solutions
2,240 Views
Registered: ‎04-20-2017

Re: How to develop a user space application to write and read from AXI-LITE SLAVe.

Jump to solution
You see the physical memory mapped address of your ip core in vivado right? Vivado usually a signs that.
You can also see it by looking into the device tree or by importing your. Hdf into sdk.

By knowing the physical address of your ip core you basically have 2 options to access its registers.

Quick and dirty way:
Look at the Linux system call '' mmap''
For your Linux application the physical address is meaningless, you need to mmap it into the virtual address space of your application.
1. You open a Linux file descriptor to /dev/mem, a device file representing your entire physical memory with the open() system call (like you would open any other file within the file system)
2. Use mmap with the in 1) optained file descriptor and as offset the physical adress of your ip core
3. Mmap returns then a pointer, by writing it you access the first register of your ip core, or the following by pointer artihmetics

Mayor disadvantages of this method that you easily can overwrite any memory Region you are not supposed to and you can't handle any irq coming from your ip core.

2. The proper way:
Using the Userspace IO kernel driver to access your ip core. It involves a few more step you can find in the xillinx wiki or here

IP-Core/FPGA IRQ-Handling on Xilinx SoC-FPGA Zynq Platform in Linux Userspace
https://www.linkedin.com/pulse/ip-corefpga-irq-handling-xilinx-soc-fpga-zynq-linux-kratochwill

View solution in original post

0 Kudos
2 Replies
2,241 Views
Registered: ‎04-20-2017

Re: How to develop a user space application to write and read from AXI-LITE SLAVe.

Jump to solution
You see the physical memory mapped address of your ip core in vivado right? Vivado usually a signs that.
You can also see it by looking into the device tree or by importing your. Hdf into sdk.

By knowing the physical address of your ip core you basically have 2 options to access its registers.

Quick and dirty way:
Look at the Linux system call '' mmap''
For your Linux application the physical address is meaningless, you need to mmap it into the virtual address space of your application.
1. You open a Linux file descriptor to /dev/mem, a device file representing your entire physical memory with the open() system call (like you would open any other file within the file system)
2. Use mmap with the in 1) optained file descriptor and as offset the physical adress of your ip core
3. Mmap returns then a pointer, by writing it you access the first register of your ip core, or the following by pointer artihmetics

Mayor disadvantages of this method that you easily can overwrite any memory Region you are not supposed to and you can't handle any irq coming from your ip core.

2. The proper way:
Using the Userspace IO kernel driver to access your ip core. It involves a few more step you can find in the xillinx wiki or here

IP-Core/FPGA IRQ-Handling on Xilinx SoC-FPGA Zynq Platform in Linux Userspace
https://www.linkedin.com/pulse/ip-corefpga-irq-handling-xilinx-soc-fpga-zynq-linux-kratochwill

View solution in original post

0 Kudos
Adventurer
Adventurer
2,016 Views
Registered: ‎05-15-2018

Re: How to develop a user space application to write and read from AXI-LITE SLAVe.

Jump to solution

Below is the detailed documents on How to access a custom AXI block from your userspace Linux application

https://www.linkedin.com/pulse/how-access-your-custom-axi-slave-from-userspace-using-jamakhandi/

0 Kudos