stm32l4x2_pac/flash/
sr.rs1#[doc = r" Value read from the register"]
2pub struct R {
3 bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7 bits: u32,
8}
9impl super::SR {
10 #[doc = r" Modifies the contents of the register"]
11 #[inline]
12 pub fn modify<F>(&self, f: F)
13 where
14 for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15 {
16 let bits = self.register.get();
17 let r = R { bits: bits };
18 let mut w = W { bits: bits };
19 f(&r, &mut w);
20 self.register.set(w.bits);
21 }
22 #[doc = r" Reads the contents of the register"]
23 #[inline]
24 pub fn read(&self) -> R {
25 R {
26 bits: self.register.get(),
27 }
28 }
29 #[doc = r" Writes to the register"]
30 #[inline]
31 pub fn write<F>(&self, f: F)
32 where
33 F: FnOnce(&mut W) -> &mut W,
34 {
35 let mut w = W::reset_value();
36 f(&mut w);
37 self.register.set(w.bits);
38 }
39 #[doc = r" Writes the reset value to the register"]
40 #[inline]
41 pub fn reset(&self) {
42 self.write(|w| w)
43 }
44}
45#[doc = r" Value of the field"]
46pub struct EOPR {
47 bits: bool,
48}
49impl EOPR {
50 #[doc = r" Value of the field as raw bits"]
51 #[inline]
52 pub fn bit(&self) -> bool {
53 self.bits
54 }
55 #[doc = r" Returns `true` if the bit is clear (0)"]
56 #[inline]
57 pub fn bit_is_clear(&self) -> bool {
58 !self.bit()
59 }
60 #[doc = r" Returns `true` if the bit is set (1)"]
61 #[inline]
62 pub fn bit_is_set(&self) -> bool {
63 self.bit()
64 }
65}
66#[doc = r" Value of the field"]
67pub struct OPERRR {
68 bits: bool,
69}
70impl OPERRR {
71 #[doc = r" Value of the field as raw bits"]
72 #[inline]
73 pub fn bit(&self) -> bool {
74 self.bits
75 }
76 #[doc = r" Returns `true` if the bit is clear (0)"]
77 #[inline]
78 pub fn bit_is_clear(&self) -> bool {
79 !self.bit()
80 }
81 #[doc = r" Returns `true` if the bit is set (1)"]
82 #[inline]
83 pub fn bit_is_set(&self) -> bool {
84 self.bit()
85 }
86}
87#[doc = r" Value of the field"]
88pub struct PROGERRR {
89 bits: bool,
90}
91impl PROGERRR {
92 #[doc = r" Value of the field as raw bits"]
93 #[inline]
94 pub fn bit(&self) -> bool {
95 self.bits
96 }
97 #[doc = r" Returns `true` if the bit is clear (0)"]
98 #[inline]
99 pub fn bit_is_clear(&self) -> bool {
100 !self.bit()
101 }
102 #[doc = r" Returns `true` if the bit is set (1)"]
103 #[inline]
104 pub fn bit_is_set(&self) -> bool {
105 self.bit()
106 }
107}
108#[doc = r" Value of the field"]
109pub struct WRPERRR {
110 bits: bool,
111}
112impl WRPERRR {
113 #[doc = r" Value of the field as raw bits"]
114 #[inline]
115 pub fn bit(&self) -> bool {
116 self.bits
117 }
118 #[doc = r" Returns `true` if the bit is clear (0)"]
119 #[inline]
120 pub fn bit_is_clear(&self) -> bool {
121 !self.bit()
122 }
123 #[doc = r" Returns `true` if the bit is set (1)"]
124 #[inline]
125 pub fn bit_is_set(&self) -> bool {
126 self.bit()
127 }
128}
129#[doc = r" Value of the field"]
130pub struct PGAERRR {
131 bits: bool,
132}
133impl PGAERRR {
134 #[doc = r" Value of the field as raw bits"]
135 #[inline]
136 pub fn bit(&self) -> bool {
137 self.bits
138 }
139 #[doc = r" Returns `true` if the bit is clear (0)"]
140 #[inline]
141 pub fn bit_is_clear(&self) -> bool {
142 !self.bit()
143 }
144 #[doc = r" Returns `true` if the bit is set (1)"]
145 #[inline]
146 pub fn bit_is_set(&self) -> bool {
147 self.bit()
148 }
149}
150#[doc = r" Value of the field"]
151pub struct SIZERRR {
152 bits: bool,
153}
154impl SIZERRR {
155 #[doc = r" Value of the field as raw bits"]
156 #[inline]
157 pub fn bit(&self) -> bool {
158 self.bits
159 }
160 #[doc = r" Returns `true` if the bit is clear (0)"]
161 #[inline]
162 pub fn bit_is_clear(&self) -> bool {
163 !self.bit()
164 }
165 #[doc = r" Returns `true` if the bit is set (1)"]
166 #[inline]
167 pub fn bit_is_set(&self) -> bool {
168 self.bit()
169 }
170}
171#[doc = r" Value of the field"]
172pub struct PGSERRR {
173 bits: bool,
174}
175impl PGSERRR {
176 #[doc = r" Value of the field as raw bits"]
177 #[inline]
178 pub fn bit(&self) -> bool {
179 self.bits
180 }
181 #[doc = r" Returns `true` if the bit is clear (0)"]
182 #[inline]
183 pub fn bit_is_clear(&self) -> bool {
184 !self.bit()
185 }
186 #[doc = r" Returns `true` if the bit is set (1)"]
187 #[inline]
188 pub fn bit_is_set(&self) -> bool {
189 self.bit()
190 }
191}
192#[doc = r" Value of the field"]
193pub struct MISERRR {
194 bits: bool,
195}
196impl MISERRR {
197 #[doc = r" Value of the field as raw bits"]
198 #[inline]
199 pub fn bit(&self) -> bool {
200 self.bits
201 }
202 #[doc = r" Returns `true` if the bit is clear (0)"]
203 #[inline]
204 pub fn bit_is_clear(&self) -> bool {
205 !self.bit()
206 }
207 #[doc = r" Returns `true` if the bit is set (1)"]
208 #[inline]
209 pub fn bit_is_set(&self) -> bool {
210 self.bit()
211 }
212}
213#[doc = r" Value of the field"]
214pub struct FASTERRR {
215 bits: bool,
216}
217impl FASTERRR {
218 #[doc = r" Value of the field as raw bits"]
219 #[inline]
220 pub fn bit(&self) -> bool {
221 self.bits
222 }
223 #[doc = r" Returns `true` if the bit is clear (0)"]
224 #[inline]
225 pub fn bit_is_clear(&self) -> bool {
226 !self.bit()
227 }
228 #[doc = r" Returns `true` if the bit is set (1)"]
229 #[inline]
230 pub fn bit_is_set(&self) -> bool {
231 self.bit()
232 }
233}
234#[doc = r" Value of the field"]
235pub struct RDERRR {
236 bits: bool,
237}
238impl RDERRR {
239 #[doc = r" Value of the field as raw bits"]
240 #[inline]
241 pub fn bit(&self) -> bool {
242 self.bits
243 }
244 #[doc = r" Returns `true` if the bit is clear (0)"]
245 #[inline]
246 pub fn bit_is_clear(&self) -> bool {
247 !self.bit()
248 }
249 #[doc = r" Returns `true` if the bit is set (1)"]
250 #[inline]
251 pub fn bit_is_set(&self) -> bool {
252 self.bit()
253 }
254}
255#[doc = r" Value of the field"]
256pub struct OPTVERRR {
257 bits: bool,
258}
259impl OPTVERRR {
260 #[doc = r" Value of the field as raw bits"]
261 #[inline]
262 pub fn bit(&self) -> bool {
263 self.bits
264 }
265 #[doc = r" Returns `true` if the bit is clear (0)"]
266 #[inline]
267 pub fn bit_is_clear(&self) -> bool {
268 !self.bit()
269 }
270 #[doc = r" Returns `true` if the bit is set (1)"]
271 #[inline]
272 pub fn bit_is_set(&self) -> bool {
273 self.bit()
274 }
275}
276#[doc = r" Value of the field"]
277pub struct BSYR {
278 bits: bool,
279}
280impl BSYR {
281 #[doc = r" Value of the field as raw bits"]
282 #[inline]
283 pub fn bit(&self) -> bool {
284 self.bits
285 }
286 #[doc = r" Returns `true` if the bit is clear (0)"]
287 #[inline]
288 pub fn bit_is_clear(&self) -> bool {
289 !self.bit()
290 }
291 #[doc = r" Returns `true` if the bit is set (1)"]
292 #[inline]
293 pub fn bit_is_set(&self) -> bool {
294 self.bit()
295 }
296}
297#[doc = r" Proxy"]
298pub struct _EOPW<'a> {
299 w: &'a mut W,
300}
301impl<'a> _EOPW<'a> {
302 #[doc = r" Sets the field bit"]
303 pub fn set_bit(self) -> &'a mut W {
304 self.bit(true)
305 }
306 #[doc = r" Clears the field bit"]
307 pub fn clear_bit(self) -> &'a mut W {
308 self.bit(false)
309 }
310 #[doc = r" Writes raw bits to the field"]
311 #[inline]
312 pub fn bit(self, value: bool) -> &'a mut W {
313 const MASK: bool = true;
314 const OFFSET: u8 = 0;
315 self.w.bits &= !((MASK as u32) << OFFSET);
316 self.w.bits |= ((value & MASK) as u32) << OFFSET;
317 self.w
318 }
319}
320#[doc = r" Proxy"]
321pub struct _OPERRW<'a> {
322 w: &'a mut W,
323}
324impl<'a> _OPERRW<'a> {
325 #[doc = r" Sets the field bit"]
326 pub fn set_bit(self) -> &'a mut W {
327 self.bit(true)
328 }
329 #[doc = r" Clears the field bit"]
330 pub fn clear_bit(self) -> &'a mut W {
331 self.bit(false)
332 }
333 #[doc = r" Writes raw bits to the field"]
334 #[inline]
335 pub fn bit(self, value: bool) -> &'a mut W {
336 const MASK: bool = true;
337 const OFFSET: u8 = 1;
338 self.w.bits &= !((MASK as u32) << OFFSET);
339 self.w.bits |= ((value & MASK) as u32) << OFFSET;
340 self.w
341 }
342}
343#[doc = r" Proxy"]
344pub struct _PROGERRW<'a> {
345 w: &'a mut W,
346}
347impl<'a> _PROGERRW<'a> {
348 #[doc = r" Sets the field bit"]
349 pub fn set_bit(self) -> &'a mut W {
350 self.bit(true)
351 }
352 #[doc = r" Clears the field bit"]
353 pub fn clear_bit(self) -> &'a mut W {
354 self.bit(false)
355 }
356 #[doc = r" Writes raw bits to the field"]
357 #[inline]
358 pub fn bit(self, value: bool) -> &'a mut W {
359 const MASK: bool = true;
360 const OFFSET: u8 = 3;
361 self.w.bits &= !((MASK as u32) << OFFSET);
362 self.w.bits |= ((value & MASK) as u32) << OFFSET;
363 self.w
364 }
365}
366#[doc = r" Proxy"]
367pub struct _WRPERRW<'a> {
368 w: &'a mut W,
369}
370impl<'a> _WRPERRW<'a> {
371 #[doc = r" Sets the field bit"]
372 pub fn set_bit(self) -> &'a mut W {
373 self.bit(true)
374 }
375 #[doc = r" Clears the field bit"]
376 pub fn clear_bit(self) -> &'a mut W {
377 self.bit(false)
378 }
379 #[doc = r" Writes raw bits to the field"]
380 #[inline]
381 pub fn bit(self, value: bool) -> &'a mut W {
382 const MASK: bool = true;
383 const OFFSET: u8 = 4;
384 self.w.bits &= !((MASK as u32) << OFFSET);
385 self.w.bits |= ((value & MASK) as u32) << OFFSET;
386 self.w
387 }
388}
389#[doc = r" Proxy"]
390pub struct _PGAERRW<'a> {
391 w: &'a mut W,
392}
393impl<'a> _PGAERRW<'a> {
394 #[doc = r" Sets the field bit"]
395 pub fn set_bit(self) -> &'a mut W {
396 self.bit(true)
397 }
398 #[doc = r" Clears the field bit"]
399 pub fn clear_bit(self) -> &'a mut W {
400 self.bit(false)
401 }
402 #[doc = r" Writes raw bits to the field"]
403 #[inline]
404 pub fn bit(self, value: bool) -> &'a mut W {
405 const MASK: bool = true;
406 const OFFSET: u8 = 5;
407 self.w.bits &= !((MASK as u32) << OFFSET);
408 self.w.bits |= ((value & MASK) as u32) << OFFSET;
409 self.w
410 }
411}
412#[doc = r" Proxy"]
413pub struct _SIZERRW<'a> {
414 w: &'a mut W,
415}
416impl<'a> _SIZERRW<'a> {
417 #[doc = r" Sets the field bit"]
418 pub fn set_bit(self) -> &'a mut W {
419 self.bit(true)
420 }
421 #[doc = r" Clears the field bit"]
422 pub fn clear_bit(self) -> &'a mut W {
423 self.bit(false)
424 }
425 #[doc = r" Writes raw bits to the field"]
426 #[inline]
427 pub fn bit(self, value: bool) -> &'a mut W {
428 const MASK: bool = true;
429 const OFFSET: u8 = 6;
430 self.w.bits &= !((MASK as u32) << OFFSET);
431 self.w.bits |= ((value & MASK) as u32) << OFFSET;
432 self.w
433 }
434}
435#[doc = r" Proxy"]
436pub struct _PGSERRW<'a> {
437 w: &'a mut W,
438}
439impl<'a> _PGSERRW<'a> {
440 #[doc = r" Sets the field bit"]
441 pub fn set_bit(self) -> &'a mut W {
442 self.bit(true)
443 }
444 #[doc = r" Clears the field bit"]
445 pub fn clear_bit(self) -> &'a mut W {
446 self.bit(false)
447 }
448 #[doc = r" Writes raw bits to the field"]
449 #[inline]
450 pub fn bit(self, value: bool) -> &'a mut W {
451 const MASK: bool = true;
452 const OFFSET: u8 = 7;
453 self.w.bits &= !((MASK as u32) << OFFSET);
454 self.w.bits |= ((value & MASK) as u32) << OFFSET;
455 self.w
456 }
457}
458#[doc = r" Proxy"]
459pub struct _MISERRW<'a> {
460 w: &'a mut W,
461}
462impl<'a> _MISERRW<'a> {
463 #[doc = r" Sets the field bit"]
464 pub fn set_bit(self) -> &'a mut W {
465 self.bit(true)
466 }
467 #[doc = r" Clears the field bit"]
468 pub fn clear_bit(self) -> &'a mut W {
469 self.bit(false)
470 }
471 #[doc = r" Writes raw bits to the field"]
472 #[inline]
473 pub fn bit(self, value: bool) -> &'a mut W {
474 const MASK: bool = true;
475 const OFFSET: u8 = 8;
476 self.w.bits &= !((MASK as u32) << OFFSET);
477 self.w.bits |= ((value & MASK) as u32) << OFFSET;
478 self.w
479 }
480}
481#[doc = r" Proxy"]
482pub struct _FASTERRW<'a> {
483 w: &'a mut W,
484}
485impl<'a> _FASTERRW<'a> {
486 #[doc = r" Sets the field bit"]
487 pub fn set_bit(self) -> &'a mut W {
488 self.bit(true)
489 }
490 #[doc = r" Clears the field bit"]
491 pub fn clear_bit(self) -> &'a mut W {
492 self.bit(false)
493 }
494 #[doc = r" Writes raw bits to the field"]
495 #[inline]
496 pub fn bit(self, value: bool) -> &'a mut W {
497 const MASK: bool = true;
498 const OFFSET: u8 = 9;
499 self.w.bits &= !((MASK as u32) << OFFSET);
500 self.w.bits |= ((value & MASK) as u32) << OFFSET;
501 self.w
502 }
503}
504#[doc = r" Proxy"]
505pub struct _RDERRW<'a> {
506 w: &'a mut W,
507}
508impl<'a> _RDERRW<'a> {
509 #[doc = r" Sets the field bit"]
510 pub fn set_bit(self) -> &'a mut W {
511 self.bit(true)
512 }
513 #[doc = r" Clears the field bit"]
514 pub fn clear_bit(self) -> &'a mut W {
515 self.bit(false)
516 }
517 #[doc = r" Writes raw bits to the field"]
518 #[inline]
519 pub fn bit(self, value: bool) -> &'a mut W {
520 const MASK: bool = true;
521 const OFFSET: u8 = 14;
522 self.w.bits &= !((MASK as u32) << OFFSET);
523 self.w.bits |= ((value & MASK) as u32) << OFFSET;
524 self.w
525 }
526}
527#[doc = r" Proxy"]
528pub struct _OPTVERRW<'a> {
529 w: &'a mut W,
530}
531impl<'a> _OPTVERRW<'a> {
532 #[doc = r" Sets the field bit"]
533 pub fn set_bit(self) -> &'a mut W {
534 self.bit(true)
535 }
536 #[doc = r" Clears the field bit"]
537 pub fn clear_bit(self) -> &'a mut W {
538 self.bit(false)
539 }
540 #[doc = r" Writes raw bits to the field"]
541 #[inline]
542 pub fn bit(self, value: bool) -> &'a mut W {
543 const MASK: bool = true;
544 const OFFSET: u8 = 15;
545 self.w.bits &= !((MASK as u32) << OFFSET);
546 self.w.bits |= ((value & MASK) as u32) << OFFSET;
547 self.w
548 }
549}
550impl R {
551 #[doc = r" Value of the register as raw bits"]
552 #[inline]
553 pub fn bits(&self) -> u32 {
554 self.bits
555 }
556 #[doc = "Bit 0 - End of operation"]
557 #[inline]
558 pub fn eop(&self) -> EOPR {
559 let bits = {
560 const MASK: bool = true;
561 const OFFSET: u8 = 0;
562 ((self.bits >> OFFSET) & MASK as u32) != 0
563 };
564 EOPR { bits }
565 }
566 #[doc = "Bit 1 - Operation error"]
567 #[inline]
568 pub fn operr(&self) -> OPERRR {
569 let bits = {
570 const MASK: bool = true;
571 const OFFSET: u8 = 1;
572 ((self.bits >> OFFSET) & MASK as u32) != 0
573 };
574 OPERRR { bits }
575 }
576 #[doc = "Bit 3 - Programming error"]
577 #[inline]
578 pub fn progerr(&self) -> PROGERRR {
579 let bits = {
580 const MASK: bool = true;
581 const OFFSET: u8 = 3;
582 ((self.bits >> OFFSET) & MASK as u32) != 0
583 };
584 PROGERRR { bits }
585 }
586 #[doc = "Bit 4 - Write protected error"]
587 #[inline]
588 pub fn wrperr(&self) -> WRPERRR {
589 let bits = {
590 const MASK: bool = true;
591 const OFFSET: u8 = 4;
592 ((self.bits >> OFFSET) & MASK as u32) != 0
593 };
594 WRPERRR { bits }
595 }
596 #[doc = "Bit 5 - Programming alignment error"]
597 #[inline]
598 pub fn pgaerr(&self) -> PGAERRR {
599 let bits = {
600 const MASK: bool = true;
601 const OFFSET: u8 = 5;
602 ((self.bits >> OFFSET) & MASK as u32) != 0
603 };
604 PGAERRR { bits }
605 }
606 #[doc = "Bit 6 - Size error"]
607 #[inline]
608 pub fn sizerr(&self) -> SIZERRR {
609 let bits = {
610 const MASK: bool = true;
611 const OFFSET: u8 = 6;
612 ((self.bits >> OFFSET) & MASK as u32) != 0
613 };
614 SIZERRR { bits }
615 }
616 #[doc = "Bit 7 - Programming sequence error"]
617 #[inline]
618 pub fn pgserr(&self) -> PGSERRR {
619 let bits = {
620 const MASK: bool = true;
621 const OFFSET: u8 = 7;
622 ((self.bits >> OFFSET) & MASK as u32) != 0
623 };
624 PGSERRR { bits }
625 }
626 #[doc = "Bit 8 - Fast programming data miss error"]
627 #[inline]
628 pub fn miserr(&self) -> MISERRR {
629 let bits = {
630 const MASK: bool = true;
631 const OFFSET: u8 = 8;
632 ((self.bits >> OFFSET) & MASK as u32) != 0
633 };
634 MISERRR { bits }
635 }
636 #[doc = "Bit 9 - Fast programming error"]
637 #[inline]
638 pub fn fasterr(&self) -> FASTERRR {
639 let bits = {
640 const MASK: bool = true;
641 const OFFSET: u8 = 9;
642 ((self.bits >> OFFSET) & MASK as u32) != 0
643 };
644 FASTERRR { bits }
645 }
646 #[doc = "Bit 14 - PCROP read error"]
647 #[inline]
648 pub fn rderr(&self) -> RDERRR {
649 let bits = {
650 const MASK: bool = true;
651 const OFFSET: u8 = 14;
652 ((self.bits >> OFFSET) & MASK as u32) != 0
653 };
654 RDERRR { bits }
655 }
656 #[doc = "Bit 15 - Option validity error"]
657 #[inline]
658 pub fn optverr(&self) -> OPTVERRR {
659 let bits = {
660 const MASK: bool = true;
661 const OFFSET: u8 = 15;
662 ((self.bits >> OFFSET) & MASK as u32) != 0
663 };
664 OPTVERRR { bits }
665 }
666 #[doc = "Bit 16 - Busy"]
667 #[inline]
668 pub fn bsy(&self) -> BSYR {
669 let bits = {
670 const MASK: bool = true;
671 const OFFSET: u8 = 16;
672 ((self.bits >> OFFSET) & MASK as u32) != 0
673 };
674 BSYR { bits }
675 }
676}
677impl W {
678 #[doc = r" Reset value of the register"]
679 #[inline]
680 pub fn reset_value() -> W {
681 W { bits: 0 }
682 }
683 #[doc = r" Writes raw bits to the register"]
684 #[inline]
685 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
686 self.bits = bits;
687 self
688 }
689 #[doc = "Bit 0 - End of operation"]
690 #[inline]
691 pub fn eop(&mut self) -> _EOPW {
692 _EOPW { w: self }
693 }
694 #[doc = "Bit 1 - Operation error"]
695 #[inline]
696 pub fn operr(&mut self) -> _OPERRW {
697 _OPERRW { w: self }
698 }
699 #[doc = "Bit 3 - Programming error"]
700 #[inline]
701 pub fn progerr(&mut self) -> _PROGERRW {
702 _PROGERRW { w: self }
703 }
704 #[doc = "Bit 4 - Write protected error"]
705 #[inline]
706 pub fn wrperr(&mut self) -> _WRPERRW {
707 _WRPERRW { w: self }
708 }
709 #[doc = "Bit 5 - Programming alignment error"]
710 #[inline]
711 pub fn pgaerr(&mut self) -> _PGAERRW {
712 _PGAERRW { w: self }
713 }
714 #[doc = "Bit 6 - Size error"]
715 #[inline]
716 pub fn sizerr(&mut self) -> _SIZERRW {
717 _SIZERRW { w: self }
718 }
719 #[doc = "Bit 7 - Programming sequence error"]
720 #[inline]
721 pub fn pgserr(&mut self) -> _PGSERRW {
722 _PGSERRW { w: self }
723 }
724 #[doc = "Bit 8 - Fast programming data miss error"]
725 #[inline]
726 pub fn miserr(&mut self) -> _MISERRW {
727 _MISERRW { w: self }
728 }
729 #[doc = "Bit 9 - Fast programming error"]
730 #[inline]
731 pub fn fasterr(&mut self) -> _FASTERRW {
732 _FASTERRW { w: self }
733 }
734 #[doc = "Bit 14 - PCROP read error"]
735 #[inline]
736 pub fn rderr(&mut self) -> _RDERRW {
737 _RDERRW { w: self }
738 }
739 #[doc = "Bit 15 - Option validity error"]
740 #[inline]
741 pub fn optverr(&mut self) -> _OPTVERRW {
742 _OPTVERRW { w: self }
743 }
744}