Libmetal allows you to access devices similarly across varying operating environments.
The flow for using libmetal is as follows:
- Start libmetal environment.
- Add devices.
- Open the devices.
- Register interrupt if required.
- Write and read device registers with libmetal API.
- Close the device.
- Close the libmetal environment.
The above steps are explained in the following subsections.
Different platforms can have different device abstractions. Following is a table to explain how libmetal manages devices differently:
Linux | Baremetal FreeRTOS |
---|---|
Devices are described in a device tree. | Because there is no device tree abstraction, devices must be defined statically before attempting to open them. |
"platform" bus definition is in Linux kernel. It is used by Linux to present memory mapped devices. | No standard for bus abstraction. Libmetal library defines generic bus structure to manage devices. |