stm32ral/stm32mp/instances/
etzpc.rs1#![allow(non_snake_case, non_upper_case_globals)]
2#![allow(non_camel_case_types)]
3#[cfg(not(feature = "nosync"))]
8pub use crate::stm32mp::peripherals::etzpc::Instance;
9pub use crate::stm32mp::peripherals::etzpc::{RegisterBlock, ResetValues};
10pub use crate::stm32mp::peripherals::etzpc::{
11 ETZPC_DECPROT0, ETZPC_DECPROT1, ETZPC_DECPROT2, ETZPC_DECPROT3, ETZPC_DECPROT4, ETZPC_DECPROT5,
12 ETZPC_DECPROT_LOCK0, ETZPC_DECPROT_LOCK1, ETZPC_DECPROT_LOCK2, ETZPC_HWCFGR, ETZPC_IDR,
13 ETZPC_SIDR, ETZPC_TZMA0_SIZE, ETZPC_TZMA1_SIZE, ETZPC_VERR,
14};
15
16pub mod ETZPC {
18 use super::ResetValues;
19
20 #[cfg(not(feature = "nosync"))]
21 use super::Instance;
22
23 #[cfg(not(feature = "nosync"))]
24 const INSTANCE: Instance = Instance {
25 addr: 0x5c007000,
26 _marker: ::core::marker::PhantomData,
27 };
28
29 pub const reset: ResetValues = ResetValues {
31 ETZPC_TZMA0_SIZE: 0x000003FF,
32 ETZPC_TZMA1_SIZE: 0x000003FF,
33 ETZPC_DECPROT0: 0x00000000,
34 ETZPC_DECPROT1: 0x00000000,
35 ETZPC_DECPROT2: 0x00000000,
36 ETZPC_DECPROT3: 0x00000000,
37 ETZPC_DECPROT4: 0x00000000,
38 ETZPC_DECPROT5: 0x00000000,
39 ETZPC_DECPROT_LOCK0: 0x00000000,
40 ETZPC_DECPROT_LOCK1: 0x00000000,
41 ETZPC_DECPROT_LOCK2: 0x00000000,
42 ETZPC_HWCFGR: 0x00006002,
43 ETZPC_VERR: 0x00000020,
44 ETZPC_IDR: 0x00100061,
45 ETZPC_SIDR: 0xA3C5DD01,
46 };
47
48 #[cfg(not(feature = "nosync"))]
49 #[allow(renamed_and_removed_lints)]
50 #[allow(private_no_mangle_statics)]
51 #[no_mangle]
52 static mut ETZPC_TAKEN: bool = false;
53
54 #[cfg(not(feature = "nosync"))]
67 #[inline]
68 pub fn take() -> Option<Instance> {
69 external_cortex_m::interrupt::free(|_| unsafe {
70 if ETZPC_TAKEN {
71 None
72 } else {
73 ETZPC_TAKEN = true;
74 Some(INSTANCE)
75 }
76 })
77 }
78
79 #[cfg(not(feature = "nosync"))]
86 #[inline]
87 pub fn release(inst: Instance) {
88 external_cortex_m::interrupt::free(|_| unsafe {
89 if ETZPC_TAKEN && inst.addr == INSTANCE.addr {
90 ETZPC_TAKEN = false;
91 } else {
92 panic!("Released a peripheral which was not taken");
93 }
94 });
95 }
96
97 #[cfg(not(feature = "nosync"))]
103 #[inline]
104 pub unsafe fn steal() -> Instance {
105 ETZPC_TAKEN = true;
106 INSTANCE
107 }
108}
109
110pub const ETZPC: *const RegisterBlock = 0x5c007000 as *const _;