1#[doc = "Register `sgi_ctrl` reader"]
2pub type R = crate::R<SgiCtrlSpec>;
3#[doc = "Register `sgi_ctrl` writer"]
4pub type W = crate::W<SgiCtrlSpec>;
5#[doc = "Field `start` writer - Start crypto operation"]
6pub type StartW<'a, REG> = crate::BitWriter<'a, REG>;
7#[doc = "Field `decrypt` reader - Sets Cipher direction(AES and DES)"]
8pub type DecryptR = crate::BitReader;
9#[doc = "Field `decrypt` writer - Sets Cipher direction(AES and DES)"]
10pub type DecryptW<'a, REG> = crate::BitWriter<'a, REG>;
11#[doc = "Field `aeskeysz` reader - Sets AES key size"]
12pub type AeskeyszR = crate::FieldReader;
13#[doc = "Field `aeskeysz` writer - Sets AES key size"]
14pub type AeskeyszW<'a, REG> = crate::FieldWriter<'a, REG, 2>;
15#[doc = "Field `crypto_op` reader - Sets 'Crypto Operation' type"]
16pub type CryptoOpR = crate::FieldReader;
17#[doc = "Field `crypto_op` writer - Sets 'Crypto Operation' type"]
18pub type CryptoOpW<'a, REG> = crate::FieldWriter<'a, REG, 3>;
19#[doc = "Field `insel` reader - 4'b0000 - DATIN\\[0\\]"]
20pub type InselR = crate::FieldReader;
21#[doc = "Field `insel` writer - 4'b0000 - DATIN\\[0\\]"]
22pub type InselW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
23#[doc = "Field `outsel` reader - 3'b000 - DATOUT = 'Kernel Res'"]
24pub type OutselR = crate::FieldReader;
25#[doc = "Field `outsel` writer - 3'b000 - DATOUT = 'Kernel Res'"]
26pub type OutselW<'a, REG> = crate::FieldWriter<'a, REG, 3>;
27#[doc = "Field `datout_res` reader - Kernels data out options"]
28pub type DatoutResR = crate::FieldReader;
29#[doc = "Field `datout_res` writer - Kernels data out options"]
30pub type DatoutResW<'a, REG> = crate::FieldWriter<'a, REG, 2>;
31#[doc = "Field `aes_en` reader - AES Kernel Enable"]
32pub type AesEnR = crate::BitReader;
33#[doc = "Field `aes_en` writer - AES Kernel Enable"]
34pub type AesEnW<'a, REG> = crate::BitWriter<'a, REG>;
35#[doc = "Field `des_en` reader - DES Kernel Enable"]
36pub type DesEnR = crate::BitReader;
37#[doc = "Field `des_en` writer - DES Kernel Enable"]
38pub type DesEnW<'a, REG> = crate::BitWriter<'a, REG>;
39#[doc = "Field `gcm_en` reader - GFMUL Kernel Enable"]
40pub type GcmEnR = crate::BitReader;
41#[doc = "Field `gcm_en` writer - GFMUL Kernel Enable"]
42pub type GcmEnW<'a, REG> = crate::BitWriter<'a, REG>;
43#[doc = "Field `prng_en` reader - PRNG Enable(only if SGI has internal PRNG, Please"]
44pub type PrngEnR = crate::BitReader;
45#[doc = "Field `prng_en` writer - PRNG Enable(only if SGI has internal PRNG, Please"]
46pub type PrngEnW<'a, REG> = crate::BitWriter<'a, REG>;
47#[doc = "Field `inkeysel` reader - Input key selection"]
48pub type InkeyselR = crate::FieldReader;
49#[doc = "Field `inkeysel` writer - Input key selection"]
50pub type InkeyselW<'a, REG> = crate::FieldWriter<'a, REG, 5>;
51#[doc = "Field `tdeskey` reader - Triple-DES Key Configuration"]
52pub type TdeskeyR = crate::BitReader;
53#[doc = "Field `tdeskey` writer - Triple-DES Key Configuration"]
54pub type TdeskeyW<'a, REG> = crate::BitWriter<'a, REG>;
55#[doc = "Field `aes_no_kl` reader - AES No decryption key schedule"]
56pub type AesNoKlR = crate::BitReader;
57#[doc = "Field `aes_no_kl` writer - AES No decryption key schedule"]
58pub type AesNoKlW<'a, REG> = crate::BitWriter<'a, REG>;
59#[doc = "Field `aes_sel` reader - AES Dual Selection"]
60pub type AesSelR = crate::BitReader;
61#[doc = "Field `aes_sel` writer - AES Dual Selection"]
62pub type AesSelW<'a, REG> = crate::BitWriter<'a, REG>;
63#[doc = "Field `ctrl_rsvd` reader - reserved"]
64pub type CtrlRsvdR = crate::FieldReader;
65impl R {
66 #[doc = "Bit 1 - Sets Cipher direction(AES and DES)"]
67 #[inline(always)]
68 pub fn decrypt(&self) -> DecryptR {
69 DecryptR::new(((self.bits >> 1) & 1) != 0)
70 }
71 #[doc = "Bits 2:3 - Sets AES key size"]
72 #[inline(always)]
73 pub fn aeskeysz(&self) -> AeskeyszR {
74 AeskeyszR::new(((self.bits >> 2) & 3) as u8)
75 }
76 #[doc = "Bits 4:6 - Sets 'Crypto Operation' type"]
77 #[inline(always)]
78 pub fn crypto_op(&self) -> CryptoOpR {
79 CryptoOpR::new(((self.bits >> 4) & 7) as u8)
80 }
81 #[doc = "Bits 7:10 - 4'b0000 - DATIN\\[0\\]"]
82 #[inline(always)]
83 pub fn insel(&self) -> InselR {
84 InselR::new(((self.bits >> 7) & 0x0f) as u8)
85 }
86 #[doc = "Bits 11:13 - 3'b000 - DATOUT = 'Kernel Res'"]
87 #[inline(always)]
88 pub fn outsel(&self) -> OutselR {
89 OutselR::new(((self.bits >> 11) & 7) as u8)
90 }
91 #[doc = "Bits 14:15 - Kernels data out options"]
92 #[inline(always)]
93 pub fn datout_res(&self) -> DatoutResR {
94 DatoutResR::new(((self.bits >> 14) & 3) as u8)
95 }
96 #[doc = "Bit 16 - AES Kernel Enable"]
97 #[inline(always)]
98 pub fn aes_en(&self) -> AesEnR {
99 AesEnR::new(((self.bits >> 16) & 1) != 0)
100 }
101 #[doc = "Bit 17 - DES Kernel Enable"]
102 #[inline(always)]
103 pub fn des_en(&self) -> DesEnR {
104 DesEnR::new(((self.bits >> 17) & 1) != 0)
105 }
106 #[doc = "Bit 18 - GFMUL Kernel Enable"]
107 #[inline(always)]
108 pub fn gcm_en(&self) -> GcmEnR {
109 GcmEnR::new(((self.bits >> 18) & 1) != 0)
110 }
111 #[doc = "Bit 19 - PRNG Enable(only if SGI has internal PRNG, Please"]
112 #[inline(always)]
113 pub fn prng_en(&self) -> PrngEnR {
114 PrngEnR::new(((self.bits >> 19) & 1) != 0)
115 }
116 #[doc = "Bits 20:24 - Input key selection"]
117 #[inline(always)]
118 pub fn inkeysel(&self) -> InkeyselR {
119 InkeyselR::new(((self.bits >> 20) & 0x1f) as u8)
120 }
121 #[doc = "Bit 25 - Triple-DES Key Configuration"]
122 #[inline(always)]
123 pub fn tdeskey(&self) -> TdeskeyR {
124 TdeskeyR::new(((self.bits >> 25) & 1) != 0)
125 }
126 #[doc = "Bit 26 - AES No decryption key schedule"]
127 #[inline(always)]
128 pub fn aes_no_kl(&self) -> AesNoKlR {
129 AesNoKlR::new(((self.bits >> 26) & 1) != 0)
130 }
131 #[doc = "Bit 27 - AES Dual Selection"]
132 #[inline(always)]
133 pub fn aes_sel(&self) -> AesSelR {
134 AesSelR::new(((self.bits >> 27) & 1) != 0)
135 }
136 #[doc = "Bits 28:31 - reserved"]
137 #[inline(always)]
138 pub fn ctrl_rsvd(&self) -> CtrlRsvdR {
139 CtrlRsvdR::new(((self.bits >> 28) & 0x0f) as u8)
140 }
141}
142#[cfg(feature = "debug")]
143impl core::fmt::Debug for R {
144 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
145 f.debug_struct("sgi_ctrl")
146 .field("decrypt", &self.decrypt())
147 .field("aeskeysz", &self.aeskeysz())
148 .field("crypto_op", &self.crypto_op())
149 .field("insel", &self.insel())
150 .field("outsel", &self.outsel())
151 .field("datout_res", &self.datout_res())
152 .field("aes_en", &self.aes_en())
153 .field("des_en", &self.des_en())
154 .field("gcm_en", &self.gcm_en())
155 .field("prng_en", &self.prng_en())
156 .field("inkeysel", &self.inkeysel())
157 .field("tdeskey", &self.tdeskey())
158 .field("aes_no_kl", &self.aes_no_kl())
159 .field("aes_sel", &self.aes_sel())
160 .field("ctrl_rsvd", &self.ctrl_rsvd())
161 .finish()
162 }
163}
164impl W {
165 #[doc = "Bit 0 - Start crypto operation"]
166 #[inline(always)]
167 pub fn start(&mut self) -> StartW<'_, SgiCtrlSpec> {
168 StartW::new(self, 0)
169 }
170 #[doc = "Bit 1 - Sets Cipher direction(AES and DES)"]
171 #[inline(always)]
172 pub fn decrypt(&mut self) -> DecryptW<'_, SgiCtrlSpec> {
173 DecryptW::new(self, 1)
174 }
175 #[doc = "Bits 2:3 - Sets AES key size"]
176 #[inline(always)]
177 pub fn aeskeysz(&mut self) -> AeskeyszW<'_, SgiCtrlSpec> {
178 AeskeyszW::new(self, 2)
179 }
180 #[doc = "Bits 4:6 - Sets 'Crypto Operation' type"]
181 #[inline(always)]
182 pub fn crypto_op(&mut self) -> CryptoOpW<'_, SgiCtrlSpec> {
183 CryptoOpW::new(self, 4)
184 }
185 #[doc = "Bits 7:10 - 4'b0000 - DATIN\\[0\\]"]
186 #[inline(always)]
187 pub fn insel(&mut self) -> InselW<'_, SgiCtrlSpec> {
188 InselW::new(self, 7)
189 }
190 #[doc = "Bits 11:13 - 3'b000 - DATOUT = 'Kernel Res'"]
191 #[inline(always)]
192 pub fn outsel(&mut self) -> OutselW<'_, SgiCtrlSpec> {
193 OutselW::new(self, 11)
194 }
195 #[doc = "Bits 14:15 - Kernels data out options"]
196 #[inline(always)]
197 pub fn datout_res(&mut self) -> DatoutResW<'_, SgiCtrlSpec> {
198 DatoutResW::new(self, 14)
199 }
200 #[doc = "Bit 16 - AES Kernel Enable"]
201 #[inline(always)]
202 pub fn aes_en(&mut self) -> AesEnW<'_, SgiCtrlSpec> {
203 AesEnW::new(self, 16)
204 }
205 #[doc = "Bit 17 - DES Kernel Enable"]
206 #[inline(always)]
207 pub fn des_en(&mut self) -> DesEnW<'_, SgiCtrlSpec> {
208 DesEnW::new(self, 17)
209 }
210 #[doc = "Bit 18 - GFMUL Kernel Enable"]
211 #[inline(always)]
212 pub fn gcm_en(&mut self) -> GcmEnW<'_, SgiCtrlSpec> {
213 GcmEnW::new(self, 18)
214 }
215 #[doc = "Bit 19 - PRNG Enable(only if SGI has internal PRNG, Please"]
216 #[inline(always)]
217 pub fn prng_en(&mut self) -> PrngEnW<'_, SgiCtrlSpec> {
218 PrngEnW::new(self, 19)
219 }
220 #[doc = "Bits 20:24 - Input key selection"]
221 #[inline(always)]
222 pub fn inkeysel(&mut self) -> InkeyselW<'_, SgiCtrlSpec> {
223 InkeyselW::new(self, 20)
224 }
225 #[doc = "Bit 25 - Triple-DES Key Configuration"]
226 #[inline(always)]
227 pub fn tdeskey(&mut self) -> TdeskeyW<'_, SgiCtrlSpec> {
228 TdeskeyW::new(self, 25)
229 }
230 #[doc = "Bit 26 - AES No decryption key schedule"]
231 #[inline(always)]
232 pub fn aes_no_kl(&mut self) -> AesNoKlW<'_, SgiCtrlSpec> {
233 AesNoKlW::new(self, 26)
234 }
235 #[doc = "Bit 27 - AES Dual Selection"]
236 #[inline(always)]
237 pub fn aes_sel(&mut self) -> AesSelW<'_, SgiCtrlSpec> {
238 AesSelW::new(self, 27)
239 }
240}
241#[doc = "SGI Control register\n\nYou can [`read`](crate::Reg::read) this register and get [`sgi_ctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`sgi_ctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
242pub struct SgiCtrlSpec;
243impl crate::RegisterSpec for SgiCtrlSpec {
244 type Ux = u32;
245}
246#[doc = "`read()` method returns [`sgi_ctrl::R`](R) reader structure"]
247impl crate::Readable for SgiCtrlSpec {}
248#[doc = "`write(|w| ..)` method takes [`sgi_ctrl::W`](W) writer structure"]
249impl crate::Writable for SgiCtrlSpec {
250 type Safety = crate::Unsafe;
251}
252#[doc = "`reset()` method sets sgi_ctrl to value 0"]
253impl crate::Resettable for SgiCtrlSpec {}