Skip to content

Remove deprecated APIs and the const-fn feature #191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ bare-metal = { version = "0.2.0", features = ["const-fn"] }
volatile-register = "0.2.0"

[features]
const-fn = []
cm7-r0p1 = []
inline-asm = []
49 changes: 4 additions & 45 deletions src/peripheral/nvic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ pub struct RegisterBlock {

_reserved5: [u32; 48],

#[cfg(not(armv6m))]
/// Interrupt Priority
///
/// On ARMv7-M, 124 word-sized registers are available. Each of those
Expand All @@ -50,9 +49,9 @@ pub struct RegisterBlock {
/// On ARMv6-M, the registers must only be accessed along word boundaries,
/// so convenient byte-sized representation wouldn't work on that
/// architecture.
#[cfg(not(armv6m))]
pub ipr: [RW<u8>; 496],

#[cfg(armv6m)]
/// Interrupt Priority
///
/// On ARMv7-M, 124 word-sized registers are available. Each of those
Expand All @@ -64,25 +63,26 @@ pub struct RegisterBlock {
/// On ARMv6-M, the registers must only be accessed along word boundaries,
/// so convenient byte-sized representation wouldn't work on that
/// architecture.
#[cfg(armv6m)]
pub ipr: [RW<u32>; 8],

#[cfg(not(armv6m))]
_reserved6: [u32; 580],

#[cfg(not(armv6m))]
/// Software Trigger Interrupt
#[cfg(not(armv6m))]
pub stir: WO<u32>,
}

impl NVIC {
#[cfg(not(armv6m))]
/// Request an IRQ in software
///
/// Writing a value to the INTID field is the same as manually pending an interrupt by setting
/// the corresponding interrupt bit in an Interrupt Set Pending Register. This is similar to
/// `set_pending`.
///
/// This method is not available on ARMv6-M chips.
#[cfg(not(armv6m))]
#[inline]
pub fn request<I>(&mut self, interrupt: I)
where
Expand All @@ -95,16 +95,6 @@ impl NVIC {
}
}

/// Clears `interrupt`'s pending state
#[deprecated(since = "0.5.8", note = "Use `NVIC::unpend`")]
#[inline]
pub fn clear_pending<I>(&mut self, interrupt: I)
where
I: Nr,
{
Self::unpend(interrupt)
}

/// Disables `interrupt`
#[inline]
pub fn mask<I>(interrupt: I)
Expand All @@ -129,27 +119,6 @@ impl NVIC {
(*Self::ptr()).iser[usize::from(nr / 32)].write(1 << (nr % 32))
}

/// Disables `interrupt`
#[deprecated(since = "0.6.1", note = "Use `NVIC::mask`")]
#[inline]
pub fn disable<I>(&mut self, interrupt: I)
where
I: Nr,
{
Self::mask(interrupt)
}

/// **WARNING** This method is a soundness hole in the API; it should actually be an `unsafe`
/// function. Use `NVIC::unmask` which has the right unsafety.
#[deprecated(since = "0.6.1", note = "Use `NVIC::unmask`")]
#[inline]
pub fn enable<I>(&mut self, interrupt: I)
where
I: Nr,
{
unsafe { Self::unmask(interrupt) }
}

/// Returns the NVIC priority of `interrupt`
///
/// *NOTE* NVIC encodes priority in the highest bits of a byte so values like `1` and `2` map
Expand Down Expand Up @@ -228,16 +197,6 @@ impl NVIC {
unsafe { (*Self::ptr()).ispr[usize::from(nr / 32)].write(1 << (nr % 32)) }
}

/// Forces `interrupt` into pending state
#[deprecated(since = "0.5.8", note = "Use `NVIC::pend`")]
#[inline]
pub fn set_pending<I>(&mut self, interrupt: I)
where
I: Nr,
{
Self::pend(interrupt)
}

/// Sets the "priority" of `interrupt` to `prio`
///
/// *NOTE* See [`get_priority`](struct.NVIC.html#method.get_priority) method for an explanation
Expand Down
21 changes: 0 additions & 21 deletions src/peripheral/scb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,27 +633,6 @@ const SCB_AIRCR_PRIGROUP_MASK: u32 = 0x5 << 8;
const SCB_AIRCR_SYSRESETREQ: u32 = 1 << 2;

impl SCB {
/// Initiate a system reset request to reset the MCU
#[deprecated(since = "0.6.1", note = "Use `SCB::sys_reset`")]
#[inline]
pub fn system_reset(&mut self) -> ! {
crate::asm::dsb();
unsafe {
self.aircr.modify(
|r| {
SCB_AIRCR_VECTKEY | // otherwise the write is ignored
r & SCB_AIRCR_PRIGROUP_MASK | // keep priority group unchanged
SCB_AIRCR_SYSRESETREQ
}, // set the bit
)
};
crate::asm::dsb();
loop {
// wait for the reset
crate::asm::nop(); // avoid rust-lang/rust#28728
}
}

/// Initiate a system reset request to reset the MCU
#[inline]
pub fn sys_reset() -> ! {
Expand Down
21 changes: 0 additions & 21 deletions src/register/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,14 @@
#[cfg(all(not(armv6m), not(armv8m_base)))]
pub mod basepri;

#[cfg(armv8m_base)]
#[deprecated(
since = "0.6.2",
note = "basepri is unavailable on thumbv8.base, and will be removed in the next release"
)]
pub mod basepri;

#[cfg(all(not(armv6m), not(armv8m_base)))]
pub mod basepri_max;

#[cfg(armv8m_base)]
#[deprecated(
since = "0.6.2",
note = "basepri is unavailable on thumbv8m.base, and will be removed in the next release"
)]
pub mod basepri_max;

pub mod control;

#[cfg(all(not(armv6m), not(armv8m_base)))]
pub mod faultmask;

#[cfg(armv8m_base)]
#[deprecated(
since = "0.6.2",
note = "faultmask is unavailable on thumbv8m.base, and will be removed in the next release"
)]
pub mod faultmask;

pub mod msp;

pub mod primask;
Expand Down