mimxrt685s_pac/hashcrypt/
intenset.rs

1#[doc = "Register `INTENSET` reader"]
2pub type R = crate::R<IntensetSpec>;
3#[doc = "Register `INTENSET` writer"]
4pub type W = crate::W<IntensetSpec>;
5#[doc = "Indicates if should interrupt when waiting for data input.\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8pub enum Waiting {
9    #[doc = "0: Will not interrupt when waiting."]
10    NoInterrupt = 0,
11    #[doc = "1: Will interrupt when waiting"]
12    Interrupt = 1,
13}
14impl From<Waiting> for bool {
15    #[inline(always)]
16    fn from(variant: Waiting) -> Self {
17        variant as u8 != 0
18    }
19}
20#[doc = "Field `WAITING` reader - Indicates if should interrupt when waiting for data input."]
21pub type WaitingR = crate::BitReader<Waiting>;
22impl WaitingR {
23    #[doc = "Get enumerated values variant"]
24    #[inline(always)]
25    pub const fn variant(&self) -> Waiting {
26        match self.bits {
27            false => Waiting::NoInterrupt,
28            true => Waiting::Interrupt,
29        }
30    }
31    #[doc = "Will not interrupt when waiting."]
32    #[inline(always)]
33    pub fn is_no_interrupt(&self) -> bool {
34        *self == Waiting::NoInterrupt
35    }
36    #[doc = "Will interrupt when waiting"]
37    #[inline(always)]
38    pub fn is_interrupt(&self) -> bool {
39        *self == Waiting::Interrupt
40    }
41}
42#[doc = "Field `WAITING` writer - Indicates if should interrupt when waiting for data input."]
43pub type WaitingW<'a, REG> = crate::BitWriter<'a, REG, Waiting>;
44impl<'a, REG> WaitingW<'a, REG>
45where
46    REG: crate::Writable + crate::RegisterSpec,
47{
48    #[doc = "Will not interrupt when waiting."]
49    #[inline(always)]
50    pub fn no_interrupt(self) -> &'a mut crate::W<REG> {
51        self.variant(Waiting::NoInterrupt)
52    }
53    #[doc = "Will interrupt when waiting"]
54    #[inline(always)]
55    pub fn interrupt(self) -> &'a mut crate::W<REG> {
56        self.variant(Waiting::Interrupt)
57    }
58}
59#[doc = "Indicates if should interrupt when Digest (or Outdata) is ready (completed a hash/crypto or completed a full sequence).\n\nValue on reset: 0"]
60#[cfg_attr(feature = "defmt", derive(defmt::Format))]
61#[derive(Clone, Copy, Debug, PartialEq, Eq)]
62pub enum Digest {
63    #[doc = "0: Will not interrupt when Digest is ready"]
64    NoInterrupt = 0,
65    #[doc = "1: Will interrupt when Digest is ready. Interrupt cleared by writing more data, starting a new Hash, or disabling (done)."]
66    Interrupt = 1,
67}
68impl From<Digest> for bool {
69    #[inline(always)]
70    fn from(variant: Digest) -> Self {
71        variant as u8 != 0
72    }
73}
74#[doc = "Field `DIGEST` reader - Indicates if should interrupt when Digest (or Outdata) is ready (completed a hash/crypto or completed a full sequence)."]
75pub type DigestR = crate::BitReader<Digest>;
76impl DigestR {
77    #[doc = "Get enumerated values variant"]
78    #[inline(always)]
79    pub const fn variant(&self) -> Digest {
80        match self.bits {
81            false => Digest::NoInterrupt,
82            true => Digest::Interrupt,
83        }
84    }
85    #[doc = "Will not interrupt when Digest is ready"]
86    #[inline(always)]
87    pub fn is_no_interrupt(&self) -> bool {
88        *self == Digest::NoInterrupt
89    }
90    #[doc = "Will interrupt when Digest is ready. Interrupt cleared by writing more data, starting a new Hash, or disabling (done)."]
91    #[inline(always)]
92    pub fn is_interrupt(&self) -> bool {
93        *self == Digest::Interrupt
94    }
95}
96#[doc = "Field `DIGEST` writer - Indicates if should interrupt when Digest (or Outdata) is ready (completed a hash/crypto or completed a full sequence)."]
97pub type DigestW<'a, REG> = crate::BitWriter<'a, REG, Digest>;
98impl<'a, REG> DigestW<'a, REG>
99where
100    REG: crate::Writable + crate::RegisterSpec,
101{
102    #[doc = "Will not interrupt when Digest is ready"]
103    #[inline(always)]
104    pub fn no_interrupt(self) -> &'a mut crate::W<REG> {
105        self.variant(Digest::NoInterrupt)
106    }
107    #[doc = "Will interrupt when Digest is ready. Interrupt cleared by writing more data, starting a new Hash, or disabling (done)."]
108    #[inline(always)]
109    pub fn interrupt(self) -> &'a mut crate::W<REG> {
110        self.variant(Digest::Interrupt)
111    }
112}
113#[doc = "Indicates if should interrupt on an ERROR (as defined in Status)\n\nValue on reset: 0"]
114#[cfg_attr(feature = "defmt", derive(defmt::Format))]
115#[derive(Clone, Copy, Debug, PartialEq, Eq)]
116pub enum Error {
117    #[doc = "0: Will not interrupt on Error."]
118    NoInterrupt = 0,
119    #[doc = "1: Will interrupt on Error (until cleared)."]
120    Interrupt = 1,
121}
122impl From<Error> for bool {
123    #[inline(always)]
124    fn from(variant: Error) -> Self {
125        variant as u8 != 0
126    }
127}
128#[doc = "Field `ERROR` reader - Indicates if should interrupt on an ERROR (as defined in Status)"]
129pub type ErrorR = crate::BitReader<Error>;
130impl ErrorR {
131    #[doc = "Get enumerated values variant"]
132    #[inline(always)]
133    pub const fn variant(&self) -> Error {
134        match self.bits {
135            false => Error::NoInterrupt,
136            true => Error::Interrupt,
137        }
138    }
139    #[doc = "Will not interrupt on Error."]
140    #[inline(always)]
141    pub fn is_no_interrupt(&self) -> bool {
142        *self == Error::NoInterrupt
143    }
144    #[doc = "Will interrupt on Error (until cleared)."]
145    #[inline(always)]
146    pub fn is_interrupt(&self) -> bool {
147        *self == Error::Interrupt
148    }
149}
150#[doc = "Field `ERROR` writer - Indicates if should interrupt on an ERROR (as defined in Status)"]
151pub type ErrorW<'a, REG> = crate::BitWriter<'a, REG, Error>;
152impl<'a, REG> ErrorW<'a, REG>
153where
154    REG: crate::Writable + crate::RegisterSpec,
155{
156    #[doc = "Will not interrupt on Error."]
157    #[inline(always)]
158    pub fn no_interrupt(self) -> &'a mut crate::W<REG> {
159        self.variant(Error::NoInterrupt)
160    }
161    #[doc = "Will interrupt on Error (until cleared)."]
162    #[inline(always)]
163    pub fn interrupt(self) -> &'a mut crate::W<REG> {
164        self.variant(Error::Interrupt)
165    }
166}
167impl R {
168    #[doc = "Bit 0 - Indicates if should interrupt when waiting for data input."]
169    #[inline(always)]
170    pub fn waiting(&self) -> WaitingR {
171        WaitingR::new((self.bits & 1) != 0)
172    }
173    #[doc = "Bit 1 - Indicates if should interrupt when Digest (or Outdata) is ready (completed a hash/crypto or completed a full sequence)."]
174    #[inline(always)]
175    pub fn digest(&self) -> DigestR {
176        DigestR::new(((self.bits >> 1) & 1) != 0)
177    }
178    #[doc = "Bit 2 - Indicates if should interrupt on an ERROR (as defined in Status)"]
179    #[inline(always)]
180    pub fn error(&self) -> ErrorR {
181        ErrorR::new(((self.bits >> 2) & 1) != 0)
182    }
183}
184#[cfg(feature = "debug")]
185impl core::fmt::Debug for R {
186    fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
187        f.debug_struct("INTENSET")
188            .field("waiting", &self.waiting())
189            .field("digest", &self.digest())
190            .field("error", &self.error())
191            .finish()
192    }
193}
194impl W {
195    #[doc = "Bit 0 - Indicates if should interrupt when waiting for data input."]
196    #[inline(always)]
197    pub fn waiting(&mut self) -> WaitingW<IntensetSpec> {
198        WaitingW::new(self, 0)
199    }
200    #[doc = "Bit 1 - Indicates if should interrupt when Digest (or Outdata) is ready (completed a hash/crypto or completed a full sequence)."]
201    #[inline(always)]
202    pub fn digest(&mut self) -> DigestW<IntensetSpec> {
203        DigestW::new(self, 1)
204    }
205    #[doc = "Bit 2 - Indicates if should interrupt on an ERROR (as defined in Status)"]
206    #[inline(always)]
207    pub fn error(&mut self) -> ErrorW<IntensetSpec> {
208        ErrorW::new(self, 2)
209    }
210}
211#[doc = "Write 1 to enable interrupts; reads back with which are set.\n\nYou can [`read`](crate::Reg::read) this register and get [`intenset::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`intenset::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
212pub struct IntensetSpec;
213impl crate::RegisterSpec for IntensetSpec {
214    type Ux = u32;
215}
216#[doc = "`read()` method returns [`intenset::R`](R) reader structure"]
217impl crate::Readable for IntensetSpec {}
218#[doc = "`write(|w| ..)` method takes [`intenset::W`](W) writer structure"]
219impl crate::Writable for IntensetSpec {
220    type Safety = crate::Unsafe;
221    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
222    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
223}
224#[doc = "`reset()` method sets INTENSET to value 0"]
225impl crate::Resettable for IntensetSpec {
226    const RESET_VALUE: u32 = 0;
227}