Userspace I/O library for Xilinx AXI S2MM DMA

Overview

Userspace DMA I/O

This library should simplify the use of the Xilinx AXI DMA controller when used in S2MM (Stream to Memory-Mapped) mode.

A typical use case would be a DAQ (Data Acquisition) system, where ADC is generating data and the DMA is responsible to store the data in the memory.

A configuration required by this library is presented in the block diagram below.

DMA components

Different operation modes

Access interface

This library supports two different access modes:

Both methods are somehow similar, but are also different in a couple of details.

Memory mapping

xdma provides only one memory mapping for the entire register space, while uio provides a separate file for each IP.

Consequently, an address of the IP needs to be provided to the xdma handler, as this information is not made available.

Interrupts

Interrupts can be associated with an individual uio files, but not with the xdma memory mapped file; xdma instead provides separate files (with the name eventN).

Data memory access

There are also two way to provide a memory for the DMA data, i.e. the memory where the DMA is writing to:

  • u-dma-buf, which provides a method to allocate a chunk of memory from the kernel
  • FPGA memory, where the memory is connected directly to the FPGA (e.g. DDR4 memory connected directly to Programmable Logic (PL) on DAMC-FMC2ZUP)

Python binding

Please keep in mind that on some systems (e.g. DAMC-FMC2ZUP and DAMC-FMC1Z7IO) the libudmaio and the pyudmaio Python binding can be already installed. The steps descibed in the chapter below are only needed for the development of the library itself.

Installation

The Python binding pyudmaio uses setuptools to build/install and requires pip 21 or newer.

It also assumes the libudmaio header files and shared library to be installed system-wide. Make sure to make install the C++ library before trying to install the Python binding.

To install the Python library, in-tree build must be used:

pip install --use-feature=in-tree-build .

