1#![allow(clippy::identity_op)]
21#![allow(clippy::module_inception)]
22#![allow(clippy::derivable_impls)]
23#[allow(unused_imports)]
24use crate::common::sealed;
25#[allow(unused_imports)]
26use crate::common::*;
27#[doc = r"ECC registers"]
28unsafe impl ::core::marker::Send for super::Ecc {}
29unsafe impl ::core::marker::Sync for super::Ecc {}
30impl super::Ecc {
31 #[allow(unused)]
32 #[inline(always)]
33 pub(crate) const fn _svd2pac_as_ptr(&self) -> *mut u8 {
34 self.ptr
35 }
36
37 #[doc = "Command register"]
38 #[inline(always)]
39 pub const fn ecc_command_reg(
40 &self,
41 ) -> &'static crate::common::Reg<self::EccCommandReg_SPEC, crate::common::RW> {
42 unsafe {
43 crate::common::Reg::<self::EccCommandReg_SPEC, crate::common::RW>::from_ptr(
44 self._svd2pac_as_ptr().add(4usize),
45 )
46 }
47 }
48
49 #[doc = "Configuration register"]
50 #[inline(always)]
51 pub const fn ecc_config_reg(
52 &self,
53 ) -> &'static crate::common::Reg<self::EccConfigReg_SPEC, crate::common::RW> {
54 unsafe {
55 crate::common::Reg::<self::EccConfigReg_SPEC, crate::common::RW>::from_ptr(
56 self._svd2pac_as_ptr().add(0usize),
57 )
58 }
59 }
60
61 #[doc = "Control register"]
62 #[inline(always)]
63 pub const fn ecc_control_reg(
64 &self,
65 ) -> &'static crate::common::Reg<self::EccControlReg_SPEC, crate::common::RW> {
66 unsafe {
67 crate::common::Reg::<self::EccControlReg_SPEC, crate::common::RW>::from_ptr(
68 self._svd2pac_as_ptr().add(8usize),
69 )
70 }
71 }
72
73 #[doc = "Status register"]
74 #[inline(always)]
75 pub const fn ecc_status_reg(
76 &self,
77 ) -> &'static crate::common::Reg<self::EccStatusReg_SPEC, crate::common::RW> {
78 unsafe {
79 crate::common::Reg::<self::EccStatusReg_SPEC, crate::common::RW>::from_ptr(
80 self._svd2pac_as_ptr().add(12usize),
81 )
82 }
83 }
84
85 #[doc = "Version register"]
86 #[inline(always)]
87 pub const fn ecc_version_reg(
88 &self,
89 ) -> &'static crate::common::Reg<self::EccVersionReg_SPEC, crate::common::RW> {
90 unsafe {
91 crate::common::Reg::<self::EccVersionReg_SPEC, crate::common::RW>::from_ptr(
92 self._svd2pac_as_ptr().add(16usize),
93 )
94 }
95 }
96}
97#[doc(hidden)]
98#[derive(Copy, Clone, Eq, PartialEq)]
99pub struct EccCommandReg_SPEC;
100impl crate::sealed::RegSpec for EccCommandReg_SPEC {
101 type DataType = u32;
102}
103
104#[doc = "Command register"]
105pub type EccCommandReg = crate::RegValueT<EccCommandReg_SPEC>;
106
107impl EccCommandReg {
108 #[doc = "This bit indicates if the IP has to calculate R mod N for the next operation. This bit must be set to 1 when a new prime number has been programmed. This bit is automatically cleared when R mod N has been calculated.\n\'0\': no effect\n\'1\': forces the IP to re-calculate R mod N"]
109 #[inline(always)]
110 pub fn ecc_calcr2(
111 self,
112 ) -> crate::common::RegisterFieldBool<31, 1, 0, EccCommandReg_SPEC, crate::common::RW> {
113 crate::common::RegisterFieldBool::<31,1,0,EccCommandReg_SPEC,crate::common::RW>::from_register(self,0)
114 }
115
116 #[doc = "Sign of parameter B in equation y2=x3+Ax+B\n\'0\': B is positive\n\'1\': B is negative"]
117 #[inline(always)]
118 pub fn ecc_signb(
119 self,
120 ) -> crate::common::RegisterFieldBool<30, 1, 0, EccCommandReg_SPEC, crate::common::RW> {
121 crate::common::RegisterFieldBool::<30,1,0,EccCommandReg_SPEC,crate::common::RW>::from_register(self,0)
122 }
123
124 #[doc = "Sign of parameter A in equation y2=x3+Ax+B\n\'0\': A is positive\n\'1\': A is negative"]
125 #[inline(always)]
126 pub fn ecc_signa(
127 self,
128 ) -> crate::common::RegisterFieldBool<29, 1, 0, EccCommandReg_SPEC, crate::common::RW> {
129 crate::common::RegisterFieldBool::<29,1,0,EccCommandReg_SPEC,crate::common::RW>::from_register(self,0)
130 }
131
132 #[doc = "This field defines the size (= number of 64-bit double words) of the operands for the current operation. Possible values are limited by the generic parameter g_Log2MaxDataSize that defines the max space allocated or reserved to each operand.\n\nArbitrary Data/Key size from 128 up to 2566 are supported:\n0x02 (02d) -> 128-bit Data/Key size\n0x03 (02d) -> 256-bit Data/Key size\nECC-ECDSA - Prime Field F(p)\n0x03 -> 192-bit (Curve P-192)\n0x04 -> 256-bit (Curves P-224 & P-256)\nECC-ECDSA - Binary Field F(2m)\n0x03 -> 192-bit (Curve K-163)\n0x04 -> 256-bit (Curve K-233)\n- 4 Xers: 0x01, 0x02, 0x4, 0x6 -> 64, 128 & multiples of 128 bits"]
133 #[inline(always)]
134 pub fn ecc_sizeofoperands(
135 self,
136 ) -> crate::common::RegisterField<8, 0xff, 1, 0, u8, u8, EccCommandReg_SPEC, crate::common::RW>
137 {
138 crate::common::RegisterField::<8,0xff,1,0,u8,u8,EccCommandReg_SPEC,crate::common::RW>::from_register(self,0)
139 }
140
141 #[doc = "\'0\': Field is F(p)\n\'1\': Field is F(2m)"]
142 #[inline(always)]
143 pub fn ecc_field(
144 self,
145 ) -> crate::common::RegisterFieldBool<7, 1, 0, EccCommandReg_SPEC, crate::common::RW> {
146 crate::common::RegisterFieldBool::<7,1,0,EccCommandReg_SPEC,crate::common::RW>::from_register(self,0)
147 }
148
149 #[doc = "Primitive Arithmetic Operations F(p) & F(2m)\n\\[6:4\\] = 0x0\n\\[3:0\\] =\n0x0 -> Reserved\n0x1 -> Modular Addition\n0x2 -> Modular Subtraction\n0x3 -> Modular Multiplication (Odd N)\n0x4 -> Modular Reduction (Odd N)\n0x5 -> Modular Division (Odd N)\n0x6 -> Modular Inversion (Odd N)\n0x7 -> Reserved\n0x8 -> Multiplication\n0x9 -> Modular Inversion (Even N)\n0xA -> Modular Reduction (Even N)\nothers -> Reserved\nC = A + B mod N\nC = A - B mod N\nC = A * B mod N\nC = B mod N\nC = A/B mod N\nC = 1/B mod N\nC = A * B\nC = 1/B mod N\nC = B mod N\nHigh-level RSA, CRT & DSA Operations - F(p) only\n(\\[7\\] forced to 0)\n\\[6:4\\] = 0x1\n\\[3:0\\] =\n0x0 -> MulModN\n0x1 -> MulAddN\n0x2 -> ECMQV (part1)\nothers -> Reserved\n\nPrimitive ECC & Check Point Operations F(p) & F(2m)\n\\[6:4\\] = 0x2\n\\[3:0\\] =\n0x0 -> Point Doubling (Projective Coord.)\n0x1 -> ptAdd3\n0x2 -> GenSessionKey\n0x3 -> Check_AB (ECDSA)\n0x4 -> Check_n (ECDSA)\n0x5 -> Check single value less than N\n0x6 -> Check_Point_On_Curve\n0x7-> Reserved\n0x8 -> Curve25519 point multiplication\n0x9 -> Ed25519 Check point on curve\n0xA -> Ed25519 ScalarMult\n0xB -> Ed25519 CheckValid\nothers -> Reserved\n\nHigh-level ECC ECDSA Operations F(p) & F(2m)\n\\[6:4\\] = 0x3\n\\[3:0\\] =\n0x0 -> ECMQV (part 2)\n0x1 -> Verify ZKP\n0x2 -> ECDSA Domain Parameters Validation\nothers -> Reserved\n\n\n\\[6:4\\]=0x4, 0x5, 0x6, 0x7 -> Reserved"]
150 #[inline(always)]
151 pub fn ecc_typeoperation(
152 self,
153 ) -> crate::common::RegisterField<0, 0x7f, 1, 0, u8, u8, EccCommandReg_SPEC, crate::common::RW>
154 {
155 crate::common::RegisterField::<0,0x7f,1,0,u8,u8,EccCommandReg_SPEC,crate::common::RW>::from_register(self,0)
156 }
157}
158impl ::core::default::Default for EccCommandReg {
159 #[inline(always)]
160 fn default() -> EccCommandReg {
161 <crate::RegValueT<EccCommandReg_SPEC> as RegisterValue<_>>::new(0)
162 }
163}
164
165#[doc(hidden)]
166#[derive(Copy, Clone, Eq, PartialEq)]
167pub struct EccConfigReg_SPEC;
168impl crate::sealed::RegSpec for EccConfigReg_SPEC {
169 type DataType = u32;
170}
171
172#[doc = "Configuration register"]
173pub type EccConfigReg = crate::RegValueT<EccConfigReg_SPEC>;
174
175impl EccConfigReg {
176 #[doc = "When executing primitive arithmetic operations, this pointer defines the location where the result will be stored in Memory."]
177 #[inline(always)]
178 pub fn ecc_opptrc(
179 self,
180 ) -> crate::common::RegisterField<16, 0x1f, 1, 0, u8, u8, EccConfigReg_SPEC, crate::common::RW>
181 {
182 crate::common::RegisterField::<16,0x1f,1,0,u8,u8,EccConfigReg_SPEC,crate::common::RW>::from_register(self,0)
183 }
184
185 #[doc = "When executing primitive arithmetic operations, this Pointer defines where operand B is located in memory."]
186 #[inline(always)]
187 pub fn ecc_opptrb(
188 self,
189 ) -> crate::common::RegisterField<8, 0x1f, 1, 0, u8, u8, EccConfigReg_SPEC, crate::common::RW>
190 {
191 crate::common::RegisterField::<8,0x1f,1,0,u8,u8,EccConfigReg_SPEC,crate::common::RW>::from_register(self,0)
192 }
193
194 #[doc = "When executing primitive arithmetic operations, this Pointer defines where operand A is located in memory."]
195 #[inline(always)]
196 pub fn ecc_opptra(
197 self,
198 ) -> crate::common::RegisterField<0, 0x1f, 1, 0, u8, u8, EccConfigReg_SPEC, crate::common::RW>
199 {
200 crate::common::RegisterField::<0,0x1f,1,0,u8,u8,EccConfigReg_SPEC,crate::common::RW>::from_register(self,0)
201 }
202}
203impl ::core::default::Default for EccConfigReg {
204 #[inline(always)]
205 fn default() -> EccConfigReg {
206 <crate::RegValueT<EccConfigReg_SPEC> as RegisterValue<_>>::new(0)
207 }
208}
209
210#[doc(hidden)]
211#[derive(Copy, Clone, Eq, PartialEq)]
212pub struct EccControlReg_SPEC;
213impl crate::sealed::RegSpec for EccControlReg_SPEC {
214 type DataType = u32;
215}
216
217#[doc = "Control register"]
218pub type EccControlReg = crate::RegValueT<EccControlReg_SPEC>;
219
220impl EccControlReg {
221 #[doc = "The Start signal is activated when all data and key inputs have been loaded in the external crypto memory and are available for processing. This signal is active high and is sampled on the rising edge of Clk.\nWhen this signal goes high, the PK Command present in the PK_CommandReg\\[\\] is initiated and executed. The PK_Start signal is ignored when the core is already processing data and is automatically cleared when the operation is finished"]
222 #[inline(always)]
223 pub fn ecc_start(
224 self,
225 ) -> crate::common::RegisterFieldBool<0, 1, 0, EccControlReg_SPEC, crate::common::RW> {
226 crate::common::RegisterFieldBool::<0,1,0,EccControlReg_SPEC,crate::common::RW>::from_register(self,0)
227 }
228}
229impl ::core::default::Default for EccControlReg {
230 #[inline(always)]
231 fn default() -> EccControlReg {
232 <crate::RegValueT<EccControlReg_SPEC> as RegisterValue<_>>::new(0)
233 }
234}
235
236#[doc(hidden)]
237#[derive(Copy, Clone, Eq, PartialEq)]
238pub struct EccStatusReg_SPEC;
239impl crate::sealed::RegSpec for EccStatusReg_SPEC {
240 type DataType = u32;
241}
242
243#[doc = "Status register"]
244pub type EccStatusReg = crate::RegValueT<EccStatusReg_SPEC>;
245
246impl EccStatusReg {
247 #[doc = "This Status Signal indicates that the core is processing data. This signal is active high and goes low when the selected algorithm is finished."]
248 #[inline(always)]
249 pub fn ecc_busy(
250 self,
251 ) -> crate::common::RegisterFieldBool<16, 1, 0, EccStatusReg_SPEC, crate::common::R> {
252 crate::common::RegisterFieldBool::<16,1,0,EccStatusReg_SPEC,crate::common::R>::from_register(self,0)
253 }
254
255 #[doc = "After the Miller-Rabin Primality test, this flag is:\n- set to 0 when the random number under test is probably prime\n- cleared to 1 when the random number under test is composite"]
256 #[inline(always)]
257 pub fn ecc_primalitytestresult(
258 self,
259 ) -> crate::common::RegisterFieldBool<12, 1, 0, EccStatusReg_SPEC, crate::common::R> {
260 crate::common::RegisterFieldBool::<12,1,0,EccStatusReg_SPEC,crate::common::R>::from_register(self,0)
261 }
262
263 #[doc = "This flag is set to 1 when executing a modular inversion (PK_CommandReg\\[3:0\\] = 0x6 or 0x9) if the operand is not invertible."]
264 #[inline(always)]
265 pub fn ecc_notinvertible(
266 self,
267 ) -> crate::common::RegisterFieldBool<11, 1, 0, EccStatusReg_SPEC, crate::common::R> {
268 crate::common::RegisterFieldBool::<11,1,0,EccStatusReg_SPEC,crate::common::R>::from_register(self,0)
269 }
270
271 #[doc = "Status signal set to 1 when parameters A and B are not valid, i.e 4A+ 27B = 0. This flag is updated after execution of the command Check_AB."]
272 #[inline(always)]
273 pub fn ecc_param_ab_notvalid(
274 self,
275 ) -> crate::common::RegisterFieldBool<10, 1, 0, EccStatusReg_SPEC, crate::common::R> {
276 crate::common::RegisterFieldBool::<10,1,0,EccStatusReg_SPEC,crate::common::R>::from_register(self,0)
277 }
278
279 #[doc = "This flag indicates if the signature can be accepted or must be rejected.\nThis flag is set to 1 when the signature is not valid and is updated after execution of the command ECDSA_Generation, ECDSA_Verification, DSA_Generation, DSA_Verification."]
280 #[inline(always)]
281 pub fn ecc_signature_notvalid(
282 self,
283 ) -> crate::common::RegisterFieldBool<9, 1, 0, EccStatusReg_SPEC, crate::common::R> {
284 crate::common::RegisterFieldBool::<9,1,0,EccStatusReg_SPEC,crate::common::R>::from_register(self,0)
285 }
286
287 #[doc = "Status signal set to 1 when Parameter n is not valid.\nThis flag is updated after execution of the command Check_n."]
288 #[inline(always)]
289 pub fn ecc_param_n_notvalid(
290 self,
291 ) -> crate::common::RegisterFieldBool<7, 1, 0, EccStatusReg_SPEC, crate::common::R> {
292 crate::common::RegisterFieldBool::<7,1,0,EccStatusReg_SPEC,crate::common::R>::from_register(self,0)
293 }
294
295 #[doc = "Status signal set to 1 when couple x, y is not valid (i.e. not smaller than the prime).\nThis flag is updated after execution of the command Check_Couple_Less_Prime."]
296 #[inline(always)]
297 pub fn ecc_couple_notvalid(
298 self,
299 ) -> crate::common::RegisterFieldBool<6, 1, 0, EccStatusReg_SPEC, crate::common::R> {
300 crate::common::RegisterFieldBool::<6,1,0,EccStatusReg_SPEC,crate::common::R>::from_register(self,0)
301 }
302
303 #[doc = "Status signal set to 1 when Point Px is at the infinity.\nThis flag is updated after execution of an ECC operation."]
304 #[inline(always)]
305 pub fn ecc_point_px_atinfinity(
306 self,
307 ) -> crate::common::RegisterFieldBool<5, 1, 0, EccStatusReg_SPEC, crate::common::R> {
308 crate::common::RegisterFieldBool::<5,1,0,EccStatusReg_SPEC,crate::common::R>::from_register(self,0)
309 }
310
311 #[doc = "Status signal set to 1 when Point Px is not on the defined EC. This flag is updated after execution of the command Check_Point_OnCurve."]
312 #[inline(always)]
313 pub fn ecc_point_px_notoncurve(
314 self,
315 ) -> crate::common::RegisterFieldBool<4, 1, 0, EccStatusReg_SPEC, crate::common::R> {
316 crate::common::RegisterFieldBool::<4,1,0,EccStatusReg_SPEC,crate::common::R>::from_register(self,0)
317 }
318
319 #[doc = "Address of the last Point detected as Not On Curve, Not Valid or at the infinity."]
320 #[inline(always)]
321 pub fn ecc_fail_address(
322 self,
323 ) -> crate::common::RegisterField<0, 0xf, 1, 0, u8, u8, EccStatusReg_SPEC, crate::common::R>
324 {
325 crate::common::RegisterField::<0,0xf,1,0,u8,u8,EccStatusReg_SPEC,crate::common::R>::from_register(self,0)
326 }
327}
328impl ::core::default::Default for EccStatusReg {
329 #[inline(always)]
330 fn default() -> EccStatusReg {
331 <crate::RegValueT<EccStatusReg_SPEC> as RegisterValue<_>>::new(0)
332 }
333}
334
335#[doc(hidden)]
336#[derive(Copy, Clone, Eq, PartialEq)]
337pub struct EccVersionReg_SPEC;
338impl crate::sealed::RegSpec for EccVersionReg_SPEC {
339 type DataType = u32;
340}
341
342#[doc = "Version register"]
343pub type EccVersionReg = crate::RegValueT<EccVersionReg_SPEC>;
344
345impl EccVersionReg {
346 #[doc = "Version of IP to be read via CPU interface."]
347 #[inline(always)]
348 pub fn ecc_hvn(
349 self,
350 ) -> crate::common::RegisterField<8, 0xff, 1, 0, u8, u8, EccVersionReg_SPEC, crate::common::R>
351 {
352 crate::common::RegisterField::<8,0xff,1,0,u8,u8,EccVersionReg_SPEC,crate::common::R>::from_register(self,0)
353 }
354
355 #[doc = "Version of Crypto code to be read via CPU interface.Note that this should be read before ECC is used since it corrupts its contents."]
356 #[inline(always)]
357 pub fn ecc_svn(
358 self,
359 ) -> crate::common::RegisterField<0, 0xff, 1, 0, u8, u8, EccVersionReg_SPEC, crate::common::R>
360 {
361 crate::common::RegisterField::<0,0xff,1,0,u8,u8,EccVersionReg_SPEC,crate::common::R>::from_register(self,0)
362 }
363}
364impl ::core::default::Default for EccVersionReg {
365 #[inline(always)]
366 fn default() -> EccVersionReg {
367 <crate::RegValueT<EccVersionReg_SPEC> as RegisterValue<_>>::new(1024)
368 }
369}