#![allow(clippy::missing_safety_doc)]
#![allow(clippy::identity_op)]
#![allow(clippy::unnecessary_cast)]
#![allow(clippy::erasing_op)]
#[doc = "Tamper and backup registers"]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Tamp {
ptr: *mut u8,
}
unsafe impl Send for Tamp {}
unsafe impl Sync for Tamp {}
impl Tamp {
#[inline(always)]
pub const unsafe fn from_ptr(ptr: *mut ()) -> Self {
Self { ptr: ptr as _ }
}
#[inline(always)]
pub const fn as_ptr(&self) -> *mut () {
self.ptr as _
}
#[doc = "control register 1"]
#[inline(always)]
pub const fn cr1(self) -> crate::common::Reg<regs::Cr1, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0usize) as _) }
}
#[doc = "control register 2"]
#[inline(always)]
pub const fn cr2(self) -> crate::common::Reg<regs::Cr2, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x04usize) as _) }
}
#[doc = "control register 3"]
#[inline(always)]
pub const fn cr3(self) -> crate::common::Reg<regs::Cr3, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x08usize) as _) }
}
#[doc = "TAMP filter control register"]
#[inline(always)]
pub const fn fltcr(self) -> crate::common::Reg<regs::Fltcr, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0cusize) as _) }
}
#[doc = "TAMP active tamper control register 1"]
#[inline(always)]
pub const fn atcr1(self) -> crate::common::Reg<regs::Atcr1, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x10usize) as _) }
}
#[doc = "TAMP active tamper seed register"]
#[inline(always)]
pub const fn atseedr(self) -> crate::common::Reg<regs::Atseedr, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x14usize) as _) }
}
#[doc = "TAMP active tamper output register"]
#[inline(always)]
pub const fn ator(self) -> crate::common::Reg<regs::Ator, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x18usize) as _) }
}
#[doc = "TAMP active tamper control register 2"]
#[inline(always)]
pub const fn atcr2(self) -> crate::common::Reg<regs::Atcr2, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x1cusize) as _) }
}
#[doc = "TAMP secure mode register"]
#[inline(always)]
pub const fn smcr(self) -> crate::common::Reg<regs::Smcr, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x20usize) as _) }
}
#[doc = "TAMP privilege mode control register"]
#[inline(always)]
pub const fn privcr(self) -> crate::common::Reg<regs::Privcr, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x24usize) as _) }
}
#[doc = "TAMP interrupt enable register"]
#[inline(always)]
pub const fn ier(self) -> crate::common::Reg<regs::Ier, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x2cusize) as _) }
}
#[doc = "TAMP status register"]
#[inline(always)]
pub const fn sr(self) -> crate::common::Reg<regs::Sr, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x30usize) as _) }
}
#[doc = "TAMP masked interrupt status register"]
#[inline(always)]
pub const fn misr(self) -> crate::common::Reg<regs::Misr, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x34usize) as _) }
}
#[doc = "TAMP secure masked interrupt status register"]
#[inline(always)]
pub const fn smisr(self) -> crate::common::Reg<regs::Smisr, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x38usize) as _) }
}
#[doc = "TAMP status clear register"]
#[inline(always)]
pub const fn scr(self) -> crate::common::Reg<regs::Scr, crate::common::W> {
unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x3cusize) as _) }
}
#[doc = "TAMP monotonic counter register"]
#[inline(always)]
pub const fn countr(self) -> crate::common::Reg<regs::Countr, crate::common::R> {
unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x40usize) as _) }
}
#[doc = "TAMP configuration register"]
#[inline(always)]
pub const fn cfgr(self) -> crate::common::Reg<regs::Cfgr, crate::common::RW> {
unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x50usize) as _) }
}
#[doc = "TAMP backup register"]
#[inline(always)]
pub const fn bkpr(self, n: usize) -> crate::common::Reg<regs::Bkpr, crate::common::RW> {
assert!(n < 32usize);
unsafe { crate::common::Reg::from_ptr(self.ptr.add(0x0100usize + n * 4usize) as _) }
}
}
pub mod regs {
#[doc = "TAMP active tamper control register 1"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Atcr1(pub u32);
impl Atcr1 {
#[doc = "TAMPAM"]
#[inline(always)]
pub const fn tampam(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "TAMPAM"]
#[inline(always)]
pub fn set_tampam(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "ATOSEL"]
#[inline(always)]
pub const fn atosel(&self, n: usize) -> u8 {
assert!(n < 4usize);
let offs = 8usize + n * 2usize;
let val = (self.0 >> offs) & 0x03;
val as u8
}
#[doc = "ATOSEL"]
#[inline(always)]
pub fn set_atosel(&mut self, n: usize, val: u8) {
assert!(n < 4usize);
let offs = 8usize + n * 2usize;
self.0 = (self.0 & !(0x03 << offs)) | (((val as u32) & 0x03) << offs);
}
#[doc = "ATCKSEL"]
#[inline(always)]
pub const fn atcksel(&self) -> u8 {
let val = (self.0 >> 16usize) & 0x03;
val as u8
}
#[doc = "ATCKSEL"]
#[inline(always)]
pub fn set_atcksel(&mut self, val: u8) {
self.0 = (self.0 & !(0x03 << 16usize)) | (((val as u32) & 0x03) << 16usize);
}
#[doc = "ATPER"]
#[inline(always)]
pub const fn atper(&self) -> u8 {
let val = (self.0 >> 24usize) & 0x03;
val as u8
}
#[doc = "ATPER"]
#[inline(always)]
pub fn set_atper(&mut self, val: u8) {
self.0 = (self.0 & !(0x03 << 24usize)) | (((val as u32) & 0x03) << 24usize);
}
#[doc = "ATOSHARE"]
#[inline(always)]
pub const fn atoshare(&self) -> bool {
let val = (self.0 >> 30usize) & 0x01;
val != 0
}
#[doc = "ATOSHARE"]
#[inline(always)]
pub fn set_atoshare(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize);
}
#[doc = "FLTEN"]
#[inline(always)]
pub const fn flten(&self) -> bool {
let val = (self.0 >> 31usize) & 0x01;
val != 0
}
#[doc = "FLTEN"]
#[inline(always)]
pub fn set_flten(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
}
}
impl Default for Atcr1 {
#[inline(always)]
fn default() -> Atcr1 {
Atcr1(0)
}
}
impl core::fmt::Debug for Atcr1 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Atcr1")
.field("tampam[0]", &self.tampam(0usize))
.field("tampam[1]", &self.tampam(1usize))
.field("tampam[2]", &self.tampam(2usize))
.field("tampam[3]", &self.tampam(3usize))
.field("tampam[4]", &self.tampam(4usize))
.field("tampam[5]", &self.tampam(5usize))
.field("tampam[6]", &self.tampam(6usize))
.field("tampam[7]", &self.tampam(7usize))
.field("atosel[0]", &self.atosel(0usize))
.field("atosel[1]", &self.atosel(1usize))
.field("atosel[2]", &self.atosel(2usize))
.field("atosel[3]", &self.atosel(3usize))
.field("atcksel", &self.atcksel())
.field("atper", &self.atper())
.field("atoshare", &self.atoshare())
.field("flten", &self.flten())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Atcr1 {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Atcr1 {{ tampam[0]: {=bool:?}, tampam[1]: {=bool:?}, tampam[2]: {=bool:?}, tampam[3]: {=bool:?}, tampam[4]: {=bool:?}, tampam[5]: {=bool:?}, tampam[6]: {=bool:?}, tampam[7]: {=bool:?}, atosel[0]: {=u8:?}, atosel[1]: {=u8:?}, atosel[2]: {=u8:?}, atosel[3]: {=u8:?}, atcksel: {=u8:?}, atper: {=u8:?}, atoshare: {=bool:?}, flten: {=bool:?} }}" , self . tampam (0usize) , self . tampam (1usize) , self . tampam (2usize) , self . tampam (3usize) , self . tampam (4usize) , self . tampam (5usize) , self . tampam (6usize) , self . tampam (7usize) , self . atosel (0usize) , self . atosel (1usize) , self . atosel (2usize) , self . atosel (3usize) , self . atcksel () , self . atper () , self . atoshare () , self . flten ())
}
}
#[doc = "TAMP active tamper control register 2"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Atcr2(pub u32);
impl Atcr2 {
#[doc = "ATOSEL"]
#[inline(always)]
pub const fn atosel(&self, n: usize) -> u8 {
assert!(n < 8usize);
let offs = 8usize + n * 3usize;
let val = (self.0 >> offs) & 0x07;
val as u8
}
#[doc = "ATOSEL"]
#[inline(always)]
pub fn set_atosel(&mut self, n: usize, val: u8) {
assert!(n < 8usize);
let offs = 8usize + n * 3usize;
self.0 = (self.0 & !(0x07 << offs)) | (((val as u32) & 0x07) << offs);
}
}
impl Default for Atcr2 {
#[inline(always)]
fn default() -> Atcr2 {
Atcr2(0)
}
}
impl core::fmt::Debug for Atcr2 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Atcr2")
.field("atosel[0]", &self.atosel(0usize))
.field("atosel[1]", &self.atosel(1usize))
.field("atosel[2]", &self.atosel(2usize))
.field("atosel[3]", &self.atosel(3usize))
.field("atosel[4]", &self.atosel(4usize))
.field("atosel[5]", &self.atosel(5usize))
.field("atosel[6]", &self.atosel(6usize))
.field("atosel[7]", &self.atosel(7usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Atcr2 {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Atcr2 {{ atosel[0]: {=u8:?}, atosel[1]: {=u8:?}, atosel[2]: {=u8:?}, atosel[3]: {=u8:?}, atosel[4]: {=u8:?}, atosel[5]: {=u8:?}, atosel[6]: {=u8:?}, atosel[7]: {=u8:?} }}" , self . atosel (0usize) , self . atosel (1usize) , self . atosel (2usize) , self . atosel (3usize) , self . atosel (4usize) , self . atosel (5usize) , self . atosel (6usize) , self . atosel (7usize))
}
}
#[doc = "TAMP active tamper output register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ator(pub u32);
impl Ator {
#[doc = "Pseudo-random generator value"]
#[inline(always)]
pub const fn prng(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Pseudo-random generator value"]
#[inline(always)]
pub fn set_prng(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
#[doc = "Seed running flag"]
#[inline(always)]
pub const fn seedf(&self) -> bool {
let val = (self.0 >> 14usize) & 0x01;
val != 0
}
#[doc = "Seed running flag"]
#[inline(always)]
pub fn set_seedf(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 14usize)) | (((val as u32) & 0x01) << 14usize);
}
#[doc = "Active tamper initialization status"]
#[inline(always)]
pub const fn inits(&self) -> bool {
let val = (self.0 >> 15usize) & 0x01;
val != 0
}
#[doc = "Active tamper initialization status"]
#[inline(always)]
pub fn set_inits(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 15usize)) | (((val as u32) & 0x01) << 15usize);
}
}
impl Default for Ator {
#[inline(always)]
fn default() -> Ator {
Ator(0)
}
}
impl core::fmt::Debug for Ator {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ator")
.field("prng", &self.prng())
.field("seedf", &self.seedf())
.field("inits", &self.inits())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ator {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Ator {{ prng: {=u8:?}, seedf: {=bool:?}, inits: {=bool:?} }}",
self.prng(),
self.seedf(),
self.inits()
)
}
}
#[doc = "TAMP active tamper seed register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Atseedr(pub u32);
impl Atseedr {
#[doc = "Pseudo-random generator seed value"]
#[inline(always)]
pub const fn seed(&self) -> u32 {
let val = (self.0 >> 0usize) & 0xffff_ffff;
val as u32
}
#[doc = "Pseudo-random generator seed value"]
#[inline(always)]
pub fn set_seed(&mut self, val: u32) {
self.0 = (self.0 & !(0xffff_ffff << 0usize)) | (((val as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Atseedr {
#[inline(always)]
fn default() -> Atseedr {
Atseedr(0)
}
}
impl core::fmt::Debug for Atseedr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Atseedr").field("seed", &self.seed()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Atseedr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Atseedr {{ seed: {=u32:?} }}", self.seed())
}
}
#[doc = "TAMP backup register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Bkpr(pub u32);
impl Bkpr {
#[doc = "BKP"]
#[inline(always)]
pub const fn bkp(&self) -> u32 {
let val = (self.0 >> 0usize) & 0xffff_ffff;
val as u32
}
#[doc = "BKP"]
#[inline(always)]
pub fn set_bkp(&mut self, val: u32) {
self.0 = (self.0 & !(0xffff_ffff << 0usize)) | (((val as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Bkpr {
#[inline(always)]
fn default() -> Bkpr {
Bkpr(0)
}
}
impl core::fmt::Debug for Bkpr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Bkpr").field("bkp", &self.bkp()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Bkpr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Bkpr {{ bkp: {=u32:?} }}", self.bkp())
}
}
#[doc = "TAMP configuration register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cfgr(pub u32);
impl Cfgr {
#[doc = "TMONEN"]
#[inline(always)]
pub const fn tmonen(&self) -> bool {
let val = (self.0 >> 1usize) & 0x01;
val != 0
}
#[doc = "TMONEN"]
#[inline(always)]
pub fn set_tmonen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 1usize)) | (((val as u32) & 0x01) << 1usize);
}
#[doc = "VMONEN"]
#[inline(always)]
pub const fn vmonen(&self) -> bool {
let val = (self.0 >> 2usize) & 0x01;
val != 0
}
#[doc = "VMONEN"]
#[inline(always)]
pub fn set_vmonen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 2usize)) | (((val as u32) & 0x01) << 2usize);
}
#[doc = "WUTMONEN"]
#[inline(always)]
pub const fn wutmonen(&self) -> bool {
let val = (self.0 >> 3usize) & 0x01;
val != 0
}
#[doc = "WUTMONEN"]
#[inline(always)]
pub fn set_wutmonen(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 3usize)) | (((val as u32) & 0x01) << 3usize);
}
}
impl Default for Cfgr {
#[inline(always)]
fn default() -> Cfgr {
Cfgr(0)
}
}
impl core::fmt::Debug for Cfgr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cfgr")
.field("tmonen", &self.tmonen())
.field("vmonen", &self.vmonen())
.field("wutmonen", &self.wutmonen())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cfgr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Cfgr {{ tmonen: {=bool:?}, vmonen: {=bool:?}, wutmonen: {=bool:?} }}",
self.tmonen(),
self.vmonen(),
self.wutmonen()
)
}
}
#[doc = "TAMP monotonic counter register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Countr(pub u32);
impl Countr {
#[doc = "COUNT"]
#[inline(always)]
pub const fn count(&self) -> u32 {
let val = (self.0 >> 0usize) & 0xffff_ffff;
val as u32
}
#[doc = "COUNT"]
#[inline(always)]
pub fn set_count(&mut self, val: u32) {
self.0 = (self.0 & !(0xffff_ffff << 0usize)) | (((val as u32) & 0xffff_ffff) << 0usize);
}
}
impl Default for Countr {
#[inline(always)]
fn default() -> Countr {
Countr(0)
}
}
impl core::fmt::Debug for Countr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Countr").field("count", &self.count()).finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Countr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "Countr {{ count: {=u32:?} }}", self.count())
}
}
#[doc = "control register 1"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cr1(pub u32);
impl Cr1 {
#[doc = "TAMPE"]
#[inline(always)]
pub const fn tampe(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "TAMPE"]
#[inline(always)]
pub fn set_tampe(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "ITAMPE"]
#[inline(always)]
pub const fn itampe(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 16usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "ITAMPE"]
#[inline(always)]
pub fn set_itampe(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 16usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Cr1 {
#[inline(always)]
fn default() -> Cr1 {
Cr1(0)
}
}
impl core::fmt::Debug for Cr1 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cr1")
.field("tampe[0]", &self.tampe(0usize))
.field("tampe[1]", &self.tampe(1usize))
.field("tampe[2]", &self.tampe(2usize))
.field("tampe[3]", &self.tampe(3usize))
.field("tampe[4]", &self.tampe(4usize))
.field("tampe[5]", &self.tampe(5usize))
.field("tampe[6]", &self.tampe(6usize))
.field("tampe[7]", &self.tampe(7usize))
.field("itampe[0]", &self.itampe(0usize))
.field("itampe[1]", &self.itampe(1usize))
.field("itampe[2]", &self.itampe(2usize))
.field("itampe[3]", &self.itampe(3usize))
.field("itampe[4]", &self.itampe(4usize))
.field("itampe[5]", &self.itampe(5usize))
.field("itampe[6]", &self.itampe(6usize))
.field("itampe[7]", &self.itampe(7usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cr1 {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Cr1 {{ tampe[0]: {=bool:?}, tampe[1]: {=bool:?}, tampe[2]: {=bool:?}, tampe[3]: {=bool:?}, tampe[4]: {=bool:?}, tampe[5]: {=bool:?}, tampe[6]: {=bool:?}, tampe[7]: {=bool:?}, itampe[0]: {=bool:?}, itampe[1]: {=bool:?}, itampe[2]: {=bool:?}, itampe[3]: {=bool:?}, itampe[4]: {=bool:?}, itampe[5]: {=bool:?}, itampe[6]: {=bool:?}, itampe[7]: {=bool:?} }}" , self . tampe (0usize) , self . tampe (1usize) , self . tampe (2usize) , self . tampe (3usize) , self . tampe (4usize) , self . tampe (5usize) , self . tampe (6usize) , self . tampe (7usize) , self . itampe (0usize) , self . itampe (1usize) , self . itampe (2usize) , self . itampe (3usize) , self . itampe (4usize) , self . itampe (5usize) , self . itampe (6usize) , self . itampe (7usize))
}
}
#[doc = "control register 2"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cr2(pub u32);
impl Cr2 {
#[doc = "Tamper X no erase"]
#[inline(always)]
pub const fn tampnoer(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Tamper X no erase"]
#[inline(always)]
pub fn set_tampnoer(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "Tamper X mask"]
#[inline(always)]
pub const fn tampmsk(&self, n: usize) -> bool {
assert!(n < 3usize);
let offs = 16usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Tamper X mask"]
#[inline(always)]
pub fn set_tampmsk(&mut self, n: usize, val: bool) {
assert!(n < 3usize);
let offs = 16usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "BKERASE"]
#[inline(always)]
pub const fn bkerase(&self) -> bool {
let val = (self.0 >> 23usize) & 0x01;
val != 0
}
#[doc = "BKERASE"]
#[inline(always)]
pub fn set_bkerase(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 23usize)) | (((val as u32) & 0x01) << 23usize);
}
#[doc = "Active level for tamper X input"]
#[inline(always)]
pub const fn tamptrg(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 24usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Active level for tamper X input"]
#[inline(always)]
pub fn set_tamptrg(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 24usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Cr2 {
#[inline(always)]
fn default() -> Cr2 {
Cr2(0)
}
}
impl core::fmt::Debug for Cr2 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cr2")
.field("tampnoer[0]", &self.tampnoer(0usize))
.field("tampnoer[1]", &self.tampnoer(1usize))
.field("tampnoer[2]", &self.tampnoer(2usize))
.field("tampnoer[3]", &self.tampnoer(3usize))
.field("tampnoer[4]", &self.tampnoer(4usize))
.field("tampnoer[5]", &self.tampnoer(5usize))
.field("tampnoer[6]", &self.tampnoer(6usize))
.field("tampnoer[7]", &self.tampnoer(7usize))
.field("tampmsk[0]", &self.tampmsk(0usize))
.field("tampmsk[1]", &self.tampmsk(1usize))
.field("tampmsk[2]", &self.tampmsk(2usize))
.field("bkerase", &self.bkerase())
.field("tamptrg[0]", &self.tamptrg(0usize))
.field("tamptrg[1]", &self.tamptrg(1usize))
.field("tamptrg[2]", &self.tamptrg(2usize))
.field("tamptrg[3]", &self.tamptrg(3usize))
.field("tamptrg[4]", &self.tamptrg(4usize))
.field("tamptrg[5]", &self.tamptrg(5usize))
.field("tamptrg[6]", &self.tamptrg(6usize))
.field("tamptrg[7]", &self.tamptrg(7usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cr2 {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Cr2 {{ tampnoer[0]: {=bool:?}, tampnoer[1]: {=bool:?}, tampnoer[2]: {=bool:?}, tampnoer[3]: {=bool:?}, tampnoer[4]: {=bool:?}, tampnoer[5]: {=bool:?}, tampnoer[6]: {=bool:?}, tampnoer[7]: {=bool:?}, tampmsk[0]: {=bool:?}, tampmsk[1]: {=bool:?}, tampmsk[2]: {=bool:?}, bkerase: {=bool:?}, tamptrg[0]: {=bool:?}, tamptrg[1]: {=bool:?}, tamptrg[2]: {=bool:?}, tamptrg[3]: {=bool:?}, tamptrg[4]: {=bool:?}, tamptrg[5]: {=bool:?}, tamptrg[6]: {=bool:?}, tamptrg[7]: {=bool:?} }}" , self . tampnoer (0usize) , self . tampnoer (1usize) , self . tampnoer (2usize) , self . tampnoer (3usize) , self . tampnoer (4usize) , self . tampnoer (5usize) , self . tampnoer (6usize) , self . tampnoer (7usize) , self . tampmsk (0usize) , self . tampmsk (1usize) , self . tampmsk (2usize) , self . bkerase () , self . tamptrg (0usize) , self . tamptrg (1usize) , self . tamptrg (2usize) , self . tamptrg (3usize) , self . tamptrg (4usize) , self . tamptrg (5usize) , self . tamptrg (6usize) , self . tamptrg (7usize))
}
}
#[doc = "control register 3"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Cr3(pub u32);
impl Cr3 {
#[doc = "Internal Tamper X no erase"]
#[inline(always)]
pub const fn itampnoer(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Internal Tamper X no erase"]
#[inline(always)]
pub fn set_itampnoer(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Cr3 {
#[inline(always)]
fn default() -> Cr3 {
Cr3(0)
}
}
impl core::fmt::Debug for Cr3 {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Cr3")
.field("itampnoer[0]", &self.itampnoer(0usize))
.field("itampnoer[1]", &self.itampnoer(1usize))
.field("itampnoer[2]", &self.itampnoer(2usize))
.field("itampnoer[3]", &self.itampnoer(3usize))
.field("itampnoer[4]", &self.itampnoer(4usize))
.field("itampnoer[5]", &self.itampnoer(5usize))
.field("itampnoer[6]", &self.itampnoer(6usize))
.field("itampnoer[7]", &self.itampnoer(7usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Cr3 {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Cr3 {{ itampnoer[0]: {=bool:?}, itampnoer[1]: {=bool:?}, itampnoer[2]: {=bool:?}, itampnoer[3]: {=bool:?}, itampnoer[4]: {=bool:?}, itampnoer[5]: {=bool:?}, itampnoer[6]: {=bool:?}, itampnoer[7]: {=bool:?} }}" , self . itampnoer (0usize) , self . itampnoer (1usize) , self . itampnoer (2usize) , self . itampnoer (3usize) , self . itampnoer (4usize) , self . itampnoer (5usize) , self . itampnoer (6usize) , self . itampnoer (7usize))
}
}
#[doc = "TAMP filter control register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Fltcr(pub u32);
impl Fltcr {
#[doc = "TAMPFREQ"]
#[inline(always)]
pub const fn tampfreq(&self) -> u8 {
let val = (self.0 >> 0usize) & 0x07;
val as u8
}
#[doc = "TAMPFREQ"]
#[inline(always)]
pub fn set_tampfreq(&mut self, val: u8) {
self.0 = (self.0 & !(0x07 << 0usize)) | (((val as u32) & 0x07) << 0usize);
}
#[doc = "TAMPFLT"]
#[inline(always)]
pub const fn tampflt(&self) -> u8 {
let val = (self.0 >> 3usize) & 0x03;
val as u8
}
#[doc = "TAMPFLT"]
#[inline(always)]
pub fn set_tampflt(&mut self, val: u8) {
self.0 = (self.0 & !(0x03 << 3usize)) | (((val as u32) & 0x03) << 3usize);
}
#[doc = "TAMPPRCH"]
#[inline(always)]
pub const fn tampprch(&self) -> u8 {
let val = (self.0 >> 5usize) & 0x03;
val as u8
}
#[doc = "TAMPPRCH"]
#[inline(always)]
pub fn set_tampprch(&mut self, val: u8) {
self.0 = (self.0 & !(0x03 << 5usize)) | (((val as u32) & 0x03) << 5usize);
}
#[doc = "TAMPPUDIS"]
#[inline(always)]
pub const fn tamppudis(&self) -> bool {
let val = (self.0 >> 7usize) & 0x01;
val != 0
}
#[doc = "TAMPPUDIS"]
#[inline(always)]
pub fn set_tamppudis(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 7usize)) | (((val as u32) & 0x01) << 7usize);
}
}
impl Default for Fltcr {
#[inline(always)]
fn default() -> Fltcr {
Fltcr(0)
}
}
impl core::fmt::Debug for Fltcr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Fltcr")
.field("tampfreq", &self.tampfreq())
.field("tampflt", &self.tampflt())
.field("tampprch", &self.tampprch())
.field("tamppudis", &self.tamppudis())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Fltcr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Fltcr {{ tampfreq: {=u8:?}, tampflt: {=u8:?}, tampprch: {=u8:?}, tamppudis: {=bool:?} }}",
self.tampfreq(),
self.tampflt(),
self.tampprch(),
self.tamppudis()
)
}
}
#[doc = "TAMP interrupt enable register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Ier(pub u32);
impl Ier {
#[doc = "Tamper X interrupt enable"]
#[inline(always)]
pub const fn tampie(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Tamper X interrupt enable"]
#[inline(always)]
pub fn set_tampie(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "Internal tamper X interrupt enable"]
#[inline(always)]
pub const fn itampie(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 16usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Internal tamper X interrupt enable"]
#[inline(always)]
pub fn set_itampie(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 16usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Ier {
#[inline(always)]
fn default() -> Ier {
Ier(0)
}
}
impl core::fmt::Debug for Ier {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Ier")
.field("tampie[0]", &self.tampie(0usize))
.field("tampie[1]", &self.tampie(1usize))
.field("tampie[2]", &self.tampie(2usize))
.field("tampie[3]", &self.tampie(3usize))
.field("tampie[4]", &self.tampie(4usize))
.field("tampie[5]", &self.tampie(5usize))
.field("tampie[6]", &self.tampie(6usize))
.field("tampie[7]", &self.tampie(7usize))
.field("itampie[0]", &self.itampie(0usize))
.field("itampie[1]", &self.itampie(1usize))
.field("itampie[2]", &self.itampie(2usize))
.field("itampie[3]", &self.itampie(3usize))
.field("itampie[4]", &self.itampie(4usize))
.field("itampie[5]", &self.itampie(5usize))
.field("itampie[6]", &self.itampie(6usize))
.field("itampie[7]", &self.itampie(7usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Ier {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Ier {{ tampie[0]: {=bool:?}, tampie[1]: {=bool:?}, tampie[2]: {=bool:?}, tampie[3]: {=bool:?}, tampie[4]: {=bool:?}, tampie[5]: {=bool:?}, tampie[6]: {=bool:?}, tampie[7]: {=bool:?}, itampie[0]: {=bool:?}, itampie[1]: {=bool:?}, itampie[2]: {=bool:?}, itampie[3]: {=bool:?}, itampie[4]: {=bool:?}, itampie[5]: {=bool:?}, itampie[6]: {=bool:?}, itampie[7]: {=bool:?} }}" , self . tampie (0usize) , self . tampie (1usize) , self . tampie (2usize) , self . tampie (3usize) , self . tampie (4usize) , self . tampie (5usize) , self . tampie (6usize) , self . tampie (7usize) , self . itampie (0usize) , self . itampie (1usize) , self . itampie (2usize) , self . itampie (3usize) , self . itampie (4usize) , self . itampie (5usize) , self . itampie (6usize) , self . itampie (7usize))
}
}
#[doc = "TAMP masked interrupt status register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Misr(pub u32);
impl Misr {
#[doc = "Tamper X interrupt masked flag"]
#[inline(always)]
pub const fn tampmf(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Tamper X interrupt masked flag"]
#[inline(always)]
pub fn set_tampmf(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "Internal tamper X interrupt masked flag"]
#[inline(always)]
pub const fn itampmf(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 16usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Internal tamper X interrupt masked flag"]
#[inline(always)]
pub fn set_itampmf(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 16usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Misr {
#[inline(always)]
fn default() -> Misr {
Misr(0)
}
}
impl core::fmt::Debug for Misr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Misr")
.field("tampmf[0]", &self.tampmf(0usize))
.field("tampmf[1]", &self.tampmf(1usize))
.field("tampmf[2]", &self.tampmf(2usize))
.field("tampmf[3]", &self.tampmf(3usize))
.field("tampmf[4]", &self.tampmf(4usize))
.field("tampmf[5]", &self.tampmf(5usize))
.field("tampmf[6]", &self.tampmf(6usize))
.field("tampmf[7]", &self.tampmf(7usize))
.field("itampmf[0]", &self.itampmf(0usize))
.field("itampmf[1]", &self.itampmf(1usize))
.field("itampmf[2]", &self.itampmf(2usize))
.field("itampmf[3]", &self.itampmf(3usize))
.field("itampmf[4]", &self.itampmf(4usize))
.field("itampmf[5]", &self.itampmf(5usize))
.field("itampmf[6]", &self.itampmf(6usize))
.field("itampmf[7]", &self.itampmf(7usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Misr {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Misr {{ tampmf[0]: {=bool:?}, tampmf[1]: {=bool:?}, tampmf[2]: {=bool:?}, tampmf[3]: {=bool:?}, tampmf[4]: {=bool:?}, tampmf[5]: {=bool:?}, tampmf[6]: {=bool:?}, tampmf[7]: {=bool:?}, itampmf[0]: {=bool:?}, itampmf[1]: {=bool:?}, itampmf[2]: {=bool:?}, itampmf[3]: {=bool:?}, itampmf[4]: {=bool:?}, itampmf[5]: {=bool:?}, itampmf[6]: {=bool:?}, itampmf[7]: {=bool:?} }}" , self . tampmf (0usize) , self . tampmf (1usize) , self . tampmf (2usize) , self . tampmf (3usize) , self . tampmf (4usize) , self . tampmf (5usize) , self . tampmf (6usize) , self . tampmf (7usize) , self . itampmf (0usize) , self . itampmf (1usize) , self . itampmf (2usize) , self . itampmf (3usize) , self . itampmf (4usize) , self . itampmf (5usize) , self . itampmf (6usize) , self . itampmf (7usize))
}
}
#[doc = "TAMP privilege mode control register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Privcr(pub u32);
impl Privcr {
#[doc = "Backup registers zone 1 privilege protection"]
#[inline(always)]
pub const fn bkprwpriv(&self) -> bool {
let val = (self.0 >> 29usize) & 0x01;
val != 0
}
#[doc = "Backup registers zone 1 privilege protection"]
#[inline(always)]
pub fn set_bkprwpriv(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 29usize)) | (((val as u32) & 0x01) << 29usize);
}
#[doc = "Backup registers zone 2 privilege protection"]
#[inline(always)]
pub const fn bkpwpriv(&self) -> bool {
let val = (self.0 >> 30usize) & 0x01;
val != 0
}
#[doc = "Backup registers zone 2 privilege protection"]
#[inline(always)]
pub fn set_bkpwpriv(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 30usize)) | (((val as u32) & 0x01) << 30usize);
}
#[doc = "Tamper privilege protection"]
#[inline(always)]
pub const fn tamppriv(&self) -> bool {
let val = (self.0 >> 31usize) & 0x01;
val != 0
}
#[doc = "Tamper privilege protection"]
#[inline(always)]
pub fn set_tamppriv(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
}
}
impl Default for Privcr {
#[inline(always)]
fn default() -> Privcr {
Privcr(0)
}
}
impl core::fmt::Debug for Privcr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Privcr")
.field("bkprwpriv", &self.bkprwpriv())
.field("bkpwpriv", &self.bkpwpriv())
.field("tamppriv", &self.tamppriv())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Privcr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Privcr {{ bkprwpriv: {=bool:?}, bkpwpriv: {=bool:?}, tamppriv: {=bool:?} }}",
self.bkprwpriv(),
self.bkpwpriv(),
self.tamppriv()
)
}
}
#[doc = "TAMP status clear register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Scr(pub u32);
impl Scr {
#[doc = "Clear tamper X detection flag"]
#[inline(always)]
pub const fn ctampf(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Clear tamper X detection flag"]
#[inline(always)]
pub fn set_ctampf(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "Clear internal tamper X detection flag"]
#[inline(always)]
pub const fn citampf(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 16usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Clear internal tamper X detection flag"]
#[inline(always)]
pub fn set_citampf(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 16usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Scr {
#[inline(always)]
fn default() -> Scr {
Scr(0)
}
}
impl core::fmt::Debug for Scr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Scr")
.field("ctampf[0]", &self.ctampf(0usize))
.field("ctampf[1]", &self.ctampf(1usize))
.field("ctampf[2]", &self.ctampf(2usize))
.field("ctampf[3]", &self.ctampf(3usize))
.field("ctampf[4]", &self.ctampf(4usize))
.field("ctampf[5]", &self.ctampf(5usize))
.field("ctampf[6]", &self.ctampf(6usize))
.field("ctampf[7]", &self.ctampf(7usize))
.field("citampf[0]", &self.citampf(0usize))
.field("citampf[1]", &self.citampf(1usize))
.field("citampf[2]", &self.citampf(2usize))
.field("citampf[3]", &self.citampf(3usize))
.field("citampf[4]", &self.citampf(4usize))
.field("citampf[5]", &self.citampf(5usize))
.field("citampf[6]", &self.citampf(6usize))
.field("citampf[7]", &self.citampf(7usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Scr {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Scr {{ ctampf[0]: {=bool:?}, ctampf[1]: {=bool:?}, ctampf[2]: {=bool:?}, ctampf[3]: {=bool:?}, ctampf[4]: {=bool:?}, ctampf[5]: {=bool:?}, ctampf[6]: {=bool:?}, ctampf[7]: {=bool:?}, citampf[0]: {=bool:?}, citampf[1]: {=bool:?}, citampf[2]: {=bool:?}, citampf[3]: {=bool:?}, citampf[4]: {=bool:?}, citampf[5]: {=bool:?}, citampf[6]: {=bool:?}, citampf[7]: {=bool:?} }}" , self . ctampf (0usize) , self . ctampf (1usize) , self . ctampf (2usize) , self . ctampf (3usize) , self . ctampf (4usize) , self . ctampf (5usize) , self . ctampf (6usize) , self . ctampf (7usize) , self . citampf (0usize) , self . citampf (1usize) , self . citampf (2usize) , self . citampf (3usize) , self . citampf (4usize) , self . citampf (5usize) , self . citampf (6usize) , self . citampf (7usize))
}
}
#[doc = "TAMP secure mode register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Smcr(pub u32);
impl Smcr {
#[doc = "Backup registers read/write protection offset"]
#[inline(always)]
pub const fn bkprwdprot(&self) -> u8 {
let val = (self.0 >> 0usize) & 0xff;
val as u8
}
#[doc = "Backup registers read/write protection offset"]
#[inline(always)]
pub fn set_bkprwdprot(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 0usize)) | (((val as u32) & 0xff) << 0usize);
}
#[doc = "Backup registers write protection offset"]
#[inline(always)]
pub const fn bkpwdprot(&self) -> u8 {
let val = (self.0 >> 16usize) & 0xff;
val as u8
}
#[doc = "Backup registers write protection offset"]
#[inline(always)]
pub fn set_bkpwdprot(&mut self, val: u8) {
self.0 = (self.0 & !(0xff << 16usize)) | (((val as u32) & 0xff) << 16usize);
}
#[doc = "Tamper protection"]
#[inline(always)]
pub const fn tampdprot(&self) -> bool {
let val = (self.0 >> 31usize) & 0x01;
val != 0
}
#[doc = "Tamper protection"]
#[inline(always)]
pub fn set_tampdprot(&mut self, val: bool) {
self.0 = (self.0 & !(0x01 << 31usize)) | (((val as u32) & 0x01) << 31usize);
}
}
impl Default for Smcr {
#[inline(always)]
fn default() -> Smcr {
Smcr(0)
}
}
impl core::fmt::Debug for Smcr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Smcr")
.field("bkprwdprot", &self.bkprwdprot())
.field("bkpwdprot", &self.bkpwdprot())
.field("tampdprot", &self.tampdprot())
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Smcr {
fn format(&self, f: defmt::Formatter) {
defmt::write!(
f,
"Smcr {{ bkprwdprot: {=u8:?}, bkpwdprot: {=u8:?}, tampdprot: {=bool:?} }}",
self.bkprwdprot(),
self.bkpwdprot(),
self.tampdprot()
)
}
}
#[doc = "TAMP secure masked interrupt status register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Smisr(pub u32);
impl Smisr {
#[doc = "Tamper X interrupt masked flag"]
#[inline(always)]
pub const fn tampmf(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Tamper X interrupt masked flag"]
#[inline(always)]
pub fn set_tampmf(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "Internal tamper X interrupt masked flag"]
#[inline(always)]
pub const fn itampmf(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 16usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Internal tamper X interrupt masked flag"]
#[inline(always)]
pub fn set_itampmf(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 16usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Smisr {
#[inline(always)]
fn default() -> Smisr {
Smisr(0)
}
}
impl core::fmt::Debug for Smisr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Smisr")
.field("tampmf[0]", &self.tampmf(0usize))
.field("tampmf[1]", &self.tampmf(1usize))
.field("tampmf[2]", &self.tampmf(2usize))
.field("tampmf[3]", &self.tampmf(3usize))
.field("tampmf[4]", &self.tampmf(4usize))
.field("tampmf[5]", &self.tampmf(5usize))
.field("tampmf[6]", &self.tampmf(6usize))
.field("tampmf[7]", &self.tampmf(7usize))
.field("itampmf[0]", &self.itampmf(0usize))
.field("itampmf[1]", &self.itampmf(1usize))
.field("itampmf[2]", &self.itampmf(2usize))
.field("itampmf[3]", &self.itampmf(3usize))
.field("itampmf[4]", &self.itampmf(4usize))
.field("itampmf[5]", &self.itampmf(5usize))
.field("itampmf[6]", &self.itampmf(6usize))
.field("itampmf[7]", &self.itampmf(7usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Smisr {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Smisr {{ tampmf[0]: {=bool:?}, tampmf[1]: {=bool:?}, tampmf[2]: {=bool:?}, tampmf[3]: {=bool:?}, tampmf[4]: {=bool:?}, tampmf[5]: {=bool:?}, tampmf[6]: {=bool:?}, tampmf[7]: {=bool:?}, itampmf[0]: {=bool:?}, itampmf[1]: {=bool:?}, itampmf[2]: {=bool:?}, itampmf[3]: {=bool:?}, itampmf[4]: {=bool:?}, itampmf[5]: {=bool:?}, itampmf[6]: {=bool:?}, itampmf[7]: {=bool:?} }}" , self . tampmf (0usize) , self . tampmf (1usize) , self . tampmf (2usize) , self . tampmf (3usize) , self . tampmf (4usize) , self . tampmf (5usize) , self . tampmf (6usize) , self . tampmf (7usize) , self . itampmf (0usize) , self . itampmf (1usize) , self . itampmf (2usize) , self . itampmf (3usize) , self . itampmf (4usize) , self . itampmf (5usize) , self . itampmf (6usize) , self . itampmf (7usize))
}
}
#[doc = "TAMP status register"]
#[repr(transparent)]
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Sr(pub u32);
impl Sr {
#[doc = "Tamper X detection flag"]
#[inline(always)]
pub const fn tampf(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Tamper X detection flag"]
#[inline(always)]
pub fn set_tampf(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 0usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
#[doc = "Internal tamper X detection flag"]
#[inline(always)]
pub const fn itampf(&self, n: usize) -> bool {
assert!(n < 8usize);
let offs = 16usize + n * 1usize;
let val = (self.0 >> offs) & 0x01;
val != 0
}
#[doc = "Internal tamper X detection flag"]
#[inline(always)]
pub fn set_itampf(&mut self, n: usize, val: bool) {
assert!(n < 8usize);
let offs = 16usize + n * 1usize;
self.0 = (self.0 & !(0x01 << offs)) | (((val as u32) & 0x01) << offs);
}
}
impl Default for Sr {
#[inline(always)]
fn default() -> Sr {
Sr(0)
}
}
impl core::fmt::Debug for Sr {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("Sr")
.field("tampf[0]", &self.tampf(0usize))
.field("tampf[1]", &self.tampf(1usize))
.field("tampf[2]", &self.tampf(2usize))
.field("tampf[3]", &self.tampf(3usize))
.field("tampf[4]", &self.tampf(4usize))
.field("tampf[5]", &self.tampf(5usize))
.field("tampf[6]", &self.tampf(6usize))
.field("tampf[7]", &self.tampf(7usize))
.field("itampf[0]", &self.itampf(0usize))
.field("itampf[1]", &self.itampf(1usize))
.field("itampf[2]", &self.itampf(2usize))
.field("itampf[3]", &self.itampf(3usize))
.field("itampf[4]", &self.itampf(4usize))
.field("itampf[5]", &self.itampf(5usize))
.field("itampf[6]", &self.itampf(6usize))
.field("itampf[7]", &self.itampf(7usize))
.finish()
}
}
#[cfg(feature = "defmt")]
impl defmt::Format for Sr {
fn format(&self, f: defmt::Formatter) {
defmt :: write ! (f , "Sr {{ tampf[0]: {=bool:?}, tampf[1]: {=bool:?}, tampf[2]: {=bool:?}, tampf[3]: {=bool:?}, tampf[4]: {=bool:?}, tampf[5]: {=bool:?}, tampf[6]: {=bool:?}, tampf[7]: {=bool:?}, itampf[0]: {=bool:?}, itampf[1]: {=bool:?}, itampf[2]: {=bool:?}, itampf[3]: {=bool:?}, itampf[4]: {=bool:?}, itampf[5]: {=bool:?}, itampf[6]: {=bool:?}, itampf[7]: {=bool:?} }}" , self . tampf (0usize) , self . tampf (1usize) , self . tampf (2usize) , self . tampf (3usize) , self . tampf (4usize) , self . tampf (5usize) , self . tampf (6usize) , self . tampf (7usize) , self . itampf (0usize) , self . itampf (1usize) , self . itampf (2usize) , self . itampf (3usize) , self . itampf (4usize) , self . itampf (5usize) , self . itampf (6usize) , self . itampf (7usize))
}
}
}