Small, complete C programs for each hardware subsystem of every Libre Computer
SoC, through the standard Linux interfaces, plus reference pages for the
Amlogic graphics and video blocks. Every program compiles on the board with
make, needs no library beyond libc (the GPU example links EGL and GLES2),
and prints what it found.
| SoC | Boards |
|---|---|
| Amlogic S805X | La Frite (AML-S805X-AC), Das Frite (AML-S805X-AC-V2) |
| Amlogic S905X | Le Potato (AML-S905X-CC), Sweet Potato (AML-S905X-CC-V2) |
| Amlogic S905D3 | Solitude (AML-S905D3-CC), Solitude CM (AML-S905D3-CM) |
| Amlogic A311D | Alta (AML-A311D-CC), Alta CM (AML-A311D-CM) |
| Allwinner H2+ / H3 / H5 | Tritium (ALL-H3-CC) |
| Rockchip RK3328 | Renegade (ROC-RK3328-CC) |
| Rockchip RK3399 | Renegade Elite (ROC-RK3399-PC) |
✓ run on that SoC's board with the result shown in the example's section of examples/README.md; ● the same kernel interface and driver family, not yet run on that SoC; — not available on that SoC.
| Subsystem | Example | Interface | S805X | S905X | S905D3 | A311D | H2+ / H3 / H5 | RK3328 | RK3399 |
|---|---|---|---|---|---|---|---|---|---|
| GPIO | gpio | /dev/gpiochipN (uAPI v2) |
● | ✓ | ✓ | ● | ● | ● | ● |
| I2C | i2c | /dev/i2c-N |
● | ✓ | ✓ | ● | ● | ● | ● |
| SPI | spi | /dev/spidevB.C (with an overlay) |
● | ● | ● | ● | ● | ● | ● |
| UART | uart | termios, /dev/ttyAMLn / /dev/ttySn |
● | ● | ● | ● | ● | ● | ● |
| PWM | pwm | /sys/class/pwm |
● | ● | ✓ | ● | ● | ● | ● |
| ADC | adc | IIO, /sys/bus/iio |
● | ✓ | ✓ | ● | — | ● | ● |
| Thermal | thermal | /sys/class/thermal |
● | ✓ | ✓ | ● | ● | ● | ● |
| CPU frequency | cpufreq | /sys/devices/system/cpu/cpufreq |
● | ✓ | ● | ● | ● | ● | ● |
| Watchdog | watchdog | /dev/watchdogN, /sys/class/watchdog |
● | ✓ | ✓ | ● | ● | ● | ● |
| Display | kms | DRM/KMS, /dev/dri/cardN |
● | ● | ✓ | ● | ● | ● | ● |
| 3D GPU | gles2 | EGL + OpenGL ES 2.0 (Mesa) | ● Mali-450, Lima | ✓ Mali-450, Lima | ✓ Mali-G31, Panfrost | ● Mali-G52, Panfrost | ● Mali-400/450, Lima | ● Mali-450, Lima | ● Mali-T860, Panfrost |
| 2D scale / rotate | convert | V4L2 memory-to-memory | — | — | ✓ | ● | — | ● RGA | ● RGA |
| Video decode | decode | V4L2 stateful decoder | ● | ✓ | ✓ | ● | stateless ¹ | stateless ¹ | stateless ¹ |
| Video encode | encode | V4L2 stateful encoder | ● H.264 | ✓ H.264 | ✓ H.264, HEVC | ● H.264, HEVC | — | — | — |
¹ The Allwinner and Rockchip decoders are stateless (the program parses the
stream and drives the kernel through the media Request API): decode with
GStreamer's v4l2slh264dec, v4l2slh265dec, v4l2slvp9dec or
v4l2slmpeg2dec, which do that parsing.
Deeper references for the Amlogic blocks: 2D, 3D on Mali-450, 3D on Mali Bifrost, and the video decoders (H.264, VP9, MPEG-1/2, MJPEG) and encoders (H.264, HEVC, JPEG).
On the board, with the compiler and headers installed:
sudo apt install build-essential libdrm-dev libegl-dev libgles-dev(libdrm-dev for the display example's headers on Debian, the EGL and GLES
packages for the GPU example; nothing else links a library.)
make # every example
make examples/gpio/gpio # oneFrom an x86 machine with a cross compiler (every example but the GPU one,
which needs the board's EGL and GLES libraries: make CROSS=... gl where the
cross compiler has them):
make CROSS=aarch64-linux-gnu-Which header pin is which GPIO line, I2C bus or UART: the pinout at https://gpio.hardware.libre.computer/ (every board). Header buses beyond the default ones are enabled with device-tree overlays from libretech-wiring-tool.
The example programs are MIT-licensed (SPDX headers in each file).