stm32ral/stm32f2/peripherals/
crc.rs

1#![allow(non_snake_case, non_upper_case_globals)]
2#![allow(non_camel_case_types)]
3//! cyclic redundancy check calculation unit
4//!
5//! Used by: stm32f215, stm32f217
6
7use crate::{RWRegister, WORegister};
8#[cfg(not(feature = "nosync"))]
9use core::marker::PhantomData;
10
11/// Data register
12pub mod DR {
13
14    /// Data register bits
15    pub mod DR {
16        /// Offset (0 bits)
17        pub const offset: u32 = 0;
18        /// Mask (32 bits: 0xffffffff << 0)
19        pub const mask: u32 = 0xffffffff << offset;
20        /// Read-only values (empty)
21        pub mod R {}
22        /// Write-only values (empty)
23        pub mod W {}
24        /// Read-write values (empty)
25        pub mod RW {}
26    }
27}
28
29/// Independent data register
30pub mod IDR {
31
32    /// General-purpose 8-bit data register bits
33    pub mod IDR {
34        /// Offset (0 bits)
35        pub const offset: u32 = 0;
36        /// Mask (8 bits: 0xff << 0)
37        pub const mask: u32 = 0xff << offset;
38        /// Read-only values (empty)
39        pub mod R {}
40        /// Write-only values (empty)
41        pub mod W {}
42        /// Read-write values (empty)
43        pub mod RW {}
44    }
45}
46
47/// Control register
48pub mod CR {
49
50    /// reset bit
51    pub mod RESET {
52        /// Offset (0 bits)
53        pub const offset: u32 = 0;
54        /// Mask (1 bit: 1 << 0)
55        pub const mask: u32 = 1 << offset;
56        /// Read-only values (empty)
57        pub mod R {}
58        /// Write-only values
59        pub mod W {
60
61            /// 0b1: Resets the CRC calculation unit and sets the data register to 0xFFFF FFFF
62            pub const Reset: u32 = 0b1;
63        }
64        /// Read-write values (empty)
65        pub mod RW {}
66    }
67}
68#[repr(C)]
69pub struct RegisterBlock {
70    /// Data register
71    pub DR: RWRegister<u32>,
72
73    /// Independent data register
74    pub IDR: RWRegister<u32>,
75
76    /// Control register
77    pub CR: WORegister<u32>,
78}
79pub struct ResetValues {
80    pub DR: u32,
81    pub IDR: u32,
82    pub CR: u32,
83}
84#[cfg(not(feature = "nosync"))]
85pub struct Instance {
86    pub(crate) addr: u32,
87    pub(crate) _marker: PhantomData<*const RegisterBlock>,
88}
89#[cfg(not(feature = "nosync"))]
90impl ::core::ops::Deref for Instance {
91    type Target = RegisterBlock;
92    #[inline(always)]
93    fn deref(&self) -> &RegisterBlock {
94        unsafe { &*(self.addr as *const _) }
95    }
96}
97#[cfg(feature = "rtic")]
98unsafe impl Send for Instance {}