diff options
| author | Arne Dußin | 2021-11-06 11:50:33 +0100 |
|---|---|---|
| committer | Arne Dußin | 2021-11-06 11:50:33 +0100 |
| commit | 0666a6ba1dbd66cf8b93c113e362ccbcd99152a0 (patch) | |
| tree | a184284dbd2316f4624f092e4e7521ea8c90855b /src/system_control/ccr.rs | |
| download | samc21-0666a6ba1dbd66cf8b93c113e362ccbcd99152a0.tar.gz samc21-0666a6ba1dbd66cf8b93c113e362ccbcd99152a0.zip | |
Initial commit
Diffstat (limited to 'src/system_control/ccr.rs')
| -rw-r--r-- | src/system_control/ccr.rs | 135 |
1 files changed, 135 insertions, 0 deletions
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 + } +} |
