diff options
Diffstat (limited to 'src/system_control')
| -rw-r--r-- | src/system_control/aircr.rs | 334 | ||||
| -rw-r--r-- | src/system_control/ccr.rs | 135 | ||||
| -rw-r--r-- | src/system_control/cpuid.rs | 128 | ||||
| -rw-r--r-- | src/system_control/dfsr.rs | 296 | ||||
| -rw-r--r-- | src/system_control/icsr.rs | 695 | ||||
| -rw-r--r-- | src/system_control/scr.rs | 345 | ||||
| -rw-r--r-- | src/system_control/shcsr.rs | 112 | ||||
| -rw-r--r-- | src/system_control/shpr2.rs | 102 | ||||
| -rw-r--r-- | src/system_control/shpr3.rs | 138 | ||||
| -rw-r--r-- | src/system_control/vtor.rs | 102 |
10 files changed, 2387 insertions, 0 deletions
diff --git a/src/system_control/aircr.rs b/src/system_control/aircr.rs new file mode 100644 index 0000000..e6e6820 --- /dev/null +++ b/src/system_control/aircr.rs @@ -0,0 +1,334 @@ +#[doc = "Register `AIRCR` reader"] +pub struct R(crate::R<AIRCR_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<AIRCR_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<AIRCR_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<AIRCR_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `AIRCR` writer"] +pub struct W(crate::W<AIRCR_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<AIRCR_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<AIRCR_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<AIRCR_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `VECTCLRACTIVE` reader - Debug: Clear state information"] +pub struct VECTCLRACTIVE_R(crate::FieldReader<bool, bool>); +impl VECTCLRACTIVE_R { + pub(crate) fn new(bits: bool) -> Self { + VECTCLRACTIVE_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for VECTCLRACTIVE_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `VECTCLRACTIVE` writer - Debug: Clear state information"] +pub struct VECTCLRACTIVE_W<'a> { + w: &'a mut W, +} +impl<'a> VECTCLRACTIVE_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1); + self.w + } +} +#[doc = "System Reset Request\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum SYSRESETREQ_A { + #[doc = "0: No system reset request"] + VALUE_0 = 0, + #[doc = "1: Asserts a signal to the outer system that requests a reset"] + VALUE_1 = 1, +} +impl From<SYSRESETREQ_A> for bool { + #[inline(always)] + fn from(variant: SYSRESETREQ_A) -> Self { + variant as u8 != 0 + } +} +#[doc = "Field `SYSRESETREQ` reader - System Reset Request"] +pub struct SYSRESETREQ_R(crate::FieldReader<bool, SYSRESETREQ_A>); +impl SYSRESETREQ_R { + pub(crate) fn new(bits: bool) -> Self { + SYSRESETREQ_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> SYSRESETREQ_A { + match self.bits { + false => SYSRESETREQ_A::VALUE_0, + true => SYSRESETREQ_A::VALUE_1, + } + } + #[doc = "Checks if the value of the field is `VALUE_0`"] + #[inline(always)] + pub fn is_value_0(&self) -> bool { + **self == SYSRESETREQ_A::VALUE_0 + } + #[doc = "Checks if the value of the field is `VALUE_1`"] + #[inline(always)] + pub fn is_value_1(&self) -> bool { + **self == SYSRESETREQ_A::VALUE_1 + } +} +impl core::ops::Deref for SYSRESETREQ_R { + type Target = crate::FieldReader<bool, SYSRESETREQ_A>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `SYSRESETREQ` writer - System Reset Request"] +pub struct SYSRESETREQ_W<'a> { + w: &'a mut W, +} +impl<'a> SYSRESETREQ_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: SYSRESETREQ_A) -> &'a mut W { + self.bit(variant.into()) + } + #[doc = "No system reset request"] + #[inline(always)] + pub fn value_0(self) -> &'a mut W { + self.variant(SYSRESETREQ_A::VALUE_0) + } + #[doc = "Asserts a signal to the outer system that requests a reset"] + #[inline(always)] + pub fn value_1(self) -> &'a mut W { + self.variant(SYSRESETREQ_A::VALUE_1) + } + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2); + self.w + } +} +#[doc = "Data Endianness, 0=little, 1=big\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum ENDIANNESS_A { + #[doc = "0: Little-endian"] + VALUE_0 = 0, + #[doc = "1: Big-endian"] + VALUE_1 = 1, +} +impl From<ENDIANNESS_A> for bool { + #[inline(always)] + fn from(variant: ENDIANNESS_A) -> Self { + variant as u8 != 0 + } +} +#[doc = "Field `ENDIANNESS` reader - Data Endianness, 0=little, 1=big"] +pub struct ENDIANNESS_R(crate::FieldReader<bool, ENDIANNESS_A>); +impl ENDIANNESS_R { + pub(crate) fn new(bits: bool) -> Self { + ENDIANNESS_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> ENDIANNESS_A { + match self.bits { + false => ENDIANNESS_A::VALUE_0, + true => ENDIANNESS_A::VALUE_1, + } + } + #[doc = "Checks if the value of the field is `VALUE_0`"] + #[inline(always)] + pub fn is_value_0(&self) -> bool { + **self == ENDIANNESS_A::VALUE_0 + } + #[doc = "Checks if the value of the field is `VALUE_1`"] + #[inline(always)] + pub fn is_value_1(&self) -> bool { + **self == ENDIANNESS_A::VALUE_1 + } +} +impl core::ops::Deref for ENDIANNESS_R { + type Target = crate::FieldReader<bool, ENDIANNESS_A>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ENDIANNESS` writer - Data Endianness, 0=little, 1=big"] +pub struct ENDIANNESS_W<'a> { + w: &'a mut W, +} +impl<'a> ENDIANNESS_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: ENDIANNESS_A) -> &'a mut W { + self.bit(variant.into()) + } + #[doc = "Little-endian"] + #[inline(always)] + pub fn value_0(self) -> &'a mut W { + self.variant(ENDIANNESS_A::VALUE_0) + } + #[doc = "Big-endian"] + #[inline(always)] + pub fn value_1(self) -> &'a mut W { + self.variant(ENDIANNESS_A::VALUE_1) + } + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 15)) | ((value as u32 & 0x01) << 15); + self.w + } +} +#[doc = "Field `VECTKEY` reader - Register key (0x05FA)"] +pub struct VECTKEY_R(crate::FieldReader<u16, u16>); +impl VECTKEY_R { + pub(crate) fn new(bits: u16) -> Self { + VECTKEY_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for VECTKEY_R { + type Target = crate::FieldReader<u16, u16>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `VECTKEY` writer - Register key (0x05FA)"] +pub struct VECTKEY_W<'a> { + w: &'a mut W, +} +impl<'a> VECTKEY_W<'a> { + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub unsafe fn bits(self, value: u16) -> &'a mut W { + self.w.bits = (self.w.bits & !(0xffff << 16)) | ((value as u32 & 0xffff) << 16); + self.w + } +} +impl R { + #[doc = "Bit 1 - Debug: Clear state information"] + #[inline(always)] + pub fn vectclractive(&self) -> VECTCLRACTIVE_R { + VECTCLRACTIVE_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 2 - System Reset Request"] + #[inline(always)] + pub fn sysresetreq(&self) -> SYSRESETREQ_R { + SYSRESETREQ_R::new(((self.bits >> 2) & 0x01) != 0) + } + #[doc = "Bit 15 - Data Endianness, 0=little, 1=big"] + #[inline(always)] + pub fn endianness(&self) -> ENDIANNESS_R { + ENDIANNESS_R::new(((self.bits >> 15) & 0x01) != 0) + } + #[doc = "Bits 16:31 - Register key (0x05FA)"] + #[inline(always)] + pub fn vectkey(&self) -> VECTKEY_R { + VECTKEY_R::new(((self.bits >> 16) & 0xffff) as u16) + } +} +impl W { + #[doc = "Bit 1 - Debug: Clear state information"] + #[inline(always)] + pub fn vectclractive(&mut self) -> VECTCLRACTIVE_W { + VECTCLRACTIVE_W { w: self } + } + #[doc = "Bit 2 - System Reset Request"] + #[inline(always)] + pub fn sysresetreq(&mut self) -> SYSRESETREQ_W { + SYSRESETREQ_W { w: self } + } + #[doc = "Bit 15 - Data Endianness, 0=little, 1=big"] + #[inline(always)] + pub fn endianness(&mut self) -> ENDIANNESS_W { + ENDIANNESS_W { w: self } + } + #[doc = "Bits 16:31 - Register key (0x05FA)"] + #[inline(always)] + pub fn vectkey(&mut self) -> VECTKEY_W { + VECTKEY_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "Application Interrupt and Reset Control Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [aircr](index.html) module"] +pub struct AIRCR_SPEC; +impl crate::RegisterSpec for AIRCR_SPEC { + type Ux = u32; +} +#[doc = "`read()` method returns [aircr::R](R) reader structure"] +impl crate::Readable for AIRCR_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [aircr::W](W) writer structure"] +impl crate::Writable for AIRCR_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets AIRCR to value 0"] +impl crate::Resettable for AIRCR_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/system_control/ccr.rs b/src/system_control/ccr.rs new file mode 100644 index 0000000..67ff3e2 --- /dev/null +++ b/src/system_control/ccr.rs @@ -0,0 +1,135 @@ +#[doc = "Register `CCR` reader"] +pub struct R(crate::R<CCR_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<CCR_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<CCR_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<CCR_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Unaligned accesses generates a Hard Fault\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum UNALIGN_TRP_A { + #[doc = "0: Do not trap unaligned halfword and word accesses"] + VALUE_0 = 0, + #[doc = "1: Trap unaligned halfword and word accesses"] + VALUE_1 = 1, +} +impl From<UNALIGN_TRP_A> for bool { + #[inline(always)] + fn from(variant: UNALIGN_TRP_A) -> Self { + variant as u8 != 0 + } +} +#[doc = "Field `UNALIGN_TRP` reader - Unaligned accesses generates a Hard Fault"] +pub struct UNALIGN_TRP_R(crate::FieldReader<bool, UNALIGN_TRP_A>); +impl UNALIGN_TRP_R { + pub(crate) fn new(bits: bool) -> Self { + UNALIGN_TRP_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> UNALIGN_TRP_A { + match self.bits { + false => UNALIGN_TRP_A::VALUE_0, + true => UNALIGN_TRP_A::VALUE_1, + } + } + #[doc = "Checks if the value of the field is `VALUE_0`"] + #[inline(always)] + pub fn is_value_0(&self) -> bool { + **self == UNALIGN_TRP_A::VALUE_0 + } + #[doc = "Checks if the value of the field is `VALUE_1`"] + #[inline(always)] + pub fn is_value_1(&self) -> bool { + **self == UNALIGN_TRP_A::VALUE_1 + } +} +impl core::ops::Deref for UNALIGN_TRP_R { + type Target = crate::FieldReader<bool, UNALIGN_TRP_A>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Stack 8-byte aligned on exception entry\n\nValue on reset: 1"] +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum STKALIGN_A { + #[doc = "0: 4-byte aligned"] + VALUE_0 = 0, + #[doc = "1: 8-byte aligned"] + VALUE_1 = 1, +} +impl From<STKALIGN_A> for bool { + #[inline(always)] + fn from(variant: STKALIGN_A) -> Self { + variant as u8 != 0 + } +} +#[doc = "Field `STKALIGN` reader - Stack 8-byte aligned on exception entry"] +pub struct STKALIGN_R(crate::FieldReader<bool, STKALIGN_A>); +impl STKALIGN_R { + pub(crate) fn new(bits: bool) -> Self { + STKALIGN_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> STKALIGN_A { + match self.bits { + false => STKALIGN_A::VALUE_0, + true => STKALIGN_A::VALUE_1, + } + } + #[doc = "Checks if the value of the field is `VALUE_0`"] + #[inline(always)] + pub fn is_value_0(&self) -> bool { + **self == STKALIGN_A::VALUE_0 + } + #[doc = "Checks if the value of the field is `VALUE_1`"] + #[inline(always)] + pub fn is_value_1(&self) -> bool { + **self == STKALIGN_A::VALUE_1 + } +} +impl core::ops::Deref for STKALIGN_R { + type Target = crate::FieldReader<bool, STKALIGN_A>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl R { + #[doc = "Bit 3 - Unaligned accesses generates a Hard Fault"] + #[inline(always)] + pub fn unalign_trp(&self) -> UNALIGN_TRP_R { + UNALIGN_TRP_R::new(((self.bits >> 3) & 0x01) != 0) + } + #[doc = "Bit 9 - Stack 8-byte aligned on exception entry"] + #[inline(always)] + pub fn stkalign(&self) -> STKALIGN_R { + STKALIGN_R::new(((self.bits >> 9) & 0x01) != 0) + } +} +#[doc = "Configuration and Control Register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [ccr](index.html) module"] +pub struct CCR_SPEC; +impl crate::RegisterSpec for CCR_SPEC { + type Ux = u32; +} +#[doc = "`read()` method returns [ccr::R](R) reader structure"] +impl crate::Readable for CCR_SPEC { + type Reader = R; +} +#[doc = "`reset()` method sets CCR to value 0x0204"] +impl crate::Resettable for CCR_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0x0204 + } +} diff --git a/src/system_control/cpuid.rs b/src/system_control/cpuid.rs new file mode 100644 index 0000000..4418397 --- /dev/null +++ b/src/system_control/cpuid.rs @@ -0,0 +1,128 @@ +#[doc = "Register `CPUID` reader"] +pub struct R(crate::R<CPUID_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<CPUID_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<CPUID_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<CPUID_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Field `REVISION` reader - Minor revision number"] +pub struct REVISION_R(crate::FieldReader<u8, u8>); +impl REVISION_R { + pub(crate) fn new(bits: u8) -> Self { + REVISION_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for REVISION_R { + type Target = crate::FieldReader<u8, u8>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `PARTNO` reader - Processor Part Number, 0xC60=Cortex-M0+"] +pub struct PARTNO_R(crate::FieldReader<u16, u16>); +impl PARTNO_R { + pub(crate) fn new(bits: u16) -> Self { + PARTNO_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for PARTNO_R { + type Target = crate::FieldReader<u16, u16>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ARCHITECTURE` reader - Processor Architecture, 0xC=ARMv6-M"] +pub struct ARCHITECTURE_R(crate::FieldReader<u8, u8>); +impl ARCHITECTURE_R { + pub(crate) fn new(bits: u8) -> Self { + ARCHITECTURE_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for ARCHITECTURE_R { + type Target = crate::FieldReader<u8, u8>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `VARIANT` reader - Major revision number"] +pub struct VARIANT_R(crate::FieldReader<u8, u8>); +impl VARIANT_R { + pub(crate) fn new(bits: u8) -> Self { + VARIANT_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for VARIANT_R { + type Target = crate::FieldReader<u8, u8>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `IMPLEMENTER` reader - Implementer code, ARM=0x41"] +pub struct IMPLEMENTER_R(crate::FieldReader<u8, u8>); +impl IMPLEMENTER_R { + pub(crate) fn new(bits: u8) -> Self { + IMPLEMENTER_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for IMPLEMENTER_R { + type Target = crate::FieldReader<u8, u8>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl R { + #[doc = "Bits 0:3 - Minor revision number"] + #[inline(always)] + pub fn revision(&self) -> REVISION_R { + REVISION_R::new((self.bits & 0x0f) as u8) + } + #[doc = "Bits 4:15 - Processor Part Number, 0xC60=Cortex-M0+"] + #[inline(always)] + pub fn partno(&self) -> PARTNO_R { + PARTNO_R::new(((self.bits >> 4) & 0x0fff) as u16) + } + #[doc = "Bits 16:19 - Processor Architecture, 0xC=ARMv6-M"] + #[inline(always)] + pub fn architecture(&self) -> ARCHITECTURE_R { + ARCHITECTURE_R::new(((self.bits >> 16) & 0x0f) as u8) + } + #[doc = "Bits 20:23 - Major revision number"] + #[inline(always)] + pub fn variant(&self) -> VARIANT_R { + VARIANT_R::new(((self.bits >> 20) & 0x0f) as u8) + } + #[doc = "Bits 24:31 - Implementer code, ARM=0x41"] + #[inline(always)] + pub fn implementer(&self) -> IMPLEMENTER_R { + IMPLEMENTER_R::new(((self.bits >> 24) & 0xff) as u8) + } +} +#[doc = "CPUID Base Register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cpuid](index.html) module"] +pub struct CPUID_SPEC; +impl crate::RegisterSpec for CPUID_SPEC { + type Ux = u32; +} +#[doc = "`read()` method returns [cpuid::R](R) reader structure"] +impl crate::Readable for CPUID_SPEC { + type Reader = R; +} +#[doc = "`reset()` method sets CPUID to value 0x410c_c601"] +impl crate::Resettable for CPUID_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0x410c_c601 + } +} diff --git a/src/system_control/dfsr.rs b/src/system_control/dfsr.rs new file mode 100644 index 0000000..4872dfe --- /dev/null +++ b/src/system_control/dfsr.rs @@ -0,0 +1,296 @@ +#[doc = "Register `DFSR` reader"] +pub struct R(crate::R<DFSR_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<DFSR_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<DFSR_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<DFSR_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `DFSR` writer"] +pub struct W(crate::W<DFSR_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<DFSR_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<DFSR_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<DFSR_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `HALTED` reader - Halt request debug event active"] +pub struct HALTED_R(crate::FieldReader<bool, bool>); +impl HALTED_R { + pub(crate) fn new(bits: bool) -> Self { + HALTED_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for HALTED_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `HALTED` writer - Halt request debug event active"] +pub struct HALTED_W<'a> { + w: &'a mut W, +} +impl<'a> HALTED_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01); + self.w + } +} +#[doc = "Field `BKPT` reader - Breakpoint debug event"] +pub struct BKPT_R(crate::FieldReader<bool, bool>); +impl BKPT_R { + pub(crate) fn new(bits: bool) -> Self { + BKPT_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for BKPT_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `BKPT` writer - Breakpoint debug event"] +pub struct BKPT_W<'a> { + w: &'a mut W, +} +impl<'a> BKPT_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1); + self.w + } +} +#[doc = "Field `DWTTRAP` reader - DWT debug event"] +pub struct DWTTRAP_R(crate::FieldReader<bool, bool>); +impl DWTTRAP_R { + pub(crate) fn new(bits: bool) -> Self { + DWTTRAP_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for DWTTRAP_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `DWTTRAP` writer - DWT debug event"] +pub struct DWTTRAP_W<'a> { + w: &'a mut W, +} +impl<'a> DWTTRAP_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2); + self.w + } +} +#[doc = "Field `VCATCH` reader - Vector catch debug event"] +pub struct VCATCH_R(crate::FieldReader<bool, bool>); +impl VCATCH_R { + pub(crate) fn new(bits: bool) -> Self { + VCATCH_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for VCATCH_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `VCATCH` writer - Vector catch debug event"] +pub struct VCATCH_W<'a> { + w: &'a mut W, +} +impl<'a> VCATCH_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 3)) | ((value as u32 & 0x01) << 3); + self.w + } +} +#[doc = "Field `EXTERNAL` reader - EDBGRQ debug event"] +pub struct EXTERNAL_R(crate::FieldReader<bool, bool>); +impl EXTERNAL_R { + pub(crate) fn new(bits: bool) -> Self { + EXTERNAL_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for EXTERNAL_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `EXTERNAL` writer - EDBGRQ debug event"] +pub struct EXTERNAL_W<'a> { + w: &'a mut W, +} +impl<'a> EXTERNAL_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 4)) | ((value as u32 & 0x01) << 4); + self.w + } +} +impl R { + #[doc = "Bit 0 - Halt request debug event active"] + #[inline(always)] + pub fn halted(&self) -> HALTED_R { + HALTED_R::new((self.bits & 0x01) != 0) + } + #[doc = "Bit 1 - Breakpoint debug event"] + #[inline(always)] + pub fn bkpt(&self) -> BKPT_R { + BKPT_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 2 - DWT debug event"] + #[inline(always)] + pub fn dwttrap(&self) -> DWTTRAP_R { + DWTTRAP_R::new(((self.bits >> 2) & 0x01) != 0) + } + #[doc = "Bit 3 - Vector catch debug event"] + #[inline(always)] + pub fn vcatch(&self) -> VCATCH_R { + VCATCH_R::new(((self.bits >> 3) & 0x01) != 0) + } + #[doc = "Bit 4 - EDBGRQ debug event"] + #[inline(always)] + pub fn external(&self) -> EXTERNAL_R { + EXTERNAL_R::new(((self.bits >> 4) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 0 - Halt request debug event active"] + #[inline(always)] + pub fn halted(&mut self) -> HALTED_W { + HALTED_W { w: self } + } + #[doc = "Bit 1 - Breakpoint debug event"] + #[inline(always)] + pub fn bkpt(&mut self) -> BKPT_W { + BKPT_W { w: self } + } + #[doc = "Bit 2 - DWT debug event"] + #[inline(always)] + pub fn dwttrap(&mut self) -> DWTTRAP_W { + DWTTRAP_W { w: self } + } + #[doc = "Bit 3 - Vector catch debug event"] + #[inline(always)] + pub fn vcatch(&mut self) -> VCATCH_W { + VCATCH_W { w: self } + } + #[doc = "Bit 4 - EDBGRQ debug event"] + #[inline(always)] + pub fn external(&mut self) -> EXTERNAL_W { + EXTERNAL_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "Debug Fault Status Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [dfsr](index.html) module"] +pub struct DFSR_SPEC; +impl crate::RegisterSpec for DFSR_SPEC { + type Ux = u32; +} +#[doc = "`read()` method returns [dfsr::R](R) reader structure"] +impl crate::Readable for DFSR_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [dfsr::W](W) writer structure"] +impl crate::Writable for DFSR_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets DFSR to value 0"] +impl crate::Resettable for DFSR_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/system_control/icsr.rs b/src/system_control/icsr.rs new file mode 100644 index 0000000..9ec9f0d --- /dev/null +++ b/src/system_control/icsr.rs @@ -0,0 +1,695 @@ +#[doc = "Register `ICSR` reader"] +pub struct R(crate::R<ICSR_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<ICSR_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<ICSR_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<ICSR_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `ICSR` writer"] +pub struct W(crate::W<ICSR_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<ICSR_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<ICSR_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<ICSR_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `VECTACTIVE` reader - Debug: Exception number of currently executing exception, or 0 if thread mode"] +pub struct VECTACTIVE_R(crate::FieldReader<u16, u16>); +impl VECTACTIVE_R { + pub(crate) fn new(bits: u16) -> Self { + VECTACTIVE_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for VECTACTIVE_R { + type Target = crate::FieldReader<u16, u16>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `VECTACTIVE` writer - Debug: Exception number of currently executing exception, or 0 if thread mode"] +pub struct VECTACTIVE_W<'a> { + w: &'a mut W, +} +impl<'a> VECTACTIVE_W<'a> { + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub unsafe fn bits(self, value: u16) -> &'a mut W { + self.w.bits = (self.w.bits & !0x01ff) | (value as u32 & 0x01ff); + self.w + } +} +#[doc = "Field `VECTPENDING` reader - Exception number of the highest priority pending enabled exception"] +pub struct VECTPENDING_R(crate::FieldReader<u16, u16>); +impl VECTPENDING_R { + pub(crate) fn new(bits: u16) -> Self { + VECTPENDING_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for VECTPENDING_R { + type Target = crate::FieldReader<u16, u16>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `VECTPENDING` writer - Exception number of the highest priority pending enabled exception"] +pub struct VECTPENDING_W<'a> { + w: &'a mut W, +} +impl<'a> VECTPENDING_W<'a> { + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub unsafe fn bits(self, value: u16) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01ff << 12)) | ((value as u32 & 0x01ff) << 12); + self.w + } +} +#[doc = "Field `ISRPENDING` reader - Debug: NVIC interrupt pending"] +pub struct ISRPENDING_R(crate::FieldReader<bool, bool>); +impl ISRPENDING_R { + pub(crate) fn new(bits: bool) -> Self { + ISRPENDING_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for ISRPENDING_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ISRPENDING` writer - Debug: NVIC interrupt pending"] +pub struct ISRPENDING_W<'a> { + w: &'a mut W, +} +impl<'a> ISRPENDING_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 22)) | ((value as u32 & 0x01) << 22); + self.w + } +} +#[doc = "Field `ISRPREEMPT` reader - Debug: Pending exception serviced on exit from debug halt"] +pub struct ISRPREEMPT_R(crate::FieldReader<bool, bool>); +impl ISRPREEMPT_R { + pub(crate) fn new(bits: bool) -> Self { + ISRPREEMPT_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for ISRPREEMPT_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `ISRPREEMPT` writer - Debug: Pending exception serviced on exit from debug halt"] +pub struct ISRPREEMPT_W<'a> { + w: &'a mut W, +} +impl<'a> ISRPREEMPT_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 23)) | ((value as u32 & 0x01) << 23); + self.w + } +} +#[doc = "SysTick exception clear-pending bit\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum PENDSTCLR_A { + #[doc = "0: No effect"] + VALUE_0 = 0, + #[doc = "1: Removes the pending state from the SysTick exception"] + VALUE_1 = 1, +} +impl From<PENDSTCLR_A> for bool { + #[inline(always)] + fn from(variant: PENDSTCLR_A) -> Self { + variant as u8 != 0 + } +} +#[doc = "Field `PENDSTCLR` reader - SysTick exception clear-pending bit"] +pub struct PENDSTCLR_R(crate::FieldReader<bool, PENDSTCLR_A>); +impl PENDSTCLR_R { + pub(crate) fn new(bits: bool) -> Self { + PENDSTCLR_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> PENDSTCLR_A { + match self.bits { + false => PENDSTCLR_A::VALUE_0, + true => PENDSTCLR_A::VALUE_1, + } + } + #[doc = "Checks if the value of the field is `VALUE_0`"] + #[inline(always)] + pub fn is_value_0(&self) -> bool { + **self == PENDSTCLR_A::VALUE_0 + } + #[doc = "Checks if the value of the field is `VALUE_1`"] + #[inline(always)] + pub fn is_value_1(&self) -> bool { + **self == PENDSTCLR_A::VALUE_1 + } +} +impl core::ops::Deref for PENDSTCLR_R { + type Target = crate::FieldReader<bool, PENDSTCLR_A>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `PENDSTCLR` writer - SysTick exception clear-pending bit"] +pub struct PENDSTCLR_W<'a> { + w: &'a mut W, +} +impl<'a> PENDSTCLR_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: PENDSTCLR_A) -> &'a mut W { + self.bit(variant.into()) + } + #[doc = "No effect"] + #[inline(always)] + pub fn value_0(self) -> &'a mut W { + self.variant(PENDSTCLR_A::VALUE_0) + } + #[doc = "Removes the pending state from the SysTick exception"] + #[inline(always)] + pub fn value_1(self) -> &'a mut W { + self.variant(PENDSTCLR_A::VALUE_1) + } + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 25)) | ((value as u32 & 0x01) << 25); + self.w + } +} +#[doc = "SysTick exception set-pending bit\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum PENDSTSET_A { + #[doc = "0: Write: no effect; read: SysTick exception is not pending"] + VALUE_0 = 0, + #[doc = "1: Write: changes SysTick exception state to pending; read: SysTick exception is pending"] + VALUE_1 = 1, +} +impl From<PENDSTSET_A> for bool { + #[inline(always)] + fn from(variant: PENDSTSET_A) -> Self { + variant as u8 != 0 + } +} +#[doc = "Field `PENDSTSET` reader - SysTick exception set-pending bit"] +pub struct PENDSTSET_R(crate::FieldReader<bool, PENDSTSET_A>); +impl PENDSTSET_R { + pub(crate) fn new(bits: bool) -> Self { + PENDSTSET_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> PENDSTSET_A { + match self.bits { + false => PENDSTSET_A::VALUE_0, + true => PENDSTSET_A::VALUE_1, + } + } + #[doc = "Checks if the value of the field is `VALUE_0`"] + #[inline(always)] + pub fn is_value_0(&self) -> bool { + **self == PENDSTSET_A::VALUE_0 + } + #[doc = "Checks if the value of the field is `VALUE_1`"] + #[inline(always)] + pub fn is_value_1(&self) -> bool { + **self == PENDSTSET_A::VALUE_1 + } +} +impl core::ops::Deref for PENDSTSET_R { + type Target = crate::FieldReader<bool, PENDSTSET_A>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `PENDSTSET` writer - SysTick exception set-pending bit"] +pub struct PENDSTSET_W<'a> { + w: &'a mut W, +} +impl<'a> PENDSTSET_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: PENDSTSET_A) -> &'a mut W { + self.bit(variant.into()) + } + #[doc = "Write: no effect; read: SysTick exception is not pending"] + #[inline(always)] + pub fn value_0(self) -> &'a mut W { + self.variant(PENDSTSET_A::VALUE_0) + } + #[doc = "Write: changes SysTick exception state to pending; read: SysTick exception is pending"] + #[inline(always)] + pub fn value_1(self) -> &'a mut W { + self.variant(PENDSTSET_A::VALUE_1) + } + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 26)) | ((value as u32 & 0x01) << 26); + self.w + } +} +#[doc = "PendSV clear-pending bit\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum PENDSVCLR_A { + #[doc = "0: No effect"] + VALUE_0 = 0, + #[doc = "1: Removes the pending state from the PendSV exception"] + VALUE_1 = 1, +} +impl From<PENDSVCLR_A> for bool { + #[inline(always)] + fn from(variant: PENDSVCLR_A) -> Self { + variant as u8 != 0 + } +} +#[doc = "Field `PENDSVCLR` reader - PendSV clear-pending bit"] +pub struct PENDSVCLR_R(crate::FieldReader<bool, PENDSVCLR_A>); +impl PENDSVCLR_R { + pub(crate) fn new(bits: bool) -> Self { + PENDSVCLR_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> PENDSVCLR_A { + match self.bits { + false => PENDSVCLR_A::VALUE_0, + true => PENDSVCLR_A::VALUE_1, + } + } + #[doc = "Checks if the value of the field is `VALUE_0`"] + #[inline(always)] + pub fn is_value_0(&self) -> bool { + **self == PENDSVCLR_A::VALUE_0 + } + #[doc = "Checks if the value of the field is `VALUE_1`"] + #[inline(always)] + pub fn is_value_1(&self) -> bool { + **self == PENDSVCLR_A::VALUE_1 + } +} +impl core::ops::Deref for PENDSVCLR_R { + type Target = crate::FieldReader<bool, PENDSVCLR_A>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `PENDSVCLR` writer - PendSV clear-pending bit"] +pub struct PENDSVCLR_W<'a> { + w: &'a mut W, +} +impl<'a> PENDSVCLR_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: PENDSVCLR_A) -> &'a mut W { + self.bit(variant.into()) + } + #[doc = "No effect"] + #[inline(always)] + pub fn value_0(self) -> &'a mut W { + self.variant(PENDSVCLR_A::VALUE_0) + } + #[doc = "Removes the pending state from the PendSV exception"] + #[inline(always)] + pub fn value_1(self) -> &'a mut W { + self.variant(PENDSVCLR_A::VALUE_1) + } + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 27)) | ((value as u32 & 0x01) << 27); + self.w + } +} +#[doc = "PendSV set-pending bit\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum PENDSVSET_A { + #[doc = "0: Write: no effect; read: PendSV exception is not pending"] + VALUE_0 = 0, + #[doc = "1: Write: changes PendSV exception state to pending; read: PendSV exception is pending"] + VALUE_1 = 1, +} +impl From<PENDSVSET_A> for bool { + #[inline(always)] + fn from(variant: PENDSVSET_A) -> Self { + variant as u8 != 0 + } +} +#[doc = "Field `PENDSVSET` reader - PendSV set-pending bit"] +pub struct PENDSVSET_R(crate::FieldReader<bool, PENDSVSET_A>); +impl PENDSVSET_R { + pub(crate) fn new(bits: bool) -> Self { + PENDSVSET_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> PENDSVSET_A { + match self.bits { + false => PENDSVSET_A::VALUE_0, + true => PENDSVSET_A::VALUE_1, + } + } + #[doc = "Checks if the value of the field is `VALUE_0`"] + #[inline(always)] + pub fn is_value_0(&self) -> bool { + **self == PENDSVSET_A::VALUE_0 + } + #[doc = "Checks if the value of the field is `VALUE_1`"] + #[inline(always)] + pub fn is_value_1(&self) -> bool { + **self == PENDSVSET_A::VALUE_1 + } +} +impl core::ops::Deref for PENDSVSET_R { + type Target = crate::FieldReader<bool, PENDSVSET_A>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `PENDSVSET` writer - PendSV set-pending bit"] +pub struct PENDSVSET_W<'a> { + w: &'a mut W, +} +impl<'a> PENDSVSET_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: PENDSVSET_A) -> &'a mut W { + self.bit(variant.into()) + } + #[doc = "Write: no effect; read: PendSV exception is not pending"] + #[inline(always)] + pub fn value_0(self) -> &'a mut W { + self.variant(PENDSVSET_A::VALUE_0) + } + #[doc = "Write: changes PendSV exception state to pending; read: PendSV exception is pending"] + #[inline(always)] + pub fn value_1(self) -> &'a mut W { + self.variant(PENDSVSET_A::VALUE_1) + } + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 28)) | ((value as u32 & 0x01) << 28); + self.w + } +} +#[doc = "NMI set-pending bit\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum NMIPENDSET_A { + #[doc = "0: Write: no effect; read: NMI exception is not pending"] + VALUE_0 = 0, + #[doc = "1: Write: changes NMI exception state to pending; read: NMI exception is pending"] + VALUE_1 = 1, +} +impl From<NMIPENDSET_A> for bool { + #[inline(always)] + fn from(variant: NMIPENDSET_A) -> Self { + variant as u8 != 0 + } +} +#[doc = "Field `NMIPENDSET` reader - NMI set-pending bit"] +pub struct NMIPENDSET_R(crate::FieldReader<bool, NMIPENDSET_A>); +impl NMIPENDSET_R { + pub(crate) fn new(bits: bool) -> Self { + NMIPENDSET_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> NMIPENDSET_A { + match self.bits { + false => NMIPENDSET_A::VALUE_0, + true => NMIPENDSET_A::VALUE_1, + } + } + #[doc = "Checks if the value of the field is `VALUE_0`"] + #[inline(always)] + pub fn is_value_0(&self) -> bool { + **self == NMIPENDSET_A::VALUE_0 + } + #[doc = "Checks if the value of the field is `VALUE_1`"] + #[inline(always)] + pub fn is_value_1(&self) -> bool { + **self == NMIPENDSET_A::VALUE_1 + } +} +impl core::ops::Deref for NMIPENDSET_R { + type Target = crate::FieldReader<bool, NMIPENDSET_A>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `NMIPENDSET` writer - NMI set-pending bit"] +pub struct NMIPENDSET_W<'a> { + w: &'a mut W, +} +impl<'a> NMIPENDSET_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: NMIPENDSET_A) -> &'a mut W { + self.bit(variant.into()) + } + #[doc = "Write: no effect; read: NMI exception is not pending"] + #[inline(always)] + pub fn value_0(self) -> &'a mut W { + self.variant(NMIPENDSET_A::VALUE_0) + } + #[doc = "Write: changes NMI exception state to pending; read: NMI exception is pending"] + #[inline(always)] + pub fn value_1(self) -> &'a mut W { + self.variant(NMIPENDSET_A::VALUE_1) + } + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 31)) | ((value as u32 & 0x01) << 31); + self.w + } +} +impl R { + #[doc = "Bits 0:8 - Debug: Exception number of currently executing exception, or 0 if thread mode"] + #[inline(always)] + pub fn vectactive(&self) -> VECTACTIVE_R { + VECTACTIVE_R::new((self.bits & 0x01ff) as u16) + } + #[doc = "Bits 12:20 - Exception number of the highest priority pending enabled exception"] + #[inline(always)] + pub fn vectpending(&self) -> VECTPENDING_R { + VECTPENDING_R::new(((self.bits >> 12) & 0x01ff) as u16) + } + #[doc = "Bit 22 - Debug: NVIC interrupt pending"] + #[inline(always)] + pub fn isrpending(&self) -> ISRPENDING_R { + ISRPENDING_R::new(((self.bits >> 22) & 0x01) != 0) + } + #[doc = "Bit 23 - Debug: Pending exception serviced on exit from debug halt"] + #[inline(always)] + pub fn isrpreempt(&self) -> ISRPREEMPT_R { + ISRPREEMPT_R::new(((self.bits >> 23) & 0x01) != 0) + } + #[doc = "Bit 25 - SysTick exception clear-pending bit"] + #[inline(always)] + pub fn pendstclr(&self) -> PENDSTCLR_R { + PENDSTCLR_R::new(((self.bits >> 25) & 0x01) != 0) + } + #[doc = "Bit 26 - SysTick exception set-pending bit"] + #[inline(always)] + pub fn pendstset(&self) -> PENDSTSET_R { + PENDSTSET_R::new(((self.bits >> 26) & 0x01) != 0) + } + #[doc = "Bit 27 - PendSV clear-pending bit"] + #[inline(always)] + pub fn pendsvclr(&self) -> PENDSVCLR_R { + PENDSVCLR_R::new(((self.bits >> 27) & 0x01) != 0) + } + #[doc = "Bit 28 - PendSV set-pending bit"] + #[inline(always)] + pub fn pendsvset(&self) -> PENDSVSET_R { + PENDSVSET_R::new(((self.bits >> 28) & 0x01) != 0) + } + #[doc = "Bit 31 - NMI set-pending bit"] + #[inline(always)] + pub fn nmipendset(&self) -> NMIPENDSET_R { + NMIPENDSET_R::new(((self.bits >> 31) & 0x01) != 0) + } +} +impl W { + #[doc = "Bits 0:8 - Debug: Exception number of currently executing exception, or 0 if thread mode"] + #[inline(always)] + pub fn vectactive(&mut self) -> VECTACTIVE_W { + VECTACTIVE_W { w: self } + } + #[doc = "Bits 12:20 - Exception number of the highest priority pending enabled exception"] + #[inline(always)] + pub fn vectpending(&mut self) -> VECTPENDING_W { + VECTPENDING_W { w: self } + } + #[doc = "Bit 22 - Debug: NVIC interrupt pending"] + #[inline(always)] + pub fn isrpending(&mut self) -> ISRPENDING_W { + ISRPENDING_W { w: self } + } + #[doc = "Bit 23 - Debug: Pending exception serviced on exit from debug halt"] + #[inline(always)] + pub fn isrpreempt(&mut self) -> ISRPREEMPT_W { + ISRPREEMPT_W { w: self } + } + #[doc = "Bit 25 - SysTick exception clear-pending bit"] + #[inline(always)] + pub fn pendstclr(&mut self) -> PENDSTCLR_W { + PENDSTCLR_W { w: self } + } + #[doc = "Bit 26 - SysTick exception set-pending bit"] + #[inline(always)] + pub fn pendstset(&mut self) -> PENDSTSET_W { + PENDSTSET_W { w: self } + } + #[doc = "Bit 27 - PendSV clear-pending bit"] + #[inline(always)] + pub fn pendsvclr(&mut self) -> PENDSVCLR_W { + PENDSVCLR_W { w: self } + } + #[doc = "Bit 28 - PendSV set-pending bit"] + #[inline(always)] + pub fn pendsvset(&mut self) -> PENDSVSET_W { + PENDSVSET_W { w: self } + } + #[doc = "Bit 31 - NMI set-pending bit"] + #[inline(always)] + pub fn nmipendset(&mut self) -> NMIPENDSET_W { + NMIPENDSET_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "Interrupt Control and State Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [icsr](index.html) module"] +pub struct ICSR_SPEC; +impl crate::RegisterSpec for ICSR_SPEC { + type Ux = u32; +} +#[doc = "`read()` method returns [icsr::R](R) reader structure"] +impl crate::Readable for ICSR_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [icsr::W](W) writer structure"] +impl crate::Writable for ICSR_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets ICSR to value 0"] +impl crate::Resettable for ICSR_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/system_control/scr.rs b/src/system_control/scr.rs new file mode 100644 index 0000000..080b0f6 --- /dev/null +++ b/src/system_control/scr.rs @@ -0,0 +1,345 @@ +#[doc = "Register `SCR` reader"] +pub struct R(crate::R<SCR_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<SCR_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<SCR_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<SCR_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `SCR` writer"] +pub struct W(crate::W<SCR_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<SCR_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<SCR_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<SCR_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Sleep-On-Exit when exiting Handler mode\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum SLEEPONEXIT_A { + #[doc = "0: O not sleep when returning to Thread mode"] + VALUE_0 = 0, + #[doc = "1: Enter sleep, or deep sleep, on return from an ISR"] + VALUE_1 = 1, +} +impl From<SLEEPONEXIT_A> for bool { + #[inline(always)] + fn from(variant: SLEEPONEXIT_A) -> Self { + variant as u8 != 0 + } +} +#[doc = "Field `SLEEPONEXIT` reader - Sleep-On-Exit when exiting Handler mode"] +pub struct SLEEPONEXIT_R(crate::FieldReader<bool, SLEEPONEXIT_A>); +impl SLEEPONEXIT_R { + pub(crate) fn new(bits: bool) -> Self { + SLEEPONEXIT_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> SLEEPONEXIT_A { + match self.bits { + false => SLEEPONEXIT_A::VALUE_0, + true => SLEEPONEXIT_A::VALUE_1, + } + } + #[doc = "Checks if the value of the field is `VALUE_0`"] + #[inline(always)] + pub fn is_value_0(&self) -> bool { + **self == SLEEPONEXIT_A::VALUE_0 + } + #[doc = "Checks if the value of the field is `VALUE_1`"] + #[inline(always)] + pub fn is_value_1(&self) -> bool { + **self == SLEEPONEXIT_A::VALUE_1 + } +} +impl core::ops::Deref for SLEEPONEXIT_R { + type Target = crate::FieldReader<bool, SLEEPONEXIT_A>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `SLEEPONEXIT` writer - Sleep-On-Exit when exiting Handler mode"] +pub struct SLEEPONEXIT_W<'a> { + w: &'a mut W, +} +impl<'a> SLEEPONEXIT_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: SLEEPONEXIT_A) -> &'a mut W { + self.bit(variant.into()) + } + #[doc = "O not sleep when returning to Thread mode"] + #[inline(always)] + pub fn value_0(self) -> &'a mut W { + self.variant(SLEEPONEXIT_A::VALUE_0) + } + #[doc = "Enter sleep, or deep sleep, on return from an ISR"] + #[inline(always)] + pub fn value_1(self) -> &'a mut W { + self.variant(SLEEPONEXIT_A::VALUE_1) + } + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 1)) | ((value as u32 & 0x01) << 1); + self.w + } +} +#[doc = "Uses Deep Sleep as low power mode\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum SLEEPDEEP_A { + #[doc = "0: Sleep"] + VALUE_0 = 0, + #[doc = "1: Deep sleep"] + VALUE_1 = 1, +} +impl From<SLEEPDEEP_A> for bool { + #[inline(always)] + fn from(variant: SLEEPDEEP_A) -> Self { + variant as u8 != 0 + } +} +#[doc = "Field `SLEEPDEEP` reader - Uses Deep Sleep as low power mode"] +pub struct SLEEPDEEP_R(crate::FieldReader<bool, SLEEPDEEP_A>); +impl SLEEPDEEP_R { + pub(crate) fn new(bits: bool) -> Self { + SLEEPDEEP_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> SLEEPDEEP_A { + match self.bits { + false => SLEEPDEEP_A::VALUE_0, + true => SLEEPDEEP_A::VALUE_1, + } + } + #[doc = "Checks if the value of the field is `VALUE_0`"] + #[inline(always)] + pub fn is_value_0(&self) -> bool { + **self == SLEEPDEEP_A::VALUE_0 + } + #[doc = "Checks if the value of the field is `VALUE_1`"] + #[inline(always)] + pub fn is_value_1(&self) -> bool { + **self == SLEEPDEEP_A::VALUE_1 + } +} +impl core::ops::Deref for SLEEPDEEP_R { + type Target = crate::FieldReader<bool, SLEEPDEEP_A>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `SLEEPDEEP` writer - Uses Deep Sleep as low power mode"] +pub struct SLEEPDEEP_W<'a> { + w: &'a mut W, +} +impl<'a> SLEEPDEEP_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: SLEEPDEEP_A) -> &'a mut W { + self.bit(variant.into()) + } + #[doc = "Sleep"] + #[inline(always)] + pub fn value_0(self) -> &'a mut W { + self.variant(SLEEPDEEP_A::VALUE_0) + } + #[doc = "Deep sleep"] + #[inline(always)] + pub fn value_1(self) -> &'a mut W { + self.variant(SLEEPDEEP_A::VALUE_1) + } + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 2)) | ((value as u32 & 0x01) << 2); + self.w + } +} +#[doc = "Send Event on Pending bit\n\nValue on reset: 0"] +#[derive(Clone, Copy, Debug, PartialEq)] +pub enum SEVONPEND_A { + #[doc = "0: Only enabled interrupts or events can wakeup the processor, disabled interrupts are excluded"] + VALUE_0 = 0, + #[doc = "1: Enabled events and all interrupts, including disabled interrupts, can wakeup the processor"] + VALUE_1 = 1, +} +impl From<SEVONPEND_A> for bool { + #[inline(always)] + fn from(variant: SEVONPEND_A) -> Self { + variant as u8 != 0 + } +} +#[doc = "Field `SEVONPEND` reader - Send Event on Pending bit"] +pub struct SEVONPEND_R(crate::FieldReader<bool, SEVONPEND_A>); +impl SEVONPEND_R { + pub(crate) fn new(bits: bool) -> Self { + SEVONPEND_R(crate::FieldReader::new(bits)) + } + #[doc = r"Get enumerated values variant"] + #[inline(always)] + pub fn variant(&self) -> SEVONPEND_A { + match self.bits { + false => SEVONPEND_A::VALUE_0, + true => SEVONPEND_A::VALUE_1, + } + } + #[doc = "Checks if the value of the field is `VALUE_0`"] + #[inline(always)] + pub fn is_value_0(&self) -> bool { + **self == SEVONPEND_A::VALUE_0 + } + #[doc = "Checks if the value of the field is `VALUE_1`"] + #[inline(always)] + pub fn is_value_1(&self) -> bool { + **self == SEVONPEND_A::VALUE_1 + } +} +impl core::ops::Deref for SEVONPEND_R { + type Target = crate::FieldReader<bool, SEVONPEND_A>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `SEVONPEND` writer - Send Event on Pending bit"] +pub struct SEVONPEND_W<'a> { + w: &'a mut W, +} +impl<'a> SEVONPEND_W<'a> { + #[doc = r"Writes `variant` to the field"] + #[inline(always)] + pub fn variant(self, variant: SEVONPEND_A) -> &'a mut W { + self.bit(variant.into()) + } + #[doc = "Only enabled interrupts or events can wakeup the processor, disabled interrupts are excluded"] + #[inline(always)] + pub fn value_0(self) -> &'a mut W { + self.variant(SEVONPEND_A::VALUE_0) + } + #[doc = "Enabled events and all interrupts, including disabled interrupts, can wakeup the processor"] + #[inline(always)] + pub fn value_1(self) -> &'a mut W { + self.variant(SEVONPEND_A::VALUE_1) + } + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 4)) | ((value as u32 & 0x01) << 4); + self.w + } +} +impl R { + #[doc = "Bit 1 - Sleep-On-Exit when exiting Handler mode"] + #[inline(always)] + pub fn sleeponexit(&self) -> SLEEPONEXIT_R { + SLEEPONEXIT_R::new(((self.bits >> 1) & 0x01) != 0) + } + #[doc = "Bit 2 - Uses Deep Sleep as low power mode"] + #[inline(always)] + pub fn sleepdeep(&self) -> SLEEPDEEP_R { + SLEEPDEEP_R::new(((self.bits >> 2) & 0x01) != 0) + } + #[doc = "Bit 4 - Send Event on Pending bit"] + #[inline(always)] + pub fn sevonpend(&self) -> SEVONPEND_R { + SEVONPEND_R::new(((self.bits >> 4) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 1 - Sleep-On-Exit when exiting Handler mode"] + #[inline(always)] + pub fn sleeponexit(&mut self) -> SLEEPONEXIT_W { + SLEEPONEXIT_W { w: self } + } + #[doc = "Bit 2 - Uses Deep Sleep as low power mode"] + #[inline(always)] + pub fn sleepdeep(&mut self) -> SLEEPDEEP_W { + SLEEPDEEP_W { w: self } + } + #[doc = "Bit 4 - Send Event on Pending bit"] + #[inline(always)] + pub fn sevonpend(&mut self) -> SEVONPEND_W { + SEVONPEND_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "System Control Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [scr](index.html) module"] +pub struct SCR_SPEC; +impl crate::RegisterSpec for SCR_SPEC { + type Ux = u32; +} +#[doc = "`read()` method returns [scr::R](R) reader structure"] +impl crate::Readable for SCR_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [scr::W](W) writer structure"] +impl crate::Writable for SCR_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets SCR to value 0"] +impl crate::Resettable for SCR_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/system_control/shcsr.rs b/src/system_control/shcsr.rs new file mode 100644 index 0000000..01e26b2 --- /dev/null +++ b/src/system_control/shcsr.rs @@ -0,0 +1,112 @@ +#[doc = "Register `SHCSR` reader"] +pub struct R(crate::R<SHCSR_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<SHCSR_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<SHCSR_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<SHCSR_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `SHCSR` writer"] +pub struct W(crate::W<SHCSR_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<SHCSR_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<SHCSR_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<SHCSR_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `SVCALLPENDED` reader - "] +pub struct SVCALLPENDED_R(crate::FieldReader<bool, bool>); +impl SVCALLPENDED_R { + pub(crate) fn new(bits: bool) -> Self { + SVCALLPENDED_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for SVCALLPENDED_R { + type Target = crate::FieldReader<bool, bool>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `SVCALLPENDED` writer - "] +pub struct SVCALLPENDED_W<'a> { + w: &'a mut W, +} +impl<'a> SVCALLPENDED_W<'a> { + #[doc = r"Sets the field bit"] + #[inline(always)] + pub fn set_bit(self) -> &'a mut W { + self.bit(true) + } + #[doc = r"Clears the field bit"] + #[inline(always)] + pub fn clear_bit(self) -> &'a mut W { + self.bit(false) + } + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub fn bit(self, value: bool) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01 << 15)) | ((value as u32 & 0x01) << 15); + self.w + } +} +impl R { + #[doc = "Bit 15"] + #[inline(always)] + pub fn svcallpended(&self) -> SVCALLPENDED_R { + SVCALLPENDED_R::new(((self.bits >> 15) & 0x01) != 0) + } +} +impl W { + #[doc = "Bit 15"] + #[inline(always)] + pub fn svcallpended(&mut self) -> SVCALLPENDED_W { + SVCALLPENDED_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "System Handler Control and State Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [shcsr](index.html) module"] +pub struct SHCSR_SPEC; +impl crate::RegisterSpec for SHCSR_SPEC { + type Ux = u32; +} +#[doc = "`read()` method returns [shcsr::R](R) reader structure"] +impl crate::Readable for SHCSR_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [shcsr::W](W) writer structure"] +impl crate::Writable for SHCSR_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets SHCSR to value 0"] +impl crate::Resettable for SHCSR_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/system_control/shpr2.rs b/src/system_control/shpr2.rs new file mode 100644 index 0000000..41392c5 --- /dev/null +++ b/src/system_control/shpr2.rs @@ -0,0 +1,102 @@ +#[doc = "Register `SHPR2` reader"] +pub struct R(crate::R<SHPR2_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<SHPR2_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<SHPR2_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<SHPR2_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `SHPR2` writer"] +pub struct W(crate::W<SHPR2_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<SHPR2_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<SHPR2_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<SHPR2_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `PRI_11` reader - Priority of system handler 11, SVCall"] +pub struct PRI_11_R(crate::FieldReader<u8, u8>); +impl PRI_11_R { + pub(crate) fn new(bits: u8) -> Self { + PRI_11_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for PRI_11_R { + type Target = crate::FieldReader<u8, u8>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `PRI_11` writer - Priority of system handler 11, SVCall"] +pub struct PRI_11_W<'a> { + w: &'a mut W, +} +impl<'a> PRI_11_W<'a> { + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub unsafe fn bits(self, value: u8) -> &'a mut W { + self.w.bits = (self.w.bits & !(0xff << 24)) | ((value as u32 & 0xff) << 24); + self.w + } +} +impl R { + #[doc = "Bits 24:31 - Priority of system handler 11, SVCall"] + #[inline(always)] + pub fn pri_11(&self) -> PRI_11_R { + PRI_11_R::new(((self.bits >> 24) & 0xff) as u8) + } +} +impl W { + #[doc = "Bits 24:31 - Priority of system handler 11, SVCall"] + #[inline(always)] + pub fn pri_11(&mut self) -> PRI_11_W { + PRI_11_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "System Handler Priority Register 2\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [shpr2](index.html) module"] +pub struct SHPR2_SPEC; +impl crate::RegisterSpec for SHPR2_SPEC { + type Ux = u32; +} +#[doc = "`read()` method returns [shpr2::R](R) reader structure"] +impl crate::Readable for SHPR2_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [shpr2::W](W) writer structure"] +impl crate::Writable for SHPR2_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets SHPR2 to value 0"] +impl crate::Resettable for SHPR2_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/system_control/shpr3.rs b/src/system_control/shpr3.rs new file mode 100644 index 0000000..057eba3 --- /dev/null +++ b/src/system_control/shpr3.rs @@ -0,0 +1,138 @@ +#[doc = "Register `SHPR3` reader"] +pub struct R(crate::R<SHPR3_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<SHPR3_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<SHPR3_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<SHPR3_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `SHPR3` writer"] +pub struct W(crate::W<SHPR3_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<SHPR3_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<SHPR3_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<SHPR3_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `PRI_14` reader - Priority of system handler 14, PendSV"] +pub struct PRI_14_R(crate::FieldReader<u8, u8>); +impl PRI_14_R { + pub(crate) fn new(bits: u8) -> Self { + PRI_14_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for PRI_14_R { + type Target = crate::FieldReader<u8, u8>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `PRI_14` writer - Priority of system handler 14, PendSV"] +pub struct PRI_14_W<'a> { + w: &'a mut W, +} +impl<'a> PRI_14_W<'a> { + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub unsafe fn bits(self, value: u8) -> &'a mut W { + self.w.bits = (self.w.bits & !(0xff << 16)) | ((value as u32 & 0xff) << 16); + self.w + } +} +#[doc = "Field `PRI_15` reader - Priority of system handler 15, SysTick exception"] +pub struct PRI_15_R(crate::FieldReader<u8, u8>); +impl PRI_15_R { + pub(crate) fn new(bits: u8) -> Self { + PRI_15_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for PRI_15_R { + type Target = crate::FieldReader<u8, u8>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `PRI_15` writer - Priority of system handler 15, SysTick exception"] +pub struct PRI_15_W<'a> { + w: &'a mut W, +} +impl<'a> PRI_15_W<'a> { + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub unsafe fn bits(self, value: u8) -> &'a mut W { + self.w.bits = (self.w.bits & !(0xff << 24)) | ((value as u32 & 0xff) << 24); + self.w + } +} +impl R { + #[doc = "Bits 16:23 - Priority of system handler 14, PendSV"] + #[inline(always)] + pub fn pri_14(&self) -> PRI_14_R { + PRI_14_R::new(((self.bits >> 16) & 0xff) as u8) + } + #[doc = "Bits 24:31 - Priority of system handler 15, SysTick exception"] + #[inline(always)] + pub fn pri_15(&self) -> PRI_15_R { + PRI_15_R::new(((self.bits >> 24) & 0xff) as u8) + } +} +impl W { + #[doc = "Bits 16:23 - Priority of system handler 14, PendSV"] + #[inline(always)] + pub fn pri_14(&mut self) -> PRI_14_W { + PRI_14_W { w: self } + } + #[doc = "Bits 24:31 - Priority of system handler 15, SysTick exception"] + #[inline(always)] + pub fn pri_15(&mut self) -> PRI_15_W { + PRI_15_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "System Handler Priority Register 3\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [shpr3](index.html) module"] +pub struct SHPR3_SPEC; +impl crate::RegisterSpec for SHPR3_SPEC { + type Ux = u32; +} +#[doc = "`read()` method returns [shpr3::R](R) reader structure"] +impl crate::Readable for SHPR3_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [shpr3::W](W) writer structure"] +impl crate::Writable for SHPR3_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets SHPR3 to value 0"] +impl crate::Resettable for SHPR3_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} diff --git a/src/system_control/vtor.rs b/src/system_control/vtor.rs new file mode 100644 index 0000000..b1784c3 --- /dev/null +++ b/src/system_control/vtor.rs @@ -0,0 +1,102 @@ +#[doc = "Register `VTOR` reader"] +pub struct R(crate::R<VTOR_SPEC>); +impl core::ops::Deref for R { + type Target = crate::R<VTOR_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl From<crate::R<VTOR_SPEC>> for R { + #[inline(always)] + fn from(reader: crate::R<VTOR_SPEC>) -> Self { + R(reader) + } +} +#[doc = "Register `VTOR` writer"] +pub struct W(crate::W<VTOR_SPEC>); +impl core::ops::Deref for W { + type Target = crate::W<VTOR_SPEC>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +impl core::ops::DerefMut for W { + #[inline(always)] + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} +impl From<crate::W<VTOR_SPEC>> for W { + #[inline(always)] + fn from(writer: crate::W<VTOR_SPEC>) -> Self { + W(writer) + } +} +#[doc = "Field `TBLOFF` reader - Vector table base offset"] +pub struct TBLOFF_R(crate::FieldReader<u32, u32>); +impl TBLOFF_R { + pub(crate) fn new(bits: u32) -> Self { + TBLOFF_R(crate::FieldReader::new(bits)) + } +} +impl core::ops::Deref for TBLOFF_R { + type Target = crate::FieldReader<u32, u32>; + #[inline(always)] + fn deref(&self) -> &Self::Target { + &self.0 + } +} +#[doc = "Field `TBLOFF` writer - Vector table base offset"] +pub struct TBLOFF_W<'a> { + w: &'a mut W, +} +impl<'a> TBLOFF_W<'a> { + #[doc = r"Writes raw bits to the field"] + #[inline(always)] + pub unsafe fn bits(self, value: u32) -> &'a mut W { + self.w.bits = (self.w.bits & !(0x01ff_ffff << 7)) | ((value as u32 & 0x01ff_ffff) << 7); + self.w + } +} +impl R { + #[doc = "Bits 7:31 - Vector table base offset"] + #[inline(always)] + pub fn tbloff(&self) -> TBLOFF_R { + TBLOFF_R::new(((self.bits >> 7) & 0x01ff_ffff) as u32) + } +} +impl W { + #[doc = "Bits 7:31 - Vector table base offset"] + #[inline(always)] + pub fn tbloff(&mut self) -> TBLOFF_W { + TBLOFF_W { w: self } + } + #[doc = "Writes raw bits to the register."] + #[inline(always)] + pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { + self.0.bits(bits); + self + } +} +#[doc = "Vector Table Offset Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [vtor](index.html) module"] +pub struct VTOR_SPEC; +impl crate::RegisterSpec for VTOR_SPEC { + type Ux = u32; +} +#[doc = "`read()` method returns [vtor::R](R) reader structure"] +impl crate::Readable for VTOR_SPEC { + type Reader = R; +} +#[doc = "`write(|w| ..)` method takes [vtor::W](W) writer structure"] +impl crate::Writable for VTOR_SPEC { + type Writer = W; +} +#[doc = "`reset()` method sets VTOR to value 0"] +impl crate::Resettable for VTOR_SPEC { + #[inline(always)] + fn reset_value() -> Self::Ux { + 0 + } +} |
