I have designed a few HATs. Now about driving it, does this sounds like a good way doing it? The architecture described below is the driver layer designed for my custom kernel, but a stripped down version can be run as user land library under Linux.
The driver library includes two parts: standard interface classes and specific device classes. Standard interface classes, like
MKSDIOInterface (extends and implements
MKStreamDevice) provides prototypes of standard operations of the bus it represents. Specific device classes derive from standard interface classes and implements the hardware interface itself, either by directly interfacing the hardware (like
MKBCM2708System BSP class) or using another standard interface (like
MKSDIOOverSPI that implements SD card interface using a SPI bus object).
When porting to Linux, a Linux-specific BSP class is used to translate access to hardware to Linux-style calls to file nodes in
Does this class model sounds sane?