This sample project contains a driver component name acpi_multiply
for a virtual “multiplier” device described the ACPI hardware ID FDFS0001
. The driver interacts with the device hardware using the fuchsia.hardware.acpi
protocol, and exposes a custom FIDL protocol (examples.acpi.multiply
) for other components to consume.
The acpi_controller
driver component emulates an ACPI controller, creating the child device nodes to the mutiply device and responding to requests for device resources such as MMIO and interrupts.
To build the acpi_multiply
driver and related components, run the following commands:
tools/bazel build --config=fuchsia_x64 //src/acpi_multiply/controller:pkg tools/bazel build --config=fuchsia_x64 //src/acpi_multiply/driver:pkg
Use the following commands to load the driver components on a target device:
Load the acpi_controller
driver component to create a virtual ACPI device node:
tools/bazel run --config=fuchsia_x64 //src/acpi_multiply/controller:pkg.component
Load the acpi_multiply
driver component to bind to the device node and begin semding requests to perform multipy operations:
tools/bazel run --config=fuchsia_x64 //src/acpi_multiply/driver:pkg.component
Open the device log viewer:
tools/ffx log --filter acpi_controller --filter acpi_multiply
You should see the acpi_multiply
driver log multiplication operations it performs after the driver has successfully bound.
[acpi-multiply,driver][I]: [acpi_multiply.cc:93] UINT32_MAX*9: Got result overflowed=true result=4294967287 [acpi-multiply,driver][I]: [acpi_multiply.cc:105] 2*9: Got result overflowed=false result=18
controller/
— Source code of the acpi_controller
driver component.driver/
— Source code of the acpi_multiply
driver component.fidl/
— FIDL library definition for examples.acpi.multiply
.lib/
— Common device registers shared between the controller and driver components.