ra4e2_pac/
crc.rs

1/*
2DISCLAIMER
3This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
4No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
5applicable laws, including copyright laws.
6THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
7OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
8NON-INFRINGEMENT.  ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY
9LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT,
10INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR
11ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
12Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability
13of this software. By using this software, you agree to the additional terms and conditions found by accessing the
14following link:
15http://www.renesas.com/disclaimer
16
17*/
18// Generated from SVD 1.30.00, with svd2pac 0.6.0 on Thu, 24 Jul 2025 04:48:35 +0000
19
20#![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"Cyclic Redundancy Check Calculator"]
28unsafe impl ::core::marker::Send for super::Crc {}
29unsafe impl ::core::marker::Sync for super::Crc {}
30impl super::Crc {
31    #[allow(unused)]
32    #[inline(always)]
33    pub(crate) const fn _svd2pac_as_ptr(&self) -> *mut u8 {
34        self.ptr
35    }
36
37    #[doc = "CRC Control Register 0"]
38    #[inline(always)]
39    pub const fn crccr0(
40        &self,
41    ) -> &'static crate::common::Reg<self::Crccr0_SPEC, crate::common::RW> {
42        unsafe {
43            crate::common::Reg::<self::Crccr0_SPEC, crate::common::RW>::from_ptr(
44                self._svd2pac_as_ptr().add(0usize),
45            )
46        }
47    }
48
49    #[doc = "CRC Data Input Register"]
50    #[inline(always)]
51    pub const fn crcdir(
52        &self,
53    ) -> &'static crate::common::Reg<self::Crcdir_SPEC, crate::common::RW> {
54        unsafe {
55            crate::common::Reg::<self::Crcdir_SPEC, crate::common::RW>::from_ptr(
56                self._svd2pac_as_ptr().add(4usize),
57            )
58        }
59    }
60
61    #[doc = "CRC Data Input Register"]
62    #[inline(always)]
63    pub const fn crcdir_by(
64        &self,
65    ) -> &'static crate::common::Reg<self::CrcdirBy_SPEC, crate::common::RW> {
66        unsafe {
67            crate::common::Reg::<self::CrcdirBy_SPEC, crate::common::RW>::from_ptr(
68                self._svd2pac_as_ptr().add(4usize),
69            )
70        }
71    }
72
73    #[doc = "CRC Data Output Register"]
74    #[inline(always)]
75    pub const fn crcdor(
76        &self,
77    ) -> &'static crate::common::Reg<self::Crcdor_SPEC, crate::common::RW> {
78        unsafe {
79            crate::common::Reg::<self::Crcdor_SPEC, crate::common::RW>::from_ptr(
80                self._svd2pac_as_ptr().add(8usize),
81            )
82        }
83    }
84
85    #[doc = "CRC Data Output Register"]
86    #[inline(always)]
87    pub const fn crcdor_ha(
88        &self,
89    ) -> &'static crate::common::Reg<self::CrcdorHa_SPEC, crate::common::RW> {
90        unsafe {
91            crate::common::Reg::<self::CrcdorHa_SPEC, crate::common::RW>::from_ptr(
92                self._svd2pac_as_ptr().add(8usize),
93            )
94        }
95    }
96
97    #[doc = "CRC Data Output Register"]
98    #[inline(always)]
99    pub const fn crcdor_by(
100        &self,
101    ) -> &'static crate::common::Reg<self::CrcdorBy_SPEC, crate::common::RW> {
102        unsafe {
103            crate::common::Reg::<self::CrcdorBy_SPEC, crate::common::RW>::from_ptr(
104                self._svd2pac_as_ptr().add(8usize),
105            )
106        }
107    }
108}
109#[doc(hidden)]
110#[derive(Copy, Clone, Eq, PartialEq)]
111pub struct Crccr0_SPEC;
112impl crate::sealed::RegSpec for Crccr0_SPEC {
113    type DataType = u8;
114}
115
116#[doc = "CRC Control Register 0"]
117pub type Crccr0 = crate::RegValueT<Crccr0_SPEC>;
118
119impl Crccr0 {
120    #[doc = "CRC Generating Polynomial Switching"]
121    #[inline(always)]
122    pub fn gps(
123        self,
124    ) -> crate::common::RegisterField<
125        0,
126        0x7,
127        1,
128        0,
129        crccr0::Gps,
130        crccr0::Gps,
131        Crccr0_SPEC,
132        crate::common::RW,
133    > {
134        crate::common::RegisterField::<
135            0,
136            0x7,
137            1,
138            0,
139            crccr0::Gps,
140            crccr0::Gps,
141            Crccr0_SPEC,
142            crate::common::RW,
143        >::from_register(self, 0)
144    }
145
146    #[doc = "CRC Calculation Switching"]
147    #[inline(always)]
148    pub fn lms(
149        self,
150    ) -> crate::common::RegisterField<
151        6,
152        0x1,
153        1,
154        0,
155        crccr0::Lms,
156        crccr0::Lms,
157        Crccr0_SPEC,
158        crate::common::RW,
159    > {
160        crate::common::RegisterField::<
161            6,
162            0x1,
163            1,
164            0,
165            crccr0::Lms,
166            crccr0::Lms,
167            Crccr0_SPEC,
168            crate::common::RW,
169        >::from_register(self, 0)
170    }
171
172    #[doc = "CRCDOR/CRCDOR_HA/CRCDOR_BY Register Clear"]
173    #[inline(always)]
174    pub fn dorclr(
175        self,
176    ) -> crate::common::RegisterField<
177        7,
178        0x1,
179        1,
180        0,
181        crccr0::Dorclr,
182        crccr0::Dorclr,
183        Crccr0_SPEC,
184        crate::common::W,
185    > {
186        crate::common::RegisterField::<
187            7,
188            0x1,
189            1,
190            0,
191            crccr0::Dorclr,
192            crccr0::Dorclr,
193            Crccr0_SPEC,
194            crate::common::W,
195        >::from_register(self, 0)
196    }
197}
198impl ::core::default::Default for Crccr0 {
199    #[inline(always)]
200    fn default() -> Crccr0 {
201        <crate::RegValueT<Crccr0_SPEC> as RegisterValue<_>>::new(0)
202    }
203}
204pub mod crccr0 {
205
206    #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
207    pub struct Gps_SPEC;
208    pub type Gps = crate::EnumBitfieldStruct<u8, Gps_SPEC>;
209    impl Gps {
210        #[doc = "8-bit CRC-8 (X8 + X2 + X + 1)"]
211        pub const _001: Self = Self::new(1);
212
213        #[doc = "16-bit CRC-16 (X16 + X15 + X2 + 1)"]
214        pub const _010: Self = Self::new(2);
215
216        #[doc = "16-bit CRC-CCITT (X16 + X12 + X5 + 1)"]
217        pub const _011: Self = Self::new(3);
218
219        #[doc = "32-bit CRC-32 (X32 + X26 + X23 + X22 + X16 + X12 + X11 +X10 + X8 + X7 + X5 + X4 + X2 + X + 1)"]
220        pub const _100: Self = Self::new(4);
221
222        #[doc = "32-bit CRC-32C (X32 + X28 + X27 + X26 + X25 + X23 + X22 + X20 + X19 + X18 + X14 + X13 + X11 + X10 + X9 + X8 + X6 + 1)"]
223        pub const _101: Self = Self::new(5);
224
225        #[doc = "No calculation is executed"]
226        pub const OTHERS: Self = Self::new(0);
227    }
228    #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
229    pub struct Lms_SPEC;
230    pub type Lms = crate::EnumBitfieldStruct<u8, Lms_SPEC>;
231    impl Lms {
232        #[doc = "Generate CRC code for LSB-first communication"]
233        pub const _0: Self = Self::new(0);
234
235        #[doc = "Generate CRC code for MSB-first communication"]
236        pub const _1: Self = Self::new(1);
237    }
238    #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
239    pub struct Dorclr_SPEC;
240    pub type Dorclr = crate::EnumBitfieldStruct<u8, Dorclr_SPEC>;
241    impl Dorclr {
242        #[doc = "No effect"]
243        pub const _0: Self = Self::new(0);
244
245        #[doc = "Clear the CRCDOR/CRCDOR_HA/CRCDOR_BY register"]
246        pub const _1: Self = Self::new(1);
247    }
248}
249#[doc(hidden)]
250#[derive(Copy, Clone, Eq, PartialEq)]
251pub struct Crcdir_SPEC;
252impl crate::sealed::RegSpec for Crcdir_SPEC {
253    type DataType = u32;
254}
255
256#[doc = "CRC Data Input Register"]
257pub type Crcdir = crate::RegValueT<Crcdir_SPEC>;
258
259impl NoBitfieldReg<Crcdir_SPEC> for Crcdir {}
260impl ::core::default::Default for Crcdir {
261    #[inline(always)]
262    fn default() -> Crcdir {
263        <crate::RegValueT<Crcdir_SPEC> as RegisterValue<_>>::new(0)
264    }
265}
266
267#[doc(hidden)]
268#[derive(Copy, Clone, Eq, PartialEq)]
269pub struct CrcdirBy_SPEC;
270impl crate::sealed::RegSpec for CrcdirBy_SPEC {
271    type DataType = u8;
272}
273
274#[doc = "CRC Data Input Register"]
275pub type CrcdirBy = crate::RegValueT<CrcdirBy_SPEC>;
276
277impl NoBitfieldReg<CrcdirBy_SPEC> for CrcdirBy {}
278impl ::core::default::Default for CrcdirBy {
279    #[inline(always)]
280    fn default() -> CrcdirBy {
281        <crate::RegValueT<CrcdirBy_SPEC> as RegisterValue<_>>::new(0)
282    }
283}
284
285#[doc(hidden)]
286#[derive(Copy, Clone, Eq, PartialEq)]
287pub struct Crcdor_SPEC;
288impl crate::sealed::RegSpec for Crcdor_SPEC {
289    type DataType = u32;
290}
291
292#[doc = "CRC Data Output Register"]
293pub type Crcdor = crate::RegValueT<Crcdor_SPEC>;
294
295impl NoBitfieldReg<Crcdor_SPEC> for Crcdor {}
296impl ::core::default::Default for Crcdor {
297    #[inline(always)]
298    fn default() -> Crcdor {
299        <crate::RegValueT<Crcdor_SPEC> as RegisterValue<_>>::new(0)
300    }
301}
302
303#[doc(hidden)]
304#[derive(Copy, Clone, Eq, PartialEq)]
305pub struct CrcdorHa_SPEC;
306impl crate::sealed::RegSpec for CrcdorHa_SPEC {
307    type DataType = u16;
308}
309
310#[doc = "CRC Data Output Register"]
311pub type CrcdorHa = crate::RegValueT<CrcdorHa_SPEC>;
312
313impl NoBitfieldReg<CrcdorHa_SPEC> for CrcdorHa {}
314impl ::core::default::Default for CrcdorHa {
315    #[inline(always)]
316    fn default() -> CrcdorHa {
317        <crate::RegValueT<CrcdorHa_SPEC> as RegisterValue<_>>::new(0)
318    }
319}
320
321#[doc(hidden)]
322#[derive(Copy, Clone, Eq, PartialEq)]
323pub struct CrcdorBy_SPEC;
324impl crate::sealed::RegSpec for CrcdorBy_SPEC {
325    type DataType = u8;
326}
327
328#[doc = "CRC Data Output Register"]
329pub type CrcdorBy = crate::RegValueT<CrcdorBy_SPEC>;
330
331impl NoBitfieldReg<CrcdorBy_SPEC> for CrcdorBy {}
332impl ::core::default::Default for CrcdorBy {
333    #[inline(always)]
334    fn default() -> CrcdorBy {
335        <crate::RegValueT<CrcdorBy_SPEC> as RegisterValue<_>>::new(0)
336    }
337}