ClockRef

Struct ClockRef 

Source
pub struct ClockRef {
    pub name: Option<String>,
    pub phandle: Phandle,
    pub cells: u32,
    pub specifier: Vec<u32>,
}
Expand description

时钟引用,用于解析 clocks 属性

根据设备树规范,clocks 属性格式为: clocks = <&clock_provider specifier [specifier ...]> [<&clock_provider2 ...>]

每个时钟引用由一个 phandle 和若干个 specifier cells 组成, specifier 的数量由目标 clock provider 的 #clock-cells 属性决定。

Fields§

§name: Option<String>

时钟的名称,来自 clock-names 属性

§phandle: Phandle

时钟提供者的 phandle

§cells: u32

provider 的 #clock-cells 值

§specifier: Vec<u32>

时钟选择器(specifier),通常第一个值用于选择时钟输出 长度由 provider 的 #clock-cells 决定

Implementations§

Source§

impl ClockRef

Source

pub fn new(phandle: Phandle, cells: u32, specifier: Vec<u32>) -> Self

创建一个新的时钟引用

Source

pub fn with_name( name: Option<String>, phandle: Phandle, cells: u32, specifier: Vec<u32>, ) -> Self

创建一个带名称的时钟引用

Source

pub fn select(&self) -> Option<u32>

获取选择器的第一个值(通常用于选择时钟输出)

只有当 cells > 0 时才返回选择器值, 因为 #clock-cells = 0 的 provider 不需要选择器。

Trait Implementations§

Source§

impl Clone for ClockRef

Source§

fn clone(&self) -> ClockRef

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ClockRef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.