Clone the repository driver_helper with the command git clone ssh://git.bobignou.red:23231/driver_helper

Driver Helper

A tool to help you write the code use to manipulate the register in a device.

Use case

Some devices have a lot of registers and in those registers multiples fields. If you write the name, address, size and offset of those fields in a CSV file, this tool will write macros used to manipulates those fields.

Input file

The input file should be a CSV file. Here is an example of possible content:

Name Address Offset Size
FIFO_FLAG 0 0 2
FIFO_SIZE 0 2 6
DATA_INPUT 1 0 8

There is multiple things to take into account:

Output file

The tool will generate a C header file containing macros defining the information in the input file. For example for the FIFO_FLAG entry, the following macros will be defined.

#define FIFO_FLAG_ADDR   0
#define FIFO_FLAG_OFFSET 0
#define FIFO_FLAG_SIZE   2

Furthermore, the function-like macro FIELD_READ(field_name) and FIELD_WRITE(field_name, data) will be defined. They depends on the functions _register_read(address) and _register_write(address, data). The two later should be defined by the user.

Usage

The usage of the tool is the following:

driver-helper <input file> <output file>

Compilation and installation

Driver Helper is written in Nelua. But as everyone might not have the Nelua compiler install, I included the generated C file in this repository.

Running make will compile the C file. To compile from the nelua file, run make full_compilation.

You can then install it with make install or uninstall it with make uninstall.

Back to homepage.