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
#[doc = "Reader of register CCR"]
pub type R = crate::R<u32, super::CCR>;
#[doc = "Writer for register CCR"]
pub type W = crate::W<u32, super::CCR>;
#[doc = "Register CCR `reset()`'s with value 0x0401_107f"]
impl crate::ResetValue for super::CCR {
    type Type = u32;
    #[inline(always)]
    fn reset_value() -> Self::Type {
        0x0401_107f
    }
}
#[doc = "Reader of field `OSCNT`"]
pub type OSCNT_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `OSCNT`"]
pub struct OSCNT_W<'a> {
    w: &'a mut W,
}
impl<'a> OSCNT_W<'a> {
    #[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 & !0xff) | ((value as u32) & 0xff);
        self.w
    }
}
#[doc = "On chip oscillator enable bit - this bit value is reflected on the output cosc_en\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum COSC_EN_A {
    #[doc = "0: disable on chip oscillator"]
    COSC_EN_0 = 0,
    #[doc = "1: enable on chip oscillator"]
    COSC_EN_1 = 1,
}
impl From<COSC_EN_A> for bool {
    #[inline(always)]
    fn from(variant: COSC_EN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `COSC_EN`"]
pub type COSC_EN_R = crate::R<bool, COSC_EN_A>;
impl COSC_EN_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> COSC_EN_A {
        match self.bits {
            false => COSC_EN_A::COSC_EN_0,
            true => COSC_EN_A::COSC_EN_1,
        }
    }
    #[doc = "Checks if the value of the field is `COSC_EN_0`"]
    #[inline(always)]
    pub fn is_cosc_en_0(&self) -> bool {
        *self == COSC_EN_A::COSC_EN_0
    }
    #[doc = "Checks if the value of the field is `COSC_EN_1`"]
    #[inline(always)]
    pub fn is_cosc_en_1(&self) -> bool {
        *self == COSC_EN_A::COSC_EN_1
    }
}
#[doc = "Write proxy for field `COSC_EN`"]
pub struct COSC_EN_W<'a> {
    w: &'a mut W,
}
impl<'a> COSC_EN_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: COSC_EN_A) -> &'a mut W {
        {
            self.bit(variant.into())
        }
    }
    #[doc = "disable on chip oscillator"]
    #[inline(always)]
    pub fn cosc_en_0(self) -> &'a mut W {
        self.variant(COSC_EN_A::COSC_EN_0)
    }
    #[doc = "enable on chip oscillator"]
    #[inline(always)]
    pub fn cosc_en_1(self) -> &'a mut W {
        self.variant(COSC_EN_A::COSC_EN_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 << 12)) | (((value as u32) & 0x01) << 12);
        self.w
    }
}
#[doc = "Counter for analog_reg_bypass signal assertion after standby voltage request by PMIC_STBY_REQ\n\nValue on reset: 32"]
#[derive(Clone, Copy, Debug, PartialEq)]
#[repr(u8)]
pub enum REG_BYPASS_COUNT_A {
    #[doc = "0: no delay"]
    REG_BYPASS_COUNT_0 = 0,
    #[doc = "1: 1 CKIL clock period delay"]
    REG_BYPASS_COUNT_1 = 1,
    #[doc = "63: 63 CKIL clock periods delay"]
    REG_BYPASS_COUNT_63 = 63,
}
impl From<REG_BYPASS_COUNT_A> for u8 {
    #[inline(always)]
    fn from(variant: REG_BYPASS_COUNT_A) -> Self {
        variant as _
    }
}
#[doc = "Reader of field `REG_BYPASS_COUNT`"]
pub type REG_BYPASS_COUNT_R = crate::R<u8, REG_BYPASS_COUNT_A>;
impl REG_BYPASS_COUNT_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> crate::Variant<u8, REG_BYPASS_COUNT_A> {
        use crate::Variant::*;
        match self.bits {
            0 => Val(REG_BYPASS_COUNT_A::REG_BYPASS_COUNT_0),
            1 => Val(REG_BYPASS_COUNT_A::REG_BYPASS_COUNT_1),
            63 => Val(REG_BYPASS_COUNT_A::REG_BYPASS_COUNT_63),
            i => Res(i),
        }
    }
    #[doc = "Checks if the value of the field is `REG_BYPASS_COUNT_0`"]
    #[inline(always)]
    pub fn is_reg_bypass_count_0(&self) -> bool {
        *self == REG_BYPASS_COUNT_A::REG_BYPASS_COUNT_0
    }
    #[doc = "Checks if the value of the field is `REG_BYPASS_COUNT_1`"]
    #[inline(always)]
    pub fn is_reg_bypass_count_1(&self) -> bool {
        *self == REG_BYPASS_COUNT_A::REG_BYPASS_COUNT_1
    }
    #[doc = "Checks if the value of the field is `REG_BYPASS_COUNT_63`"]
    #[inline(always)]
    pub fn is_reg_bypass_count_63(&self) -> bool {
        *self == REG_BYPASS_COUNT_A::REG_BYPASS_COUNT_63
    }
}
#[doc = "Write proxy for field `REG_BYPASS_COUNT`"]
pub struct REG_BYPASS_COUNT_W<'a> {
    w: &'a mut W,
}
impl<'a> REG_BYPASS_COUNT_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: REG_BYPASS_COUNT_A) -> &'a mut W {
        unsafe { self.bits(variant.into()) }
    }
    #[doc = "no delay"]
    #[inline(always)]
    pub fn reg_bypass_count_0(self) -> &'a mut W {
        self.variant(REG_BYPASS_COUNT_A::REG_BYPASS_COUNT_0)
    }
    #[doc = "1 CKIL clock period delay"]
    #[inline(always)]
    pub fn reg_bypass_count_1(self) -> &'a mut W {
        self.variant(REG_BYPASS_COUNT_A::REG_BYPASS_COUNT_1)
    }
    #[doc = "63 CKIL clock periods delay"]
    #[inline(always)]
    pub fn reg_bypass_count_63(self) -> &'a mut W {
        self.variant(REG_BYPASS_COUNT_A::REG_BYPASS_COUNT_63)
    }
    #[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 & !(0x3f << 21)) | (((value as u32) & 0x3f) << 21);
        self.w
    }
}
#[doc = "Enable for REG_BYPASS_COUNTER\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RBC_EN_A {
    #[doc = "0: REG_BYPASS_COUNTER disabled"]
    RBC_EN_0 = 0,
    #[doc = "1: REG_BYPASS_COUNTER enabled."]
    RBC_EN_1 = 1,
}
impl From<RBC_EN_A> for bool {
    #[inline(always)]
    fn from(variant: RBC_EN_A) -> Self {
        variant as u8 != 0
    }
}
#[doc = "Reader of field `RBC_EN`"]
pub type RBC_EN_R = crate::R<bool, RBC_EN_A>;
impl RBC_EN_R {
    #[doc = r"Get enumerated values variant"]
    #[inline(always)]
    pub fn variant(&self) -> RBC_EN_A {
        match self.bits {
            false => RBC_EN_A::RBC_EN_0,
            true => RBC_EN_A::RBC_EN_1,
        }
    }
    #[doc = "Checks if the value of the field is `RBC_EN_0`"]
    #[inline(always)]
    pub fn is_rbc_en_0(&self) -> bool {
        *self == RBC_EN_A::RBC_EN_0
    }
    #[doc = "Checks if the value of the field is `RBC_EN_1`"]
    #[inline(always)]
    pub fn is_rbc_en_1(&self) -> bool {
        *self == RBC_EN_A::RBC_EN_1
    }
}
#[doc = "Write proxy for field `RBC_EN`"]
pub struct RBC_EN_W<'a> {
    w: &'a mut W,
}
impl<'a> RBC_EN_W<'a> {
    #[doc = r"Writes `variant` to the field"]
    #[inline(always)]
    pub fn variant(self, variant: RBC_EN_A) -> &'a mut W {
        {
            self.bit(variant.into())
        }
    }
    #[doc = "REG_BYPASS_COUNTER disabled"]
    #[inline(always)]
    pub fn rbc_en_0(self) -> &'a mut W {
        self.variant(RBC_EN_A::RBC_EN_0)
    }
    #[doc = "REG_BYPASS_COUNTER enabled."]
    #[inline(always)]
    pub fn rbc_en_1(self) -> &'a mut W {
        self.variant(RBC_EN_A::RBC_EN_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 << 27)) | (((value as u32) & 0x01) << 27);
        self.w
    }
}
impl R {
    #[doc = "Bits 0:7 - Oscillator ready counter value. These bits define value of 32KHz counter, that serve as counter for oscillator lock time (count to n+1 ckil's). This is used for oscillator lock time. Current estimation is ~5ms. This counter will be used in ignition sequence and in wake from stop sequence if sbyos bit was defined, to notify that on chip oscillator output is ready for the dpll_ip to use and only then the gate in dpll_ip can be opened."]
    #[inline(always)]
    pub fn oscnt(&self) -> OSCNT_R {
        OSCNT_R::new((self.bits & 0xff) as u8)
    }
    #[doc = "Bit 12 - On chip oscillator enable bit - this bit value is reflected on the output cosc_en"]
    #[inline(always)]
    pub fn cosc_en(&self) -> COSC_EN_R {
        COSC_EN_R::new(((self.bits >> 12) & 0x01) != 0)
    }
    #[doc = "Bits 21:26 - Counter for analog_reg_bypass signal assertion after standby voltage request by PMIC_STBY_REQ"]
    #[inline(always)]
    pub fn reg_bypass_count(&self) -> REG_BYPASS_COUNT_R {
        REG_BYPASS_COUNT_R::new(((self.bits >> 21) & 0x3f) as u8)
    }
    #[doc = "Bit 27 - Enable for REG_BYPASS_COUNTER"]
    #[inline(always)]
    pub fn rbc_en(&self) -> RBC_EN_R {
        RBC_EN_R::new(((self.bits >> 27) & 0x01) != 0)
    }
}
impl W {
    #[doc = "Bits 0:7 - Oscillator ready counter value. These bits define value of 32KHz counter, that serve as counter for oscillator lock time (count to n+1 ckil's). This is used for oscillator lock time. Current estimation is ~5ms. This counter will be used in ignition sequence and in wake from stop sequence if sbyos bit was defined, to notify that on chip oscillator output is ready for the dpll_ip to use and only then the gate in dpll_ip can be opened."]
    #[inline(always)]
    pub fn oscnt(&mut self) -> OSCNT_W {
        OSCNT_W { w: self }
    }
    #[doc = "Bit 12 - On chip oscillator enable bit - this bit value is reflected on the output cosc_en"]
    #[inline(always)]
    pub fn cosc_en(&mut self) -> COSC_EN_W {
        COSC_EN_W { w: self }
    }
    #[doc = "Bits 21:26 - Counter for analog_reg_bypass signal assertion after standby voltage request by PMIC_STBY_REQ"]
    #[inline(always)]
    pub fn reg_bypass_count(&mut self) -> REG_BYPASS_COUNT_W {
        REG_BYPASS_COUNT_W { w: self }
    }
    #[doc = "Bit 27 - Enable for REG_BYPASS_COUNTER"]
    #[inline(always)]
    pub fn rbc_en(&mut self) -> RBC_EN_W {
        RBC_EN_W { w: self }
    }
}