libsoc: C library for interfacing with common SoC peripherals through generic kernel interfaces
libsoc is a C library to interface with common peripherals found in System on Chips (SoC) through generic Linux Kernel interfaces.
It is aimed at new Linux users, and intends to be a stepping stone to enable a user to get started quickly. It is optimised for reliability rather than speed. While the library should be fast, no guarantees are made on its determinism and it should not be used in time critical routines.
libsoc was born due to the influx of new embedded Linux boards becoming available cheap, and to hobbyists. There are currently numerous libraries that do interfacing with common SoC peripherals, but they all tend to be centred around a particular board or SoC. This leads to board specific hacks and in some cases direct bypassing of the Linux Kernel.
libsoc aims to be generic and compatible with any SoC that has drivers exposing the correct interfaces for the defined peripheral.
If your SoC exposes its I/O subsystems using the generic Linux kernel interfaces then yes, libsoc supports your SoC!
The library is written in C and has a native C API. A subset of the API is also supported with Python bindings.
libsoc is built and installed using the autotools build system. This means it follows the traditional linux methodology of autoreconf, configure, make.
First, check if your distro packages libsoc. If it does it is easiest to install your distro's version of libsoc through its provided package manager. Depending on your distro this may be
pacman, etc. Consult your distro documentation for more info.
First, make sure you have the prerequisites installed. Under Debian Jessie this means:
Under Fedora this would instead be:
* Optional, only required if Python 2 bindings are desired.
** Optional, only required if Python 3 bindings are desired.
Then, clone libsoc from its git repository.
git clone https://github.com/jackmitch/libsoc.git libsoc.git
Enter the libsoc.git directory
autoreconfto generate the libsoc configure scripts
Configure the libsoc library with the required features
[--disable-debug] [--enable-python=<path>] [--enable-board=<board>] [--with-board-configs]
disables the debug code, turn off the debug to get the fastest operation but at the cost of any debug print outs. Omitting this flag will leave debug enabled.
enable Python language bindings to libsoc API. Value can be empty for autodetect, the value 2 or 3 to search the PATH environment variable for python2 or python3, or an absolute path to a python binary.
install a specific board config file to $(sysdir)/libsoc.conf. This enables the use of the board pin name lookup functions and automatic board config probing. Supported boards can be found under ./contrib/board_files. If --with-board-configs is also used, a symlink will be created instead of copying a single file.
install all the contributed board configuration files to $PREFIX/share/libsoc.
Compile the code using make
Install the library using make
Written documentation can be found at http://jackmitch.github.io/libsoc.
Test cases can be found in the test/ directory from the root of the project.
All functions and types are also documented directly in the code in the application header files under lib/include.
libsoc is licenced under the LGPLv2.1, please see the COPYING file for further details.
libsoc is open-source software and as such you are welcome to browse the code and either add features, or fix bugs. Please submit pull requests, and bugs to [email protected]. If you have any comments or questions, I can be contacted by email at the address [email protected].