libHartwer - Documentation

libHartwer Documentation

Basic Hardware and OS Abstraction Layer

Marius Zwicker / ERB


libHartwer arose out of an effort to develop embedded applications for the NetDCU family of f&s electronics while not being able to use the actual hardware yet. Additionally the goal was to provide a nice and abstracted API for a lot of low level kernel functions needed throughout the projects BCS9 and BCSX, i.e. the board computer systems of Elefant Racing Bayreuth. While the entire code for the board computer systems will not be released, we decided to publish our hardware abstraction layer under the Apache License 2.0 to simplify the future development work of others. This library certainly is designed tightly around the special needs that arose during the last two years of our development work. Still they can be easily extended to support all the available interfaces or other embedded hardware systems as well.

Currently this library has to major functions:

  1. Provide hardware and driver independent access to all needed protocols and interfaces such as CAN, I/O,...
  2. Provied access to interprocess communication channels used within BCS such as Shared Memory, Message Queues...

Hardware/Interface access

Functions to communicate via CAN and COM Port have been implemented. Functionality to read status of Pins (high/low) of Basic I/O Hardware is provided, over an equal interface you can also access analog input ports. Additionally basic tcp server capabilities can be implemented using the tcp framework

Use these functions to communicate with the ports whenever needed. If you should use another Interface, please extend libHartwer to support it, do not talk to this interface in your process code directly and continue our work instead.

Interprocess Communication means

Shared memory provides access to memory segments shared between individual processes. Use of BCS_SM_getSharedRo() might prevent you from writing to data fields accidentally where you should not do so. This increases securiy in your code. Message queues can be created and used choosing between our own IPC Message Queue Implementation or several others implemented within the kernel.

Error Handling and File Descriptors

To provide an efficient way of handling errors that is specially designed for the functionality of libHartwer, a number of error codes are defined and returned by various functions whenever possible. The errorcodes themselves should be self-explanatory.

Each headerfile defining another access interface also provides its own filedescriptor. This is to make sure you're using the correct file descriptor for each function and to support some special functionality not possible when using one-for-all descriptor.

Simulation capabilities

When built for an x86 linux machine or compiled in Debug mode, libhartwer will provide a feature especially useful for testing and developing. Altough they do not exist for real, you still can use all interfaces such as CAN ports. libHartwer will simulate them and send and receive messages just as if it would be running on a real embedded system. While being run on the actual hardware you can still monitor or manipulate all interfaces for easier debugging.

The IO Port as well as can port simulation is fully implemented, simulating analogue inputs as well as com ports can be easily added.

For feeding those interfaces with data, two components were implemented:


Please see the INSTALL file at for details.

Obtain a copy

The current libhartwer version can both be browsed at and is accessable using subversion as well. To get your own copy, run:

svn co

Please do not forget to take a look at the requirements section. In case you want to report a bug or contribute to this project, please contact us using email via libhartwer (at)

Generated on Fri Feb 11 2011 18:25:46 for libHartwer by Doxygen 1.7.3
Content © 2009-2011 Elefant Racing Bayreuth & MLBA (About) – Design © 2010 Emzeat. All Rights reserved.