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.4.0 on Sat, 12 Apr 2025 22:15: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    #[doc = "CRC Control Register 0"]
37    #[inline(always)]
38    pub const fn crccr0(
39        &self,
40    ) -> &'static crate::common::Reg<self::Crccr0_SPEC, crate::common::RW> {
41        unsafe {
42            crate::common::Reg::<self::Crccr0_SPEC, crate::common::RW>::from_ptr(
43                self._svd2pac_as_ptr().add(0usize),
44            )
45        }
46    }
47
48    #[doc = "CRC Data Input Register"]
49    #[inline(always)]
50    pub const fn crcdir(
51        &self,
52    ) -> &'static crate::common::Reg<self::Crcdir_SPEC, crate::common::RW> {
53        unsafe {
54            crate::common::Reg::<self::Crcdir_SPEC, crate::common::RW>::from_ptr(
55                self._svd2pac_as_ptr().add(4usize),
56            )
57        }
58    }
59
60    #[doc = "CRC Data Input Register"]
61    #[inline(always)]
62    pub const fn crcdir_by(
63        &self,
64    ) -> &'static crate::common::Reg<self::CrcdirBy_SPEC, crate::common::RW> {
65        unsafe {
66            crate::common::Reg::<self::CrcdirBy_SPEC, crate::common::RW>::from_ptr(
67                self._svd2pac_as_ptr().add(4usize),
68            )
69        }
70    }
71
72    #[doc = "CRC Data Output Register"]
73    #[inline(always)]
74    pub const fn crcdor(
75        &self,
76    ) -> &'static crate::common::Reg<self::Crcdor_SPEC, crate::common::RW> {
77        unsafe {
78            crate::common::Reg::<self::Crcdor_SPEC, crate::common::RW>::from_ptr(
79                self._svd2pac_as_ptr().add(8usize),
80            )
81        }
82    }
83
84    #[doc = "CRC Data Output Register"]
85    #[inline(always)]
86    pub const fn crcdor_ha(
87        &self,
88    ) -> &'static crate::common::Reg<self::CrcdorHa_SPEC, crate::common::RW> {
89        unsafe {
90            crate::common::Reg::<self::CrcdorHa_SPEC, crate::common::RW>::from_ptr(
91                self._svd2pac_as_ptr().add(8usize),
92            )
93        }
94    }
95
96    #[doc = "CRC Data Output Register"]
97    #[inline(always)]
98    pub const fn crcdor_by(
99        &self,
100    ) -> &'static crate::common::Reg<self::CrcdorBy_SPEC, crate::common::RW> {
101        unsafe {
102            crate::common::Reg::<self::CrcdorBy_SPEC, crate::common::RW>::from_ptr(
103                self._svd2pac_as_ptr().add(8usize),
104            )
105        }
106    }
107}
108#[doc(hidden)]
109#[derive(Copy, Clone, Eq, PartialEq)]
110pub struct Crccr0_SPEC;
111impl crate::sealed::RegSpec for Crccr0_SPEC {
112    type DataType = u8;
113}
114#[doc = "CRC Control Register 0"]
115pub type Crccr0 = crate::RegValueT<Crccr0_SPEC>;
116
117impl Crccr0 {
118    #[doc = "CRC Generating Polynomial Switching"]
119    #[inline(always)]
120    pub fn gps(
121        self,
122    ) -> crate::common::RegisterField<0, 0x7, 1, 0, crccr0::Gps, Crccr0_SPEC, crate::common::RW>
123    {
124        crate::common::RegisterField::<0,0x7,1,0,crccr0::Gps, Crccr0_SPEC,crate::common::RW>::from_register(self,0)
125    }
126    #[doc = "CRC Calculation Switching"]
127    #[inline(always)]
128    pub fn lms(
129        self,
130    ) -> crate::common::RegisterField<6, 0x1, 1, 0, crccr0::Lms, Crccr0_SPEC, crate::common::RW>
131    {
132        crate::common::RegisterField::<6,0x1,1,0,crccr0::Lms, Crccr0_SPEC,crate::common::RW>::from_register(self,0)
133    }
134    #[doc = "CRCDOR/CRCDOR_HA/CRCDOR_BY Register Clear"]
135    #[inline(always)]
136    pub fn dorclr(
137        self,
138    ) -> crate::common::RegisterField<7, 0x1, 1, 0, crccr0::Dorclr, Crccr0_SPEC, crate::common::W>
139    {
140        crate::common::RegisterField::<7,0x1,1,0,crccr0::Dorclr, Crccr0_SPEC,crate::common::W>::from_register(self,0)
141    }
142}
143impl ::core::default::Default for Crccr0 {
144    #[inline(always)]
145    fn default() -> Crccr0 {
146        <crate::RegValueT<Crccr0_SPEC> as RegisterValue<_>>::new(0)
147    }
148}
149pub mod crccr0 {
150
151    #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
152    pub struct Gps_SPEC;
153    pub type Gps = crate::EnumBitfieldStruct<u8, Gps_SPEC>;
154    impl Gps {
155        #[doc = "8-bit CRC-8 (X8 + X2 + X + 1)"]
156        pub const _001: Self = Self::new(1);
157        #[doc = "16-bit CRC-16 (X16 + X15 + X2 + 1)"]
158        pub const _010: Self = Self::new(2);
159        #[doc = "16-bit CRC-CCITT (X16 + X12 + X5 + 1)"]
160        pub const _011: Self = Self::new(3);
161        #[doc = "32-bit CRC-32 (X32 + X26 + X23 + X22 + X16 + X12 + X11 +X10 + X8 + X7 + X5 + X4 + X2 + X + 1)"]
162        pub const _100: Self = Self::new(4);
163        #[doc = "32-bit CRC-32C (X32 + X28 + X27 + X26 + X25 + X23 + X22 + X20 + X19 + X18 + X14 + X13 + X11 + X10 + X9 + X8 + X6 + 1)"]
164        pub const _101: Self = Self::new(5);
165        #[doc = "No calculation is executed"]
166        pub const OTHERS: Self = Self::new(0);
167    }
168    #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
169    pub struct Lms_SPEC;
170    pub type Lms = crate::EnumBitfieldStruct<u8, Lms_SPEC>;
171    impl Lms {
172        #[doc = "Generate CRC code for LSB-first communication"]
173        pub const _0: Self = Self::new(0);
174        #[doc = "Generate CRC code for MSB-first communication"]
175        pub const _1: Self = Self::new(1);
176    }
177    #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
178    pub struct Dorclr_SPEC;
179    pub type Dorclr = crate::EnumBitfieldStruct<u8, Dorclr_SPEC>;
180    impl Dorclr {
181        #[doc = "No effect"]
182        pub const _0: Self = Self::new(0);
183        #[doc = "Clear the CRCDOR/CRCDOR_HA/CRCDOR_BY register"]
184        pub const _1: Self = Self::new(1);
185    }
186}
187#[doc(hidden)]
188#[derive(Copy, Clone, Eq, PartialEq)]
189pub struct Crcdir_SPEC;
190impl crate::sealed::RegSpec for Crcdir_SPEC {
191    type DataType = u32;
192}
193#[doc = "CRC Data Input Register"]
194pub type Crcdir = crate::RegValueT<Crcdir_SPEC>;
195
196impl NoBitfieldReg<Crcdir_SPEC> for Crcdir {}
197impl ::core::default::Default for Crcdir {
198    #[inline(always)]
199    fn default() -> Crcdir {
200        <crate::RegValueT<Crcdir_SPEC> as RegisterValue<_>>::new(0)
201    }
202}
203
204#[doc(hidden)]
205#[derive(Copy, Clone, Eq, PartialEq)]
206pub struct CrcdirBy_SPEC;
207impl crate::sealed::RegSpec for CrcdirBy_SPEC {
208    type DataType = u8;
209}
210#[doc = "CRC Data Input Register"]
211pub type CrcdirBy = crate::RegValueT<CrcdirBy_SPEC>;
212
213impl NoBitfieldReg<CrcdirBy_SPEC> for CrcdirBy {}
214impl ::core::default::Default for CrcdirBy {
215    #[inline(always)]
216    fn default() -> CrcdirBy {
217        <crate::RegValueT<CrcdirBy_SPEC> as RegisterValue<_>>::new(0)
218    }
219}
220
221#[doc(hidden)]
222#[derive(Copy, Clone, Eq, PartialEq)]
223pub struct Crcdor_SPEC;
224impl crate::sealed::RegSpec for Crcdor_SPEC {
225    type DataType = u32;
226}
227#[doc = "CRC Data Output Register"]
228pub type Crcdor = crate::RegValueT<Crcdor_SPEC>;
229
230impl NoBitfieldReg<Crcdor_SPEC> for Crcdor {}
231impl ::core::default::Default for Crcdor {
232    #[inline(always)]
233    fn default() -> Crcdor {
234        <crate::RegValueT<Crcdor_SPEC> as RegisterValue<_>>::new(0)
235    }
236}
237
238#[doc(hidden)]
239#[derive(Copy, Clone, Eq, PartialEq)]
240pub struct CrcdorHa_SPEC;
241impl crate::sealed::RegSpec for CrcdorHa_SPEC {
242    type DataType = u16;
243}
244#[doc = "CRC Data Output Register"]
245pub type CrcdorHa = crate::RegValueT<CrcdorHa_SPEC>;
246
247impl NoBitfieldReg<CrcdorHa_SPEC> for CrcdorHa {}
248impl ::core::default::Default for CrcdorHa {
249    #[inline(always)]
250    fn default() -> CrcdorHa {
251        <crate::RegValueT<CrcdorHa_SPEC> as RegisterValue<_>>::new(0)
252    }
253}
254
255#[doc(hidden)]
256#[derive(Copy, Clone, Eq, PartialEq)]
257pub struct CrcdorBy_SPEC;
258impl crate::sealed::RegSpec for CrcdorBy_SPEC {
259    type DataType = u8;
260}
261#[doc = "CRC Data Output Register"]
262pub type CrcdorBy = crate::RegValueT<CrcdorBy_SPEC>;
263
264impl NoBitfieldReg<CrcdorBy_SPEC> for CrcdorBy {}
265impl ::core::default::Default for CrcdorBy {
266    #[inline(always)]
267    fn default() -> CrcdorBy {
268        <crate::RegValueT<CrcdorBy_SPEC> as RegisterValue<_>>::new(0)
269    }
270}