Coder Social home page Coder Social logo

praton1729 / libsoc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jackmitch/libsoc

0.0 0.0 0.0 929 KB

libsoc: C library for interfacing with common SoC peripherals through generic kernel interfaces

Home Page: http://www.embed.me.uk

License: GNU Lesser General Public License v2.1

Shell 2.65% Python 14.87% C 78.63% Makefile 1.84% M4 2.00%

libsoc's Introduction

Introduction


What is libsoc

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.

Why libsoc

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.

Support


SoC Support

If your SoC exposes its I/O subsystems using the generic Linux kernel interfaces then yes, libsoc supports your SoC!

Language Support

The library is written in C and has a native C API. A subset of the API is also supported with Python bindings.

  • Manual GPIO Manipulation through sysfs (Value, Edge, Direction, Exporting)
  • Blocking GPIO Interrupts with timeout
  • Non-blocking GPIO Interrupts with callback mechanism (pthread based)
  • SPI transfers using spidev
  • I2C transfers using ioctls
  • PWM support through sysfs (Linux 3.12+)
  • Automatic board probing via installed config files
  • Manual GPIO Manipulation through sysfs (Value, Edge, Direction, Exporting)
  • Blocking GPIO Interrupts with timeout
  • Non-blocking GPIO Interrupts with callback mechanism
  • I2C transfers

Building


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 apt-get, dnf, yum, pacman, etc. Consult your distro documentation for more info.

Manually Building

First, make sure you have the prerequisites installed. Under Debian Jessie this means:

  • autoconf
  • build-essential
  • libtool-bin
  • pkg-config
  • python-dev *
  • python3-dev **

Under Fedora this would instead be:

  • autoconf
  • automake
  • libtool
  • python2-devel *
  • python3-devel **

* 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

cd libsoc.git

Run autoreconf to generate the libsoc configure scripts

autoreconf -i

Configure the libsoc library with the required features

./configure

	[--disable-debug]
	[--enable-python=<path|version>]
	[--enable-board=<board>]
	[--with-board-configs]
--disable-debug

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=<path|version>

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.
--enable-board=<board>

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.
--with-board-configs

install all the contributed board configuration
files to $PREFIX/share/libsoc.

Compile the code using make

make

Install the library using make

make install

Documentation

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.

Licencing

libsoc is licenced under the LGPLv2.1, please see the COPYING file for further details.

Contributing

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 libsoc@github. If you have any comments or questions, I can be contacted by email at the address [email protected].

libsoc's People

Contributors

jackmitch avatar yegorich avatar tatianaleon avatar biot avatar raja-sivasankaran avatar bhuvanchandra avatar vaishnavachath avatar livewang avatar t-higuchi avatar janick avatar caiubi avatar werecatf avatar railatesenciatechdotcom avatar ndechesne avatar nbellotto avatar mikedigi avatar karthikpoduval avatar ldts avatar jcomeauictx avatar blimjoe avatar jviguera avatar fboudra avatar martoni avatar daescalona avatar

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.