@@ -96,7 +96,15 @@ pub fn render(p_original: &Peripheral, index: &Index, config: &Config) -> Result
96
96
///
97
97
///# Safety
98
98
///
99
- ///Make sure that [`Peripherals::steal`] is already called
99
+ /// Ensure that the new instance of the peripheral cannot be used in a way
100
+ /// that may race with any existing instances, for example by only
101
+ /// accessing read-only or write-only registers, or by consuming the
102
+ /// original peripheral and using critical sections to coordinate
103
+ /// access between multiple new instances.
104
+ ///
105
+ /// Additionally, other software such as HALs may rely on only one
106
+ /// peripheral instance existing to ensure memory safety; ensure
107
+ /// no stolen instances are passed to such software.
100
108
pub unsafe fn steal( ) -> Self {
101
109
Self { _marker: PhantomData }
102
110
}
@@ -161,10 +169,18 @@ pub fn render(p_original: &Peripheral, index: &Index, config: &Config) -> Result
161
169
}
162
170
163
171
///Steal an instance of this peripheral
164
- ///
165
- ///# Safety
166
- ///
167
- ///Make sure that [`Peripherals::steal`] is already called
172
+ ///
173
+ ///# Safety
174
+ ///
175
+ /// Ensure that the new instance of the peripheral cannot be used in a way
176
+ /// that may race with any existing instances, for example by only
177
+ /// accessing read-only or write-only registers, or by consuming the
178
+ /// original peripheral and using critical sections to coordinate
179
+ /// access between multiple new instances.
180
+ ///
181
+ /// Additionally, other software such as HALs may rely on only one
182
+ /// peripheral instance existing to ensure memory safety; ensure
183
+ /// no stolen instances are passed to such software.
168
184
pub unsafe fn steal( ) -> Self {
169
185
Self { _marker: PhantomData }
170
186
}
0 commit comments