efm32pg22_pac/efm32pg22c200/cryptoacc_s_pkctrl/
pkstatus.rs

1#[doc = "Register `PKSTATUS` reader"]
2pub struct R(crate::R<PKSTATUS_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<PKSTATUS_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<PKSTATUS_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<PKSTATUS_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `FAILADDR` reader - Fail Address"]
17pub type FAILADDR_R = crate::FieldReader<u8, u8>;
18#[doc = "Field `NOTONCURVE` reader - Point Px not on curve"]
19pub type NOTONCURVE_R = crate::BitReader<bool>;
20#[doc = "Field `ATINFINITY` reader - Point Px at infinity"]
21pub type ATINFINITY_R = crate::BitReader<bool>;
22#[doc = "Field `COUPLENOTVALID` reader - Couple not valid"]
23pub type COUPLENOTVALID_R = crate::BitReader<bool>;
24#[doc = "Field `PARAMNNOTVALID` reader - Param n not valid"]
25pub type PARAMNNOTVALID_R = crate::BitReader<bool>;
26#[doc = "Field `NOTIMPLEMENTED` reader - Not implemented"]
27pub type NOTIMPLEMENTED_R = crate::BitReader<bool>;
28#[doc = "Field `SIGNOTVALID` reader - Signature not valid"]
29pub type SIGNOTVALID_R = crate::BitReader<bool>;
30#[doc = "Field `PARAMABNOTVALID` reader - Param AB not valid"]
31pub type PARAMABNOTVALID_R = crate::BitReader<bool>;
32#[doc = "Field `NOTINVERTIBLE` reader - Not invertible"]
33pub type NOTINVERTIBLE_R = crate::BitReader<bool>;
34#[doc = "Field `COMPOSITE` reader - Composite"]
35pub type COMPOSITE_R = crate::BitReader<COMPOSITE_A>;
36#[doc = "Composite\n\nValue on reset: 0"]
37#[derive(Clone, Copy, Debug, PartialEq, Eq)]
38pub enum COMPOSITE_A {
39    #[doc = "0: random number under test is probably prime"]
40    FALSE = 0,
41    #[doc = "1: random number under test is composite"]
42    TRUE = 1,
43}
44impl From<COMPOSITE_A> for bool {
45    #[inline(always)]
46    fn from(variant: COMPOSITE_A) -> Self {
47        variant as u8 != 0
48    }
49}
50impl COMPOSITE_R {
51    #[doc = "Get enumerated values variant"]
52    #[inline(always)]
53    pub fn variant(&self) -> COMPOSITE_A {
54        match self.bits {
55            false => COMPOSITE_A::FALSE,
56            true => COMPOSITE_A::TRUE,
57        }
58    }
59    #[doc = "Checks if the value of the field is `FALSE`"]
60    #[inline(always)]
61    pub fn is_false(&self) -> bool {
62        *self == COMPOSITE_A::FALSE
63    }
64    #[doc = "Checks if the value of the field is `TRUE`"]
65    #[inline(always)]
66    pub fn is_true(&self) -> bool {
67        *self == COMPOSITE_A::TRUE
68    }
69}
70#[doc = "Field `NOTQUAD` reader - Not quadratic residue"]
71pub type NOTQUAD_R = crate::BitReader<bool>;
72#[doc = "Field `PKBUSY` reader - PK busy"]
73pub type PKBUSY_R = crate::BitReader<bool>;
74#[doc = "Field `PKIF` reader - Interrupt status"]
75pub type PKIF_R = crate::BitReader<bool>;
76impl R {
77    #[doc = "Bits 0:3 - Fail Address"]
78    #[inline(always)]
79    pub fn failaddr(&self) -> FAILADDR_R {
80        FAILADDR_R::new((self.bits & 0x0f) as u8)
81    }
82    #[doc = "Bit 4 - Point Px not on curve"]
83    #[inline(always)]
84    pub fn notoncurve(&self) -> NOTONCURVE_R {
85        NOTONCURVE_R::new(((self.bits >> 4) & 1) != 0)
86    }
87    #[doc = "Bit 5 - Point Px at infinity"]
88    #[inline(always)]
89    pub fn atinfinity(&self) -> ATINFINITY_R {
90        ATINFINITY_R::new(((self.bits >> 5) & 1) != 0)
91    }
92    #[doc = "Bit 6 - Couple not valid"]
93    #[inline(always)]
94    pub fn couplenotvalid(&self) -> COUPLENOTVALID_R {
95        COUPLENOTVALID_R::new(((self.bits >> 6) & 1) != 0)
96    }
97    #[doc = "Bit 7 - Param n not valid"]
98    #[inline(always)]
99    pub fn paramnnotvalid(&self) -> PARAMNNOTVALID_R {
100        PARAMNNOTVALID_R::new(((self.bits >> 7) & 1) != 0)
101    }
102    #[doc = "Bit 8 - Not implemented"]
103    #[inline(always)]
104    pub fn notimplemented(&self) -> NOTIMPLEMENTED_R {
105        NOTIMPLEMENTED_R::new(((self.bits >> 8) & 1) != 0)
106    }
107    #[doc = "Bit 9 - Signature not valid"]
108    #[inline(always)]
109    pub fn signotvalid(&self) -> SIGNOTVALID_R {
110        SIGNOTVALID_R::new(((self.bits >> 9) & 1) != 0)
111    }
112    #[doc = "Bit 10 - Param AB not valid"]
113    #[inline(always)]
114    pub fn paramabnotvalid(&self) -> PARAMABNOTVALID_R {
115        PARAMABNOTVALID_R::new(((self.bits >> 10) & 1) != 0)
116    }
117    #[doc = "Bit 11 - Not invertible"]
118    #[inline(always)]
119    pub fn notinvertible(&self) -> NOTINVERTIBLE_R {
120        NOTINVERTIBLE_R::new(((self.bits >> 11) & 1) != 0)
121    }
122    #[doc = "Bit 12 - Composite"]
123    #[inline(always)]
124    pub fn composite(&self) -> COMPOSITE_R {
125        COMPOSITE_R::new(((self.bits >> 12) & 1) != 0)
126    }
127    #[doc = "Bit 13 - Not quadratic residue"]
128    #[inline(always)]
129    pub fn notquad(&self) -> NOTQUAD_R {
130        NOTQUAD_R::new(((self.bits >> 13) & 1) != 0)
131    }
132    #[doc = "Bit 16 - PK busy"]
133    #[inline(always)]
134    pub fn pkbusy(&self) -> PKBUSY_R {
135        PKBUSY_R::new(((self.bits >> 16) & 1) != 0)
136    }
137    #[doc = "Bit 17 - Interrupt status"]
138    #[inline(always)]
139    pub fn pkif(&self) -> PKIF_R {
140        PKIF_R::new(((self.bits >> 17) & 1) != 0)
141    }
142}
143#[doc = "No Description\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [pkstatus](index.html) module"]
144pub struct PKSTATUS_SPEC;
145impl crate::RegisterSpec for PKSTATUS_SPEC {
146    type Ux = u32;
147}
148#[doc = "`read()` method returns [pkstatus::R](R) reader structure"]
149impl crate::Readable for PKSTATUS_SPEC {
150    type Reader = R;
151}
152#[doc = "`reset()` method sets PKSTATUS to value 0"]
153impl crate::Resettable for PKSTATUS_SPEC {
154    const RESET_VALUE: Self::Ux = 0;
155}