use crate::peripheral::CBP;
pub use cortex_m_0_7::peripheral::cbp::RegisterBlock;
const CBP_SW_WAY_POS: u32 = 30;
const CBP_SW_WAY_MASK: u32 = 0x3 << CBP_SW_WAY_POS;
const CBP_SW_SET_POS: u32 = 5;
const CBP_SW_SET_MASK: u32 = 0x1FF << CBP_SW_SET_POS;
impl CBP {
#[inline]
pub fn iciallu(&mut self) {
unsafe {
self.iciallu.write(0);
}
}
#[inline]
pub fn icimvau(&mut self, mva: u32) {
unsafe {
self.icimvau.write(mva);
}
}
#[inline]
pub fn dcimvac(&mut self, mva: u32) {
unsafe {
self.dcimvac.write(mva);
}
}
#[inline]
pub fn dcisw(&mut self, set: u16, way: u16) {
unsafe {
self.dcisw.write(
((u32::from(way) & (CBP_SW_WAY_MASK >> CBP_SW_WAY_POS)) << CBP_SW_WAY_POS)
| ((u32::from(set) & (CBP_SW_SET_MASK >> CBP_SW_SET_POS)) << CBP_SW_SET_POS),
);
}
}
#[inline]
pub fn dccmvau(&mut self, mva: u32) {
unsafe {
self.dccmvau.write(mva);
}
}
#[inline]
pub fn dccmvac(&mut self, mva: u32) {
unsafe {
self.dccmvac.write(mva);
}
}
#[inline]
pub fn dccsw(&mut self, set: u16, way: u16) {
unsafe {
self.dccsw.write(
((u32::from(way) & (CBP_SW_WAY_MASK >> CBP_SW_WAY_POS)) << CBP_SW_WAY_POS)
| ((u32::from(set) & (CBP_SW_SET_MASK >> CBP_SW_SET_POS)) << CBP_SW_SET_POS),
);
}
}
#[inline]
pub fn dccimvac(&mut self, mva: u32) {
unsafe {
self.dccimvac.write(mva);
}
}
#[inline]
pub fn dccisw(&mut self, set: u16, way: u16) {
unsafe {
self.dccisw.write(
((u32::from(way) & (CBP_SW_WAY_MASK >> CBP_SW_WAY_POS)) << CBP_SW_WAY_POS)
| ((u32::from(set) & (CBP_SW_SET_MASK >> CBP_SW_SET_POS)) << CBP_SW_SET_POS),
);
}
}
#[inline]
pub fn bpiall(&mut self) {
unsafe {
self.bpiall.write(0);
}
}
}