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
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
#[doc = "Reader of register OCMDR0"]
pub type R = crate::R<u32, super::OCMDR0>;
#[doc = "Writer for register OCMDR0"]
pub type W = crate::W<u32, super::OCMDR0>;
#[doc = "Register OCMDR0 `reset()`'s with value 0xcb08_9000"]
impl crate::ResetValue for super::OCMDR0 {
  type Type = u32;
  #[inline(always)]
  fn reset_value() -> Self::Type {
    0xcb08_9000
  }
}
#[doc = "Reader of field `OCM1`"]
pub type OCM1_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `OCM1`"]
pub struct OCM1_W<'a> {
  w: &'a mut W,
}
impl<'a> OCM1_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 & !(0x03 << 4)) | (((value as u32) & 0x03) << 4);
    self.w
  }
}
#[doc = "Reader of field `OCMPU`"]
pub type OCMPU_R = crate::R<bool, bool>;
#[doc = "OCMT\n\nValue on reset: 4"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OCMT_A {
  #[doc = "3: OCMEMn is a ROM."]
  OCMT_3,
  #[doc = "4: OCMEMn is a Program Flash."]
  OCMT_4,
  #[doc = "6: OCMEMn is an EEE."]
  OCMT_6,
}
impl From<OCMT_A> for u8 {
  #[inline(always)]
  fn from(variant: OCMT_A) -> Self {
    match variant {
      OCMT_A::OCMT_3 => 3,
      OCMT_A::OCMT_4 => 4,
      OCMT_A::OCMT_6 => 6,
    }
  }
}
#[doc = "Reader of field `OCMT`"]
pub type OCMT_R = crate::R<u8, OCMT_A>;
impl OCMT_R {
  #[doc = r"Get enumerated values variant"]
  #[inline(always)]
  pub fn variant(&self) -> crate::Variant<u8, OCMT_A> {
    use crate::Variant::*;
    match self.bits {
      3 => Val(OCMT_A::OCMT_3),
      4 => Val(OCMT_A::OCMT_4),
      6 => Val(OCMT_A::OCMT_6),
      i => Res(i),
    }
  }
  #[doc = "Checks if the value of the field is `OCMT_3`"]
  #[inline(always)]
  pub fn is_ocmt_3(&self) -> bool {
    *self == OCMT_A::OCMT_3
  }
  #[doc = "Checks if the value of the field is `OCMT_4`"]
  #[inline(always)]
  pub fn is_ocmt_4(&self) -> bool {
    *self == OCMT_A::OCMT_4
  }
  #[doc = "Checks if the value of the field is `OCMT_6`"]
  #[inline(always)]
  pub fn is_ocmt_6(&self) -> bool {
    *self == OCMT_A::OCMT_6
  }
}
#[doc = "RO\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum RO_A {
  #[doc = "0: Writes to the OCMDRn\\[11:0\\] are allowed"]
  RO_0,
  #[doc = "1: Writes to the OCMDRn\\[11:0\\] are ignored"]
  RO_1,
}
impl From<RO_A> for bool {
  #[inline(always)]
  fn from(variant: RO_A) -> Self {
    match variant {
      RO_A::RO_0 => false,
      RO_A::RO_1 => true,
    }
  }
}
#[doc = "Reader of field `RO`"]
pub type RO_R = crate::R<bool, RO_A>;
impl RO_R {
  #[doc = r"Get enumerated values variant"]
  #[inline(always)]
  pub fn variant(&self) -> RO_A {
    match self.bits {
      false => RO_A::RO_0,
      true => RO_A::RO_1,
    }
  }
  #[doc = "Checks if the value of the field is `RO_0`"]
  #[inline(always)]
  pub fn is_ro_0(&self) -> bool {
    *self == RO_A::RO_0
  }
  #[doc = "Checks if the value of the field is `RO_1`"]
  #[inline(always)]
  pub fn is_ro_1(&self) -> bool {
    *self == RO_A::RO_1
  }
}
#[doc = "Write proxy for field `RO`"]
pub struct RO_W<'a> {
  w: &'a mut W,
}
impl<'a> RO_W<'a> {
  #[doc = r"Writes `variant` to the field"]
  #[inline(always)]
  pub fn variant(self, variant: RO_A) -> &'a mut W {
    {
      self.bit(variant.into())
    }
  }
  #[doc = "Writes to the OCMDRn\\[11:0\\] are allowed"]
  #[inline(always)]
  pub fn ro_0(self) -> &'a mut W {
    self.variant(RO_A::RO_0)
  }
  #[doc = "Writes to the OCMDRn\\[11:0\\] are ignored"]
  #[inline(always)]
  pub fn ro_1(self) -> &'a mut W {
    self.variant(RO_A::RO_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 = "OCMW\n\nValue on reset: 4"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OCMW_A {
  #[doc = "2: OCMEMn 32-bits wide"]
  OCMW_2,
  #[doc = "3: OCMEMn 64-bits wide"]
  OCMW_3,
  #[doc = "4: OCMEMn 128-bits wide"]
  OCMW_4,
  #[doc = "5: OCMEMn 256-bits wide"]
  OCMW_5,
}
impl From<OCMW_A> for u8 {
  #[inline(always)]
  fn from(variant: OCMW_A) -> Self {
    match variant {
      OCMW_A::OCMW_2 => 2,
      OCMW_A::OCMW_3 => 3,
      OCMW_A::OCMW_4 => 4,
      OCMW_A::OCMW_5 => 5,
    }
  }
}
#[doc = "Reader of field `OCMW`"]
pub type OCMW_R = crate::R<u8, OCMW_A>;
impl OCMW_R {
  #[doc = r"Get enumerated values variant"]
  #[inline(always)]
  pub fn variant(&self) -> crate::Variant<u8, OCMW_A> {
    use crate::Variant::*;
    match self.bits {
      2 => Val(OCMW_A::OCMW_2),
      3 => Val(OCMW_A::OCMW_3),
      4 => Val(OCMW_A::OCMW_4),
      5 => Val(OCMW_A::OCMW_5),
      i => Res(i),
    }
  }
  #[doc = "Checks if the value of the field is `OCMW_2`"]
  #[inline(always)]
  pub fn is_ocmw_2(&self) -> bool {
    *self == OCMW_A::OCMW_2
  }
  #[doc = "Checks if the value of the field is `OCMW_3`"]
  #[inline(always)]
  pub fn is_ocmw_3(&self) -> bool {
    *self == OCMW_A::OCMW_3
  }
  #[doc = "Checks if the value of the field is `OCMW_4`"]
  #[inline(always)]
  pub fn is_ocmw_4(&self) -> bool {
    *self == OCMW_A::OCMW_4
  }
  #[doc = "Checks if the value of the field is `OCMW_5`"]
  #[inline(always)]
  pub fn is_ocmw_5(&self) -> bool {
    *self == OCMW_A::OCMW_5
  }
}
#[doc = "OCMSZ\n\nValue on reset: 11"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OCMSZ_A {
  #[doc = "0: no OCMEMn"]
  OCMSZ_0,
  #[doc = "1: 1KB OCMEMn"]
  OCMSZ_1,
  #[doc = "2: 2KB OCMEMn"]
  OCMSZ_2,
  #[doc = "3: 4KB OCMEMn"]
  OCMSZ_3,
  #[doc = "4: 8KB OCMEMn"]
  OCMSZ_4,
  #[doc = "5: 16KB OCMEMn"]
  OCMSZ_5,
  #[doc = "6: 32KB OCMEMn"]
  OCMSZ_6,
  #[doc = "7: 64KB OCMEMn"]
  OCMSZ_7,
  #[doc = "8: 128KB OCMEMn"]
  OCMSZ_8,
  #[doc = "9: 256KB OCMEMn"]
  OCMSZ_9,
  #[doc = "10: 512KB OCMEMn"]
  OCMSZ_10,
  #[doc = "11: 1MB OCMEMn"]
  OCMSZ_11,
  #[doc = "12: 2MB OCMEMn"]
  OCMSZ_12,
  #[doc = "13: 4MB OCMEMn"]
  OCMSZ_13,
  #[doc = "14: 8MB OCMEMn"]
  OCMSZ_14,
  #[doc = "15: 16MB OCMEMn"]
  OCMSZ_15,
}
impl From<OCMSZ_A> for u8 {
  #[inline(always)]
  fn from(variant: OCMSZ_A) -> Self {
    match variant {
      OCMSZ_A::OCMSZ_0 => 0,
      OCMSZ_A::OCMSZ_1 => 1,
      OCMSZ_A::OCMSZ_2 => 2,
      OCMSZ_A::OCMSZ_3 => 3,
      OCMSZ_A::OCMSZ_4 => 4,
      OCMSZ_A::OCMSZ_5 => 5,
      OCMSZ_A::OCMSZ_6 => 6,
      OCMSZ_A::OCMSZ_7 => 7,
      OCMSZ_A::OCMSZ_8 => 8,
      OCMSZ_A::OCMSZ_9 => 9,
      OCMSZ_A::OCMSZ_10 => 10,
      OCMSZ_A::OCMSZ_11 => 11,
      OCMSZ_A::OCMSZ_12 => 12,
      OCMSZ_A::OCMSZ_13 => 13,
      OCMSZ_A::OCMSZ_14 => 14,
      OCMSZ_A::OCMSZ_15 => 15,
    }
  }
}
#[doc = "Reader of field `OCMSZ`"]
pub type OCMSZ_R = crate::R<u8, OCMSZ_A>;
impl OCMSZ_R {
  #[doc = r"Get enumerated values variant"]
  #[inline(always)]
  pub fn variant(&self) -> OCMSZ_A {
    match self.bits {
      0 => OCMSZ_A::OCMSZ_0,
      1 => OCMSZ_A::OCMSZ_1,
      2 => OCMSZ_A::OCMSZ_2,
      3 => OCMSZ_A::OCMSZ_3,
      4 => OCMSZ_A::OCMSZ_4,
      5 => OCMSZ_A::OCMSZ_5,
      6 => OCMSZ_A::OCMSZ_6,
      7 => OCMSZ_A::OCMSZ_7,
      8 => OCMSZ_A::OCMSZ_8,
      9 => OCMSZ_A::OCMSZ_9,
      10 => OCMSZ_A::OCMSZ_10,
      11 => OCMSZ_A::OCMSZ_11,
      12 => OCMSZ_A::OCMSZ_12,
      13 => OCMSZ_A::OCMSZ_13,
      14 => OCMSZ_A::OCMSZ_14,
      15 => OCMSZ_A::OCMSZ_15,
      _ => unreachable!(),
    }
  }
  #[doc = "Checks if the value of the field is `OCMSZ_0`"]
  #[inline(always)]
  pub fn is_ocmsz_0(&self) -> bool {
    *self == OCMSZ_A::OCMSZ_0
  }
  #[doc = "Checks if the value of the field is `OCMSZ_1`"]
  #[inline(always)]
  pub fn is_ocmsz_1(&self) -> bool {
    *self == OCMSZ_A::OCMSZ_1
  }
  #[doc = "Checks if the value of the field is `OCMSZ_2`"]
  #[inline(always)]
  pub fn is_ocmsz_2(&self) -> bool {
    *self == OCMSZ_A::OCMSZ_2
  }
  #[doc = "Checks if the value of the field is `OCMSZ_3`"]
  #[inline(always)]
  pub fn is_ocmsz_3(&self) -> bool {
    *self == OCMSZ_A::OCMSZ_3
  }
  #[doc = "Checks if the value of the field is `OCMSZ_4`"]
  #[inline(always)]
  pub fn is_ocmsz_4(&self) -> bool {
    *self == OCMSZ_A::OCMSZ_4
  }
  #[doc = "Checks if the value of the field is `OCMSZ_5`"]
  #[inline(always)]
  pub fn is_ocmsz_5(&self) -> bool {
    *self == OCMSZ_A::OCMSZ_5
  }
  #[doc = "Checks if the value of the field is `OCMSZ_6`"]
  #[inline(always)]
  pub fn is_ocmsz_6(&self) -> bool {
    *self == OCMSZ_A::OCMSZ_6
  }
  #[doc = "Checks if the value of the field is `OCMSZ_7`"]
  #[inline(always)]
  pub fn is_ocmsz_7(&self) -> bool {
    *self == OCMSZ_A::OCMSZ_7
  }
  #[doc = "Checks if the value of the field is `OCMSZ_8`"]
  #[inline(always)]
  pub fn is_ocmsz_8(&self) -> bool {
    *self == OCMSZ_A::OCMSZ_8
  }
  #[doc = "Checks if the value of the field is `OCMSZ_9`"]
  #[inline(always)]
  pub fn is_ocmsz_9(&self) -> bool {
    *self == OCMSZ_A::OCMSZ_9
  }
  #[doc = "Checks if the value of the field is `OCMSZ_10`"]
  #[inline(always)]
  pub fn is_ocmsz_10(&self) -> bool {
    *self == OCMSZ_A::OCMSZ_10
  }
  #[doc = "Checks if the value of the field is `OCMSZ_11`"]
  #[inline(always)]
  pub fn is_ocmsz_11(&self) -> bool {
    *self == OCMSZ_A::OCMSZ_11
  }
  #[doc = "Checks if the value of the field is `OCMSZ_12`"]
  #[inline(always)]
  pub fn is_ocmsz_12(&self) -> bool {
    *self == OCMSZ_A::OCMSZ_12
  }
  #[doc = "Checks if the value of the field is `OCMSZ_13`"]
  #[inline(always)]
  pub fn is_ocmsz_13(&self) -> bool {
    *self == OCMSZ_A::OCMSZ_13
  }
  #[doc = "Checks if the value of the field is `OCMSZ_14`"]
  #[inline(always)]
  pub fn is_ocmsz_14(&self) -> bool {
    *self == OCMSZ_A::OCMSZ_14
  }
  #[doc = "Checks if the value of the field is `OCMSZ_15`"]
  #[inline(always)]
  pub fn is_ocmsz_15(&self) -> bool {
    *self == OCMSZ_A::OCMSZ_15
  }
}
#[doc = "OCMSZH\n\nValue on reset: 0"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum OCMSZH_A {
  #[doc = "0: OCMEMn is a power-of-2 capacity."]
  OCMSZH_0,
  #[doc = "1: OCMEMn is not a power-of-2, with a capacity is 0.75 * OCMSZ."]
  OCMSZH_1,
}
impl From<OCMSZH_A> for bool {
  #[inline(always)]
  fn from(variant: OCMSZH_A) -> Self {
    match variant {
      OCMSZH_A::OCMSZH_0 => false,
      OCMSZH_A::OCMSZH_1 => true,
    }
  }
}
#[doc = "Reader of field `OCMSZH`"]
pub type OCMSZH_R = crate::R<bool, OCMSZH_A>;
impl OCMSZH_R {
  #[doc = r"Get enumerated values variant"]
  #[inline(always)]
  pub fn variant(&self) -> OCMSZH_A {
    match self.bits {
      false => OCMSZH_A::OCMSZH_0,
      true => OCMSZH_A::OCMSZH_1,
    }
  }
  #[doc = "Checks if the value of the field is `OCMSZH_0`"]
  #[inline(always)]
  pub fn is_ocmszh_0(&self) -> bool {
    *self == OCMSZH_A::OCMSZH_0
  }
  #[doc = "Checks if the value of the field is `OCMSZH_1`"]
  #[inline(always)]
  pub fn is_ocmszh_1(&self) -> bool {
    *self == OCMSZH_A::OCMSZH_1
  }
}
#[doc = "V\n\nValue on reset: 1"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum V_A {
  #[doc = "0: OCMEMn is not present."]
  V_0,
  #[doc = "1: OCMEMn is present."]
  V_1,
}
impl From<V_A> for bool {
  #[inline(always)]
  fn from(variant: V_A) -> Self {
    match variant {
      V_A::V_0 => false,
      V_A::V_1 => true,
    }
  }
}
#[doc = "Reader of field `V`"]
pub type V_R = crate::R<bool, V_A>;
impl V_R {
  #[doc = r"Get enumerated values variant"]
  #[inline(always)]
  pub fn variant(&self) -> V_A {
    match self.bits {
      false => V_A::V_0,
      true => V_A::V_1,
    }
  }
  #[doc = "Checks if the value of the field is `V_0`"]
  #[inline(always)]
  pub fn is_v_0(&self) -> bool {
    *self == V_A::V_0
  }
  #[doc = "Checks if the value of the field is `V_1`"]
  #[inline(always)]
  pub fn is_v_1(&self) -> bool {
    *self == V_A::V_1
  }
}
impl R {
  #[doc = "Bits 4:5 - OCMEM Control Field 1"]
  #[inline(always)]
  pub fn ocm1(&self) -> OCM1_R {
    OCM1_R::new(((self.bits >> 4) & 0x03) as u8)
  }
  #[doc = "Bit 12 - OCMPU"]
  #[inline(always)]
  pub fn ocmpu(&self) -> OCMPU_R {
    OCMPU_R::new(((self.bits >> 12) & 0x01) != 0)
  }
  #[doc = "Bits 13:15 - OCMT"]
  #[inline(always)]
  pub fn ocmt(&self) -> OCMT_R {
    OCMT_R::new(((self.bits >> 13) & 0x07) as u8)
  }
  #[doc = "Bit 16 - RO"]
  #[inline(always)]
  pub fn ro(&self) -> RO_R {
    RO_R::new(((self.bits >> 16) & 0x01) != 0)
  }
  #[doc = "Bits 17:19 - OCMW"]
  #[inline(always)]
  pub fn ocmw(&self) -> OCMW_R {
    OCMW_R::new(((self.bits >> 17) & 0x07) as u8)
  }
  #[doc = "Bits 24:27 - OCMSZ"]
  #[inline(always)]
  pub fn ocmsz(&self) -> OCMSZ_R {
    OCMSZ_R::new(((self.bits >> 24) & 0x0f) as u8)
  }
  #[doc = "Bit 28 - OCMSZH"]
  #[inline(always)]
  pub fn ocmszh(&self) -> OCMSZH_R {
    OCMSZH_R::new(((self.bits >> 28) & 0x01) != 0)
  }
  #[doc = "Bit 31 - V"]
  #[inline(always)]
  pub fn v(&self) -> V_R {
    V_R::new(((self.bits >> 31) & 0x01) != 0)
  }
}
impl W {
  #[doc = "Bits 4:5 - OCMEM Control Field 1"]
  #[inline(always)]
  pub fn ocm1(&mut self) -> OCM1_W {
    OCM1_W { w: self }
  }
  #[doc = "Bit 16 - RO"]
  #[inline(always)]
  pub fn ro(&mut self) -> RO_W {
    RO_W { w: self }
  }
}