Git Product home page Git Product logo

dma-driver's Introduction

dma-driver

Build Kernel Module/Driver

  1. Install prerequisites, e.g. on Ubuntu install the following packages:
$ apt install build-essential linux-headers-generic
  1. Build kernel module
$ cd dma/driver/driver
$ make

Setup Hugepages

  1. Create a group for users of hugepages, and retrieve its GID (in this example, 1001) then add yourself to the group.
$ groupadd hugetlbfs

$ getent group hugetlbfs

$ adduser dasidler hugetlbfs
  1. Edit /etc/sysctl.conf and add this text to specify the number of pages you want to reserve (see page-size)
# Allocate 8192*2MiB for HugePageTables
vm.nr_hugepages = 8192

# Members of group hugetlbfs(1001) can allocate "huge" shared memory segments
vm.hugetlb_shm_group = 1001
  1. Create a mount point for the file system
$ mkdir /media/huge
  1. Add this line in /etc/fstab (The mode 1770 allows anyone in the group to create files but not unlink or rename each other's files.)
# hugetlbfs
hugetlbfs /media/huge hugetlbfs mode=1770,gid=1001 0 0
  1. Reboot

  2. Add the following line to /etc/security/limits.conf to configure the amount of memory a user can lock, so an application can't crash your operating system by locking all the memory.

@hugetlbfs	hard	memlock		1048576

Build Example Application

  1. Install prerequisites, e.g. on Ubuntu install the following packages:
$ apt install libboost-program-options-dev cmake
  1. Compile example application
$ cd dma-driver/sw
$ mkdir build && cd build
$ cmake ../src
$ make

Run Example Application/Benchmark

  1. Load kernel module if not loaded yet.
$ cd dma-driver/driver
$ insmod xdma_driver.ko
  1. Run the Application (requires root permission)
$ cd dma-driver/sw/build
$ ./dma-example

Read FPGA Debug Registers

  1. Load kernel module if not loaded yet.
$ cd dma-driver/driver
$ insmod xdma_driver.ko
  1. Run the Application (requires root permission)
$ cd dma-driver/sw/build
$ ./debug

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.