lpc55s6x_pac/casper/
loader.rs1#[doc = "Reader of register LOADER"]
2pub type R = crate::R<u32, super::LOADER>;
3#[doc = "Writer for register LOADER"]
4pub type W = crate::W<u32, super::LOADER>;
5#[doc = "Register LOADER `reset()`'s with value 0"]
6impl crate::ResetValue for super::LOADER {
7 type Type = u32;
8 #[inline(always)]
9 fn reset_value() -> Self::Type {
10 0
11 }
12}
13#[doc = "Reader of field `COUNT`"]
14pub type COUNT_R = crate::R<u8, u8>;
15#[doc = "Write proxy for field `COUNT`"]
16pub struct COUNT_W<'a> {
17 w: &'a mut W,
18}
19impl<'a> COUNT_W<'a> {
20 #[doc = r"Writes raw bits to the field"]
21 #[inline(always)]
22 pub unsafe fn bits(self, value: u8) -> &'a mut W {
23 self.w.bits = (self.w.bits & !0xff) | ((value as u32) & 0xff);
24 self.w
25 }
26}
27#[doc = "Which bank-pair the offset CTRLOFF is within. This must be 0 if only 2-up. Does not matter which bank is used as this is loaded when not performing an operation.\n\nValue on reset: 0"]
28#[derive(Clone, Copy, Debug, PartialEq)]
29pub enum CTRLBPAIR_A {
30 #[doc = "0: Bank-pair 0 (1st)"]
31 PAIR0 = 0,
32 #[doc = "1: Bank-pair 1 (2nd)"]
33 PAIR1 = 1,
34}
35impl From<CTRLBPAIR_A> for bool {
36 #[inline(always)]
37 fn from(variant: CTRLBPAIR_A) -> Self {
38 variant as u8 != 0
39 }
40}
41#[doc = "Reader of field `CTRLBPAIR`"]
42pub type CTRLBPAIR_R = crate::R<bool, CTRLBPAIR_A>;
43impl CTRLBPAIR_R {
44 #[doc = r"Get enumerated values variant"]
45 #[inline(always)]
46 pub fn variant(&self) -> CTRLBPAIR_A {
47 match self.bits {
48 false => CTRLBPAIR_A::PAIR0,
49 true => CTRLBPAIR_A::PAIR1,
50 }
51 }
52 #[doc = "Checks if the value of the field is `PAIR0`"]
53 #[inline(always)]
54 pub fn is_pair0(&self) -> bool {
55 *self == CTRLBPAIR_A::PAIR0
56 }
57 #[doc = "Checks if the value of the field is `PAIR1`"]
58 #[inline(always)]
59 pub fn is_pair1(&self) -> bool {
60 *self == CTRLBPAIR_A::PAIR1
61 }
62}
63#[doc = "Write proxy for field `CTRLBPAIR`"]
64pub struct CTRLBPAIR_W<'a> {
65 w: &'a mut W,
66}
67impl<'a> CTRLBPAIR_W<'a> {
68 #[doc = r"Writes `variant` to the field"]
69 #[inline(always)]
70 pub fn variant(self, variant: CTRLBPAIR_A) -> &'a mut W {
71 {
72 self.bit(variant.into())
73 }
74 }
75 #[doc = "Bank-pair 0 (1st)"]
76 #[inline(always)]
77 pub fn pair0(self) -> &'a mut W {
78 self.variant(CTRLBPAIR_A::PAIR0)
79 }
80 #[doc = "Bank-pair 1 (2nd)"]
81 #[inline(always)]
82 pub fn pair1(self) -> &'a mut W {
83 self.variant(CTRLBPAIR_A::PAIR1)
84 }
85 #[doc = r"Sets the field bit"]
86 #[inline(always)]
87 pub fn set_bit(self) -> &'a mut W {
88 self.bit(true)
89 }
90 #[doc = r"Clears the field bit"]
91 #[inline(always)]
92 pub fn clear_bit(self) -> &'a mut W {
93 self.bit(false)
94 }
95 #[doc = r"Writes raw bits to the field"]
96 #[inline(always)]
97 pub fn bit(self, value: bool) -> &'a mut W {
98 self.w.bits = (self.w.bits & !(0x01 << 16)) | (((value as u32) & 0x01) << 16);
99 self.w
100 }
101}
102#[doc = "Reader of field `CTRLOFF`"]
103pub type CTRLOFF_R = crate::R<u16, u16>;
104#[doc = "Write proxy for field `CTRLOFF`"]
105pub struct CTRLOFF_W<'a> {
106 w: &'a mut W,
107}
108impl<'a> CTRLOFF_W<'a> {
109 #[doc = r"Writes raw bits to the field"]
110 #[inline(always)]
111 pub unsafe fn bits(self, value: u16) -> &'a mut W {
112 self.w.bits = (self.w.bits & !(0x07ff << 18)) | (((value as u32) & 0x07ff) << 18);
113 self.w
114 }
115}
116impl R {
117 #[doc = "Bits 0:7 - Number of control pairs to load 0 relative (so 1 means load 1). write 1 means Does one op - does not iterate, write N means N control pairs to load"]
118 #[inline(always)]
119 pub fn count(&self) -> COUNT_R {
120 COUNT_R::new((self.bits & 0xff) as u8)
121 }
122 #[doc = "Bit 16 - Which bank-pair the offset CTRLOFF is within. This must be 0 if only 2-up. Does not matter which bank is used as this is loaded when not performing an operation."]
123 #[inline(always)]
124 pub fn ctrlbpair(&self) -> CTRLBPAIR_R {
125 CTRLBPAIR_R::new(((self.bits >> 16) & 0x01) != 0)
126 }
127 #[doc = "Bits 18:28 - DWord Offset of CTRL pair to load next."]
128 #[inline(always)]
129 pub fn ctrloff(&self) -> CTRLOFF_R {
130 CTRLOFF_R::new(((self.bits >> 18) & 0x07ff) as u16)
131 }
132}
133impl W {
134 #[doc = "Bits 0:7 - Number of control pairs to load 0 relative (so 1 means load 1). write 1 means Does one op - does not iterate, write N means N control pairs to load"]
135 #[inline(always)]
136 pub fn count(&mut self) -> COUNT_W {
137 COUNT_W { w: self }
138 }
139 #[doc = "Bit 16 - Which bank-pair the offset CTRLOFF is within. This must be 0 if only 2-up. Does not matter which bank is used as this is loaded when not performing an operation."]
140 #[inline(always)]
141 pub fn ctrlbpair(&mut self) -> CTRLBPAIR_W {
142 CTRLBPAIR_W { w: self }
143 }
144 #[doc = "Bits 18:28 - DWord Offset of CTRL pair to load next."]
145 #[inline(always)]
146 pub fn ctrloff(&mut self) -> CTRLOFF_W {
147 CTRLOFF_W { w: self }
148 }
149}