mcxa_pac/sgi0/
sgi_sha2_ctrl.rs1#[doc = "Register `sgi_sha2_ctrl` reader"]
2pub type R = crate::R<SgiSha2CtrlSpec>;
3#[doc = "Register `sgi_sha2_ctrl` writer"]
4pub type W = crate::W<SgiSha2CtrlSpec>;
5#[doc = "Field `sha2_en` reader - SHA enable"]
6pub type Sha2EnR = crate::BitReader;
7#[doc = "Field `sha2_en` writer - SHA enable"]
8pub type Sha2EnW<'a, REG> = crate::BitWriter<'a, REG>;
9#[doc = "Field `sha2_mode` reader - SHA mode normal or automatic"]
10pub type Sha2ModeR = crate::BitReader;
11#[doc = "Field `sha2_mode` writer - SHA mode normal or automatic"]
12pub type Sha2ModeW<'a, REG> = crate::BitWriter<'a, REG>;
13#[doc = "Field `sha2_size` reader - SHA size 0=224;1=256;2=384;3=512"]
14pub type Sha2SizeR = crate::FieldReader;
15#[doc = "Field `sha2_size` writer - SHA size 0=224;1=256;2=384;3=512"]
16pub type Sha2SizeW<'a, REG> = crate::FieldWriter<'a, REG, 2>;
17#[doc = "Field `sha2_low_lim` reader - SHA FIFO low limit"]
18pub type Sha2LowLimR = crate::FieldReader;
19#[doc = "Field `sha2_low_lim` writer - SHA FIFO low limit"]
20pub type Sha2LowLimW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
21#[doc = "Field `sha2_high_lim` reader - SHA FIFO high limit"]
22pub type Sha2HighLimR = crate::FieldReader;
23#[doc = "Field `sha2_high_lim` writer - SHA FIFO high limit"]
24pub type Sha2HighLimW<'a, REG> = crate::FieldWriter<'a, REG, 4>;
25#[doc = "Field `sha2_count_en` reader - SHA Calculation counter enable"]
26pub type Sha2CountEnR = crate::BitReader;
27#[doc = "Field `sha2_count_en` writer - SHA Calculation counter enable"]
28pub type Sha2CountEnW<'a, REG> = crate::BitWriter<'a, REG>;
29#[doc = "Field `hash_reload` reader - SHA HASH reload"]
30pub type HashReloadR = crate::BitReader;
31#[doc = "Field `hash_reload` writer - SHA HASH reload"]
32pub type HashReloadW<'a, REG> = crate::BitWriter<'a, REG>;
33#[doc = "Field `sha2_stop` writer - STOP SHA AUTO mode"]
34pub type Sha2StopW<'a, REG> = crate::BitWriter<'a, REG>;
35#[doc = "Field `no_auto_init` reader - SHA no automatic HASH initialisation"]
36pub type NoAutoInitR = crate::BitReader;
37#[doc = "Field `no_auto_init` writer - SHA no automatic HASH initialisation"]
38pub type NoAutoInitW<'a, REG> = crate::BitWriter<'a, REG>;
39#[doc = "Field `sha2ctl_rsvd` reader - reserved"]
40pub type Sha2ctlRsvdR = crate::FieldReader<u16>;
41impl R {
42 #[doc = "Bit 0 - SHA enable"]
43 #[inline(always)]
44 pub fn sha2_en(&self) -> Sha2EnR {
45 Sha2EnR::new((self.bits & 1) != 0)
46 }
47 #[doc = "Bit 1 - SHA mode normal or automatic"]
48 #[inline(always)]
49 pub fn sha2_mode(&self) -> Sha2ModeR {
50 Sha2ModeR::new(((self.bits >> 1) & 1) != 0)
51 }
52 #[doc = "Bits 2:3 - SHA size 0=224;1=256;2=384;3=512"]
53 #[inline(always)]
54 pub fn sha2_size(&self) -> Sha2SizeR {
55 Sha2SizeR::new(((self.bits >> 2) & 3) as u8)
56 }
57 #[doc = "Bits 4:7 - SHA FIFO low limit"]
58 #[inline(always)]
59 pub fn sha2_low_lim(&self) -> Sha2LowLimR {
60 Sha2LowLimR::new(((self.bits >> 4) & 0x0f) as u8)
61 }
62 #[doc = "Bits 8:11 - SHA FIFO high limit"]
63 #[inline(always)]
64 pub fn sha2_high_lim(&self) -> Sha2HighLimR {
65 Sha2HighLimR::new(((self.bits >> 8) & 0x0f) as u8)
66 }
67 #[doc = "Bit 12 - SHA Calculation counter enable"]
68 #[inline(always)]
69 pub fn sha2_count_en(&self) -> Sha2CountEnR {
70 Sha2CountEnR::new(((self.bits >> 12) & 1) != 0)
71 }
72 #[doc = "Bit 13 - SHA HASH reload"]
73 #[inline(always)]
74 pub fn hash_reload(&self) -> HashReloadR {
75 HashReloadR::new(((self.bits >> 13) & 1) != 0)
76 }
77 #[doc = "Bit 15 - SHA no automatic HASH initialisation"]
78 #[inline(always)]
79 pub fn no_auto_init(&self) -> NoAutoInitR {
80 NoAutoInitR::new(((self.bits >> 15) & 1) != 0)
81 }
82 #[doc = "Bits 16:31 - reserved"]
83 #[inline(always)]
84 pub fn sha2ctl_rsvd(&self) -> Sha2ctlRsvdR {
85 Sha2ctlRsvdR::new(((self.bits >> 16) & 0xffff) as u16)
86 }
87}
88#[cfg(feature = "debug")]
89impl core::fmt::Debug for R {
90 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
91 f.debug_struct("sgi_sha2_ctrl")
92 .field("sha2_en", &self.sha2_en())
93 .field("sha2_mode", &self.sha2_mode())
94 .field("sha2_size", &self.sha2_size())
95 .field("sha2_low_lim", &self.sha2_low_lim())
96 .field("sha2_high_lim", &self.sha2_high_lim())
97 .field("sha2_count_en", &self.sha2_count_en())
98 .field("hash_reload", &self.hash_reload())
99 .field("no_auto_init", &self.no_auto_init())
100 .field("sha2ctl_rsvd", &self.sha2ctl_rsvd())
101 .finish()
102 }
103}
104impl W {
105 #[doc = "Bit 0 - SHA enable"]
106 #[inline(always)]
107 pub fn sha2_en(&mut self) -> Sha2EnW<'_, SgiSha2CtrlSpec> {
108 Sha2EnW::new(self, 0)
109 }
110 #[doc = "Bit 1 - SHA mode normal or automatic"]
111 #[inline(always)]
112 pub fn sha2_mode(&mut self) -> Sha2ModeW<'_, SgiSha2CtrlSpec> {
113 Sha2ModeW::new(self, 1)
114 }
115 #[doc = "Bits 2:3 - SHA size 0=224;1=256;2=384;3=512"]
116 #[inline(always)]
117 pub fn sha2_size(&mut self) -> Sha2SizeW<'_, SgiSha2CtrlSpec> {
118 Sha2SizeW::new(self, 2)
119 }
120 #[doc = "Bits 4:7 - SHA FIFO low limit"]
121 #[inline(always)]
122 pub fn sha2_low_lim(&mut self) -> Sha2LowLimW<'_, SgiSha2CtrlSpec> {
123 Sha2LowLimW::new(self, 4)
124 }
125 #[doc = "Bits 8:11 - SHA FIFO high limit"]
126 #[inline(always)]
127 pub fn sha2_high_lim(&mut self) -> Sha2HighLimW<'_, SgiSha2CtrlSpec> {
128 Sha2HighLimW::new(self, 8)
129 }
130 #[doc = "Bit 12 - SHA Calculation counter enable"]
131 #[inline(always)]
132 pub fn sha2_count_en(&mut self) -> Sha2CountEnW<'_, SgiSha2CtrlSpec> {
133 Sha2CountEnW::new(self, 12)
134 }
135 #[doc = "Bit 13 - SHA HASH reload"]
136 #[inline(always)]
137 pub fn hash_reload(&mut self) -> HashReloadW<'_, SgiSha2CtrlSpec> {
138 HashReloadW::new(self, 13)
139 }
140 #[doc = "Bit 14 - STOP SHA AUTO mode"]
141 #[inline(always)]
142 pub fn sha2_stop(&mut self) -> Sha2StopW<'_, SgiSha2CtrlSpec> {
143 Sha2StopW::new(self, 14)
144 }
145 #[doc = "Bit 15 - SHA no automatic HASH initialisation"]
146 #[inline(always)]
147 pub fn no_auto_init(&mut self) -> NoAutoInitW<'_, SgiSha2CtrlSpec> {
148 NoAutoInitW::new(self, 15)
149 }
150}
151#[doc = "SHA Control Register\n\nYou can [`read`](crate::Reg::read) this register and get [`sgi_sha2_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_sha2_ctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
152pub struct SgiSha2CtrlSpec;
153impl crate::RegisterSpec for SgiSha2CtrlSpec {
154 type Ux = u32;
155}
156#[doc = "`read()` method returns [`sgi_sha2_ctrl::R`](R) reader structure"]
157impl crate::Readable for SgiSha2CtrlSpec {}
158#[doc = "`write(|w| ..)` method takes [`sgi_sha2_ctrl::W`](W) writer structure"]
159impl crate::Writable for SgiSha2CtrlSpec {
160 type Safety = crate::Unsafe;
161}
162#[doc = "`reset()` method sets sgi_sha2_ctrl to value 0x0f00"]
163impl crate::Resettable for SgiSha2CtrlSpec {
164 const RESET_VALUE: u32 = 0x0f00;
165}