Added missing guard for hsi48. Updated use of removed enums from stm32-data u5 chip

This commit is contained in:
Chris Storah 2025-07-23 15:52:36 +10:00
parent 88e1d61654
commit 487b42f62c
2 changed files with 12 additions and 11 deletions

View File

@ -30,19 +30,19 @@ pub(crate) unsafe fn enable_blocking_write() {
#[cfg(feature = "trustzone-secure")]
pac::FLASH.seccr().write(|w| {
w.set_pg(pac::flash::vals::SeccrPg::B_0X1);
w.set_pg(true);
});
#[cfg(not(feature = "trustzone-secure"))]
pac::FLASH.nscr().write(|w| {
w.set_pg(pac::flash::vals::NscrPg::B_0X1);
w.set_pg(true);
});
}
pub(crate) unsafe fn disable_blocking_write() {
#[cfg(feature = "trustzone-secure")]
pac::FLASH.seccr().write(|w| w.set_pg(pac::flash::vals::SeccrPg::B_0X0));
pac::FLASH.seccr().write(|w| w.set_pg(false));
#[cfg(not(feature = "trustzone-secure"))]
pac::FLASH.nscr().write(|w| w.set_pg(pac::flash::vals::NscrPg::B_0X0));
pac::FLASH.nscr().write(|w| w.set_pg(false));
}
pub(crate) unsafe fn blocking_write(start_address: u32, buf: &[u8; WRITE_SIZE]) -> Result<(), Error> {
@ -65,19 +65,19 @@ pub(crate) unsafe fn blocking_erase_sector(sector: &FlashSector) -> Result<(), E
w.set_pnb(sector.index_in_bank);
// TODO: add check for bank swap
w.set_bker(match sector.bank {
FlashBank::Bank1 => pac::flash::vals::SeccrBker::B_0X0,
FlashBank::Bank2 => pac::flash::vals::SeccrBker::B_0X1,
FlashBank::Bank1 => false,
FlashBank::Bank2 => true,
_ => unreachable!(),
});
});
#[cfg(not(feature = "trustzone-secure"))]
pac::FLASH.nscr().modify(|w| {
w.set_per(pac::flash::vals::NscrPer::B_0X1);
w.set_per(true);
w.set_pnb(sector.index_in_bank);
// TODO: add check for bank swap
w.set_bker(match sector.bank {
FlashBank::Bank1 => pac::flash::vals::NscrBker::B_0X0,
FlashBank::Bank2 => pac::flash::vals::NscrBker::B_0X1,
FlashBank::Bank1 => false,
FlashBank::Bank2 => true,
_ => unreachable!(),
});
});
@ -95,11 +95,11 @@ pub(crate) unsafe fn blocking_erase_sector(sector: &FlashSector) -> Result<(), E
#[cfg(feature = "trustzone-secure")]
pac::FLASH
.seccr()
.modify(|w| w.set_per(pac::flash::vals::SeccrPer::B_0X0));
.modify(|w| w.set_per(false));
#[cfg(not(feature = "trustzone-secure"))]
pac::FLASH
.nscr()
.modify(|w| w.set_per(pac::flash::vals::NscrPer::B_0X0));
.modify(|w| w.set_per(false));
clear_all_err();
ret
}

View File

@ -190,6 +190,7 @@ pub(crate) unsafe fn init(config: Config) {
// TODO
lsi: None,
lse: None,
#[cfg(crs)]
hsi48: None,
);