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:
Add a test node for the acpi_controller
driver:
tools/ffx driver test-node add controller-node \ examples.driver.test.property=acpi-multiply-controller
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 --tags acpi-multiply --tags acpi-multiply-controller
After the drivers are loaded, use the following commands to run the multiplier client:
Load the multiply_client
component:
tools/bazel run --config=fuchsia_x64 //src/acpi_multiply/client:pkg.component
Open the device log viewer:
tools/ffx log --filter multiply_client
You should see the client respond with an incrementing temperature value on each run:
[ffx-laboratory:multiply_client][I] Multiply(4294967295, 9): Invalid result: Overflow [ffx-laboratory:multiply_client][I] Multiply(2, 9) = 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.