Trait Driver

Source
pub trait Driver {
    type PData: ForeignOwnable;
Show 24 associated constants and 20 methods const USE_VTABLE_ATTR: (); const NAME: &'static CStr; const FLAGS: u16; const BOOST_ENABLED: bool; const HAS_INIT: bool = false; const HAS_EXIT: bool = false; const HAS_ONLINE: bool = false; const HAS_OFFLINE: bool = false; const HAS_SUSPEND: bool = false; const HAS_RESUME: bool = false; const HAS_READY: bool = false; const HAS_VERIFY: bool = false; const HAS_SETPOLICY: bool = false; const HAS_TARGET: bool = false; const HAS_TARGET_INDEX: bool = false; const HAS_FAST_SWITCH: bool = false; const HAS_ADJUST_PERF: bool = false; const HAS_GET_INTERMEDIATE: bool = false; const HAS_TARGET_INTERMEDIATE: bool = false; const HAS_GET: bool = false; const HAS_UPDATE_LIMITS: bool = false; const HAS_BIOS_LIMIT: bool = false; const HAS_SET_BOOST: bool = false; const HAS_REGISTER_EM: bool = false; // Required methods fn init(policy: &mut Policy) -> Result<Self::PData>; fn verify(data: &mut PolicyData) -> Result<()>; // Provided methods fn exit(_policy: &mut Policy, _data: Option<Self::PData>) -> Result<()> { ... } fn online(_policy: &mut Policy) -> Result<()> { ... } fn offline(_policy: &mut Policy) -> Result<()> { ... } fn suspend(_policy: &mut Policy) -> Result<()> { ... } fn resume(_policy: &mut Policy) -> Result<()> { ... } fn ready(_policy: &mut Policy) { ... } fn setpolicy(_policy: &mut Policy) -> Result<()> { ... } fn target( _policy: &mut Policy, _target_freq: u32, _relation: Relation, ) -> Result<()> { ... } fn target_index(_policy: &mut Policy, _index: TableIndex) -> Result<()> { ... } fn fast_switch(_policy: &mut Policy, _target_freq: u32) -> u32 { ... } fn adjust_perf( _policy: &mut Policy, _min_perf: usize, _target_perf: usize, _capacity: usize, ) { ... } fn get_intermediate(_policy: &mut Policy, _index: TableIndex) -> u32 { ... } fn target_intermediate( _policy: &mut Policy, _index: TableIndex, ) -> Result<()> { ... } fn get(_policy: &mut Policy) -> Result<u32> { ... } fn update_limits(_policy: &mut Policy) { ... } fn bios_limit(_policy: &mut Policy, _limit: &mut u32) -> Result<()> { ... } fn set_boost(_policy: &mut Policy, _state: i32) -> Result<()> { ... } fn register_em(_policy: &mut Policy) { ... }
}
Expand description

CPU frequency driver.

Implement this trait to provide a CPU frequency driver and its callbacks.

Reference: https://docs.kernel.org/cpu-freq/cpu-drivers.html

Required Associated Constants§

Source

const USE_VTABLE_ATTR: ()

A marker to prevent implementors from forgetting to use #[vtable] attribute when implementing this trait.

Source

const NAME: &'static CStr

Driver’s name.

Source

const FLAGS: u16

Driver’s flags.

Source

const BOOST_ENABLED: bool

Boost support.

Provided Associated Constants§

Source

const HAS_INIT: bool = false

Indicates if the init method is overridden by the implementor.

Source

const HAS_EXIT: bool = false

Indicates if the exit method is overridden by the implementor.

Source

const HAS_ONLINE: bool = false

Indicates if the online method is overridden by the implementor.

Source

const HAS_OFFLINE: bool = false

Indicates if the offline method is overridden by the implementor.

Source

const HAS_SUSPEND: bool = false

Indicates if the suspend method is overridden by the implementor.

Source

const HAS_RESUME: bool = false

Indicates if the resume method is overridden by the implementor.

Source

