> +//! ### Example
> +//!
> +//! ```
> +//! # use qemu_api::prelude::*;
> +//! # use qemu_api::{c_str, cell::BqlRefCell, irq::InterruptSource,
> irq::IRQState};
> +//! # use qemu_api::{sysbus::SysBusDevice, qom::Owned, qom::ParentField};
> +//! # const N_GPIOS: usize = 8;
> +//! # struct PL061Registers { /* ... */ }
> +//! # unsafe impl ObjectType for PL061Device {
> +//! # type Class = <SysBusDevice as ObjectType>::Class;
> +//! # const TYPE_NAME: &'static std::ffi::CStr = c_str!("pl061");
> +//! # }
> +//! struct PL061Device {
Maybe PL061State?
> +//! parent_obj: ParentField<SysBusDevice>,
> +//!
> +//! // Configuration is read-only after initialization
> +//! pullups: u32,
> +//! pulldowns: u32,
> +//!
> +//! // Same for sub-objects of the device
> +//! out: [Owned<IRQState>; N_GPIOS],
Should this be InterruptSource type?
Just have a quick look at pl061.c:
qdev_init_gpio_out(dev, s->out, N_GPIOS);
So in Rust side, `out` would be initialized by
DeviceMethods::init_gpio_out().
Others are fine for me ~ with above nits fixed,
Reviewed-by: Zhao Liu <[email protected]>