Skip to main content

ra2a2_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.20.02, with svd2pac 0.6.1 on Sun, 15 Mar 2026 07:01:00 +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    #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
271    pub struct Rpes_SPEC;
272    pub type Rpes = crate::EnumBitfieldStruct<u8, Rpes_SPEC>;
273    impl Rpes {
274        #[doc = "75%"]
275        pub const _00: Self = Self::new(0);
276
277        #[doc = "50%"]
278        pub const _01: Self = Self::new(1);
279
280        #[doc = "25%"]
281        pub const _10: Self = Self::new(2);
282
283        #[doc = "0% (do not specify window end position)."]
284        pub const _11: Self = Self::new(3);
285    }
286    #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
287    pub struct Rpss_SPEC;
288    pub type Rpss = crate::EnumBitfieldStruct<u8, Rpss_SPEC>;
289    impl Rpss {
290        #[doc = "25%"]
291        pub const _00: Self = Self::new(0);
292
293        #[doc = "50%"]
294        pub const _01: Self = Self::new(1);
295
296        #[doc = "75%"]
297        pub const _10: Self = Self::new(2);
298
299        #[doc = "100% (do not specify window start position)."]
300        pub const _11: Self = Self::new(3);
301    }
302}
303#[doc(hidden)]
304#[derive(Copy, Clone, Eq, PartialEq)]
305pub struct Wdtsr_SPEC;
306impl crate::sealed::RegSpec for Wdtsr_SPEC {
307    type DataType = u16;
308}
309
310#[doc = "WDT Status Register"]
311pub type Wdtsr = crate::RegValueT<Wdtsr_SPEC>;
312
313impl Wdtsr {
314    #[doc = "Down-Counter Value"]
315    #[inline(always)]
316    pub fn cntval(
317        self,
318    ) -> crate::common::RegisterField<0, 0x3fff, 1, 0, u16, u16, Wdtsr_SPEC, crate::common::R> {
319        crate::common::RegisterField::<0,0x3fff,1,0,u16,u16,Wdtsr_SPEC,crate::common::R>::from_register(self,0)
320    }
321
322    #[doc = "Underflow Flag"]
323    #[inline(always)]
324    pub fn undff(
325        self,
326    ) -> crate::common::RegisterField<
327        14,
328        0x1,
329        1,
330        0,
331        wdtsr::Undff,
332        wdtsr::Undff,
333        Wdtsr_SPEC,
334        crate::common::RW,
335    > {
336        crate::common::RegisterField::<
337            14,
338            0x1,
339            1,
340            0,
341            wdtsr::Undff,
342            wdtsr::Undff,
343            Wdtsr_SPEC,
344            crate::common::RW,
345        >::from_register(self, 0)
346    }
347
348    #[doc = "Refresh Error Flag"]
349    #[inline(always)]
350    pub fn refef(
351        self,
352    ) -> crate::common::RegisterField<
353        15,
354        0x1,
355        1,
356        0,
357        wdtsr::Refef,
358        wdtsr::Refef,
359        Wdtsr_SPEC,
360        crate::common::RW,
361    > {
362        crate::common::RegisterField::<
363            15,
364            0x1,
365            1,
366            0,
367            wdtsr::Refef,
368            wdtsr::Refef,
369            Wdtsr_SPEC,
370            crate::common::RW,
371        >::from_register(self, 0)
372    }
373}
374impl ::core::default::Default for Wdtsr {
375    #[inline(always)]
376    fn default() -> Wdtsr {
377        <crate::RegValueT<Wdtsr_SPEC> as RegisterValue<_>>::new(0)
378    }
379}
380pub mod wdtsr {
381
382    #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
383    pub struct Undff_SPEC;
384    pub type Undff = crate::EnumBitfieldStruct<u8, Undff_SPEC>;
385    impl Undff {
386        #[doc = "No underflow occurred"]
387        pub const _0: Self = Self::new(0);
388
389        #[doc = "Underflow occurred"]
390        pub const _1: Self = Self::new(1);
391    }
392    #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
393    pub struct Refef_SPEC;
394    pub type Refef = crate::EnumBitfieldStruct<u8, Refef_SPEC>;
395    impl Refef {
396        #[doc = "No refresh error occurred"]
397        pub const _0: Self = Self::new(0);
398
399        #[doc = "Refresh error occurred"]
400        pub const _1: Self = Self::new(1);
401    }
402}
403#[doc(hidden)]
404#[derive(Copy, Clone, Eq, PartialEq)]
405pub struct Wdtrcr_SPEC;
406impl crate::sealed::RegSpec for Wdtrcr_SPEC {
407    type DataType = u8;
408}
409
410#[doc = "WDT Reset Control Register"]
411pub type Wdtrcr = crate::RegValueT<Wdtrcr_SPEC>;
412
413impl Wdtrcr {
414    #[doc = "WDT Behavior Selection"]
415    #[inline(always)]
416    pub fn rstirqs(
417        self,
418    ) -> crate::common::RegisterField<
419        7,
420        0x1,
421        1,
422        0,
423        wdtrcr::Rstirqs,
424        wdtrcr::Rstirqs,
425        Wdtrcr_SPEC,
426        crate::common::RW,
427    > {
428        crate::common::RegisterField::<
429            7,
430            0x1,
431            1,
432            0,
433            wdtrcr::Rstirqs,
434            wdtrcr::Rstirqs,
435            Wdtrcr_SPEC,
436            crate::common::RW,
437        >::from_register(self, 0)
438    }
439}
440impl ::core::default::Default for Wdtrcr {
441    #[inline(always)]
442    fn default() -> Wdtrcr {
443        <crate::RegValueT<Wdtrcr_SPEC> as RegisterValue<_>>::new(128)
444    }
445}
446pub mod wdtrcr {
447
448    #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
449    pub struct Rstirqs_SPEC;
450    pub type Rstirqs = crate::EnumBitfieldStruct<u8, Rstirqs_SPEC>;
451    impl Rstirqs {
452        #[doc = "Interrupt"]
453        pub const _0: Self = Self::new(0);
454
455        #[doc = "Reset"]
456        pub const _1: Self = Self::new(1);
457    }
458}
459#[doc(hidden)]
460#[derive(Copy, Clone, Eq, PartialEq)]
461pub struct Wdtcstpr_SPEC;
462impl crate::sealed::RegSpec for Wdtcstpr_SPEC {
463    type DataType = u8;
464}
465
466#[doc = "WDT Count Stop Control Register"]
467pub type Wdtcstpr = crate::RegValueT<Wdtcstpr_SPEC>;
468
469impl Wdtcstpr {
470    #[doc = "Sleep-Mode Count Stop Control Register"]
471    #[inline(always)]
472    pub fn slcstp(
473        self,
474    ) -> crate::common::RegisterField<
475        7,
476        0x1,
477        1,
478        0,
479        wdtcstpr::Slcstp,
480        wdtcstpr::Slcstp,
481        Wdtcstpr_SPEC,
482        crate::common::RW,
483    > {
484        crate::common::RegisterField::<
485            7,
486            0x1,
487            1,
488            0,
489            wdtcstpr::Slcstp,
490            wdtcstpr::Slcstp,
491            Wdtcstpr_SPEC,
492            crate::common::RW,
493        >::from_register(self, 0)
494    }
495}
496impl ::core::default::Default for Wdtcstpr {
497    #[inline(always)]
498    fn default() -> Wdtcstpr {
499        <crate::RegValueT<Wdtcstpr_SPEC> as RegisterValue<_>>::new(128)
500    }
501}
502pub mod wdtcstpr {
503
504    #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
505    pub struct Slcstp_SPEC;
506    pub type Slcstp = crate::EnumBitfieldStruct<u8, Slcstp_SPEC>;
507    impl Slcstp {
508        #[doc = "Disable count stop"]
509        pub const _0: Self = Self::new(0);
510
511        #[doc = "Stop count on transition to Sleep mode"]
512        pub const _1: Self = Self::new(1);
513    }
514}