or (to install the library in editable mode:

pip3 install --use-feature=in-tree-build -e .

Usage example

Available in the folder example is a small example, which demonstrates how to use the components of this library. This example assumes that the AXI Traffic Generator is connected to the AXI4-Stream input of the DMA; this Traffic Generator IP produces a LFSR pattern which is then compared in the interrupt handler.

udev rules

Install TechLab's xdma metapackage (either as Debian package xdma-dkms from doocs.desy.de or from source) to make sure udev rules are installed to match the device file paths expected by the library.

UIO - with default parameters

# ./axi_dma_demo --mode uio --debug
[2069-12-16 19:52:38.443477] [0x0000007fbce25010] [debug]   : uio name = /dev/uio5
[2069-12-16 19:52:38.444203] [0x0000007fbce25010] [debug]   : uio name = /dev/uio4
[2069-12-16 19:52:38.444769] [0x0000007fbce25010] [debug]   : uio name = /dev/uio6
[2069-12-16 19:52:38.444988] [0x0000007fbce25010] [debug]   UDmaBuf: size      = 134217728
[2069-12-16 19:52:38.445022] [0x0000007fbce25010] [debug]   UDmaBuf: phys addr = 6fd00000
[2069-12-16 19:52:38.445264] [0x0000007fbce25010] [debug]   UioAxiDmaIf: start, start_desc = 88840000
[2069-12-16 19:52:38.445651] [0x0000007fb46251c0] [debug]   DataHandlerPrint: process data, size = 16384
[2069-12-16 19:52:38.445853] [0x0000007fb46251c0] [debug]   DataHandler: stopping thread
Counters: OK = 8192, total = 8192

UIO - long data acquisition

When the pause between packets is high enough (and when the packets are small enough), the library can operate continuously - here an example where 50000 samples were captured.

# ./axi_dma_demo --debug --mode uio --nr_pkts 50000 --pkt_pause 60000
[2069-12-16 20:21:36.560101] [0x0000007fae16d010] [debug]   : uio name = /dev/uio5
[2069-12-16 20:21:36.560779] [0x0000007fae16d010] [debug]   : uio name = /dev/uio4
[2069-12-16 20:21:36.561316] [0x0000007fae16d010] [debug]   : uio name = /dev/uio6
[2069-12-16 20:21:36.561505] [0x0000007fae16d010] [debug]   UDmaBuf: size      = 134217728
[2069-12-16 20:21:36.561529] [0x0000007fae16d010] [debug]   UDmaBuf: phys addr = 6fd00000
[2069-12-16 20:21:36.561788] [0x0000007fae16d010] [debug]   UioAxiDmaIf: start, start_desc = 88840000
[2069-12-16 20:21:36.562072] [0x0000007fa596d1c0] [debug]   DataHandlerPrint: process data, size = 16384
[2069-12-16 20:21:36.562366] [0x0000007fa596d1c0] [debug]   DataHandlerPrint: process data, size = 16384
[2069-12-16 20:21:36.562650] [0x0000007fa596d1c0] [debug]   DataHandlerPrint: process data, size = 16384
[2069-12-16 20:21:36.562931] [0x0000007fa596d1c0] [debug]   DataHandlerPrint: process data, size = 16384
<...>
[2069-12-16 20:21:48.766523] [0x0000007fa596d1c0] [debug]   DataHandlerPrint: process data, size = 16384
[2069-12-16 20:21:48.766794] [0x0000007fa596d1c0] [debug]   DataHandlerPrint: process data, size = 16384
[2069-12-16 20:22:37.585985] [0x0000007fa596d1c0] [debug]   DataHandler: stopping thread
Counters: OK = 409600000, total = 40960000

XDMA

$ ./axi_dma_demo --mode xdma --debug
[2021-03-01 13:49:31.941347] [0x00007f6b7e56c740] [debug]   : uio name = /dev/xdma/card0/user
[2021-03-01 13:49:31.941421] [0x00007f6b7e56c740] [debug]   : uio name = /dev/xdma/card0/user
[2021-03-01 13:49:31.941451] [0x00007f6b7e56c740] [debug]   : uio name = /dev/xdma/card0/user
[2021-03-01 13:49:31.941601] [0x00007f6b7e56c740] [debug]   UioAxiDmaIf: start, start_desc = 88920000
[2021-03-01 13:49:31.942309] [0x00007f6b7e568700] [debug]   DataHandlerPrint: process data, size = 16384
[2021-03-01 13:49:31.942382] [0x00007f6b7e568700] [debug]   DataHandler: stopping thread
Counters: OK = 8192, total = 8192

Selecting the target hardware

The demo application includes hardware-related constants such as bus width and IP core addresses. To make it work, the right target hardware must be selected. The demo application currently supports DAMC-FMC2ZUP and DAMC-FMC1Z7IO.

Hardware selection for the C++ demo

The hardware is selected at build time using a CMake parameter.

cmake -DTARGET_HW=ZUP
cmake -DTARGET_HW=Z7IO

Hardware selection for the Python demo

The hardware is selected at runtime using a command line parameter.

./axi_dma_demo.py -H zup
./axi_dma_demo.py -H z7io
Owner
MicroTCA Technology Lab
MicroTCA Technology Lab
A small proof-of-concept for using disk devices for DMA on Windows.

ddma A small proof-of-concept for using disk devices for DMA on Windows. Why Some native hypervisors (i.e. Hyper-V) allow the guest unvirtualized devi

null 42 Jun 7, 2022
STM32 examples for USART using DMA for efficient RX and TX transmission

STM32 UART DMA RX and TX This application note contains explanation with examples for 2 distinct topics: Data reception with UART and DMA when applica

Tilen Majerle 739 Aug 8, 2022
Xilinx Virtual Cable Implementation based on ESP8266

xvc-esp8266 Xilinx Virtual Cable Implementation based on ESP8266 Compiling Please set the CPU frequency to 160MHz and lwIP variant to "v2 Higher bandw

Vadzim Dambrouski 10 May 15, 2022
Hobbyist Operating System targeting x86_64 systems. Includes userspace, Virtual File System, An InitFS (tarfs), Lua port, easy porting, a decent LibC and LibM, and a shell that supports: piping, file redirection, and more.

SynnixOS Epic Hobby OS targeting x86_64 CPUs, it includes some hacked together functionality for most essential OSs although, with interactivity via Q

RaidTheWeb 41 Jul 30, 2022
XNU in Linux userspace

limbo Limbo is an XNU emulator similar to qemu-user; it translates XNU system calls into their Linux equivalent(s). It is capable of executing support

null 156 Aug 1, 2022
LLpatch: Userspace tool to generate Linux kernel livepatch

LLpatch: LLVM-based Kernel Livepatch Generation LLpatch generates, from a source patch, a kernel loadable module or binary package, that can update Li

Google 25 Jul 6, 2022
This is a Linux userspace driver for the AverMedia LGX2 (GC551)

LGX2 Userspace driver This software is little more than a POC and no guarantees of functionality are given and it may even be dangerous to use this so

Chris Sawczuk 13 Jul 20, 2022
waved is aimed at becoming a userspace driver for the reMarkable 2 E-Ink controller.

waved waved is aimed at becoming a userspace driver for the reMarkable 2 E-Ink controller. Disclaimer: This is still a prototype. It might damage your

Mattéo Delabre 33 Aug 8, 2022
Proof of concept userspace filesystem that executes filenames as shell commands and makes the result accessible though reading the file.

ExecFS Proof of concept userspace filesystem that executes filenames as shell commands and makes the result accessible though reading the file. $ ./ex

Camel Coder 28 Aug 5, 2022
A userspace TCP/IP stack based on dpdk

oceanus oceanus is a userspace TCP/IP stack based on dpdk. Quick Start build DPDK wget http://fast.dpdk.org/rel/dpdk-19.11.12.tar.xz tar xvf dpdk-19.1

菜菜 3 Jul 13, 2022
SSD1306 library and simple graphics core library based on Adafruit GFX Library.

Raspberry Pico SSD1306 + GFX Library Based on Adafruit GFX Library https://github.com/adafruit/Adafruit-GFX-Library Usage Hardware Connect your SSD130

Marcin Bober 29 Jul 27, 2022
Libft is an individual project at 42 that requires us to re-create some standard C library functions including some additional ones that can be used later to build a library of useful functions for the rest of the program.

Libft is an individual project at 42 that requires us to re-create some standard C library functions including some additional ones that can be used later to build a library of useful functions for the rest of the program.

Paulo Rafael Ramalho 0 Apr 5, 2022
Samir Teymurov 1 Oct 6, 2021
F Graphics Library (FGL) is a small graphics C++ portable library for LCD displays on embedded systems

F Graphics Library (FGL) Full documentation: fgl.docsforge.com (By Filipe Chagas) F Graphics Library is a C++ library that I created for use in embedd

Filipe Chagas 8 Dec 14, 2021
Itpp - IT++ library mirror/fork. C++ library of mathematical, signal processing and communication classes and functions.

Introduction ************ IT++ is a C++ library of mathematical, signal processing and communication classes and functions. Its main use is in simula

null 18 Apr 9, 2022
2D physics header-only library for videogames developed in C using raylib library.

Physac Physac is a small 2D physics engine written in pure C. The engine uses a fixed time-step thread loop to simluate physics. A physics step contai

Víctor Fisac 226 Aug 4, 2022
This is a helper library to abstract away interfacing with floppy disk drives in a cross-platform and open source library.

Adafruit Floppy This is a helper library to abstract away interfacing with floppy disk drives in a cross-platform and open source library. Adafruit Fl

Adafruit Industries 126 Jul 24, 2022
`lv_lib_100ask` is a reference for various out of the box schemes based on lvgl library or an enhanced interface for various components of lvgl library.

Introduction lv_lib_100ask is a reference for various out of the box schemes based on lvgl library or an enhanced interface for various components of

100askTeam 21 Aug 11, 2022
QtVerbalExpressions - This Qt lib is based off of the C++ VerbalExpressions library. [MIT]

QtVerbalExpressions Qt Regular Expressions made easy This Qt lib is based off of the C++ VerbalExpressions library by whackashoe. Testing if we have a

null 54 Jul 2, 2022