lpc55_pac/syscon/
debug_lock_en.rs1#[doc = "Register `DEBUG_LOCK_EN` reader"]
2pub struct R(crate::R<DEBUG_LOCK_EN_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<DEBUG_LOCK_EN_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<DEBUG_LOCK_EN_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<DEBUG_LOCK_EN_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `DEBUG_LOCK_EN` writer"]
17pub struct W(crate::W<DEBUG_LOCK_EN_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<DEBUG_LOCK_EN_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<DEBUG_LOCK_EN_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<DEBUG_LOCK_EN_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Control write access to CODESECURITYPROTTEST, CODESECURITYPROTCPU0, CODESECURITYPROTCPU1, CPU0_DEBUG_FEATURES, CPU1_DEBUG_FEATURES and DBG_AUTH_SCRATCH registers.\n\nValue on reset: 5"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum LOCK_ALL_A {
41 #[doc = "0: Any other value than b1010: disable write access to all 6 registers."]
42 DISABLE = 0,
43 #[doc = "10: 1010: Enable write access to all 6 registers."]
44 ENABLE = 10,
45}
46impl From<LOCK_ALL_A> for u8 {
47 #[inline(always)]
48 fn from(variant: LOCK_ALL_A) -> Self {
49 variant as _
50 }
51}
52#[doc = "Field `LOCK_ALL` reader - Control write access to CODESECURITYPROTTEST, CODESECURITYPROTCPU0, CODESECURITYPROTCPU1, CPU0_DEBUG_FEATURES, CPU1_DEBUG_FEATURES and DBG_AUTH_SCRATCH registers."]
53pub struct LOCK_ALL_R(crate::FieldReader<u8, LOCK_ALL_A>);
54impl LOCK_ALL_R {
55 #[inline(always)]
56 pub(crate) fn new(bits: u8) -> Self {
57 LOCK_ALL_R(crate::FieldReader::new(bits))
58 }
59 #[doc = r"Get enumerated values variant"]
60 #[inline(always)]
61 pub fn variant(&self) -> Option<LOCK_ALL_A> {
62 match self.bits {
63 0 => Some(LOCK_ALL_A::DISABLE),
64 10 => Some(LOCK_ALL_A::ENABLE),
65 _ => None,
66 }
67 }
68 #[doc = "Checks if the value of the field is `DISABLE`"]
69 #[inline(always)]
70 pub fn is_disable(&self) -> bool {
71 **self == LOCK_ALL_A::DISABLE
72 }
73 #[doc = "Checks if the value of the field is `ENABLE`"]
74 #[inline(always)]
75 pub fn is_enable(&self) -> bool {
76 **self == LOCK_ALL_A::ENABLE
77 }
78}
79impl core::ops::Deref for LOCK_ALL_R {
80 type Target = crate::FieldReader<u8, LOCK_ALL_A>;
81 #[inline(always)]
82 fn deref(&self) -> &Self::Target {
83 &self.0
84 }
85}
86#[doc = "Field `LOCK_ALL` writer - Control write access to CODESECURITYPROTTEST, CODESECURITYPROTCPU0, CODESECURITYPROTCPU1, CPU0_DEBUG_FEATURES, CPU1_DEBUG_FEATURES and DBG_AUTH_SCRATCH registers."]
87pub struct LOCK_ALL_W<'a> {
88 w: &'a mut W,
89}
90impl<'a> LOCK_ALL_W<'a> {
91 #[doc = r"Writes `variant` to the field"]
92 #[inline(always)]
93 pub fn variant(self, variant: LOCK_ALL_A) -> &'a mut W {
94 unsafe { self.bits(variant.into()) }
95 }
96 #[doc = "Any other value than b1010: disable write access to all 6 registers."]
97 #[inline(always)]
98 pub fn disable(self) -> &'a mut W {
99 self.variant(LOCK_ALL_A::DISABLE)
100 }
101 #[doc = "1010: Enable write access to all 6 registers."]
102 #[inline(always)]
103 pub fn enable(self) -> &'a mut W {
104 self.variant(LOCK_ALL_A::ENABLE)
105 }
106 #[doc = r"Writes raw bits to the field"]
107 #[inline(always)]
108 pub unsafe fn bits(self, value: u8) -> &'a mut W {
109 self.w.bits = (self.w.bits & !0x0f) | (value as u32 & 0x0f);
110 self.w
111 }
112}
113impl R {
114 #[doc = "Bits 0:3 - Control write access to CODESECURITYPROTTEST, CODESECURITYPROTCPU0, CODESECURITYPROTCPU1, CPU0_DEBUG_FEATURES, CPU1_DEBUG_FEATURES and DBG_AUTH_SCRATCH registers."]
115 #[inline(always)]
116 pub fn lock_all(&self) -> LOCK_ALL_R {
117 LOCK_ALL_R::new((self.bits & 0x0f) as u8)
118 }
119}
120impl W {
121 #[doc = "Bits 0:3 - Control write access to CODESECURITYPROTTEST, CODESECURITYPROTCPU0, CODESECURITYPROTCPU1, CPU0_DEBUG_FEATURES, CPU1_DEBUG_FEATURES and DBG_AUTH_SCRATCH registers."]
122 #[inline(always)]
123 pub fn lock_all(&mut self) -> LOCK_ALL_W {
124 LOCK_ALL_W { w: self }
125 }
126 #[doc = "Writes raw bits to the register."]
127 #[inline(always)]
128 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
129 self.0.bits(bits);
130 self
131 }
132}
133#[doc = "Control write access to security registers.\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 [debug_lock_en](index.html) module"]
134pub struct DEBUG_LOCK_EN_SPEC;
135impl crate::RegisterSpec for DEBUG_LOCK_EN_SPEC {
136 type Ux = u32;
137}
138#[doc = "`read()` method returns [debug_lock_en::R](R) reader structure"]
139impl crate::Readable for DEBUG_LOCK_EN_SPEC {
140 type Reader = R;
141}
142#[doc = "`write(|w| ..)` method takes [debug_lock_en::W](W) writer structure"]
143impl crate::Writable for DEBUG_LOCK_EN_SPEC {
144 type Writer = W;
145}
146#[doc = "`reset()` method sets DEBUG_LOCK_EN to value 0x05"]
147impl crate::Resettable for DEBUG_LOCK_EN_SPEC {
148 #[inline(always)]
149 fn reset_value() -> Self::Ux {
150 0x05
151 }
152}