• skip to content



flink-project

Universal Serial Interface to FPGA's

User Tools

  • Admin
  • Log In

Site Tools

  • Recent Changes
  • Media Manager
  • Sitemap
You are here: start » flink_lib

Sidebar

Navigation

  • Home
  • flink VHDL subdevices and interfaces
  • flink Linux Kernel Modules
  • flink Userspace Library
  • flink Library Lite
  • flink Utilities
  • flink Java Library

  • flink First Steps
  • flink on a Phytec PCM032 Board
  • flink on a Digilent ZYBO

Table of Contents

Table of Contents

  • Overview
  • Requirements
  • Building
  • Building for a different platform architecture
  • Generating the documentation
  • Installation
  • Using a flink Device
flink_lib

flink Userspace Library

Downloads

  • flink Userspace Library on Github

This is the user documentation for the flink userspace library in C. It provides a device and bus independent interface to the underlying driver modules. For more information about the inner workings see flink Userspace Library on Github. The API of the library can be found under API

Overview

Examples

  • Use GPIO using high-level API
  • Use low-level API for custom function

When flink is used on a Linux based system the flink userspace library offers an simple interface to communicate with the underlying kernel modules. The userspace library is split in two parts.

  • High-Level API: Interface to predefined subdevices, such as PWM or GPIO.
  • Low-Level API: Can be used to access user-defined subdevices.
High-level and low-level API

The library must be built for the desired target platform architecture.

Requirements

  • Linux based operating system
  • GCC 4.6 or newer
  • CMake 2.8 or newer
  • GNU make

Building

  1. Clone git repository and all submodules:
    git clone https://github.com/flink-project/flinklib.git --recursive
    cd flinklib
    git submodule init
    git submodule update
  2. Checkout a stable version
    git checkout v1.0.0
  3. Create a build directory:
    mkdir build-local
  4. Change to the build directory and setup your build environment with CMake:
    cmake ..

    Optional: you can specify an installation prefix path with

    cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/ ..
  5. Build the source code:
    make

Building for a different platform architecture

  1. Clone git repository and all submodules:
    git clone https://github.com/flink-project/flinklib.git --recursive
    cd flinklib
    git submodule init
    git submodule update
  2. Checkout a branch
    git checkout v1.0.1
  3. Create a build directory for the target platform, e.g.:
    mkdir build-powerpc
  4. Create a CMake toolchain file. For more informations, please have a look at the CMake Wiki. This file has to specify which compiler has to be used and where it can be found on the system.
  5. Change to the build directory and setup your build environment with CMake:
    cmake -DCMAKE_TOOLCHAIN_FILE:PATH=/path/to/your/toolchain/file.cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/powerpc-linux-gnu/ ..
  6. Build the source code:
    make

Generating the documentation

Create the makefile with cmake (in the root directory):

cmake .

After this generate the documentation as given in the Doxyfile by :

make doc

Installation

Install the library and header files on your system:

make install

Using a flink Device

A flink device must be opened before use (see Example using high-level API).

flink_dev* dev = flink_open("/dev/flink0");

As a next step one has to choose an appropriate subdevice. This could be done by

flink_subdev* subdev = flink_get_subdevice_by_id(dev, 2);

Here, the second subdevice is selected. You could also select a subdevice by its uniqe id.

flink_subdev* subdev = flink_get_subdevice_by_unique_id(dev, 0x23a5);

Here, the subdevice with unique_id = 0x23a5 is selected. This has the advantage that this unique_id does not change even in the case where subdevices are arranged differently in a FPGA design. Now you can communicate with this selected subdevice. Assuming that it's of type GPIO you could configure it as an input or output.

flink_dio_set_direction(subdev, 0, true);
flink_dio_set_value(subdev, 0, false);

This sets channel 0 to output and writes a logical 0.As a last step you have to close the device.

flink_close(dev);
flink_lib.txt · Last modified: 2020/06/26 14:22 by ursgraf

Page Tools

  • Show pagesource
  • Old revisions
  • Back to top
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki