nrf52840_pac/cc_host_rgf/
host_iot_lcs.rs

1#[doc = "Register `HOST_IOT_LCS` reader"]
2pub struct R(crate::R<HOST_IOT_LCS_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<HOST_IOT_LCS_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<HOST_IOT_LCS_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<HOST_IOT_LCS_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `HOST_IOT_LCS` writer"]
17pub struct W(crate::W<HOST_IOT_LCS_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<HOST_IOT_LCS_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<HOST_IOT_LCS_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<HOST_IOT_LCS_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `LCS` reader - Lifecycle state value. This field is write-once per reset."]
38pub type LCS_R = crate::FieldReader<u8, LCS_A>;
39#[doc = "Lifecycle state value. This field is write-once per reset.\n\nValue on reset: 2"]
40#[derive(Clone, Copy, Debug, PartialEq)]
41#[repr(u8)]
42pub enum LCS_A {
43    #[doc = "0: CC310 operates in debug mode"]
44    DEBUG = 0,
45    #[doc = "2: CC310 operates in secure mode"]
46    SECURE = 2,
47}
48impl From<LCS_A> for u8 {
49    #[inline(always)]
50    fn from(variant: LCS_A) -> Self {
51        variant as _
52    }
53}
54impl LCS_R {
55    #[doc = "Get enumerated values variant"]
56    #[inline(always)]
57    pub fn variant(&self) -> Option<LCS_A> {
58        match self.bits {
59            0 => Some(LCS_A::DEBUG),
60            2 => Some(LCS_A::SECURE),
61            _ => None,
62        }
63    }
64    #[doc = "Checks if the value of the field is `DEBUG`"]
65    #[inline(always)]
66    pub fn is_debug(&self) -> bool {
67        *self == LCS_A::DEBUG
68    }
69    #[doc = "Checks if the value of the field is `SECURE`"]
70    #[inline(always)]
71    pub fn is_secure(&self) -> bool {
72        *self == LCS_A::SECURE
73    }
74}
75#[doc = "Field `LCS` writer - Lifecycle state value. This field is write-once per reset."]
76pub type LCS_W<'a, const O: u8> = crate::FieldWriter<'a, u32, HOST_IOT_LCS_SPEC, u8, LCS_A, 3, O>;
77impl<'a, const O: u8> LCS_W<'a, O> {
78    #[doc = "CC310 operates in debug mode"]
79    #[inline(always)]
80    pub fn debug(self) -> &'a mut W {
81        self.variant(LCS_A::DEBUG)
82    }
83    #[doc = "CC310 operates in secure mode"]
84    #[inline(always)]
85    pub fn secure(self) -> &'a mut W {
86        self.variant(LCS_A::SECURE)
87    }
88}
89#[doc = "Field `LCS_IS_VALID` reader - This field is read-only and indicates if CRYPTOCELL LCS has been successfully configured since last reset"]
90pub type LCS_IS_VALID_R = crate::BitReader<LCS_IS_VALID_A>;
91#[doc = "This field is read-only and indicates if CRYPTOCELL LCS has been successfully configured since last reset\n\nValue on reset: 0"]
92#[derive(Clone, Copy, Debug, PartialEq)]
93pub enum LCS_IS_VALID_A {
94    #[doc = "0: A valid LCS is not yet retained in the CRYPTOCELL AO power domain"]
95    INVALID = 0,
96    #[doc = "1: A valid LCS is successfully retained in the CRYPTOCELL AO power domain"]
97    VALID = 1,
98}
99impl From<LCS_IS_VALID_A> for bool {
100    #[inline(always)]
101    fn from(variant: LCS_IS_VALID_A) -> Self {
102        variant as u8 != 0
103    }
104}
105impl LCS_IS_VALID_R {
106    #[doc = "Get enumerated values variant"]
107    #[inline(always)]
108    pub fn variant(&self) -> LCS_IS_VALID_A {
109        match self.bits {
110            false => LCS_IS_VALID_A::INVALID,
111            true => LCS_IS_VALID_A::VALID,
112        }
113    }
114    #[doc = "Checks if the value of the field is `INVALID`"]
115    #[inline(always)]
116    pub fn is_invalid(&self) -> bool {
117        *self == LCS_IS_VALID_A::INVALID
118    }
119    #[doc = "Checks if the value of the field is `VALID`"]
120    #[inline(always)]
121    pub fn is_valid(&self) -> bool {
122        *self == LCS_IS_VALID_A::VALID
123    }
124}
125#[doc = "Field `LCS_IS_VALID` writer - This field is read-only and indicates if CRYPTOCELL LCS has been successfully configured since last reset"]
126pub type LCS_IS_VALID_W<'a, const O: u8> =
127    crate::BitWriter<'a, u32, HOST_IOT_LCS_SPEC, LCS_IS_VALID_A, O>;
128impl<'a, const O: u8> LCS_IS_VALID_W<'a, O> {
129    #[doc = "A valid LCS is not yet retained in the CRYPTOCELL AO power domain"]
130    #[inline(always)]
131    pub fn invalid(self) -> &'a mut W {
132        self.variant(LCS_IS_VALID_A::INVALID)
133    }
134    #[doc = "A valid LCS is successfully retained in the CRYPTOCELL AO power domain"]
135    #[inline(always)]
136    pub fn valid(self) -> &'a mut W {
137        self.variant(LCS_IS_VALID_A::VALID)
138    }
139}
140impl R {
141    #[doc = "Bits 0:2 - Lifecycle state value. This field is write-once per reset."]
142    #[inline(always)]
143    pub fn lcs(&self) -> LCS_R {
144        LCS_R::new((self.bits & 7) as u8)
145    }
146    #[doc = "Bit 8 - This field is read-only and indicates if CRYPTOCELL LCS has been successfully configured since last reset"]
147    #[inline(always)]
148    pub fn lcs_is_valid(&self) -> LCS_IS_VALID_R {
149        LCS_IS_VALID_R::new(((self.bits >> 8) & 1) != 0)
150    }
151}
152impl W {
153    #[doc = "Bits 0:2 - Lifecycle state value. This field is write-once per reset."]
154    #[inline(always)]
155    pub fn lcs(&mut self) -> LCS_W<0> {
156        LCS_W::new(self)
157    }
158    #[doc = "Bit 8 - This field is read-only and indicates if CRYPTOCELL LCS has been successfully configured since last reset"]
159    #[inline(always)]
160    pub fn lcs_is_valid(&mut self) -> LCS_IS_VALID_W<8> {
161        LCS_IS_VALID_W::new(self)
162    }
163    #[doc = "Writes raw bits to the register."]
164    #[inline(always)]
165    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
166        self.0.bits(bits);
167        self
168    }
169}
170#[doc = "Controls lifecycle state (LCS) for CRYPTOCELL subsystem\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 [host_iot_lcs](index.html) module"]
171pub struct HOST_IOT_LCS_SPEC;
172impl crate::RegisterSpec for HOST_IOT_LCS_SPEC {
173    type Ux = u32;
174}
175#[doc = "`read()` method returns [host_iot_lcs::R](R) reader structure"]
176impl crate::Readable for HOST_IOT_LCS_SPEC {
177    type Reader = R;
178}
179#[doc = "`write(|w| ..)` method takes [host_iot_lcs::W](W) writer structure"]
180impl crate::Writable for HOST_IOT_LCS_SPEC {
181    type Writer = W;
182}
183#[doc = "`reset()` method sets HOST_IOT_LCS to value 0x02"]
184impl crate::Resettable for HOST_IOT_LCS_SPEC {
185    #[inline(always)]
186    fn reset_value() -> Self::Ux {
187        0x02
188    }
189}