ra2e2_pac/
wdt.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.40.00, with svd2pac 0.6.0 on Thu, 24 Jul 2025 04:46:37 +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"Watchdog Timer"]
28unsafe impl ::core::marker::Send for super::Wdt {}
29unsafe impl ::core::marker::Sync for super::Wdt {}
30impl super::Wdt {
31    #[allow(unused)]
32    #[inline(always)]
33    pub(crate) const fn _svd2pac_as_ptr(&self) -> *mut u8 {
34        self.ptr
35    }
36
37    #[doc = "WDT Refresh Register"]
38    #[inline(always)]
39    pub const fn wdtrr(&self) -> &'static crate::common::Reg<self::Wdtrr_SPEC, crate::common::RW> {
40        unsafe {
41            crate::common::Reg::<self::Wdtrr_SPEC, crate::common::RW>::from_ptr(
42                self._svd2pac_as_ptr().add(0usize),
43            )
44        }
45    }
46
47    #[doc = "WDT Control Register"]
48    #[inline(always)]
49    pub const fn wdtcr(&self) -> &'static crate::common::Reg<self::Wdtcr_SPEC, crate::common::RW> {
50        unsafe {
51            crate::common::Reg::<self::Wdtcr_SPEC, crate::common::RW>::from_ptr(
52                self._svd2pac_as_ptr().add(2usize),
53            )
54        }
55    }
56
57    #[doc = "WDT Status Register"]
58    #[inline(always)]
59    pub const fn wdtsr(&self) -> &'static crate::common::Reg<self::Wdtsr_SPEC, crate::common::RW> {
60        unsafe {
61            crate::common::Reg::<self::Wdtsr_SPEC, crate::common::RW>::from_ptr(
62                self._svd2pac_as_ptr().add(4usize),
63            )
64        }
65    }
66
67    #[doc = "WDT Reset Control Register"]
68    #[inline(always)]
69    pub const fn wdtrcr(
70        &self,
71    ) -> &'static crate::common::Reg<self::Wdtrcr_SPEC, crate::common::RW> {
72        unsafe {
73            crate::common::Reg::<self::Wdtrcr_SPEC, crate::common::RW>::from_ptr(
74                self._svd2pac_as_ptr().add(6usize),
75            )
76        }
77    }
78
79    #[doc = "WDT Count Stop Control Register"]
80    #[inline(always)]
81    pub const fn wdtcstpr(
82        &self,
83    ) -> &'static crate::common::Reg<self::Wdtcstpr_SPEC, crate::common::RW> {
84        unsafe {
85            crate::common::Reg::<self::Wdtcstpr_SPEC, crate::common::RW>::from_ptr(
86                self._svd2pac_as_ptr().add(8usize),
87            )
88        }
89    }
90}
91#[doc(hidden)]
92#[derive(Copy, Clone, Eq, PartialEq)]
93pub struct Wdtrr_SPEC;
94impl crate::sealed::RegSpec for Wdtrr_SPEC {
95    type DataType = u8;
96}
97
98#[doc = "WDT Refresh Register"]
99pub type Wdtrr = crate::RegValueT<Wdtrr_SPEC>;
100
101impl NoBitfieldReg<Wdtrr_SPEC> for Wdtrr {}
102impl ::core::default::Default for Wdtrr {
103    #[inline(always)]
104    fn default() -> Wdtrr {
105        <crate::RegValueT<Wdtrr_SPEC> as RegisterValue<_>>::new(255)
106    }
107}
108
109#[doc(hidden)]
110#[derive(Copy, Clone, Eq, PartialEq)]
111pub struct Wdtcr_SPEC;
112impl crate::sealed::RegSpec for Wdtcr_SPEC {
113    type DataType = u16;
114}
115
116#[doc = "WDT Control Register"]
117pub type Wdtcr = crate::RegValueT<Wdtcr_SPEC>;
118
119impl Wdtcr {
120    #[doc = "Timeout Period Select"]
121    #[inline(always)]
122    pub fn tops(
123        self,
124    ) -> crate::common::RegisterField<
125        0,
126        0x3,
127        1,
128        0,
129        wdtcr::Tops,
130        wdtcr::Tops,
131        Wdtcr_SPEC,
132        crate::common::RW,
133    > {
134        crate::common::RegisterField::<
135            0,
136            0x3,
137            1,
138            0,
139            wdtcr::Tops,
140            wdtcr::Tops,
141            Wdtcr_SPEC,
142            crate::common::RW,
143        >::from_register(self, 0)
144    }
145
146    #[doc = "Clock Division Ratio Select"]
147    #[inline(always)]
148    pub fn cks(
149        self,
150    ) -> crate::common::RegisterField<
151        4,
152        0xf,
153        1,
154        0,
155        wdtcr::Cks,
156        wdtcr::Cks,
157        Wdtcr_SPEC,
158        crate::common::RW,
159    > {
160        crate::common::RegisterField::<
161            4,
162            0xf,
163            1,
164            0,
165            wdtcr::Cks,
166            wdtcr::Cks,
167            Wdtcr_SPEC,
168            crate::common::RW,
169        >::from_register(self, 0)
170    }
171
172    #[doc = "Window End Position Select"]
173    #[inline(always)]
174    pub fn rpes(
175        self,
176    ) -> crate::common::RegisterField<
177        8,
178        0x3,
179        1,
180        0,
181        wdtcr::Rpes,
182        wdtcr::Rpes,
183        Wdtcr_SPEC,
184        crate::common::RW,
185    > {
186        crate::common::RegisterField::<
187            8,
188            0x3,
189            1,
190            0,
191            wdtcr::Rpes,
192            wdtcr::Rpes,
193            Wdtcr_SPEC,
194            crate::common::RW,
195        >::from_register(self, 0)
196    }
197
198    #[doc = "Window Start Position Select"]
199    #[inline(always)]
200    pub fn rpss(
201        self,
202    ) -> crate::common::RegisterField<
203        12,
204        0x3,
205        1,
206        0,
207        wdtcr::Rpss,
208        wdtcr::Rpss,
209        Wdtcr_SPEC,
210        crate::common::RW,
211    > {
212        crate::common::RegisterField::<
213            12,
214            0x3,
215            1,
216            0,
217            wdtcr::Rpss,
218            wdtcr::Rpss,
219            Wdtcr_SPEC,
220            crate::common::RW,
221        >::from_register(self, 0)
222    }
223}
224impl ::core::default::Default for Wdtcr {
225    #[inline(always)]
226    fn default() -> Wdtcr {
227        <crate::RegValueT<Wdtcr_SPEC> as RegisterValue<_>>::new(13299)
228    }
229}
230pub mod wdtcr {
231
232    #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
233    pub struct Tops_SPEC;
234    pub type Tops = crate::EnumBitfieldStruct<u8, Tops_SPEC>;
235    impl Tops {
236        #[doc = "1024 cycles (0x03FF)"]
237        pub const _00: Self = Self::new(0);
238
239        #[doc = "4096 cycles (0x0FFF)"]
240        pub const _01: Self = Self::new(1);
241
242        #[doc = "8192 cycles (0x1FFF)"]
243        pub const _10: Self = Self::new(2);
244
245        #[doc = "16384 cycles (0x3FFF)"]
246        pub const _11: Self = Self::new(3);
247    }
248    #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
249    pub struct Cks_SPEC;
250    pub type Cks = crate::EnumBitfieldStruct<u8, Cks_SPEC>;
251    impl Cks {
252        #[doc = "PCLKB/4"]
253        pub const _0_X_1: Self = Self::new(1);
254
255        #[doc = "PCLKB/64"]
256        pub const _0_X_4: Self = Self::new(4);
257
258        #[doc = "PCLKB/128"]
259        pub const _0_X_F: Self = Self::new(15);
260
261        #[doc = "PCLKB/512"]
262        pub const _0_X_6: Self = Self::new(6);
263
264        #[doc = "PCLKB/2048"]
265        pub const _0_X_7: Self = Self::new(7);
266
267        #[doc = "PCLKB/8192"]
268        pub const _0_X_8: Self = Self::new(8);
269
270        #[doc = "Setting prohibited"]
271        pub const OTHERS: Self = Self::new(0);
272    }
273    #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
274    pub struct Rpes_SPEC;
275    pub type Rpes = crate::EnumBitfieldStruct<u8, Rpes_SPEC>;
276    impl Rpes {
277        #[doc = "75%"]
278        pub const _00: Self = Self::new(0);
279
280        #[doc = "50%"]
281        pub const _01: Self = Self::new(1);
282
283        #[doc = "25%"]
284        pub const _10: Self = Self::new(2);
285
286        #[doc = "0% (do not specify window end position)."]
287        pub const _11: Self = Self::new(3);
288    }
289    #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
290    pub struct Rpss_SPEC;
291    pub type Rpss = crate::EnumBitfieldStruct<u8, Rpss_SPEC>;
292    impl Rpss {
293        #[doc = "25%"]
294        pub const _00: Self = Self::new(0);
295
296        #[doc = "50%"]
297        pub const _01: Self = Self::new(1);
298
299        #[doc = "75%"]
300        pub const _10: Self = Self::new(2);
301
302        #[doc = "100% (do not specify window start position)."]
303        pub const _11: Self = Self::new(3);
304    }
305}
306#[doc(hidden)]
307#[derive(Copy, Clone, Eq, PartialEq)]
308pub struct Wdtsr_SPEC;
309impl crate::sealed::RegSpec for Wdtsr_SPEC {
310    type DataType = u16;
311}
312
313#[doc = "WDT Status Register"]
314pub type Wdtsr = crate::RegValueT<Wdtsr_SPEC>;
315
316impl Wdtsr {
317    #[doc = "Down-Counter Value"]
318    #[inline(always)]
319    pub fn cntval(
320        self,
321    ) -> crate::common::RegisterField<0, 0x3fff, 1, 0, u16, u16, Wdtsr_SPEC, crate::common::R> {
322        crate::common::RegisterField::<0,0x3fff,1,0,u16,u16,Wdtsr_SPEC,crate::common::R>::from_register(self,0)
323    }
324
325    #[doc = "Underflow Flag"]
326    #[inline(always)]
327    pub fn undff(
328        self,
329    ) -> crate::common::RegisterField<
330        14,
331        0x1,
332        1,
333        0,
334        wdtsr::Undff,
335        wdtsr::Undff,
336        Wdtsr_SPEC,
337        crate::common::RW,
338    > {
339        crate::common::RegisterField::<
340            14,
341            0x1,
342            1,
343            0,
344            wdtsr::Undff,
345            wdtsr::Undff,
346            Wdtsr_SPEC,
347            crate::common::RW,
348        >::from_register(self, 0)
349    }
350
351    #[doc = "Refresh Error Flag"]
352    #[inline(always)]
353    pub fn refef(
354        self,
355    ) -> crate::common::RegisterField<
356        15,
357        0x1,
358        1,
359        0,
360        wdtsr::Refef,
361        wdtsr::Refef,
362        Wdtsr_SPEC,
363        crate::common::RW,
364    > {
365        crate::common::RegisterField::<
366            15,
367            0x1,
368            1,
369            0,
370            wdtsr::Refef,
371            wdtsr::Refef,
372            Wdtsr_SPEC,
373            crate::common::RW,
374        >::from_register(self, 0)
375    }
376}
377impl ::core::default::Default for Wdtsr {
378    #[inline(always)]
379    fn default() -> Wdtsr {
380        <crate::RegValueT<Wdtsr_SPEC> as RegisterValue<_>>::new(0)
381    }
382}
383pub mod wdtsr {
384
385    #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
386    pub struct Undff_SPEC;
387    pub type Undff = crate::EnumBitfieldStruct<u8, Undff_SPEC>;
388    impl Undff {
389        #[doc = "No underflow occurred"]
390        pub const _0: Self = Self::new(0);
391
392        #[doc = "Underflow occurred"]
393        pub const _1: Self = Self::new(1);
394    }
395    #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
396    pub struct Refef_SPEC;
397    pub type Refef = crate::EnumBitfieldStruct<u8, Refef_SPEC>;
398    impl Refef {
399        #[doc = "No refresh error occurred"]
400        pub const _0: Self = Self::new(0);
401
402        #[doc = "Refresh error occurred"]
403        pub const _1: Self = Self::new(1);
404    }
405}
406#[doc(hidden)]
407#[derive(Copy, Clone, Eq, PartialEq)]
408pub struct Wdtrcr_SPEC;
409impl crate::sealed::RegSpec for Wdtrcr_SPEC {
410    type DataType = u8;
411}
412
413#[doc = "WDT Reset Control Register"]
414pub type Wdtrcr = crate::RegValueT<Wdtrcr_SPEC>;
415
416impl Wdtrcr {
417    #[doc = "WDT Behavior Selection"]
418    #[inline(always)]
419    pub fn rstirqs(
420        self,
421    ) -> crate::common::RegisterField<
422        7,
423        0x1,
424        1,
425        0,
426        wdtrcr::Rstirqs,
427        wdtrcr::Rstirqs,
428        Wdtrcr_SPEC,
429        crate::common::RW,
430    > {
431        crate::common::RegisterField::<
432            7,
433            0x1,
434            1,
435            0,
436            wdtrcr::Rstirqs,
437            wdtrcr::Rstirqs,
438            Wdtrcr_SPEC,
439            crate::common::RW,
440        >::from_register(self, 0)
441    }
442}
443impl ::core::default::Default for Wdtrcr {
444    #[inline(always)]
445    fn default() -> Wdtrcr {
446        <crate::RegValueT<Wdtrcr_SPEC> as RegisterValue<_>>::new(128)
447    }
448}
449pub mod wdtrcr {
450
451    #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
452    pub struct Rstirqs_SPEC;
453    pub type Rstirqs = crate::EnumBitfieldStruct<u8, Rstirqs_SPEC>;
454    impl Rstirqs {
455        #[doc = "Interrupt"]
456        pub const _0: Self = Self::new(0);
457
458        #[doc = "Reset"]
459        pub const _1: Self = Self::new(1);
460    }
461}
462#[doc(hidden)]
463#[derive(Copy, Clone, Eq, PartialEq)]
464pub struct Wdtcstpr_SPEC;
465impl crate::sealed::RegSpec for Wdtcstpr_SPEC {
466    type DataType = u8;
467}
468
469#[doc = "WDT Count Stop Control Register"]
470pub type Wdtcstpr = crate::RegValueT<Wdtcstpr_SPEC>;
471
472impl Wdtcstpr {
473    #[doc = "Sleep-Mode Count Stop Control Register"]
474    #[inline(always)]
475    pub fn slcstp(
476        self,
477    ) -> crate::common::RegisterField<
478        7,
479        0x1,
480        1,
481        0,
482        wdtcstpr::Slcstp,
483        wdtcstpr::Slcstp,
484        Wdtcstpr_SPEC,
485        crate::common::RW,
486    > {
487        crate::common::RegisterField::<
488            7,
489            0x1,
490            1,
491            0,
492            wdtcstpr::Slcstp,
493            wdtcstpr::Slcstp,
494            Wdtcstpr_SPEC,
495            crate::common::RW,
496        >::from_register(self, 0)
497    }
498}
499impl ::core::default::Default for Wdtcstpr {
500    #[inline(always)]
501    fn default() -> Wdtcstpr {
502        <crate::RegValueT<Wdtcstpr_SPEC> as RegisterValue<_>>::new(128)
503    }
504}
505pub mod wdtcstpr {
506
507    #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
508    pub struct Slcstp_SPEC;
509    pub type Slcstp = crate::EnumBitfieldStruct<u8, Slcstp_SPEC>;
510    impl Slcstp {
511        #[doc = "Disable count stop"]
512        pub const _0: Self = Self::new(0);
513
514        #[doc = "Stop count on transition to Sleep mode"]
515        pub const _1: Self = Self::new(1);
516    }
517}