mcxa_pac/sgi0/
sgi_auto_mode.rs1#[doc = "Register `sgi_auto_mode` reader"]
2pub type R = crate::R<SgiAutoModeSpec>;
3#[doc = "Register `sgi_auto_mode` writer"]
4pub type W = crate::W<SgiAutoModeSpec>;
5#[doc = "Field `auto_mode_en` reader - auto_start_en"]
6pub type AutoModeEnR = crate::BitReader;
7#[doc = "Field `auto_mode_en` writer - auto_start_en"]
8pub type AutoModeEnW<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `auto_mode_stop` writer - auto_mode_stop"]
10pub type AutoModeStopW<'a, REG> = crate::BitWriter<'a, REG>;
11#[doc = "Field `auto_mode_rsvd1` reader - reserved"]
12pub type AutoModeRsvd1R = crate::FieldReader;
13#[doc = "Field `incr_mode` reader - CTR increment mode"]
14pub type IncrModeR = crate::FieldReader;
15#[doc = "Field `incr_mode` writer - CTR increment mode"]
16pub type IncrModeW<'a, REG> = crate::FieldWriter<'a, REG, 2>;
17#[doc = "Field `auto_mode_rsvd2` reader - reserved"]
18pub type AutoModeRsvd2R = crate::FieldReader;
19#[doc = "Auto mode of operation\n\nValue on reset: 0"]
20#[cfg_attr(feature = "defmt", derive(defmt::Format))]
21#[derive(Clone, Copy, Debug, PartialEq, Eq)]
22#[repr(u8)]
23pub enum Cmd {
24 #[doc = "0: 8'h00 - ECB mode"]
25 Ecb = 0,
26 #[doc = "1: 8'h01 - CTR mode"]
27 Ctr = 1,
28 #[doc = "2: 8'h02 - CBC mode"]
29 Cbc = 2,
30 #[doc = "3: 8'h03 - CBCMAC mode"]
31 Cbcmac = 3,
32 #[doc = "16: 8'h10 - Key Wrap/Unwrap(128 bit key data)"]
33 Kw128 = 16,
34 #[doc = "17: 8'h11 - Key Wrap/Unwrap(256 bit key data)"]
35 Kw256 = 17,
36}
37impl From<Cmd> for u8 {
38 #[inline(always)]
39 fn from(variant: Cmd) -> Self {
40 variant as _
41 }
42}
43impl crate::FieldSpec for Cmd {
44 type Ux = u8;
45}
46impl crate::IsEnum for Cmd {}
47#[doc = "Field `cmd` reader - Auto mode of operation"]
48pub type CmdR = crate::FieldReader<Cmd>;
49impl CmdR {
50 #[doc = "Get enumerated values variant"]
51 #[inline(always)]
52 pub const fn variant(&self) -> Option<Cmd> {
53 match self.bits {
54 0 => Some(Cmd::Ecb),
55 1 => Some(Cmd::Ctr),
56 2 => Some(Cmd::Cbc),
57 3 => Some(Cmd::Cbcmac),
58 16 => Some(Cmd::Kw128),
59 17 => Some(Cmd::Kw256),
60 _ => None,
61 }
62 }
63 #[doc = "8'h00 - ECB mode"]
64 #[inline(always)]
65 pub fn is_ecb(&self) -> bool {
66 *self == Cmd::Ecb
67 }
68 #[doc = "8'h01 - CTR mode"]
69 #[inline(always)]
70 pub fn is_ctr(&self) -> bool {
71 *self == Cmd::Ctr
72 }
73 #[doc = "8'h02 - CBC mode"]
74 #[inline(always)]
75 pub fn is_cbc(&self) -> bool {
76 *self == Cmd::Cbc
77 }
78 #[doc = "8'h03 - CBCMAC mode"]
79 #[inline(always)]
80 pub fn is_cbcmac(&self) -> bool {
81 *self == Cmd::Cbcmac
82 }
83 #[doc = "8'h10 - Key Wrap/Unwrap(128 bit key data)"]
84 #[inline(always)]
85 pub fn is_kw128(&self) -> bool {
86 *self == Cmd::Kw128
87 }
88 #[doc = "8'h11 - Key Wrap/Unwrap(256 bit key data)"]
89 #[inline(always)]
90 pub fn is_kw256(&self) -> bool {
91 *self == Cmd::Kw256
92 }
93}
94#[doc = "Field `cmd` writer - Auto mode of operation"]
95pub type CmdW<'a, REG> = crate::FieldWriter<'a, REG, 8, Cmd>;
96impl<'a, REG> CmdW<'a, REG>
97where
98 REG: crate::Writable + crate::RegisterSpec,
99 REG::Ux: From<u8>,
100{
101 #[doc = "8'h00 - ECB mode"]
102 #[inline(always)]
103 pub fn ecb(self) -> &'a mut crate::W<REG> {
104 self.variant(Cmd::Ecb)
105 }
106 #[doc = "8'h01 - CTR mode"]
107 #[inline(always)]
108 pub fn ctr(self) -> &'a mut crate::W<REG> {
109 self.variant(Cmd::Ctr)
110 }
111 #[doc = "8'h02 - CBC mode"]
112 #[inline(always)]
113 pub fn cbc(self) -> &'a mut crate::W<REG> {
114 self.variant(Cmd::Cbc)
115 }
116 #[doc = "8'h03 - CBCMAC mode"]
117 #[inline(always)]
118 pub fn cbcmac(self) -> &'a mut crate::W<REG> {
119 self.variant(Cmd::Cbcmac)
120 }
121 #[doc = "8'h10 - Key Wrap/Unwrap(128 bit key data)"]
122 #[inline(always)]
123 pub fn kw128(self) -> &'a mut crate::W<REG> {
124 self.variant(Cmd::Kw128)
125 }
126 #[doc = "8'h11 - Key Wrap/Unwrap(256 bit key data)"]
127 #[inline(always)]
128 pub fn kw256(self) -> &'a mut crate::W<REG> {
129 self.variant(Cmd::Kw256)
130 }
131}
132#[doc = "Field `auto_mode_rsvd3` reader - reserved"]
133pub type AutoModeRsvd3R = crate::FieldReader<u16>;
134impl R {
135 #[doc = "Bit 0 - auto_start_en"]
136 #[inline(always)]
137 pub fn auto_mode_en(&self) -> AutoModeEnR {
138 AutoModeEnR::new((self.bits & 1) != 0)
139 }
140 #[doc = "Bits 2:3 - reserved"]
141 #[inline(always)]
142 pub fn auto_mode_rsvd1(&self) -> AutoModeRsvd1R {
143 AutoModeRsvd1R::new(((self.bits >> 2) & 3) as u8)
144 }
145 #[doc = "Bits 4:5 - CTR increment mode"]
146 #[inline(always)]
147 pub fn incr_mode(&self) -> IncrModeR {
148 IncrModeR::new(((self.bits >> 4) & 3) as u8)
149 }
150 #[doc = "Bits 6:7 - reserved"]
151 #[inline(always)]
152 pub fn auto_mode_rsvd2(&self) -> AutoModeRsvd2R {
153 AutoModeRsvd2R::new(((self.bits >> 6) & 3) as u8)
154 }
155 #[doc = "Bits 8:15 - Auto mode of operation"]
156 #[inline(always)]
157 pub fn cmd(&self) -> CmdR {
158 CmdR::new(((self.bits >> 8) & 0xff) as u8)
159 }
160 #[doc = "Bits 16:31 - reserved"]
161 #[inline(always)]
162 pub fn auto_mode_rsvd3(&self) -> AutoModeRsvd3R {
163 AutoModeRsvd3R::new(((self.bits >> 16) & 0xffff) as u16)
164 }
165}
166#[cfg(feature = "debug")]
167impl core::fmt::Debug for R {
168 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
169 f.debug_struct("sgi_auto_mode")
170 .field("auto_mode_en", &self.auto_mode_en())
171 .field("auto_mode_rsvd1", &self.auto_mode_rsvd1())
172 .field("incr_mode", &self.incr_mode())
173 .field("auto_mode_rsvd2", &self.auto_mode_rsvd2())
174 .field("cmd", &self.cmd())
175 .field("auto_mode_rsvd3", &self.auto_mode_rsvd3())
176 .finish()
177 }
178}
179impl W {
180 #[doc = "Bit 0 - auto_start_en"]
181 #[inline(always)]
182 pub fn auto_mode_en(&mut self) -> AutoModeEnW<'_, SgiAutoModeSpec> {
183 AutoModeEnW::new(self, 0)
184 }
185 #[doc = "Bit 1 - auto_mode_stop"]
186 #[inline(always)]
187 pub fn auto_mode_stop(&mut self) -> AutoModeStopW<'_, SgiAutoModeSpec> {
188 AutoModeStopW::new(self, 1)
189 }
190 #[doc = "Bits 4:5 - CTR increment mode"]
191 #[inline(always)]
192 pub fn incr_mode(&mut self) -> IncrModeW<'_, SgiAutoModeSpec> {
193 IncrModeW::new(self, 4)
194 }
195 #[doc = "Bits 8:15 - Auto mode of operation"]
196 #[inline(always)]
197 pub fn cmd(&mut self) -> CmdW<'_, SgiAutoModeSpec> {
198 CmdW::new(self, 8)
199 }
200}
201#[doc = "SGI Auto Mode Control register\n\nYou can [`read`](crate::Reg::read) this register and get [`sgi_auto_mode::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sgi_auto_mode::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
202pub struct SgiAutoModeSpec;
203impl crate::RegisterSpec for SgiAutoModeSpec {
204 type Ux = u32;
205}
206#[doc = "`read()` method returns [`sgi_auto_mode::R`](R) reader structure"]
207impl crate::Readable for SgiAutoModeSpec {}
208#[doc = "`write(|w| ..)` method takes [`sgi_auto_mode::W`](W) writer structure"]
209impl crate::Writable for SgiAutoModeSpec {
210 type Safety = crate::Unsafe;
211}
212#[doc = "`reset()` method sets sgi_auto_mode to value 0"]
213impl crate::Resettable for SgiAutoModeSpec {}