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
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
#[doc = "Reader of register CGPR"]
pub type R = crate::R<u32, super::CGPR>;
#[doc = "Writer for register CGPR"]
pub type W = crate::W<u32, super::CGPR>;
#[doc = "Register CGPR `reset()`'s with value 0xfe62"]
impl crate::ResetValue for super::CGPR {
    type Type = u32;
    #[inline(always)]
    fn reset_value() -> Self::Type {
        0xfe62
    }
}
#[doc = "Defines clock dividion of clock for stby_count (pmic delay counter)\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PMIC_DELAY_SCALER_A {
    #[doc = "0: clock is not divided"]
    PMIC_DELAY_SCALER_0 = 0,
    #[doc = "1: clock is divided /8"]
    PMIC_DELAY_SCALER_1 = 1,
}
impl From<PMIC_DELAY_SCALER_A> for bool {
    #[inline(always)]
    fn from(variant: PMIC_DELAY_SCALER_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `PMIC_DELAY_SCALER`"]
pub type PMIC_DELAY_SCALER_R = crate::R<bool, PMIC_DELAY_SCALER_A>;
impl PMIC_DELAY_SCALER_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> PMIC_DELAY_SCALER_A {
        match self.bits {
            false => PMIC_DELAY_SCALER_A::PMIC_DELAY_SCALER_0,
            true => PMIC_DELAY_SCALER_A::PMIC_DELAY_SCALER_1,
        }
    }
    #[doc = "Checks if the value of the field is `PMIC_DELAY_SCALER_0`"]
    #[inline(always)]
    pub fn is_pmic_delay_scaler_0(&self) -> bool {
        *self == PMIC_DELAY_SCALER_A::PMIC_DELAY_SCALER_0
    }
    #[doc = "Checks if the value of the field is `PMIC_DELAY_SCALER_1`"]
    #[inline(always)]
    pub fn is_pmic_delay_scaler_1(&self) -> bool {
        *self == PMIC_DELAY_SCALER_A::PMIC_DELAY_SCALER_1
    }
}
#[doc = "Write proxy for field `PMIC_DELAY_SCALER`"]
pub struct PMIC_DELAY_SCALER_W<'a> {
    w: &'a mut W,
}
impl<'a> PMIC_DELAY_SCALER_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: PMIC_DELAY_SCALER_A) -> &'a mut W {
        {
            self.bit(variant.into())
        }
    }
    #[doc = "clock is not divided"]
    #[inline(always)]
    pub fn pmic_delay_scaler_0(self) -> &'a mut W {
        self.variant(PMIC_DELAY_SCALER_A::PMIC_DELAY_SCALER_0)
    }
    #[doc = "clock is divided /8"]
    #[inline(always)]
    pub fn pmic_delay_scaler_1(self) -> &'a mut W {
        self.variant(PMIC_DELAY_SCALER_A::PMIC_DELAY_SCALER_1)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !0x01) | ((value as u32) & 0x01);
        self.w
    }
}
#[doc = "Defines the value of the output signal cgpr_dout\\[4\\]. Gate of program supply for efuse programing\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum EFUSE_PROG_SUPPLY_GATE_A {
    #[doc = "0: fuse programing supply voltage is gated off to the efuse module"]
    EFUSE_PROG_SUPPLY_GATE_0 = 0,
    #[doc = "1: allow fuse programing."]
    EFUSE_PROG_SUPPLY_GATE_1 = 1,
}
impl From<EFUSE_PROG_SUPPLY_GATE_A> for bool {
    #[inline(always)]
    fn from(variant: EFUSE_PROG_SUPPLY_GATE_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `EFUSE_PROG_SUPPLY_GATE`"]
pub type EFUSE_PROG_SUPPLY_GATE_R = crate::R<bool, EFUSE_PROG_SUPPLY_GATE_A>;
impl EFUSE_PROG_SUPPLY_GATE_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> EFUSE_PROG_SUPPLY_GATE_A {
        match self.bits {
            false => EFUSE_PROG_SUPPLY_GATE_A::EFUSE_PROG_SUPPLY_GATE_0,
            true => EFUSE_PROG_SUPPLY_GATE_A::EFUSE_PROG_SUPPLY_GATE_1,
        }
    }
    #[doc = "Checks if the value of the field is `EFUSE_PROG_SUPPLY_GATE_0`"]
    #[inline(always)]
    pub fn is_efuse_prog_supply_gate_0(&self) -> bool {
        *self == EFUSE_PROG_SUPPLY_GATE_A::EFUSE_PROG_SUPPLY_GATE_0
    }
    #[doc = "Checks if the value of the field is `EFUSE_PROG_SUPPLY_GATE_1`"]
    #[inline(always)]
    pub fn is_efuse_prog_supply_gate_1(&self) -> bool {
        *self == EFUSE_PROG_SUPPLY_GATE_A::EFUSE_PROG_SUPPLY_GATE_1
    }
}
#[doc = "Write proxy for field `EFUSE_PROG_SUPPLY_GATE`"]
pub struct EFUSE_PROG_SUPPLY_GATE_W<'a> {
    w: &'a mut W,
}
impl<'a> EFUSE_PROG_SUPPLY_GATE_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: EFUSE_PROG_SUPPLY_GATE_A) -> &'a mut W {
        {
            self.bit(variant.into())
        }
    }
    #[doc = "fuse programing supply voltage is gated off to the efuse module"]
    #[inline(always)]
    pub fn efuse_prog_supply_gate_0(self) -> &'a mut W {
        self.variant(EFUSE_PROG_SUPPLY_GATE_A::EFUSE_PROG_SUPPLY_GATE_0)
    }
    #[doc = "allow fuse programing."]
    #[inline(always)]
    pub fn efuse_prog_supply_gate_1(self) -> &'a mut W {
        self.variant(EFUSE_PROG_SUPPLY_GATE_A::EFUSE_PROG_SUPPLY_GATE_1)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4);
        self.w
    }
}
#[doc = "System memory DS control\n\nValue on reset: 3"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum SYS_MEM_DS_CTRL_A {
    #[doc = "0: Disable memory DS mode always"]
    SYS_MEM_DS_CTRL_0 = 0,
    #[doc = "1: Enable memory (outside ARM platform) DS mode when system STOP and PLL are disabled"]
    SYS_MEM_DS_CTRL_1 = 1,
    #[doc = "2: enable memory (outside ARM platform) DS mode when system is in STOP mode"]
    SYS_MEM_DS_CTRL_2 = 2,
}
impl From<SYS_MEM_DS_CTRL_A> for u8 {
    #[inline(always)]
    fn from(variant: SYS_MEM_DS_CTRL_A) -> Self {
        variant as _
    }
}
#[doc = "Reader of field `SYS_MEM_DS_CTRL`"]
pub type SYS_MEM_DS_CTRL_R = crate::R<u8, SYS_MEM_DS_CTRL_A>;
impl SYS_MEM_DS_CTRL_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> crate::Variant<u8, SYS_MEM_DS_CTRL_A> {
        use crate::Variant::*;
        match self.bits {
            0 => Val(SYS_MEM_DS_CTRL_A::SYS_MEM_DS_CTRL_0),
            1 => Val(SYS_MEM_DS_CTRL_A::SYS_MEM_DS_CTRL_1),
            2 => Val(SYS_MEM_DS_CTRL_A::SYS_MEM_DS_CTRL_2),
            i => Res(i),
        }
    }
    #[doc = "Checks if the value of the field is `SYS_MEM_DS_CTRL_0`"]
    #[inline(always)]
    pub fn is_sys_mem_ds_ctrl_0(&self) -> bool {
        *self == SYS_MEM_DS_CTRL_A::SYS_MEM_DS_CTRL_0
    }
    #[doc = "Checks if the value of the field is `SYS_MEM_DS_CTRL_1`"]
    #[inline(always)]
    pub fn is_sys_mem_ds_ctrl_1(&self) -> bool {
        *self == SYS_MEM_DS_CTRL_A::SYS_MEM_DS_CTRL_1
    }
    #[doc = "Checks if the value of the field is `SYS_MEM_DS_CTRL_2`"]
    #[inline(always)]
    pub fn is_sys_mem_ds_ctrl_2(&self) -> bool {
        *self == SYS_MEM_DS_CTRL_A::SYS_MEM_DS_CTRL_2
    }
}
#[doc = "Write proxy for field `SYS_MEM_DS_CTRL`"]
pub struct SYS_MEM_DS_CTRL_W<'a> {
    w: &'a mut W,
}
impl<'a> SYS_MEM_DS_CTRL_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: SYS_MEM_DS_CTRL_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "Disable memory DS mode always"]
    #[inline(always)]
    pub fn sys_mem_ds_ctrl_0(self) -> &'a mut W {
        self.variant(SYS_MEM_DS_CTRL_A::SYS_MEM_DS_CTRL_0)
    }
    #[doc = "Enable memory (outside ARM platform) DS mode when system STOP and PLL are disabled"]
    #[inline(always)]
    pub fn sys_mem_ds_ctrl_1(self) -> &'a mut W {
        self.variant(SYS_MEM_DS_CTRL_A::SYS_MEM_DS_CTRL_1)
    }
    #[doc = "enable memory (outside ARM platform) DS mode when system is in STOP mode"]
    #[inline(always)]
    pub fn sys_mem_ds_ctrl_2(self) -> &'a mut W {
        self.variant(SYS_MEM_DS_CTRL_A::SYS_MEM_DS_CTRL_2)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub unsafe fn bits(self, value: u8) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x03 << 14)) | (((value as u32) & 0x03) << 14);
        self.w
    }
}
#[doc = "Fast PLL enable.\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum FPL_A {
    #[doc = "0: Engage PLL enable default way."]
    FPL_0 = 0,
    #[doc = "1: Engage PLL enable 3 CKIL clocks earlier at exiting low power mode (STOP). Should be used only if 24MHz OSC was active in low power mode."]
    FPL_1 = 1,
}
impl From<FPL_A> for bool {
    #[inline(always)]
    fn from(variant: FPL_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `FPL`"]
pub type FPL_R = crate::R<bool, FPL_A>;
impl FPL_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> FPL_A {
        match self.bits {
            false => FPL_A::FPL_0,
            true => FPL_A::FPL_1,
        }
    }
    #[doc = "Checks if the value of the field is `FPL_0`"]
    #[inline(always)]
    pub fn is_fpl_0(&self) -> bool {
        *self == FPL_A::FPL_0
    }
    #[doc = "Checks if the value of the field is `FPL_1`"]
    #[inline(always)]
    pub fn is_fpl_1(&self) -> bool {
        *self == FPL_A::FPL_1
    }
}
#[doc = "Write proxy for field `FPL`"]
pub struct FPL_W<'a> {
    w: &'a mut W,
}
impl<'a> FPL_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: FPL_A) -> &'a mut W {
        {
            self.bit(variant.into())
        }
    }
    #[doc = "Engage PLL enable default way."]
    #[inline(always)]
    pub fn fpl_0(self) -> &'a mut W {
        self.variant(FPL_A::FPL_0)
    }
    #[doc = "Engage PLL enable 3 CKIL clocks earlier at exiting low power mode (STOP). Should be used only if 24MHz OSC was active in low power mode."]
    #[inline(always)]
    pub fn fpl_1(self) -> &'a mut W {
        self.variant(FPL_A::FPL_1)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 16)) | (((value as u32) & 0x01) << 16);
        self.w
    }
}
#[doc = "Control for the Deep Sleep signal to the ARM Platform memories with additional control logic based on the ARM WFI signal\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum INT_MEM_CLK_LPM_A {
    #[doc = "0: Disable the clock to the ARM platform memories when entering Low Power Mode"]
    INT_MEM_CLK_LPM_0 = 0,
    #[doc = "1: Keep the clocks to the ARM platform memories enabled only if an interrupt is pending when entering Low Power Modes (WAIT and STOP without power gating)"]
    INT_MEM_CLK_LPM_1 = 1,
}
impl From<INT_MEM_CLK_LPM_A> for bool {
    #[inline(always)]
    fn from(variant: INT_MEM_CLK_LPM_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `INT_MEM_CLK_LPM`"]
pub type INT_MEM_CLK_LPM_R = crate::R<bool, INT_MEM_CLK_LPM_A>;
impl INT_MEM_CLK_LPM_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> INT_MEM_CLK_LPM_A {
        match self.bits {
            false => INT_MEM_CLK_LPM_A::INT_MEM_CLK_LPM_0,
            true => INT_MEM_CLK_LPM_A::INT_MEM_CLK_LPM_1,
        }
    }
    #[doc = "Checks if the value of the field is `INT_MEM_CLK_LPM_0`"]
    #[inline(always)]
    pub fn is_int_mem_clk_lpm_0(&self) -> bool {
        *self == INT_MEM_CLK_LPM_A::INT_MEM_CLK_LPM_0
    }
    #[doc = "Checks if the value of the field is `INT_MEM_CLK_LPM_1`"]
    #[inline(always)]
    pub fn is_int_mem_clk_lpm_1(&self) -> bool {
        *self == INT_MEM_CLK_LPM_A::INT_MEM_CLK_LPM_1
    }
}
#[doc = "Write proxy for field `INT_MEM_CLK_LPM`"]
pub struct INT_MEM_CLK_LPM_W<'a> {
    w: &'a mut W,
}
impl<'a> INT_MEM_CLK_LPM_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: INT_MEM_CLK_LPM_A) -> &'a mut W {
        {
            self.bit(variant.into())
        }
    }
    #[doc = "Disable the clock to the ARM platform memories when entering Low Power Mode"]
    #[inline(always)]
    pub fn int_mem_clk_lpm_0(self) -> &'a mut W {
        self.variant(INT_MEM_CLK_LPM_A::INT_MEM_CLK_LPM_0)
    }
    #[doc = "Keep the clocks to the ARM platform memories enabled only if an interrupt is pending when entering Low Power Modes (WAIT and STOP without power gating)"]
    #[inline(always)]
    pub fn int_mem_clk_lpm_1(self) -> &'a mut W {
        self.variant(INT_MEM_CLK_LPM_A::INT_MEM_CLK_LPM_1)
    }
    #[doc = r"Sets the field bit"]
    #[inline(always)]
    pub fn set_bit(self) -> &'a mut W {
        self.bit(true)
    }
    #[doc = r"Clears the field bit"]
    #[inline(always)]
    pub fn clear_bit(self) -> &'a mut W {
        self.bit(false)
    }
    #[doc = r"Writes raw bits to the field"]
    #[inline(always)]
    pub fn bit(self, value: bool) -> &'a mut W {
        self.w.bits = (self.w.bits & !(0x01 << 17)) | (((value as u32) & 0x01) << 17);
        self.w
    }
}
impl R {
    #[doc = "Bit 0 - Defines clock dividion of clock for stby_count (pmic delay counter)"]
    #[inline(always)]
    pub fn pmic_delay_scaler(&self) -> PMIC_DELAY_SCALER_R {
        PMIC_DELAY_SCALER_R::new((self.bits & 0x01) != 0)
    }
    #[doc = "Bit 4 - Defines the value of the output signal cgpr_dout\\[4\\]. Gate of program supply for efuse programing"]
    #[inline(always)]
    pub fn efuse_prog_supply_gate(&self) -> EFUSE_PROG_SUPPLY_GATE_R {
        EFUSE_PROG_SUPPLY_GATE_R::new(((self.bits >> 4) & 0x01) != 0)
    }
    #[doc = "Bits 14:15 - System memory DS control"]
    #[inline(always)]
    pub fn sys_mem_ds_ctrl(&self) -> SYS_MEM_DS_CTRL_R {
        SYS_MEM_DS_CTRL_R::new(((self.bits >> 14) & 0x03) as u8)
    }
    #[doc = "Bit 16 - Fast PLL enable."]
    #[inline(always)]
    pub fn fpl(&self) -> FPL_R {
        FPL_R::new(((self.bits >> 16) & 0x01) != 0)
    }
    #[doc = "Bit 17 - Control for the Deep Sleep signal to the ARM Platform memories with additional control logic based on the ARM WFI signal"]
    #[inline(always)]
    pub fn int_mem_clk_lpm(&self) -> INT_MEM_CLK_LPM_R {
        INT_MEM_CLK_LPM_R::new(((self.bits >> 17) & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bit 0 - Defines clock dividion of clock for stby_count (pmic delay counter)"]
    #[inline(always)]
    pub fn pmic_delay_scaler(&mut self) -> PMIC_DELAY_SCALER_W {
        PMIC_DELAY_SCALER_W { w: self }
    }
    #[doc = "Bit 4 - Defines the value of the output signal cgpr_dout\\[4\\]. Gate of program supply for efuse programing"]
    #[inline(always)]
    pub fn efuse_prog_supply_gate(&mut self) -> EFUSE_PROG_SUPPLY_GATE_W {
        EFUSE_PROG_SUPPLY_GATE_W { w: self }
    }
    #[doc = "Bits 14:15 - System memory DS control"]
    #[inline(always)]
    pub fn sys_mem_ds_ctrl(&mut self) -> SYS_MEM_DS_CTRL_W {
        SYS_MEM_DS_CTRL_W { w: self }
    }
    #[doc = "Bit 16 - Fast PLL enable."]
    #[inline(always)]
    pub fn fpl(&mut self) -> FPL_W {
        FPL_W { w: self }
    }
    #[doc = "Bit 17 - Control for the Deep Sleep signal to the ARM Platform memories with additional control logic based on the ARM WFI signal"]
    #[inline(always)]
    pub fn int_mem_clk_lpm(&mut self) -> INT_MEM_CLK_LPM_W {
        INT_MEM_CLK_LPM_W { w: self }
    }
}