stm32ral/stm32f7/instances/
rtc_f730_f7x2_f7x3.rs1#![allow(non_snake_case, non_upper_case_globals)]
2#![allow(non_camel_case_types)]
3#[cfg(not(feature = "nosync"))]
8pub use crate::stm32f7::peripherals::rtc_v1::Instance;
9pub use crate::stm32f7::peripherals::rtc_v1::{RegisterBlock, ResetValues};
10pub use crate::stm32f7::peripherals::rtc_v1::{
11 ALRMAR, ALRMASSR, ALRMBR, ALRMBSSR, BKP0R, BKP10R, BKP11R, BKP12R, BKP13R, BKP14R, BKP15R,
12 BKP16R, BKP17R, BKP18R, BKP19R, BKP1R, BKP20R, BKP21R, BKP22R, BKP23R, BKP24R, BKP25R, BKP26R,
13 BKP27R, BKP28R, BKP29R, BKP2R, BKP30R, BKP31R, BKP3R, BKP4R, BKP5R, BKP6R, BKP7R, BKP8R, BKP9R,
14 CALR, CR, DR, ISR, OR, PRER, SHIFTR, SSR, TAMPCR, TR, TSDR, TSSSR, TSTR, WPR, WUTR,
15};
16
17pub mod RTC {
19 use super::ResetValues;
20
21 #[cfg(not(feature = "nosync"))]
22 use super::Instance;
23
24 #[cfg(not(feature = "nosync"))]
25 const INSTANCE: Instance = Instance {
26 addr: 0x40002800,
27 _marker: ::core::marker::PhantomData,
28 };
29
30 pub const reset: ResetValues = ResetValues {
32 TR: 0x00000000,
33 DR: 0x00002101,
34 CR: 0x00000000,
35 ISR: 0x00000007,
36 PRER: 0x007F00FF,
37 WUTR: 0x0000FFFF,
38 ALRMAR: 0x00000000,
39 ALRMBR: 0x00000000,
40 WPR: 0x00000000,
41 SSR: 0x00000000,
42 SHIFTR: 0x00000000,
43 TSTR: 0x00000000,
44 TSDR: 0x00000000,
45 TSSSR: 0x00000000,
46 CALR: 0x00000000,
47 TAMPCR: 0x00000000,
48 ALRMASSR: 0x00000000,
49 ALRMBSSR: 0x00000000,
50 OR: 0x00000000,
51 BKP0R: 0x00000000,
52 BKP1R: 0x00000000,
53 BKP2R: 0x00000000,
54 BKP3R: 0x00000000,
55 BKP4R: 0x00000000,
56 BKP5R: 0x00000000,
57 BKP6R: 0x00000000,
58 BKP7R: 0x00000000,
59 BKP8R: 0x00000000,
60 BKP9R: 0x00000000,
61 BKP10R: 0x00000000,
62 BKP11R: 0x00000000,
63 BKP12R: 0x00000000,
64 BKP13R: 0x00000000,
65 BKP14R: 0x00000000,
66 BKP15R: 0x00000000,
67 BKP16R: 0x00000000,
68 BKP17R: 0x00000000,
69 BKP18R: 0x00000000,
70 BKP19R: 0x00000000,
71 BKP20R: 0x00000000,
72 BKP21R: 0x00000000,
73 BKP22R: 0x00000000,
74 BKP23R: 0x00000000,
75 BKP24R: 0x00000000,
76 BKP25R: 0x00000000,
77 BKP26R: 0x00000000,
78 BKP27R: 0x00000000,
79 BKP28R: 0x00000000,
80 BKP29R: 0x00000000,
81 BKP30R: 0x00000000,
82 BKP31R: 0x00000000,
83 };
84
85 #[cfg(not(feature = "nosync"))]
86 #[allow(renamed_and_removed_lints)]
87 #[allow(private_no_mangle_statics)]
88 #[no_mangle]
89 static mut RTC_TAKEN: bool = false;
90
91 #[cfg(not(feature = "nosync"))]
104 #[inline]
105 pub fn take() -> Option<Instance> {
106 external_cortex_m::interrupt::free(|_| unsafe {
107 if RTC_TAKEN {
108 None
109 } else {
110 RTC_TAKEN = true;
111 Some(INSTANCE)
112 }
113 })
114 }
115
116 #[cfg(not(feature = "nosync"))]
123 #[inline]
124 pub fn release(inst: Instance) {
125 external_cortex_m::interrupt::free(|_| unsafe {
126 if RTC_TAKEN && inst.addr == INSTANCE.addr {
127 RTC_TAKEN = false;
128 } else {
129 panic!("Released a peripheral which was not taken");
130 }
131 });
132 }
133
134 #[cfg(not(feature = "nosync"))]
140 #[inline]
141 pub unsafe fn steal() -> Instance {
142 RTC_TAKEN = true;
143 INSTANCE
144 }
145}
146
147pub const RTC: *const RegisterBlock = 0x40002800 as *const _;