zephyr::raw

Struct device

source
#[repr(C)]
pub struct device { pub name: *const i8, pub config: *const c_void, pub api: *const c_void, pub state: *mut device_state, pub data: *mut c_void, }
Expand description

@defgroup sys_init System Initialization @ingroup os_services

Zephyr offers an infrastructure to call initialization code before main. Such initialization calls can be registered using SYS_INIT() or SYS_INIT_NAMED() macros. By using a combination of initialization levels and priorities init sequence can be adjusted as needed. The available initialization levels are described, in order, below:

  • EARLY: Used very early in the boot process, right after entering the C domain (z_cstart()). This can be used in architectures and SoCs that extend or implement architecture code and use drivers or system services that have to be initialized before the Kernel calls any architecture specific initialization code.
  • PRE_KERNEL_1: Executed in Kernel’s initialization context, which uses the interrupt stack. At this point Kernel services are not yet available.
  • PRE_KERNEL_2: Same as PRE_KERNEL_1.
  • POST_KERNEL: Executed after Kernel is alive. From this point on, Kernel primitives can be used.
  • APPLICATION: Executed just before application code (main).
  • SMP: Only available if @kconfig{CONFIG_SMP} is enabled, specific for SMP.

Initialization priority can take a value in the range of 0 to 99.

@note The same infrastructure is used by devices. @{

Fields§

§name: *const i8

Name of the device instance

§config: *const c_void

Address of device instance config information

§api: *const c_void

Address of the API structure exposed by the device instance

§state: *mut device_state

Address of the common device state

§data: *mut c_void

Address of the device instance private data

Trait Implementations§

source§

impl Debug for device

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for device

§

impl RefUnwindSafe for device

§

impl !Send for device

§

impl !Sync for device

§

impl Unpin for device

§

impl UnwindSafe for device

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

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

source§

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

source§

type Error = Infallible

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

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

Performs the conversion.
source§

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

source§

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

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

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

Performs the conversion.