imxrt_hal/chip/drivers/snvs.rs
1//! Secure non-volatile storage.
2//!
3//! The SNVS peripheral implements a few functions. This implementation
4//! supports
5//!
6//! - the secure real-time counter (SRTC) in the low-power (LP) domain.
7
8#[path = "snvs/ral.rs"]
9mod ral;
10#[path = "snvs/srtc.rs"]
11pub mod srtc;
12
13pub use ral::lp::Core as LpCore;
14
15/// SNVS low-power domain.
16#[non_exhaustive]
17pub struct LowPower {
18 /// Core registers.
19 ///
20 /// This handled is passed into other SNVS low-power components
21 /// when required.
22 pub core: ral::lp::Core,
23 /// Secure real-time counter.
24 pub srtc: srtc::Disabled,
25}
26
27/// SNVS components.
28///
29/// Use [`new`](crate::snvs::new) to create the components.
30#[non_exhaustive]
31pub struct Snvs {
32 /// Components for the low power domain.
33 pub low_power: LowPower,
34}
35
36/// Decompose the SNVS peripheral into its components.
37pub fn new(snvs: crate::ral::snvs::SNVS) -> Snvs {
38 let components = ral::new(snvs);
39 Snvs {
40 low_power: LowPower {
41 core: components.lp_core,
42 srtc: srtc::Disabled::new(components.lp_srtc),
43 },
44 }
45}