To ease the creation of drivers for Genode I've written a shell script that takes simple Register specs as input and generates appropriate MMIO-framework declarations as output.
As an example this input:
r M0_grp0_span 28 32 b Span 0 15
t M0_grp0_xy 32 b Y 0 11 b X 16 11
x M0_grp0_sxy M0_grp0_xy 2c x M0_grp0_dxy M0_grp0_xy 34
r M0_grp0_wh 30 32 b Height 0 11 b V_scale 12 2 b Width 16 11 b H_scale 28 2
Would result in this output:
struct M0_grp0_span : Register<0x28, 32> { struct Span : Bitfield<0, 15> { }; };
template <unsigned OFF> struct M0_grp0_xy : Register<OFF, 32> { struct Y : Register<OFF, 32>::template Bitfield<0, 11> { }; struct X : Register<OFF, 32>::template Bitfield<16, 11> { }; };
struct M0_grp0_sxy : M0_grp0_xy<0x2c> { }; struct M0_grp0_dxy : M0_grp0_xy<0x34> { };
struct M0_grp0_wh : Register<0x30, 32> { struct Height : Bitfield<0, 11> { }; struct V_scale : Bitfield<12, 2> { }; struct Width : Bitfield<16, 11> { }; struct H_scale : Bitfield<28, 2> { }; };
It fastens my workflow a lot when adding many new registers at a time.
The tool can be found as 'tool/mmio' in my branch https://github.com/m-stein/genode/tree/tool_mmio. This branch is not meant to be merged into genodelabs/master and is updated manually.
To print the tools manual call the tool without an argument. If you have further questions don't hesitate to ask me.
Martin