const HAS_READY: bool = false

Indicates if the ready method is overridden by the implementor.

Source

const HAS_VERIFY: bool = false

Indicates if the verify method is overridden by the implementor.

Source

const HAS_SETPOLICY: bool = false

Indicates if the setpolicy method is overridden by the implementor.

Source

const HAS_TARGET: bool = false

Indicates if the target method is overridden by the implementor.

Source

const HAS_TARGET_INDEX: bool = false

Indicates if the target_index method is overridden by the implementor.

Source

const HAS_FAST_SWITCH: bool = false

Indicates if the fast_switch method is overridden by the implementor.

Source

const HAS_ADJUST_PERF: bool = false

Indicates if the adjust_perf method is overridden by the implementor.

Source

const HAS_GET_INTERMEDIATE: bool = false

Indicates if the get_intermediate method is overridden by the implementor.

Source

const HAS_TARGET_INTERMEDIATE: bool = false

Indicates if the target_intermediate method is overridden by the implementor.

Source

const HAS_GET: bool = false

Indicates if the get method is overridden by the implementor.

Source

const HAS_UPDATE_LIMITS: bool = false

Indicates if the update_limits method is overridden by the implementor.

Source

const HAS_BIOS_LIMIT: bool = false

Indicates if the bios_limit method is overridden by the implementor.

Source

const HAS_SET_BOOST: bool = false

Indicates if the set_boost method is overridden by the implementor.

Source

const HAS_REGISTER_EM: bool = false

Indicates if the register_em method is overridden by the implementor.

Required Associated Types§

Source

type PData: ForeignOwnable

Policy specific data.

Require that PData implements ForeignOwnable. We guarantee to never move the underlying wrapped data structure.

Required Methods§

Source

fn init(policy: &mut Policy) -> Result<Self::PData>

Driver’s init callback.

Source

fn verify(data: &mut PolicyData) -> Result<()>

Driver’s verify callback.

Provided Methods§

Source

fn exit(_policy: &mut Policy, _data: Option<Self::PData>) -> Result<()>

Driver’s exit callback.

Source

fn online(_policy: &mut Policy) -> Result<()>

Driver’s online callback.

Source

fn offline(_policy: &mut Policy) -> Result<()>

Driver’s offline callback.

Source

fn suspend(_policy: &mut Policy) -> Result<()>

Driver’s suspend callback.

Source

fn resume(_policy: &mut Policy) -> Result<()>

Driver’s resume callback.

Source

fn ready(_policy: &mut Policy)

Driver’s ready callback.

Source

fn setpolicy(_policy: &mut Policy) -> Result<()>

Driver’s setpolicy callback.

Source

fn target( _policy: &mut Policy, _target_freq: u32, _relation: Relation, ) -> Result<()>

Driver’s target callback.

Source

fn target_index(_policy: &mut Policy, _index: TableIndex) -> Result<()>

Driver’s target_index callback.

Source

fn fast_switch(_policy: &mut Policy, _target_freq: u32) -> u32

Driver’s fast_switch callback.

Source

fn adjust_perf( _policy: &mut Policy, _min_perf: usize, _target_perf: usize, _capacity: usize, )

Driver’s adjust_perf callback.

Source

fn get_intermediate(_policy: &mut Policy, _index: TableIndex) -> u32

Driver’s get_intermediate callback.

Source

fn target_intermediate(_policy: &mut Policy, _index: TableIndex) -> Result<()>

Driver’s target_intermediate callback.

Source

fn get(_policy: &mut Policy) -> Result<u32>

Driver’s get callback.

Source

fn update_limits(_policy: &mut Policy)

Driver’s update_limits callback.

Source

fn bios_limit(_policy: &mut Policy, _limit: &mut u32) -> Result<()>

Driver’s bios_limit callback.

Source

fn set_boost(_policy: &mut Policy, _state: i32) -> Result<()>

Driver’s set_boost callback.

Source

fn register_em(_policy: &mut Policy)

Driver’s register_em callback.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§