stm32: fix fmc-related build failures on some F4's
This commit is contained in:
parent
80b7c3cf69
commit
1e36c91bf8
2 changed files with 122 additions and 126 deletions
|
@ -6,9 +6,6 @@ use crate::gpio::sealed::AFType;
|
|||
use crate::gpio::{Pull, Speed};
|
||||
use crate::Peripheral;
|
||||
|
||||
mod pins;
|
||||
pub use pins::*;
|
||||
|
||||
pub struct Fmc<'d, T: Instance> {
|
||||
peri: PhantomData<&'d mut T>,
|
||||
}
|
||||
|
@ -19,7 +16,7 @@ unsafe impl<'d, T> stm32_fmc::FmcPeripheral for Fmc<'d, T>
|
|||
where
|
||||
T: Instance,
|
||||
{
|
||||
const REGISTERS: *const () = crate::pac::FMC.0 as *const _;
|
||||
const REGISTERS: *const () = T::REGS.0 as *const _;
|
||||
|
||||
fn enable(&mut self) {
|
||||
<T as crate::rcc::sealed::RccPeripheral>::enable();
|
||||
|
@ -32,7 +29,7 @@ where
|
|||
// This is a "not" because it is expected that all future versions have this bit
|
||||
#[cfg(not(any(fmc_v1x3, fmc_v2x1, fsmc_v1x0, fsmc_v1x3, fsmc_v2x3, fsmc_v3x1)))]
|
||||
unsafe {
|
||||
T::regs().bcr1().modify(|r| r.set_fmcen(true))
|
||||
T::REGS.bcr1().modify(|r| r.set_fmcen(true))
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -150,13 +147,130 @@ impl<'d, T: Instance> Fmc<'d, T> {
|
|||
));
|
||||
}
|
||||
|
||||
pub(crate) mod sealed {
|
||||
pub trait Instance: crate::rcc::sealed::RccPeripheral {
|
||||
const REGS: crate::pac::fmc::Fmc;
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Instance: sealed::Instance + 'static {}
|
||||
|
||||
foreach_peripheral!(
|
||||
(fmc, $inst:ident) => {
|
||||
impl crate::fmc::sealed::Instance for crate::peripherals::$inst {
|
||||
fn regs() -> stm32_metapac::fmc::Fmc {
|
||||
crate::pac::$inst
|
||||
}
|
||||
const REGS: crate::pac::fmc::Fmc = crate::pac::$inst;
|
||||
}
|
||||
impl crate::fmc::Instance for crate::peripherals::$inst {}
|
||||
};
|
||||
);
|
||||
|
||||
pin_trait!(SDNWEPin, Instance);
|
||||
pin_trait!(SDNCASPin, Instance);
|
||||
pin_trait!(SDNRASPin, Instance);
|
||||
|
||||
pin_trait!(SDNE0Pin, Instance);
|
||||
pin_trait!(SDNE1Pin, Instance);
|
||||
|
||||
pin_trait!(SDCKE0Pin, Instance);
|
||||
pin_trait!(SDCKE1Pin, Instance);
|
||||
|
||||
pin_trait!(SDCLKPin, Instance);
|
||||
|
||||
pin_trait!(NBL0Pin, Instance);
|
||||
pin_trait!(NBL1Pin, Instance);
|
||||
pin_trait!(NBL2Pin, Instance);
|
||||
pin_trait!(NBL3Pin, Instance);
|
||||
|
||||
pin_trait!(INTPin, Instance);
|
||||
pin_trait!(NLPin, Instance);
|
||||
pin_trait!(NWaitPin, Instance);
|
||||
|
||||
pin_trait!(NE1Pin, Instance);
|
||||
pin_trait!(NE2Pin, Instance);
|
||||
pin_trait!(NE3Pin, Instance);
|
||||
pin_trait!(NE4Pin, Instance);
|
||||
|
||||
pin_trait!(NCEPin, Instance);
|
||||
pin_trait!(NOEPin, Instance);
|
||||
pin_trait!(NWEPin, Instance);
|
||||
pin_trait!(ClkPin, Instance);
|
||||
|
||||
pin_trait!(BA0Pin, Instance);
|
||||
pin_trait!(BA1Pin, Instance);
|
||||
|
||||
pin_trait!(D0Pin, Instance);
|
||||
pin_trait!(D1Pin, Instance);
|
||||
pin_trait!(D2Pin, Instance);
|
||||
pin_trait!(D3Pin, Instance);
|
||||
pin_trait!(D4Pin, Instance);
|
||||
pin_trait!(D5Pin, Instance);
|
||||
pin_trait!(D6Pin, Instance);
|
||||
pin_trait!(D7Pin, Instance);
|
||||
pin_trait!(D8Pin, Instance);
|
||||
pin_trait!(D9Pin, Instance);
|
||||
pin_trait!(D10Pin, Instance);
|
||||
pin_trait!(D11Pin, Instance);
|
||||
pin_trait!(D12Pin, Instance);
|
||||
pin_trait!(D13Pin, Instance);
|
||||
pin_trait!(D14Pin, Instance);
|
||||
pin_trait!(D15Pin, Instance);
|
||||
pin_trait!(D16Pin, Instance);
|
||||
pin_trait!(D17Pin, Instance);
|
||||
pin_trait!(D18Pin, Instance);
|
||||
pin_trait!(D19Pin, Instance);
|
||||
pin_trait!(D20Pin, Instance);
|
||||
pin_trait!(D21Pin, Instance);
|
||||
pin_trait!(D22Pin, Instance);
|
||||
pin_trait!(D23Pin, Instance);
|
||||
pin_trait!(D24Pin, Instance);
|
||||
pin_trait!(D25Pin, Instance);
|
||||
pin_trait!(D26Pin, Instance);
|
||||
pin_trait!(D27Pin, Instance);
|
||||
pin_trait!(D28Pin, Instance);
|
||||
pin_trait!(D29Pin, Instance);
|
||||
pin_trait!(D30Pin, Instance);
|
||||
pin_trait!(D31Pin, Instance);
|
||||
|
||||
pin_trait!(DA0Pin, Instance);
|
||||
pin_trait!(DA1Pin, Instance);
|
||||
pin_trait!(DA2Pin, Instance);
|
||||
pin_trait!(DA3Pin, Instance);
|
||||
pin_trait!(DA4Pin, Instance);
|
||||
pin_trait!(DA5Pin, Instance);
|
||||
pin_trait!(DA6Pin, Instance);
|
||||
pin_trait!(DA7Pin, Instance);
|
||||
pin_trait!(DA8Pin, Instance);
|
||||
pin_trait!(DA9Pin, Instance);
|
||||
pin_trait!(DA10Pin, Instance);
|
||||
pin_trait!(DA11Pin, Instance);
|
||||
pin_trait!(DA12Pin, Instance);
|
||||
pin_trait!(DA13Pin, Instance);
|
||||
pin_trait!(DA14Pin, Instance);
|
||||
pin_trait!(DA15Pin, Instance);
|
||||
|
||||
pin_trait!(A0Pin, Instance);
|
||||
pin_trait!(A1Pin, Instance);
|
||||
pin_trait!(A2Pin, Instance);
|
||||
pin_trait!(A3Pin, Instance);
|
||||
pin_trait!(A4Pin, Instance);
|
||||
pin_trait!(A5Pin, Instance);
|
||||
pin_trait!(A6Pin, Instance);
|
||||
pin_trait!(A7Pin, Instance);
|
||||
pin_trait!(A8Pin, Instance);
|
||||
pin_trait!(A9Pin, Instance);
|
||||
pin_trait!(A10Pin, Instance);
|
||||
pin_trait!(A11Pin, Instance);
|
||||
pin_trait!(A12Pin, Instance);
|
||||
pin_trait!(A13Pin, Instance);
|
||||
pin_trait!(A14Pin, Instance);
|
||||
pin_trait!(A15Pin, Instance);
|
||||
pin_trait!(A16Pin, Instance);
|
||||
pin_trait!(A17Pin, Instance);
|
||||
pin_trait!(A18Pin, Instance);
|
||||
pin_trait!(A19Pin, Instance);
|
||||
pin_trait!(A20Pin, Instance);
|
||||
pin_trait!(A21Pin, Instance);
|
||||
pin_trait!(A22Pin, Instance);
|
||||
pin_trait!(A23Pin, Instance);
|
||||
pin_trait!(A24Pin, Instance);
|
||||
pin_trait!(A25Pin, Instance);
|
|
@ -1,118 +0,0 @@
|
|||
pub(crate) mod sealed {
|
||||
pub trait Instance: crate::rcc::sealed::RccPeripheral {
|
||||
fn regs() -> crate::pac::fmc::Fmc;
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Instance: sealed::Instance + 'static {}
|
||||
|
||||
pin_trait!(SDNWEPin, Instance);
|
||||
pin_trait!(SDNCASPin, Instance);
|
||||
pin_trait!(SDNRASPin, Instance);
|
||||
|
||||
pin_trait!(SDNE0Pin, Instance);
|
||||
pin_trait!(SDNE1Pin, Instance);
|
||||
|
||||
pin_trait!(SDCKE0Pin, Instance);
|
||||
pin_trait!(SDCKE1Pin, Instance);
|
||||
|
||||
pin_trait!(SDCLKPin, Instance);
|
||||
|
||||
pin_trait!(NBL0Pin, Instance);
|
||||
pin_trait!(NBL1Pin, Instance);
|
||||
pin_trait!(NBL2Pin, Instance);
|
||||
pin_trait!(NBL3Pin, Instance);
|
||||
|
||||
pin_trait!(INTPin, Instance);
|
||||
pin_trait!(NLPin, Instance);
|
||||
pin_trait!(NWaitPin, Instance);
|
||||
|
||||
pin_trait!(NE1Pin, Instance);
|
||||
pin_trait!(NE2Pin, Instance);
|
||||
pin_trait!(NE3Pin, Instance);
|
||||
pin_trait!(NE4Pin, Instance);
|
||||
|
||||
pin_trait!(NCEPin, Instance);
|
||||
pin_trait!(NOEPin, Instance);
|
||||
pin_trait!(NWEPin, Instance);
|
||||
pin_trait!(ClkPin, Instance);
|
||||
|
||||
pin_trait!(BA0Pin, Instance);
|
||||
pin_trait!(BA1Pin, Instance);
|
||||
|
||||
pin_trait!(D0Pin, Instance);
|
||||
pin_trait!(D1Pin, Instance);
|
||||
pin_trait!(D2Pin, Instance);
|
||||
pin_trait!(D3Pin, Instance);
|
||||
pin_trait!(D4Pin, Instance);
|
||||
pin_trait!(D5Pin, Instance);
|
||||
pin_trait!(D6Pin, Instance);
|
||||
pin_trait!(D7Pin, Instance);
|
||||
pin_trait!(D8Pin, Instance);
|
||||
pin_trait!(D9Pin, Instance);
|
||||
pin_trait!(D10Pin, Instance);
|
||||
pin_trait!(D11Pin, Instance);
|
||||
pin_trait!(D12Pin, Instance);
|
||||
pin_trait!(D13Pin, Instance);
|
||||
pin_trait!(D14Pin, Instance);
|
||||
pin_trait!(D15Pin, Instance);
|
||||
pin_trait!(D16Pin, Instance);
|
||||
pin_trait!(D17Pin, Instance);
|
||||
pin_trait!(D18Pin, Instance);
|
||||
pin_trait!(D19Pin, Instance);
|
||||
pin_trait!(D20Pin, Instance);
|
||||
pin_trait!(D21Pin, Instance);
|
||||
pin_trait!(D22Pin, Instance);
|
||||
pin_trait!(D23Pin, Instance);
|
||||
pin_trait!(D24Pin, Instance);
|
||||
pin_trait!(D25Pin, Instance);
|
||||
pin_trait!(D26Pin, Instance);
|
||||
pin_trait!(D27Pin, Instance);
|
||||
pin_trait!(D28Pin, Instance);
|
||||
pin_trait!(D29Pin, Instance);
|
||||
pin_trait!(D30Pin, Instance);
|
||||
pin_trait!(D31Pin, Instance);
|
||||
|
||||
pin_trait!(DA0Pin, Instance);
|
||||
pin_trait!(DA1Pin, Instance);
|
||||
pin_trait!(DA2Pin, Instance);
|
||||
pin_trait!(DA3Pin, Instance);
|
||||
pin_trait!(DA4Pin, Instance);
|
||||
pin_trait!(DA5Pin, Instance);
|
||||
pin_trait!(DA6Pin, Instance);
|
||||
pin_trait!(DA7Pin, Instance);
|
||||
pin_trait!(DA8Pin, Instance);
|
||||
pin_trait!(DA9Pin, Instance);
|
||||
pin_trait!(DA10Pin, Instance);
|
||||
pin_trait!(DA11Pin, Instance);
|
||||
pin_trait!(DA12Pin, Instance);
|
||||
pin_trait!(DA13Pin, Instance);
|
||||
pin_trait!(DA14Pin, Instance);
|
||||
pin_trait!(DA15Pin, Instance);
|
||||
|
||||
pin_trait!(A0Pin, Instance);
|
||||
pin_trait!(A1Pin, Instance);
|
||||
pin_trait!(A2Pin, Instance);
|
||||
pin_trait!(A3Pin, Instance);
|
||||
pin_trait!(A4Pin, Instance);
|
||||
pin_trait!(A5Pin, Instance);
|
||||
pin_trait!(A6Pin, Instance);
|
||||
pin_trait!(A7Pin, Instance);
|
||||
pin_trait!(A8Pin, Instance);
|
||||
pin_trait!(A9Pin, Instance);
|
||||
pin_trait!(A10Pin, Instance);
|
||||
pin_trait!(A11Pin, Instance);
|
||||
pin_trait!(A12Pin, Instance);
|
||||
pin_trait!(A13Pin, Instance);
|
||||
pin_trait!(A14Pin, Instance);
|
||||
pin_trait!(A15Pin, Instance);
|
||||
pin_trait!(A16Pin, Instance);
|
||||
pin_trait!(A17Pin, Instance);
|
||||
pin_trait!(A18Pin, Instance);
|
||||
pin_trait!(A19Pin, Instance);
|
||||
pin_trait!(A20Pin, Instance);
|
||||
pin_trait!(A21Pin, Instance);
|
||||
pin_trait!(A22Pin, Instance);
|
||||
pin_trait!(A23Pin, Instance);
|
||||
pin_trait!(A24Pin, Instance);
|
||||
pin_trait!(A25Pin, Instance);
|
Loading…
Reference in a new issue