corstone300_pac/syscontrol/
nmi_enable.rs

1// Copyright 2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
2//
3// SPDX-License-Identifier: MIT
4
5#[doc = "Register `NMI_ENABLE` reader"]
6pub struct R(crate::R<NMI_ENABLE_SPEC>);
7impl core::ops::Deref for R {
8    type Target = crate::R<NMI_ENABLE_SPEC>;
9    #[inline(always)]
10    fn deref(&self) -> &Self::Target {
11        &self.0
12    }
13}
14impl From<crate::R<NMI_ENABLE_SPEC>> for R {
15    #[inline(always)]
16    fn from(reader: crate::R<NMI_ENABLE_SPEC>) -> Self {
17        R(reader)
18    }
19}
20#[doc = "Register `NMI_ENABLE` writer"]
21pub struct W(crate::W<NMI_ENABLE_SPEC>);
22impl core::ops::Deref for W {
23    type Target = crate::W<NMI_ENABLE_SPEC>;
24    #[inline(always)]
25    fn deref(&self) -> &Self::Target {
26        &self.0
27    }
28}
29impl core::ops::DerefMut for W {
30    #[inline(always)]
31    fn deref_mut(&mut self) -> &mut Self::Target {
32        &mut self.0
33    }
34}
35impl From<crate::W<NMI_ENABLE_SPEC>> for W {
36    #[inline(always)]
37    fn from(writer: crate::W<NMI_ENABLE_SPEC>) -> Self {
38        W(writer)
39    }
40}
41#[doc = "Field `CPU0_INTNMI_ENABLE` reader - CPU0 Internally Sourced NMI Enable"]
42pub type CPU0_INTNMI_ENABLE_R = crate::BitReader<CPU0_INTNMI_ENABLE_A>;
43#[doc = "CPU0 Internally Sourced NMI Enable\n\nValue on reset: 0"]
44#[derive(Clone, Copy, Debug, PartialEq, Eq)]
45pub enum CPU0_INTNMI_ENABLE_A {
46    #[doc = "1: CPU0 Internally Sourced NMI Enabled"]
47    ENABLE = 1,
48    #[doc = "0: CPU0 Internally Sourced NMI Disabled"]
49    DISABLED = 0,
50}
51impl From<CPU0_INTNMI_ENABLE_A> for bool {
52    #[inline(always)]
53    fn from(variant: CPU0_INTNMI_ENABLE_A) -> Self {
54        variant as u8 != 0
55    }
56}
57impl CPU0_INTNMI_ENABLE_R {
58    #[doc = "Get enumerated values variant"]
59    #[inline(always)]
60    pub fn variant(&self) -> CPU0_INTNMI_ENABLE_A {
61        match self.bits {
62            true => CPU0_INTNMI_ENABLE_A::ENABLE,
63            false => CPU0_INTNMI_ENABLE_A::DISABLED,
64        }
65    }
66    #[doc = "Checks if the value of the field is `ENABLE`"]
67    #[inline(always)]
68    pub fn is_enable(&self) -> bool {
69        *self == CPU0_INTNMI_ENABLE_A::ENABLE
70    }
71    #[doc = "Checks if the value of the field is `DISABLED`"]
72    #[inline(always)]
73    pub fn is_disabled(&self) -> bool {
74        *self == CPU0_INTNMI_ENABLE_A::DISABLED
75    }
76}
77#[doc = "Field `CPU0_INTNMI_ENABLE` writer - CPU0 Internally Sourced NMI Enable"]
78pub type CPU0_INTNMI_ENABLE_W<'a, const O: u8> =
79    crate::BitWriter<'a, u32, NMI_ENABLE_SPEC, CPU0_INTNMI_ENABLE_A, O>;
80impl<'a, const O: u8> CPU0_INTNMI_ENABLE_W<'a, O> {
81    #[doc = "CPU0 Internally Sourced NMI Enabled"]
82    #[inline(always)]
83    pub fn enable(self) -> &'a mut W {
84        self.variant(CPU0_INTNMI_ENABLE_A::ENABLE)
85    }
86    #[doc = "CPU0 Internally Sourced NMI Disabled"]
87    #[inline(always)]
88    pub fn disabled(self) -> &'a mut W {
89        self.variant(CPU0_INTNMI_ENABLE_A::DISABLED)
90    }
91}
92#[doc = "Field `CPU1_INTNMI_ENABLE` reader - CPU1 Internally Sourced NMI Enable"]
93pub type CPU1_INTNMI_ENABLE_R = crate::BitReader<CPU1_INTNMI_ENABLE_A>;
94#[doc = "CPU1 Internally Sourced NMI Enable\n\nValue on reset: 0"]
95#[derive(Clone, Copy, Debug, PartialEq, Eq)]
96pub enum CPU1_INTNMI_ENABLE_A {
97    #[doc = "1: CPU1 Internally Sourced NMI Enabled"]
98    ENABLE = 1,
99    #[doc = "0: CPU1 Internally Sourced NMI Disabled"]
100    DISABLED = 0,
101}
102impl From<CPU1_INTNMI_ENABLE_A> for bool {
103    #[inline(always)]
104    fn from(variant: CPU1_INTNMI_ENABLE_A) -> Self {
105        variant as u8 != 0
106    }
107}
108impl CPU1_INTNMI_ENABLE_R {
109    #[doc = "Get enumerated values variant"]
110    #[inline(always)]
111    pub fn variant(&self) -> CPU1_INTNMI_ENABLE_A {
112        match self.bits {
113            true => CPU1_INTNMI_ENABLE_A::ENABLE,
114            false => CPU1_INTNMI_ENABLE_A::DISABLED,
115        }
116    }
117    #[doc = "Checks if the value of the field is `ENABLE`"]
118    #[inline(always)]
119    pub fn is_enable(&self) -> bool {
120        *self == CPU1_INTNMI_ENABLE_A::ENABLE
121    }
122    #[doc = "Checks if the value of the field is `DISABLED`"]
123    #[inline(always)]
124    pub fn is_disabled(&self) -> bool {
125        *self == CPU1_INTNMI_ENABLE_A::DISABLED
126    }
127}
128#[doc = "Field `CPU1_INTNMI_ENABLE` writer - CPU1 Internally Sourced NMI Enable"]
129pub type CPU1_INTNMI_ENABLE_W<'a, const O: u8> =
130    crate::BitWriter<'a, u32, NMI_ENABLE_SPEC, CPU1_INTNMI_ENABLE_A, O>;
131impl<'a, const O: u8> CPU1_INTNMI_ENABLE_W<'a, O> {
132    #[doc = "CPU1 Internally Sourced NMI Enabled"]
133    #[inline(always)]
134    pub fn enable(self) -> &'a mut W {
135        self.variant(CPU1_INTNMI_ENABLE_A::ENABLE)
136    }
137    #[doc = "CPU1 Internally Sourced NMI Disabled"]
138    #[inline(always)]
139    pub fn disabled(self) -> &'a mut W {
140        self.variant(CPU1_INTNMI_ENABLE_A::DISABLED)
141    }
142}
143#[doc = "Field `CPU0_EXPNMI_ENABLE` reader - CPU0 Externally Sourced NMI Enable"]
144pub type CPU0_EXPNMI_ENABLE_R = crate::BitReader<CPU0_EXPNMI_ENABLE_A>;
145#[doc = "CPU0 Externally Sourced NMI Enable\n\nValue on reset: 0"]
146#[derive(Clone, Copy, Debug, PartialEq, Eq)]
147pub enum CPU0_EXPNMI_ENABLE_A {
148    #[doc = "1: CPU0 Externally Sourced NMI Enabled"]
149    ENABLE = 1,
150    #[doc = "0: CPU0 Externally Sourced NMI Disabled"]
151    DISABLED = 0,
152}
153impl From<CPU0_EXPNMI_ENABLE_A> for bool {
154    #[inline(always)]
155    fn from(variant: CPU0_EXPNMI_ENABLE_A) -> Self {
156        variant as u8 != 0
157    }
158}
159impl CPU0_EXPNMI_ENABLE_R {
160    #[doc = "Get enumerated values variant"]
161    #[inline(always)]
162    pub fn variant(&self) -> CPU0_EXPNMI_ENABLE_A {
163        match self.bits {
164            true => CPU0_EXPNMI_ENABLE_A::ENABLE,
165            false => CPU0_EXPNMI_ENABLE_A::DISABLED,
166        }
167    }
168    #[doc = "Checks if the value of the field is `ENABLE`"]
169    #[inline(always)]
170    pub fn is_enable(&self) -> bool {
171        *self == CPU0_EXPNMI_ENABLE_A::ENABLE
172    }
173    #[doc = "Checks if the value of the field is `DISABLED`"]
174    #[inline(always)]
175    pub fn is_disabled(&self) -> bool {
176        *self == CPU0_EXPNMI_ENABLE_A::DISABLED
177    }
178}
179#[doc = "Field `CPU0_EXPNMI_ENABLE` writer - CPU0 Externally Sourced NMI Enable"]
180pub type CPU0_EXPNMI_ENABLE_W<'a, const O: u8> =
181    crate::BitWriter<'a, u32, NMI_ENABLE_SPEC, CPU0_EXPNMI_ENABLE_A, O>;
182impl<'a, const O: u8> CPU0_EXPNMI_ENABLE_W<'a, O> {
183    #[doc = "CPU0 Externally Sourced NMI Enabled"]
184    #[inline(always)]
185    pub fn enable(self) -> &'a mut W {
186        self.variant(CPU0_EXPNMI_ENABLE_A::ENABLE)
187    }
188    #[doc = "CPU0 Externally Sourced NMI Disabled"]
189    #[inline(always)]
190    pub fn disabled(self) -> &'a mut W {
191        self.variant(CPU0_EXPNMI_ENABLE_A::DISABLED)
192    }
193}
194#[doc = "Field `CPU1_EXPNMI_ENABLE` reader - CPU1 Externally Sourced NMI Enable"]
195pub type CPU1_EXPNMI_ENABLE_R = crate::BitReader<CPU1_EXPNMI_ENABLE_A>;
196#[doc = "CPU1 Externally Sourced NMI Enable\n\nValue on reset: 0"]
197#[derive(Clone, Copy, Debug, PartialEq, Eq)]
198pub enum CPU1_EXPNMI_ENABLE_A {
199    #[doc = "1: CPU1 Externally Sourced NMI Enabled"]
200    ENABLE = 1,
201    #[doc = "0: CPU1 Externally Sourced NMI Disabled"]
202    DISABLED = 0,
203}
204impl From<CPU1_EXPNMI_ENABLE_A> for bool {
205    #[inline(always)]
206    fn from(variant: CPU1_EXPNMI_ENABLE_A) -> Self {
207        variant as u8 != 0
208    }
209}
210impl CPU1_EXPNMI_ENABLE_R {
211    #[doc = "Get enumerated values variant"]
212    #[inline(always)]
213    pub fn variant(&self) -> CPU1_EXPNMI_ENABLE_A {
214        match self.bits {
215            true => CPU1_EXPNMI_ENABLE_A::ENABLE,
216            false => CPU1_EXPNMI_ENABLE_A::DISABLED,
217        }
218    }
219    #[doc = "Checks if the value of the field is `ENABLE`"]
220    #[inline(always)]
221    pub fn is_enable(&self) -> bool {
222        *self == CPU1_EXPNMI_ENABLE_A::ENABLE
223    }
224    #[doc = "Checks if the value of the field is `DISABLED`"]
225    #[inline(always)]
226    pub fn is_disabled(&self) -> bool {
227        *self == CPU1_EXPNMI_ENABLE_A::DISABLED
228    }
229}
230#[doc = "Field `CPU1_EXPNMI_ENABLE` writer - CPU1 Externally Sourced NMI Enable"]
231pub type CPU1_EXPNMI_ENABLE_W<'a, const O: u8> =
232    crate::BitWriter<'a, u32, NMI_ENABLE_SPEC, CPU1_EXPNMI_ENABLE_A, O>;
233impl<'a, const O: u8> CPU1_EXPNMI_ENABLE_W<'a, O> {
234    #[doc = "CPU1 Externally Sourced NMI Enabled"]
235    #[inline(always)]
236    pub fn enable(self) -> &'a mut W {
237        self.variant(CPU1_EXPNMI_ENABLE_A::ENABLE)
238    }
239    #[doc = "CPU1 Externally Sourced NMI Disabled"]
240    #[inline(always)]
241    pub fn disabled(self) -> &'a mut W {
242        self.variant(CPU1_EXPNMI_ENABLE_A::DISABLED)
243    }
244}
245impl R {
246    #[doc = "Bit 0 - CPU0 Internally Sourced NMI Enable"]
247    #[inline(always)]
248    pub fn cpu0_intnmi_enable(&self) -> CPU0_INTNMI_ENABLE_R {
249        CPU0_INTNMI_ENABLE_R::new((self.bits & 1) != 0)
250    }
251    #[doc = "Bit 1 - CPU1 Internally Sourced NMI Enable"]
252    #[inline(always)]
253    pub fn cpu1_intnmi_enable(&self) -> CPU1_INTNMI_ENABLE_R {
254        CPU1_INTNMI_ENABLE_R::new(((self.bits >> 1) & 1) != 0)
255    }
256    #[doc = "Bit 16 - CPU0 Externally Sourced NMI Enable"]
257    #[inline(always)]
258    pub fn cpu0_expnmi_enable(&self) -> CPU0_EXPNMI_ENABLE_R {
259        CPU0_EXPNMI_ENABLE_R::new(((self.bits >> 16) & 1) != 0)
260    }
261    #[doc = "Bit 17 - CPU1 Externally Sourced NMI Enable"]
262    #[inline(always)]
263    pub fn cpu1_expnmi_enable(&self) -> CPU1_EXPNMI_ENABLE_R {
264        CPU1_EXPNMI_ENABLE_R::new(((self.bits >> 17) & 1) != 0)
265    }
266}
267impl W {
268    #[doc = "Bit 0 - CPU0 Internally Sourced NMI Enable"]
269    #[inline(always)]
270    pub fn cpu0_intnmi_enable(&mut self) -> CPU0_INTNMI_ENABLE_W<0> {
271        CPU0_INTNMI_ENABLE_W::new(self)
272    }
273    #[doc = "Bit 1 - CPU1 Internally Sourced NMI Enable"]
274    #[inline(always)]
275    pub fn cpu1_intnmi_enable(&mut self) -> CPU1_INTNMI_ENABLE_W<1> {
276        CPU1_INTNMI_ENABLE_W::new(self)
277    }
278    #[doc = "Bit 16 - CPU0 Externally Sourced NMI Enable"]
279    #[inline(always)]
280    pub fn cpu0_expnmi_enable(&mut self) -> CPU0_EXPNMI_ENABLE_W<16> {
281        CPU0_EXPNMI_ENABLE_W::new(self)
282    }
283    #[doc = "Bit 17 - CPU1 Externally Sourced NMI Enable"]
284    #[inline(always)]
285    pub fn cpu1_expnmi_enable(&mut self) -> CPU1_EXPNMI_ENABLE_W<17> {
286        CPU1_EXPNMI_ENABLE_W::new(self)
287    }
288    #[doc = "Writes raw bits to the register."]
289    #[inline(always)]
290    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
291        self.0.bits(bits);
292        self
293    }
294}
295#[doc = "NMI Enable 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 [nmi_enable](index.html) module"]
296pub struct NMI_ENABLE_SPEC;
297impl crate::RegisterSpec for NMI_ENABLE_SPEC {
298    type Ux = u32;
299}
300#[doc = "`read()` method returns [nmi_enable::R](R) reader structure"]
301impl crate::Readable for NMI_ENABLE_SPEC {
302    type Reader = R;
303}
304#[doc = "`write(|w| ..)` method takes [nmi_enable::W](W) writer structure"]
305impl crate::Writable for NMI_ENABLE_SPEC {
306    type Writer = W;
307}
308#[doc = "`reset()` method sets NMI_ENABLE to value 0"]
309impl crate::Resettable for NMI_ENABLE_SPEC {
310    #[inline(always)]
311    fn reset_value() -> Self::Ux {
312        0
313    }
314}