lpc55_pac/ahb_secure_ctrl/
sec_ctrl_usb_hs_slave_rule.rs1#[doc = "Register `SEC_CTRL_USB_HS_SLAVE_RULE` reader"]
2pub struct R(crate::R<SEC_CTRL_USB_HS_SLAVE_RULE_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<SEC_CTRL_USB_HS_SLAVE_RULE_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<SEC_CTRL_USB_HS_SLAVE_RULE_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<SEC_CTRL_USB_HS_SLAVE_RULE_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `SEC_CTRL_USB_HS_SLAVE_RULE` writer"]
17pub struct W(crate::W<SEC_CTRL_USB_HS_SLAVE_RULE_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<SEC_CTRL_USB_HS_SLAVE_RULE_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<SEC_CTRL_USB_HS_SLAVE_RULE_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<SEC_CTRL_USB_HS_SLAVE_RULE_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Security access rules for the whole USB High Speed RAM : 0x4010_0000 - 0x4010_3FFF\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum RAM_USB_HS_RULE_A {
41 #[doc = "0: Non-secure and Non-priviledge user access allowed."]
42 ENUM_NS_NP = 0,
43 #[doc = "1: Non-secure and Privilege access allowed."]
44 ENUM_NS_P = 1,
45 #[doc = "2: Secure and Non-priviledge user access allowed."]
46 ENUM_S_NP = 2,
47 #[doc = "3: Secure and Priviledge user access allowed."]
48 ENUM_S_P = 3,
49}
50impl From<RAM_USB_HS_RULE_A> for u8 {
51 #[inline(always)]
52 fn from(variant: RAM_USB_HS_RULE_A) -> Self {
53 variant as _
54 }
55}
56#[doc = "Field `RAM_USB_HS_RULE` reader - Security access rules for the whole USB High Speed RAM : 0x4010_0000 - 0x4010_3FFF"]
57pub struct RAM_USB_HS_RULE_R(crate::FieldReader<u8, RAM_USB_HS_RULE_A>);
58impl RAM_USB_HS_RULE_R {
59 #[inline(always)]
60 pub(crate) fn new(bits: u8) -> Self {
61 RAM_USB_HS_RULE_R(crate::FieldReader::new(bits))
62 }
63 #[doc = r"Get enumerated values variant"]
64 #[inline(always)]
65 pub fn variant(&self) -> RAM_USB_HS_RULE_A {
66 match self.bits {
67 0 => RAM_USB_HS_RULE_A::ENUM_NS_NP,
68 1 => RAM_USB_HS_RULE_A::ENUM_NS_P,
69 2 => RAM_USB_HS_RULE_A::ENUM_S_NP,
70 3 => RAM_USB_HS_RULE_A::ENUM_S_P,
71 _ => unreachable!(),
72 }
73 }
74 #[doc = "Checks if the value of the field is `ENUM_NS_NP`"]
75 #[inline(always)]
76 pub fn is_enum_ns_np(&self) -> bool {
77 **self == RAM_USB_HS_RULE_A::ENUM_NS_NP
78 }
79 #[doc = "Checks if the value of the field is `ENUM_NS_P`"]
80 #[inline(always)]
81 pub fn is_enum_ns_p(&self) -> bool {
82 **self == RAM_USB_HS_RULE_A::ENUM_NS_P
83 }
84 #[doc = "Checks if the value of the field is `ENUM_S_NP`"]
85 #[inline(always)]
86 pub fn is_enum_s_np(&self) -> bool {
87 **self == RAM_USB_HS_RULE_A::ENUM_S_NP
88 }
89 #[doc = "Checks if the value of the field is `ENUM_S_P`"]
90 #[inline(always)]
91 pub fn is_enum_s_p(&self) -> bool {
92 **self == RAM_USB_HS_RULE_A::ENUM_S_P
93 }
94}
95impl core::ops::Deref for RAM_USB_HS_RULE_R {
96 type Target = crate::FieldReader<u8, RAM_USB_HS_RULE_A>;
97 #[inline(always)]
98 fn deref(&self) -> &Self::Target {
99 &self.0
100 }
101}
102#[doc = "Field `RAM_USB_HS_RULE` writer - Security access rules for the whole USB High Speed RAM : 0x4010_0000 - 0x4010_3FFF"]
103pub struct RAM_USB_HS_RULE_W<'a> {
104 w: &'a mut W,
105}
106impl<'a> RAM_USB_HS_RULE_W<'a> {
107 #[doc = r"Writes `variant` to the field"]
108 #[inline(always)]
109 pub fn variant(self, variant: RAM_USB_HS_RULE_A) -> &'a mut W {
110 self.bits(variant.into())
111 }
112 #[doc = "Non-secure and Non-priviledge user access allowed."]
113 #[inline(always)]
114 pub fn enum_ns_np(self) -> &'a mut W {
115 self.variant(RAM_USB_HS_RULE_A::ENUM_NS_NP)
116 }
117 #[doc = "Non-secure and Privilege access allowed."]
118 #[inline(always)]
119 pub fn enum_ns_p(self) -> &'a mut W {
120 self.variant(RAM_USB_HS_RULE_A::ENUM_NS_P)
121 }
122 #[doc = "Secure and Non-priviledge user access allowed."]
123 #[inline(always)]
124 pub fn enum_s_np(self) -> &'a mut W {
125 self.variant(RAM_USB_HS_RULE_A::ENUM_S_NP)
126 }
127 #[doc = "Secure and Priviledge user access allowed."]
128 #[inline(always)]
129 pub fn enum_s_p(self) -> &'a mut W {
130 self.variant(RAM_USB_HS_RULE_A::ENUM_S_P)
131 }
132 #[doc = r"Writes raw bits to the field"]
133 #[inline(always)]
134 pub fn bits(self, value: u8) -> &'a mut W {
135 self.w.bits = (self.w.bits & !0x03) | (value as u32 & 0x03);
136 self.w
137 }
138}
139impl R {
140 #[doc = "Bits 0:1 - Security access rules for the whole USB High Speed RAM : 0x4010_0000 - 0x4010_3FFF"]
141 #[inline(always)]
142 pub fn ram_usb_hs_rule(&self) -> RAM_USB_HS_RULE_R {
143 RAM_USB_HS_RULE_R::new((self.bits & 0x03) as u8)
144 }
145}
146impl W {
147 #[doc = "Bits 0:1 - Security access rules for the whole USB High Speed RAM : 0x4010_0000 - 0x4010_3FFF"]
148 #[inline(always)]
149 pub fn ram_usb_hs_rule(&mut self) -> RAM_USB_HS_RULE_W {
150 RAM_USB_HS_RULE_W { w: self }
151 }
152 #[doc = "Writes raw bits to the register."]
153 #[inline(always)]
154 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
155 self.0.bits(bits);
156 self
157 }
158}
159#[doc = "Security access rules for USB High speed RAM slaves.\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 [sec_ctrl_usb_hs_slave_rule](index.html) module"]
160pub struct SEC_CTRL_USB_HS_SLAVE_RULE_SPEC;
161impl crate::RegisterSpec for SEC_CTRL_USB_HS_SLAVE_RULE_SPEC {
162 type Ux = u32;
163}
164#[doc = "`read()` method returns [sec_ctrl_usb_hs_slave_rule::R](R) reader structure"]
165impl crate::Readable for SEC_CTRL_USB_HS_SLAVE_RULE_SPEC {
166 type Reader = R;
167}
168#[doc = "`write(|w| ..)` method takes [sec_ctrl_usb_hs_slave_rule::W](W) writer structure"]
169impl crate::Writable for SEC_CTRL_USB_HS_SLAVE_RULE_SPEC {
170 type Writer = W;
171}
172#[doc = "`reset()` method sets SEC_CTRL_USB_HS_SLAVE_RULE to value 0"]
173impl crate::Resettable for SEC_CTRL_USB_HS_SLAVE_RULE_SPEC {
174 #[inline(always)]
175 fn reset_value() -> Self::Ux {
176 0
177 }
178}