Update stm32-data: rcc regs info comes from yamls now.
This commit is contained in:
@ -103,7 +103,7 @@ crate::pac::peripherals!(
|
||||
|
||||
crate::pac::peripherals!(
|
||||
(can, CAN) => {
|
||||
unsafe impl bxcan::FilterOwner for peripherals::$inst {
|
||||
unsafe impl bxcan::FilterOwner for peripherals::CAN {
|
||||
const NUM_FILTER_BANKS: u8 = 14;
|
||||
}
|
||||
};
|
||||
@ -144,4 +144,10 @@ crate::pac::peripheral_pins!(
|
||||
($inst:ident, can, CAN, $pin:ident, RX, $af:expr) => {
|
||||
impl_pin!($inst, $pin, RxPin, $af);
|
||||
};
|
||||
($inst:ident, can, CAN, $pin:ident, TX) => {
|
||||
impl_pin!($inst, $pin, TxPin, 0);
|
||||
};
|
||||
($inst:ident, can, CAN, $pin:ident, RX) => {
|
||||
impl_pin!($inst, $pin, RxPin, 0);
|
||||
};
|
||||
);
|
||||
|
@ -49,16 +49,11 @@ pac::dma_channels! {
|
||||
|
||||
/// safety: must be called only once
|
||||
pub(crate) unsafe fn init() {
|
||||
pac::peripherals! {
|
||||
(dmamux, $peri:ident) => {
|
||||
{
|
||||
pac::peripheral_rcc! {
|
||||
($peri, $clock:ident, $en_reg:ident, $rst_reg:ident, $en_fn:ident, $rst_fn:ident) => {
|
||||
use crate::rcc::sealed::RccPeripheral;
|
||||
crate::peripherals::$peri::enable()
|
||||
};
|
||||
}
|
||||
}
|
||||
crate::pac::peripheral_rcc! {
|
||||
($name:ident, dmamux, DMAMUX, $clock:ident, ($reg:ident, $field:ident, $set_field:ident), $rst:tt) => {
|
||||
crate::pac::RCC.$reg().modify(|reg| {
|
||||
reg.$set_field(true);
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -601,14 +601,10 @@ crate::pac::pins!(
|
||||
);
|
||||
|
||||
pub(crate) unsafe fn init() {
|
||||
crate::pac::gpio_rcc! {
|
||||
($en_reg:ident) => {
|
||||
crate::pac::RCC.$en_reg().modify(|reg| {
|
||||
crate::pac::gpio_rcc! {
|
||||
($name:ident, $clock:ident, $en_reg, $rst_reg:ident, $en_fn:ident, $rst_fn:ident) => {
|
||||
reg.$en_fn(true);
|
||||
};
|
||||
}
|
||||
crate::pac::peripheral_rcc! {
|
||||
($name:ident, gpio, GPIO, $clock:ident, ($reg:ident, $field:ident, $set_field:ident), $rst:tt) => {
|
||||
crate::pac::RCC.$reg().modify(|reg| {
|
||||
reg.$set_field(true);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@ -120,35 +120,33 @@ pub(crate) mod sealed {
|
||||
pub trait RccPeripheral: sealed::RccPeripheral + 'static {}
|
||||
|
||||
crate::pac::peripheral_rcc!(
|
||||
($inst:ident, $clk:ident, $enable:ident, $reset:ident, $perien:ident, $perirst:ident) => {
|
||||
($inst:ident, gpio, GPIO, $clk:ident, $en:tt, $rst:tt) => {};
|
||||
($inst:ident, $module:ident, $block:ident, $clk:ident, ($en_reg:ident, $en_field:ident, $en_set_field:ident), ($rst_reg:ident, $rst_field:ident, $rst_set_field:ident)) => {
|
||||
impl sealed::RccPeripheral for peripherals::$inst {
|
||||
fn frequency() -> crate::time::Hertz {
|
||||
critical_section::with(|_| {
|
||||
unsafe {
|
||||
let freqs = get_freqs();
|
||||
freqs.$clk
|
||||
}
|
||||
unsafe { get_freqs().$clk }
|
||||
})
|
||||
}
|
||||
fn enable() {
|
||||
critical_section::with(|_| {
|
||||
unsafe {
|
||||
crate::pac::RCC.$enable().modify(|w| w.$perien(true));
|
||||
crate::pac::RCC.$en_reg().modify(|w| w.$en_set_field(true));
|
||||
}
|
||||
})
|
||||
}
|
||||
fn disable() {
|
||||
critical_section::with(|_| {
|
||||
unsafe {
|
||||
crate::pac::RCC.$enable().modify(|w| w.$perien(false));
|
||||
crate::pac::RCC.$en_reg().modify(|w| w.$en_set_field(false));
|
||||
}
|
||||
})
|
||||
}
|
||||
fn reset() {
|
||||
critical_section::with(|_| {
|
||||
unsafe {
|
||||
crate::pac::RCC.$reset().modify(|w| w.$perirst(true));
|
||||
crate::pac::RCC.$reset().modify(|w| w.$perirst(false));
|
||||
crate::pac::RCC.$rst_reg().modify(|w| w.$rst_set_field(true));
|
||||
crate::pac::RCC.$rst_reg().modify(|w| w.$rst_set_field(false));
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -156,27 +154,24 @@ crate::pac::peripheral_rcc!(
|
||||
|
||||
impl RccPeripheral for peripherals::$inst {}
|
||||
};
|
||||
($inst:ident, $clk:ident, $enable:ident, $perien:ident) => {
|
||||
($inst:ident, $module:ident, $block:ident, $clk:ident, ($en_reg:ident, $en_field:ident, $en_set_field:ident), _) => {
|
||||
impl sealed::RccPeripheral for peripherals::$inst {
|
||||
fn frequency() -> crate::time::Hertz {
|
||||
critical_section::with(|_| {
|
||||
unsafe {
|
||||
let freqs = get_freqs();
|
||||
freqs.$clk
|
||||
}
|
||||
unsafe { get_freqs().$clk }
|
||||
})
|
||||
}
|
||||
fn enable() {
|
||||
critical_section::with(|_| {
|
||||
unsafe {
|
||||
crate::pac::RCC.$enable().modify(|w| w.$perien(true));
|
||||
crate::pac::RCC.$en_reg().modify(|w| w.$en_set_field(true));
|
||||
}
|
||||
})
|
||||
}
|
||||
fn disable() {
|
||||
critical_section::with(|_| {
|
||||
unsafe {
|
||||
crate::pac::RCC.$enable().modify(|w| w.$perien(false));
|
||||
crate::pac::RCC.$en_reg().modify(|w| w.$en_set_field(false));
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user