Skip to content

Commit cbd8738

Browse files
committed
Tweaks to appease semver-checks
1 parent e1b0e70 commit cbd8738

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

cortex-m/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ inline-asm = []
4040
linker-plugin-lto = []
4141
std = []
4242
critical-section-single-core = ["critical-section/restore-state-u32"]
43+
# Deprecated feature from when critical-section was an optional dependency
44+
critical-section = []
4345

4446
[package.metadata.docs.rs]
4547
targets = [

cortex-m/src/interrupt.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,11 @@ where
7474
r
7575
}
7676

77-
// Make a `free()` function available to allow checking dependencies without specifying a target,
78-
// but that will panic at runtime if executed.
79-
#[doc(hidden)]
77+
// Make a `free()` function available on hosted platforms to allow checking dependencies without
78+
// specifying a target, but that will panic at runtime if executed.
79+
/// Execute closure `f` in an interrupt-free context.
80+
///
81+
/// This as also known as a "critical section".
8082
#[cfg(not(cortex_m))]
8183
#[inline]
8284
pub fn free<F, R>(_: F) -> R

cortex-m/src/register/primask.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ impl Primask {
2929
}
3030

3131
/// Reads the prioritizable interrupt mask
32-
#[cfg(cortex_m)]
3332
#[inline]
3433
pub fn read() -> Primask {
3534
if read_raw() & (1 << 0) == (1 << 0) {
@@ -41,11 +40,15 @@ pub fn read() -> Primask {
4140

4241
/// Reads the entire PRIMASK register
4342
/// Note that bits [31:1] are reserved and UNK (Unknown)
44-
#[cfg(cortex_m)]
4543
#[inline]
4644
pub fn read_raw() -> u32 {
4745
let r: u32;
48-
unsafe { asm!("mrs {}, PRIMASK", out(reg) r, options(nomem, nostack, preserves_flags)) };
46+
#[cfg(cortex_m)]
47+
unsafe {
48+
asm!("mrs {}, PRIMASK", out(reg) r, options(nomem, nostack, preserves_flags))
49+
};
50+
#[cfg(not(cortex_m))]
51+
panic!("cannot read PRIMASK on non-cortex-m platform");
4952
r
5053
}
5154

0 commit comments

Comments
 (0)