jacobfeder / axisfifo Goto Github PK
View Code? Open in Web Editor NEWZynq SoC Linux kernel driver for Xilinx AXI-Stream FIFO IP
License: GNU General Public License v3.0
Zynq SoC Linux kernel driver for Xilinx AXI-Stream FIFO IP
License: GNU General Public License v3.0
Hi @jacobfeder ,
I am trying to create an application using PetaLinux which uses AXIS Stream FIFO. I had created a module and put the axis-fifo.c file under it and created an application and put the fifo-test.c file under it. After building and booting the system image on Zynq board, the axis_fifo device was not found under /dev folder. I am not sure what I am missing in the entire proceduer. Could you please help fix the problem?
If transmitting larger packets over fifo in non-blocking mode it comes to over-read error after certain data amount is transmitted.
The proposed solution is to check occupancy and rxLength so that all bytes indicated by rxLength are in the fifo.
Xilinx updated the AXI Stream FIFO IP in Vivado 2018.3. The version number bumped from 4.1 to 4.2.
The change log at https://www.xilinx.com/support/answers/71806.html lists the changes as:
AXI-Stream FIFO (4.2)
- Version 4.2
- Feature Enhancement: FIFO generator replaced with XPM.
- Feature Enhancement: Default values for FIFO_PE_THRESHOLD parameters changed to 5.
- Revision change in one or more subcores
Hi, since the driver is now build in the petalinux kernel, i was unable to run
insmod /lib/modules/4.9.0-xilinx-v2017.4/extra/axis-fifo.ko read_timeout=-1 write_timeout=-1
because the axis-fifo.ko is not found. Where can i change these values?
I have the axis_stream_fifo setup.
I attempt to read the data and display it in ascii.
I can read some data which should be a counter that I am clocking in, but all I get are zeros and then I get
Failed to read from FIFO: Resource temporarily unavailable
root@platform:/apps# poke 0x41200000 1 && ./readfifo
Read 8 bytes from FIFO:
00 00 00 00 00 00 00 00
root@platform:/apps# poke 0x41200000 1 && ./readfifo
Read 8 bytes from FIFO:
00 00 00 00 00 00 00 00
root@platform:/apps# poke 0x41200000 1 && ./readfifo
Read 8 bytes from FIFO:
00 00 00 00 00 00 00 00
root@platform:/apps# poke 0x41200000 1 && ./readfifo
Read 8 bytes from FIFO:
00 00 00 00 00 00 00 00
root@platform:/apps# poke 0x41200000 1 && ./readfifo
Read 8 bytes from FIFO:
00 00 00 00 00 00 00 00
root@platform:/apps# poke 0x41200000 1 && ./readfifo
Failed to read from FIFO: Resource temporarily unavailable
I cannot read again unless I reboot.
When I set timeout to -1 in blocking mode, I wont be able to write
It gives "wait_event_interruptible_timeout() error in write (ret=-1)"
But when i make it bigger than zero, it works.
What could be wrong?
I am developing an application using the AXI4 FIFO and started by using the axis-fifo driver included in xilinx-linux. I have found that modifications made in this repository are not in the xilinx-linux, and likewise, patches made to the xilinix-linux driver are not in this repository.
Has anyone made the effort to merge these two development paths back together?
The following code causes a crash
int fifo_fd = open("/dev/axis_fifo_0x43c00000", O_RDWR);
if (fifo_fd < 0)
return 1;
struct axis_fifo_kern_regInfo reg_info{XLLF_RLR_OFFSET, 0};
int rc = ioctl(fifo_fd, AXIS_FIFO_GET_REG, ®_info);
if (rc) {
return EXIT_FAILURE;
} else {
return EXIT_SUCCESS;
}
Reads and writes are successful, other ioctl operations work fine, and the provided test app functions correctly. When I try the above code I get:
Internal error: Oops - BUG: 1406 [#1] PREEMPT SMP ARM
Modules linked in: axis_fifo(O) uio_pdrv_genirq
CPU: 1 PID: 492 Comm: fifo_benchmark Tainted: G O 5.10.0-xilinx-v2021.2 #1
Hardware name: Xilinx Zynq Platform
PC is at axis_fifo_ioctl+0x1c0/0x29c [axis_fifo]
LR is at 0x0
pc : [<bf012960>] lr : [<00000000>] psr: 60010013
sp : c1c93ef0 ip : 00000018 fp : 00000000
r10: c1c92000 r9 : c18a2f00 r8 : c1c92000
r7 : 80085100 r6 : befffab4 r5 : 00000000 r4 : c1a0f540
r3 : 00000000 r2 : 00000024 r1 : befffabc r0 : 00000000
Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
Control: 18c5387d Table: 01a1404a DAC: 00000051
Process fifo_benchmark (pid: 492, stack limit = 0xc7d15f33)
Stack: (0xc1c93ef0 to 0xc1c94000)
3ee0: 00000000 00000024 00000000 4fb846c8
3f00: 80085100 befffab4 c18a2f00 c19d58d0 00000003 c0210d60 80085100 c0211738
3f20: c1c92000 00000000 00000000 c1c92000 c1c93f40 ffffe000 00000000 c0108704
3f40: 00000000 00000005 00000000 00000001 00401544 00000000 00000000 00000000
3f60: 00000005 00000000 00000001 00401544 00000000 00000000 00000000 4fb846c8
3f80: 00000000 00414ed4 00414ed4 004016ad 00000036 c0100264 c1c92000 00000036
3fa0: 00000000 c0100060 00414ed4 00414ed4 00000003 80085100 befffab4 00000003
3fc0: 00414ed4 00414ed4 004016ad 00000036 00000000 00000000 00414ed4 00000000
3fe0: 00414f4c befffaa4 00403531 b6e10228 40010030 00000003 00000000 00000000
[<bf012960>] (axis_fifo_ioctl [axis_fifo]) from [<c0210d60>] (vfs_ioctl+0x20/0x38)
[<c0210d60>] (vfs_ioctl) from [<c0211738>] (sys_ioctl+0xc0/0x770)
[<c0211738>] (sys_ioctl) from [<c0100060>] (ret_fast_syscall+0x0/0x54)
Exception stack(0xc1c93fa8 to 0xc1c93ff0)
3fa0: 00414ed4 00414ed4 00000003 80085100 befffab4 00000003
3fc0: 00414ed4 00414ed4 004016ad 00000036 00000000 00000000 00414ed4 00000000
3fe0: 00414f4c befffaa4 00403531 b6e10228
Code: e59d2004 e0833002 e5933000 f57ff04f (e28d1004)
---[ end trace 5d0f1f8cb441a56f ]---
I am using PetaLinux 2021.2 with the following FIFO configuration
Let me know if you need any more information.
hi jacobfeder
if you have this dialog block of xilinx AXI-stream FIFO project,please send it to me.in this way I can learn to drive against xilinx AXI-stream FIFO project.
thank you.
I tried to use AXI_Stream_FIFO v4.2 IP core in Petalinux. I enabled the Xilinx AXI-Stream FIFO v4.1/v4.2 IP core driver directly in the petalinux kernel configuration, but after booting I did not find a device like /dev/axis_fifo__########. I'd like to ask what's going on, is there an operation I'm missing?
Board: ZCU104
Petalinux Version: 2020.2
Vivado Version: 2020.2
dmesg:
dmesg.txt
pl.dtsi:
pl.dtsi.txt
vivado bd:
top_design.pdf
I am using this driver in my project i.e., AXI4-Lite FIFO. While trying to get the vacancy of the FIFO, I am unable to get the vacancy. Can anyone solve this problem.
Hi!
I am using Zynq7020 based design and have Ubuntu 20.4 rootfs with Petalinux 2020.2 kernel on one ARM cortex, and I have run the last version of the axis-fifo driver.
On the PL side I have 2 AXI-Stream FIFOs (v4.2):
one connected only to read data from PL (DB FIFO) which is periodically being written to from the PL:
Data Interface : AXI4 Lite
Enabled check-boxes: Enable Receive Data, TDEST Width 4
Receive Fifo Depth 512
Full Threshold 507
Empty Threshold 5
the other connected to write to/read from PL, with the loopback implemented on PL:
Data Interface : AXI4 Lite
Enabled check-boxes: Enable Transmit/Receive Data, TDEST Width 4
Transmit/Receive Fifo Depth 512
Full Threshold 507
Empty Threshold 5
In addition, in the driver code I commented the lines related to checking tdest, tx-max-pkt-size and rx-min-pkt-size.
Both AXI FIFOs are created correctly:
axis_fifo 40001000.axi_fifo_mm_s: axis-fifo created at 0x40001000 mapped to 0x0xf080a000, irq=54, major=241, minor=0
axis_fifo 40000000.axi_fifo_mm_s: axis-fifo created at 0x40000000 mapped to 0x0xf080c000, irq=55, major=240, minor=0
I have made two examples:
When both examples are running everything is working ok. But when the fifo_read is stopped (or not run at all), as soon as the DB FIFO becomes full, the fifo_rw_loop keeps getting ARM FIFO empty, i.e. does not read any data from the ARM FIFO while the write process to the ARM FIFO continues to work fine. I tried both BLOCKING (it jumps out with the read timeout for the read_timeout values of 1000ms or 5000ms, but with read_timeout of -1 it stays indefinitely in wait_event_interruptible_lock_irq_timeout) and NON_BLOCKING read with the same results. As soon as I run the fifo_read and start reading DB FIFO, everything starts working ok again.
The same happens when I restart the driver (rmmod/insmod) – everything works ok until DB FIFO is detected as full.
How/why does the state of one FIFO affect the (wrong) state of the other FIFO? How are these two instances of the driver related?
I am using AXI FIFO with AXI4-Lite configuration in PL.
I have used this driver and could find character device in /dev.
But when I run echo.c application (after making base address changes). I am getting error 'inappropriate ioctl for device'
How to correct this?
In the README.md in the home page you have these instructions to quickly test.
To quickly test things, you can write a packet to your fifo from the command line with
echo -n -e '\xDE\xAD\xBE\xEF' > /dev/axis_fifo<#>
and read from it with
cat /dev/axis_fifo<#> | hexdump -C.
I want to clarify, if our axis-fifo is wired in hardware for loopback, we won't get data when we cat, correct?
Thank you!
Hi jacob ,
a problem with axis-fifo-test program on my zynq target :
root@os:~# axis-fifo-test 512 1 /dev/axis_fifo_0x43c10000
START :
TKEEP enabled ... testing byte boundary read/writes
axis_fifo 43c10000.axi_fifo_mm_s: user read buffer too small (available bytes=8 user buffer bytes=4) - fifo core will be reset
TESTING error conditions...
axis_fifo 43c10000.axi_fifo_mm_s: tried to send a packet of length 0
Reseting with ioctl...
ioctl: Inappropriate ioctl for device
my IP configuration :
my block design :
Hi Jacob,
I am trying to use your "axi-fifo" driver, in a project using petalinux 2021.1 and Vivado 2021.1, as tools. The problem is that on my target system (Zynq -> Eclypse Z7), there is no /dev/axis_fifo_43c00000, when the linux kernel boots there is only one message about axi-fifo :
root@os:~# dmesg|grep axis
axis-fifo driver loaded with parameters read_timeout = 1000, write_timeout = 1000
on the target system, I just replaced in the /boot/decice-tree.dts file :
compatible = "xlnx,axi-fifo-mm-s-4.2";
with:
compatible = "xlnx,axi-fifo-mm-s-4.1";
and recompiled to obtain the file device-tree.dtb
I've been trying to solve the problem for several days, do you have any ideas?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.