1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
#[doc = "Register `KSCFG` reader"]
pub type R = crate::R<KscfgSpec>;
#[doc = "Register `KSCFG` writer"]
pub type W = crate::W<KscfgSpec>;
#[doc = "Module Enable\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Moden {
    #[doc = "0: The module is switched off immediately (without respecting a stop condition). It does not react on mode control actions and the module clock is switched off. The module does not react on read accesses and ignores write accesses (except to KSCFG)."]
    Value1 = 0,
    #[doc = "1: The module is switched on and can operate. After writing 1 to MODEN, it is recommended to read register KSCFG to avoid pipeline effects in the control block before accessing other Service Request Processing registers."]
    Value2 = 1,
}
impl From<Moden> for bool {
    #[inline(always)]
    fn from(variant: Moden) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `MODEN` reader - Module Enable"]
pub type ModenR = crate::BitReader<Moden>;
impl ModenR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Moden {
        match self.bits {
            false => Moden::Value1,
            true => Moden::Value2,
        }
    }
    #[doc = "The module is switched off immediately (without respecting a stop condition). It does not react on mode control actions and the module clock is switched off. The module does not react on read accesses and ignores write accesses (except to KSCFG)."]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == Moden::Value1
    }
    #[doc = "The module is switched on and can operate. After writing 1 to MODEN, it is recommended to read register KSCFG to avoid pipeline effects in the control block before accessing other Service Request Processing registers."]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == Moden::Value2
    }
}
#[doc = "Field `MODEN` writer - Module Enable"]
pub type ModenW<'a, REG> = crate::BitWriter<'a, REG, Moden>;
impl<'a, REG> ModenW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "The module is switched off immediately (without respecting a stop condition). It does not react on mode control actions and the module clock is switched off. The module does not react on read accesses and ignores write accesses (except to KSCFG)."]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(Moden::Value1)
    }
    #[doc = "The module is switched on and can operate. After writing 1 to MODEN, it is recommended to read register KSCFG to avoid pipeline effects in the control block before accessing other Service Request Processing registers."]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(Moden::Value2)
    }
}
#[doc = "Bit Protection for MODEN\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Bpmoden {
    #[doc = "0: MODEN is not changed."]
    Value1 = 0,
    #[doc = "1: MODEN is updated with the written value."]
    Value2 = 1,
}
impl From<Bpmoden> for bool {
    #[inline(always)]
    fn from(variant: Bpmoden) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `BPMODEN` writer - Bit Protection for MODEN"]
pub type BpmodenW<'a, REG> = crate::BitWriter<'a, REG, Bpmoden>;
impl<'a, REG> BpmodenW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "MODEN is not changed."]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(Bpmoden::Value1)
    }
    #[doc = "MODEN is updated with the written value."]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(Bpmoden::Value2)
    }
}
#[doc = "Normal Operation Mode Configuration\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum Nomcfg {
    #[doc = "0: Run mode 0 is selected."]
    Value1 = 0,
    #[doc = "1: Run mode 1 is selected."]
    Value2 = 1,
    #[doc = "2: Stop mode 0 is selected."]
    Value3 = 2,
    #[doc = "3: Stop mode 1 is selected."]
    Value4 = 3,
}
impl From<Nomcfg> for u8 {
    #[inline(always)]
    fn from(variant: Nomcfg) -> Self {
        variant as _
    }
}
impl crate::FieldSpec for Nomcfg {
    type Ux = u8;
}
#[doc = "Field `NOMCFG` reader - Normal Operation Mode Configuration"]
pub type NomcfgR = crate::FieldReader<Nomcfg>;
impl NomcfgR {
    #[doc = "Get enumerated values variant"]
    #[inline(always)]
    pub const fn variant(&self) -> Nomcfg {
        match self.bits {
            0 => Nomcfg::Value1,
            1 => Nomcfg::Value2,
            2 => Nomcfg::Value3,
            3 => Nomcfg::Value4,
            _ => unreachable!(),
        }
    }
    #[doc = "Run mode 0 is selected."]
    #[inline(always)]
    pub fn is_value1(&self) -> bool {
        *self == Nomcfg::Value1
    }
    #[doc = "Run mode 1 is selected."]
    #[inline(always)]
    pub fn is_value2(&self) -> bool {
        *self == Nomcfg::Value2
    }
    #[doc = "Stop mode 0 is selected."]
    #[inline(always)]
    pub fn is_value3(&self) -> bool {
        *self == Nomcfg::Value3
    }
    #[doc = "Stop mode 1 is selected."]
    #[inline(always)]
    pub fn is_value4(&self) -> bool {
        *self == Nomcfg::Value4
    }
}
#[doc = "Field `NOMCFG` writer - Normal Operation Mode Configuration"]
pub type NomcfgW<'a, REG> = crate::FieldWriterSafe<'a, REG, 2, Nomcfg>;
impl<'a, REG> NomcfgW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
    REG::Ux: From<u8>,
{
    #[doc = "Run mode 0 is selected."]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(Nomcfg::Value1)
    }
    #[doc = "Run mode 1 is selected."]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(Nomcfg::Value2)
    }
    #[doc = "Stop mode 0 is selected."]
    #[inline(always)]
    pub fn value3(self) -> &'a mut crate::W<REG> {
        self.variant(Nomcfg::Value3)
    }
    #[doc = "Stop mode 1 is selected."]
    #[inline(always)]
    pub fn value4(self) -> &'a mut crate::W<REG> {
        self.variant(Nomcfg::Value4)
    }
}
#[doc = "Bit Protection for NOMCFG\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Bpnom {
    #[doc = "0: NOMCFG is not changed."]
    Value1 = 0,
    #[doc = "1: NOMCFG is updated with the written value."]
    Value2 = 1,
}
impl From<Bpnom> for bool {
    #[inline(always)]
    fn from(variant: Bpnom) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `BPNOM` writer - Bit Protection for NOMCFG"]
pub type BpnomW<'a, REG> = crate::BitWriter<'a, REG, Bpnom>;
impl<'a, REG> BpnomW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "NOMCFG is not changed."]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(Bpnom::Value1)
    }
    #[doc = "NOMCFG is updated with the written value."]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(Bpnom::Value2)
    }
}
#[doc = "Field `SUMCFG` reader - Suspend Mode Configuration"]
pub type SumcfgR = crate::FieldReader;
#[doc = "Field `SUMCFG` writer - Suspend Mode Configuration"]
pub type SumcfgW<'a, REG> = crate::FieldWriter<'a, REG, 2>;
#[doc = "Bit Protection for SUMCFG\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Bpsum {
    #[doc = "0: SUMCFG is not changed."]
    Value1 = 0,
    #[doc = "1: SUMCFG is updated with the written value."]
    Value2 = 1,
}
impl From<Bpsum> for bool {
    #[inline(always)]
    fn from(variant: Bpsum) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Field `BPSUM` writer - Bit Protection for SUMCFG"]
pub type BpsumW<'a, REG> = crate::BitWriter<'a, REG, Bpsum>;
impl<'a, REG> BpsumW<'a, REG>
where
    REG: crate::Writable + crate::RegisterSpec,
{
    #[doc = "SUMCFG is not changed."]
    #[inline(always)]
    pub fn value1(self) -> &'a mut crate::W<REG> {
        self.variant(Bpsum::Value1)
    }
    #[doc = "SUMCFG is updated with the written value."]
    #[inline(always)]
    pub fn value2(self) -> &'a mut crate::W<REG> {
        self.variant(Bpsum::Value2)
    }
}
impl R {
    #[doc = "Bit 0 - Module Enable"]
    #[inline(always)]
    pub fn moden(&self) -> ModenR {
        ModenR::new((self.bits & 1) != 0)
    }
    #[doc = "Bits 4:5 - Normal Operation Mode Configuration"]
    #[inline(always)]
    pub fn nomcfg(&self) -> NomcfgR {
        NomcfgR::new(((self.bits >> 4) & 3) as u8)
    }
    #[doc = "Bits 8:9 - Suspend Mode Configuration"]
    #[inline(always)]
    pub fn sumcfg(&self) -> SumcfgR {
        SumcfgR::new(((self.bits >> 8) & 3) as u8)
    }
}
impl W {
    #[doc = "Bit 0 - Module Enable"]
    #[inline(always)]
    #[must_use]
    pub fn moden(&mut self) -> ModenW<KscfgSpec> {
        ModenW::new(self, 0)
    }
    #[doc = "Bit 1 - Bit Protection for MODEN"]
    #[inline(always)]
    #[must_use]
    pub fn bpmoden(&mut self) -> BpmodenW<KscfgSpec> {
        BpmodenW::new(self, 1)
    }
    #[doc = "Bits 4:5 - Normal Operation Mode Configuration"]
    #[inline(always)]
    #[must_use]
    pub fn nomcfg(&mut self) -> NomcfgW<KscfgSpec> {
        NomcfgW::new(self, 4)
    }
    #[doc = "Bit 7 - Bit Protection for NOMCFG"]
    #[inline(always)]
    #[must_use]
    pub fn bpnom(&mut self) -> BpnomW<KscfgSpec> {
        BpnomW::new(self, 7)
    }
    #[doc = "Bits 8:9 - Suspend Mode Configuration"]
    #[inline(always)]
    #[must_use]
    pub fn sumcfg(&mut self) -> SumcfgW<KscfgSpec> {
        SumcfgW::new(self, 8)
    }
    #[doc = "Bit 11 - Bit Protection for SUMCFG"]
    #[inline(always)]
    #[must_use]
    pub fn bpsum(&mut self) -> BpsumW<KscfgSpec> {
        BpsumW::new(self, 11)
    }
}
#[doc = "Kernel State Configuration Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`kscfg::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 [`kscfg::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct KscfgSpec;
impl crate::RegisterSpec for KscfgSpec {
    type Ux = u32;
}
#[doc = "`read()` method returns [`kscfg::R`](R) reader structure"]
impl crate::Readable for KscfgSpec {}
#[doc = "`write(|w| ..)` method takes [`kscfg::W`](W) writer structure"]
impl crate::Writable for KscfgSpec {
    type Safety = crate::Unsafe;
    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets KSCFG to value 0"]
impl crate::Resettable for KscfgSpec {
    const RESET_VALUE: u32 = 0;
}