Dies ist eine alte Version des Dokuments!


flink Userspace Library

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

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.
Invalid Link
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:
    git clone https://github.com/flink-project/flinklib.git
  2. Create a build directory:
    mkdir build-local
  3. 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/ ..
  4. Build the source code:
    make

Building for a different platform architecture

  1. Clone git repository:
    git clone https://github.com/flink-project/flinklib.git
  2. Create a build directory for the target platform, e.g.:
    mkdir build-powerpc
  3. 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.
  4. 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/ ..
  5. Build the source code:
    make

Installation

  1. Install the library and header files on your system:
    make install

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

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

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

subdev = flink_get_subdevice_by_id(dev, 2);

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

subdev = flink_get_subdevice_by_unique_id(dev, 0x23a5);

. Here, the subdevice with unique_id = 0x23a5 is selected