#[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 asPRE_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§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more