d1_pac/plic/
mth.rs

1#[doc = "Register `mth` reader"]
2pub type R = crate::R<MTH_SPEC>;
3#[doc = "Register `mth` writer"]
4pub type W = crate::W<MTH_SPEC>;
5#[doc = "Field `priority` reader - "]
6pub type PRIORITY_R = crate::FieldReader<PRIORITY_A>;
7#[doc = "\n\nValue on reset: 0"]
8#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9#[repr(u8)]
10pub enum PRIORITY_A {
11    #[doc = "0: Priority 0 (never interrupt)"]
12    P0 = 0,
13    #[doc = "1: Priority 1"]
14    P1 = 1,
15    #[doc = "2: Priority 2"]
16    P2 = 2,
17    #[doc = "3: Priority 3"]
18    P3 = 3,
19    #[doc = "4: Priority 4"]
20    P4 = 4,
21    #[doc = "5: Priority 5"]
22    P5 = 5,
23    #[doc = "6: Priority 6"]
24    P6 = 6,
25    #[doc = "7: Priority 7"]
26    P7 = 7,
27    #[doc = "8: Priority 8"]
28    P8 = 8,
29    #[doc = "9: Priority 9"]
30    P9 = 9,
31    #[doc = "10: Priority 10"]
32    P10 = 10,
33    #[doc = "11: Priority 11"]
34    P11 = 11,
35    #[doc = "12: Priority 12"]
36    P12 = 12,
37    #[doc = "13: Priority 13"]
38    P13 = 13,
39    #[doc = "14: Priority 14"]
40    P14 = 14,
41    #[doc = "15: Priority 15"]
42    P15 = 15,
43    #[doc = "16: Priority 16"]
44    P16 = 16,
45    #[doc = "17: Priority 17"]
46    P17 = 17,
47    #[doc = "18: Priority 18"]
48    P18 = 18,
49    #[doc = "19: Priority 19"]
50    P19 = 19,
51    #[doc = "20: Priority 20"]
52    P20 = 20,
53    #[doc = "21: Priority 21"]
54    P21 = 21,
55    #[doc = "22: Priority 22"]
56    P22 = 22,
57    #[doc = "23: Priority 23"]
58    P23 = 23,
59    #[doc = "24: Priority 24"]
60    P24 = 24,
61    #[doc = "25: Priority 25"]
62    P25 = 25,
63    #[doc = "26: Priority 26"]
64    P26 = 26,
65    #[doc = "27: Priority 27"]
66    P27 = 27,
67    #[doc = "28: Priority 28"]
68    P28 = 28,
69    #[doc = "29: Priority 29"]
70    P29 = 29,
71    #[doc = "30: Priority 30"]
72    P30 = 30,
73    #[doc = "31: Priority 31"]
74    P31 = 31,
75}
76impl From<PRIORITY_A> for u8 {
77    #[inline(always)]
78    fn from(variant: PRIORITY_A) -> Self {
79        variant as _
80    }
81}
82impl crate::FieldSpec for PRIORITY_A {
83    type Ux = u8;
84}
85impl PRIORITY_R {
86    #[doc = "Get enumerated values variant"]
87    #[inline(always)]
88    pub const fn variant(&self) -> PRIORITY_A {
89        match self.bits {
90            0 => PRIORITY_A::P0,
91            1 => PRIORITY_A::P1,
92            2 => PRIORITY_A::P2,
93            3 => PRIORITY_A::P3,
94            4 => PRIORITY_A::P4,
95            5 => PRIORITY_A::P5,
96            6 => PRIORITY_A::P6,
97            7 => PRIORITY_A::P7,
98            8 => PRIORITY_A::P8,
99            9 => PRIORITY_A::P9,
100            10 => PRIORITY_A::P10,
101            11 => PRIORITY_A::P11,
102            12 => PRIORITY_A::P12,
103            13 => PRIORITY_A::P13,
104            14 => PRIORITY_A::P14,
105            15 => PRIORITY_A::P15,
106            16 => PRIORITY_A::P16,
107            17 => PRIORITY_A::P17,
108            18 => PRIORITY_A::P18,
109            19 => PRIORITY_A::P19,
110            20 => PRIORITY_A::P20,
111            21 => PRIORITY_A::P21,
112            22 => PRIORITY_A::P22,
113            23 => PRIORITY_A::P23,
114            24 => PRIORITY_A::P24,
115            25 => PRIORITY_A::P25,
116            26 => PRIORITY_A::P26,
117            27 => PRIORITY_A::P27,
118            28 => PRIORITY_A::P28,
119            29 => PRIORITY_A::P29,
120            30 => PRIORITY_A::P30,
121            31 => PRIORITY_A::P31,
122            _ => unreachable!(),
123        }
124    }
125    #[doc = "Priority 0 (never interrupt)"]
126    #[inline(always)]
127    pub fn is_p0(&self) -> bool {
128        *self == PRIORITY_A::P0
129    }
130    #[doc = "Priority 1"]
131    #[inline(always)]
132    pub fn is_p1(&self) -> bool {
133        *self == PRIORITY_A::P1
134    }
135    #[doc = "Priority 2"]
136    #[inline(always)]
137    pub fn is_p2(&self) -> bool {
138        *self == PRIORITY_A::P2
139    }
140    #[doc = "Priority 3"]
141    #[inline(always)]
142    pub fn is_p3(&self) -> bool {
143        *self == PRIORITY_A::P3
144    }
145    #[doc = "Priority 4"]
146    #[inline(always)]
147    pub fn is_p4(&self) -> bool {
148        *self == PRIORITY_A::P4
149    }
150    #[doc = "Priority 5"]
151    #[inline(always)]
152    pub fn is_p5(&self) -> bool {
153        *self == PRIORITY_A::P5
154    }
155    #[doc = "Priority 6"]
156    #[inline(always)]
157    pub fn is_p6(&self) -> bool {
158        *self == PRIORITY_A::P6
159    }
160    #[doc = "Priority 7"]
161    #[inline(always)]
162    pub fn is_p7(&self) -> bool {
163        *self == PRIORITY_A::P7
164    }
165    #[doc = "Priority 8"]
166    #[inline(always)]
167    pub fn is_p8(&self) -> bool {
168        *self == PRIORITY_A::P8
169    }
170    #[doc = "Priority 9"]
171    #[inline(always)]
172    pub fn is_p9(&self) -> bool {
173        *self == PRIORITY_A::P9
174    }
175    #[doc = "Priority 10"]
176    #[inline(always)]
177    pub fn is_p10(&self) -> bool {
178        *self == PRIORITY_A::P10
179    }
180    #[doc = "Priority 11"]
181    #[inline(always)]
182    pub fn is_p11(&self) -> bool {
183        *self == PRIORITY_A::P11
184    }
185    #[doc = "Priority 12"]
186    #[inline(always)]
187    pub fn is_p12(&self) -> bool {
188        *self == PRIORITY_A::P12
189    }
190    #[doc = "Priority 13"]
191    #[inline(always)]
192    pub fn is_p13(&self) -> bool {
193        *self == PRIORITY_A::P13
194    }
195    #[doc = "Priority 14"]
196    #[inline(always)]
197    pub fn is_p14(&self) -> bool {
198        *self == PRIORITY_A::P14
199    }
200    #[doc = "Priority 15"]
201    #[inline(always)]
202    pub fn is_p15(&self) -> bool {
203        *self == PRIORITY_A::P15
204    }
205    #[doc = "Priority 16"]
206    #[inline(always)]
207    pub fn is_p16(&self) -> bool {
208        *self == PRIORITY_A::P16
209    }
210    #[doc = "Priority 17"]
211    #[inline(always)]
212    pub fn is_p17(&self) -> bool {
213        *self == PRIORITY_A::P17
214    }
215    #[doc = "Priority 18"]
216    #[inline(always)]
217    pub fn is_p18(&self) -> bool {
218        *self == PRIORITY_A::P18
219    }
220    #[doc = "Priority 19"]
221    #[inline(always)]
222    pub fn is_p19(&self) -> bool {
223        *self == PRIORITY_A::P19
224    }
225    #[doc = "Priority 20"]
226    #[inline(always)]
227    pub fn is_p20(&self) -> bool {
228        *self == PRIORITY_A::P20
229    }
230    #[doc = "Priority 21"]
231    #[inline(always)]
232    pub fn is_p21(&self) -> bool {
233        *self == PRIORITY_A::P21
234    }
235    #[doc = "Priority 22"]
236    #[inline(always)]
237    pub fn is_p22(&self) -> bool {
238        *self == PRIORITY_A::P22
239    }
240    #[doc = "Priority 23"]
241    #[inline(always)]
242    pub fn is_p23(&self) -> bool {
243        *self == PRIORITY_A::P23
244    }
245    #[doc = "Priority 24"]
246    #[inline(always)]
247    pub fn is_p24(&self) -> bool {
248        *self == PRIORITY_A::P24
249    }
250    #[doc = "Priority 25"]
251    #[inline(always)]
252    pub fn is_p25(&self) -> bool {
253        *self == PRIORITY_A::P25
254    }
255    #[doc = "Priority 26"]
256    #[inline(always)]
257    pub fn is_p26(&self) -> bool {
258        *self == PRIORITY_A::P26
259    }
260    #[doc = "Priority 27"]
261    #[inline(always)]
262    pub fn is_p27(&self) -> bool {
263        *self == PRIORITY_A::P27
264    }
265    #[doc = "Priority 28"]
266    #[inline(always)]
267    pub fn is_p28(&self) -> bool {
268        *self == PRIORITY_A::P28
269    }
270    #[doc = "Priority 29"]
271    #[inline(always)]
272    pub fn is_p29(&self) -> bool {
273        *self == PRIORITY_A::P29
274    }
275    #[doc = "Priority 30"]
276    #[inline(always)]
277    pub fn is_p30(&self) -> bool {
278        *self == PRIORITY_A::P30
279    }
280    #[doc = "Priority 31"]
281    #[inline(always)]
282    pub fn is_p31(&self) -> bool {
283        *self == PRIORITY_A::P31
284    }
285}
286#[doc = "Field `priority` writer - "]
287pub type PRIORITY_W<'a, REG> = crate::FieldWriterSafe<'a, REG, 5, PRIORITY_A>;
288impl<'a, REG> PRIORITY_W<'a, REG>
289where
290    REG: crate::Writable + crate::RegisterSpec,
291    REG::Ux: From<u8>,
292{
293    #[doc = "Priority 0 (never interrupt)"]
294    #[inline(always)]
295    pub fn p0(self) -> &'a mut crate::W<REG> {
296        self.variant(PRIORITY_A::P0)
297    }
298    #[doc = "Priority 1"]
299    #[inline(always)]
300    pub fn p1(self) -> &'a mut crate::W<REG> {
301        self.variant(PRIORITY_A::P1)
302    }
303    #[doc = "Priority 2"]
304    #[inline(always)]
305    pub fn p2(self) -> &'a mut crate::W<REG> {
306        self.variant(PRIORITY_A::P2)
307    }
308    #[doc = "Priority 3"]
309    #[inline(always)]
310    pub fn p3(self) -> &'a mut crate::W<REG> {
311        self.variant(PRIORITY_A::P3)
312    }
313    #[doc = "Priority 4"]
314    #[inline(always)]
315    pub fn p4(self) -> &'a mut crate::W<REG> {
316        self.variant(PRIORITY_A::P4)
317    }
318    #[doc = "Priority 5"]
319    #[inline(always)]
320    pub fn p5(self) -> &'a mut crate::W<REG> {
321        self.variant(PRIORITY_A::P5)
322    }
323    #[doc = "Priority 6"]
324    #[inline(always)]
325    pub fn p6(self) -> &'a mut crate::W<REG> {
326        self.variant(PRIORITY_A::P6)
327    }
328    #[doc = "Priority 7"]
329    #[inline(always)]
330    pub fn p7(self) -> &'a mut crate::W<REG> {
331        self.variant(PRIORITY_A::P7)
332    }
333    #[doc = "Priority 8"]
334    #[inline(always)]
335    pub fn p8(self) -> &'a mut crate::W<REG> {
336        self.variant(PRIORITY_A::P8)
337    }
338    #[doc = "Priority 9"]
339    #[inline(always)]
340    pub fn p9(self) -> &'a mut crate::W<REG> {
341        self.variant(PRIORITY_A::P9)
342    }
343    #[doc = "Priority 10"]
344    #[inline(always)]
345    pub fn p10(self) -> &'a mut crate::W<REG> {
346        self.variant(PRIORITY_A::P10)
347    }
348    #[doc = "Priority 11"]
349    #[inline(always)]
350    pub fn p11(self) -> &'a mut crate::W<REG> {
351        self.variant(PRIORITY_A::P11)
352    }
353    #[doc = "Priority 12"]
354    #[inline(always)]
355    pub fn p12(self) -> &'a mut crate::W<REG> {
356        self.variant(PRIORITY_A::P12)
357    }
358    #[doc = "Priority 13"]
359    #[inline(always)]
360    pub fn p13(self) -> &'a mut crate::W<REG> {
361        self.variant(PRIORITY_A::P13)
362    }
363    #[doc = "Priority 14"]
364    #[inline(always)]
365    pub fn p14(self) -> &'a mut crate::W<REG> {
366        self.variant(PRIORITY_A::P14)
367    }
368    #[doc = "Priority 15"]
369    #[inline(always)]
370    pub fn p15(self) -> &'a mut crate::W<REG> {
371        self.variant(PRIORITY_A::P15)
372    }
373    #[doc = "Priority 16"]
374    #[inline(always)]
375    pub fn p16(self) -> &'a mut crate::W<REG> {
376        self.variant(PRIORITY_A::P16)
377    }
378    #[doc = "Priority 17"]
379    #[inline(always)]
380    pub fn p17(self) -> &'a mut crate::W<REG> {
381        self.variant(PRIORITY_A::P17)
382    }
383    #[doc = "Priority 18"]
384    #[inline(always)]
385    pub fn p18(self) -> &'a mut crate::W<REG> {
386        self.variant(PRIORITY_A::P18)
387    }
388    #[doc = "Priority 19"]
389    #[inline(always)]
390    pub fn p19(self) -> &'a mut crate::W<REG> {
391        self.variant(PRIORITY_A::P19)
392    }
393    #[doc = "Priority 20"]
394    #[inline(always)]
395    pub fn p20(self) -> &'a mut crate::W<REG> {
396        self.variant(PRIORITY_A::P20)
397    }
398    #[doc = "Priority 21"]
399    #[inline(always)]
400    pub fn p21(self) -> &'a mut crate::W<REG> {
401        self.variant(PRIORITY_A::P21)
402    }
403    #[doc = "Priority 22"]
404    #[inline(always)]
405    pub fn p22(self) -> &'a mut crate::W<REG> {
406        self.variant(PRIORITY_A::P22)
407    }
408    #[doc = "Priority 23"]
409    #[inline(always)]
410    pub fn p23(self) -> &'a mut crate::W<REG> {
411        self.variant(PRIORITY_A::P23)
412    }
413    #[doc = "Priority 24"]
414    #[inline(always)]
415    pub fn p24(self) -> &'a mut crate::W<REG> {
416        self.variant(PRIORITY_A::P24)
417    }
418    #[doc = "Priority 25"]
419    #[inline(always)]
420    pub fn p25(self) -> &'a mut crate::W<REG> {
421        self.variant(PRIORITY_A::P25)
422    }
423    #[doc = "Priority 26"]
424    #[inline(always)]
425    pub fn p26(self) -> &'a mut crate::W<REG> {
426        self.variant(PRIORITY_A::P26)
427    }
428    #[doc = "Priority 27"]
429    #[inline(always)]
430    pub fn p27(self) -> &'a mut crate::W<REG> {
431        self.variant(PRIORITY_A::P27)
432    }
433    #[doc = "Priority 28"]
434    #[inline(always)]
435    pub fn p28(self) -> &'a mut crate::W<REG> {
436        self.variant(PRIORITY_A::P28)
437    }
438    #[doc = "Priority 29"]
439    #[inline(always)]
440    pub fn p29(self) -> &'a mut crate::W<REG> {
441        self.variant(PRIORITY_A::P29)
442    }
443    #[doc = "Priority 30"]
444    #[inline(always)]
445    pub fn p30(self) -> &'a mut crate::W<REG> {
446        self.variant(PRIORITY_A::P30)
447    }
448    #[doc = "Priority 31"]
449    #[inline(always)]
450    pub fn p31(self) -> &'a mut crate::W<REG> {
451        self.variant(PRIORITY_A::P31)
452    }
453}
454impl R {
455    #[doc = "Bits 0:4"]
456    #[inline(always)]
457    pub fn priority(&self) -> PRIORITY_R {
458        PRIORITY_R::new((self.bits & 0x1f) as u8)
459    }
460}
461impl W {
462    #[doc = "Bits 0:4"]
463    #[inline(always)]
464    #[must_use]
465    pub fn priority(&mut self) -> PRIORITY_W<MTH_SPEC> {
466        PRIORITY_W::new(self, 0)
467    }
468    #[doc = r" Writes raw bits to the register."]
469    #[doc = r""]
470    #[doc = r" # Safety"]
471    #[doc = r""]
472    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
473    #[inline(always)]
474    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
475        self.bits = bits;
476        self
477    }
478}
479#[doc = "Machine Mode Priority Threshold Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`mth::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`mth::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
480pub struct MTH_SPEC;
481impl crate::RegisterSpec for MTH_SPEC {
482    type Ux = u32;
483}
484#[doc = "`read()` method returns [`mth::R`](R) reader structure"]
485impl crate::Readable for MTH_SPEC {}
486#[doc = "`write(|w| ..)` method takes [`mth::W`](W) writer structure"]
487impl crate::Writable for MTH_SPEC {
488    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
489    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
490}
491#[doc = "`reset()` method sets mth to value 0"]
492impl crate::Resettable for MTH_SPEC {
493    const RESET_VALUE: Self::Ux = 0;
494}