1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#![allow(non_snake_case, non_upper_case_globals)]
#![allow(non_camel_case_types)]
#[cfg(not(feature = "nosync"))]
pub use stm32f2::peripherals::ethernet_ptp::Instance;
pub use stm32f2::peripherals::ethernet_ptp::{RegisterBlock, ResetValues};
pub use stm32f2::peripherals::ethernet_ptp::{
PTPPPSCR, PTPSSIR, PTPTSAR, PTPTSCR, PTPTSHR, PTPTSHUR, PTPTSLR, PTPTSLUR, PTPTSSR, PTPTTHR,
PTPTTLR,
};
pub mod Ethernet_PTP {
#[cfg(not(feature = "nosync"))]
use external_cortex_m;
use super::ResetValues;
#[cfg(not(feature = "nosync"))]
use super::Instance;
#[cfg(not(feature = "nosync"))]
const INSTANCE: Instance = Instance {
addr: 0x40028700,
_marker: ::core::marker::PhantomData,
};
pub const reset: ResetValues = ResetValues {
PTPTSCR: 0x00002000,
PTPSSIR: 0x00000000,
PTPTSHR: 0x00000000,
PTPTSLR: 0x00000000,
PTPTSHUR: 0x00000000,
PTPTSLUR: 0x00000000,
PTPTSAR: 0x00000000,
PTPTTHR: 0x00000000,
PTPTTLR: 0x00000000,
PTPTSSR: 0x00000000,
PTPPPSCR: 0x00000000,
};
#[cfg(not(feature = "nosync"))]
#[allow(renamed_and_removed_lints)]
#[allow(private_no_mangle_statics)]
#[no_mangle]
static mut Ethernet_PTP_TAKEN: bool = false;
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn take() -> Option<Instance> {
external_cortex_m::interrupt::free(|_| unsafe {
if Ethernet_PTP_TAKEN {
None
} else {
Ethernet_PTP_TAKEN = true;
Some(INSTANCE)
}
})
}
#[cfg(not(feature = "nosync"))]
#[inline]
pub fn release(inst: Instance) {
external_cortex_m::interrupt::free(|_| unsafe {
if Ethernet_PTP_TAKEN && inst.addr == INSTANCE.addr {
Ethernet_PTP_TAKEN = false;
} else {
panic!("Released a peripheral which was not taken");
}
});
}
}
pub const Ethernet_PTP: *const RegisterBlock = 0x40028700 as *const _;