d1_pac/ccu/
cpu_gating.rs

1#[doc = "Register `cpu_gating` reader"]
2pub type R = crate::R<CPU_GATING_SPEC>;
3#[doc = "Register `cpu_gating` writer"]
4pub type W = crate::W<CPU_GATING_SPEC>;
5#[doc = "Field `cpu_gating_field` reader - CPU Gating Field"]
6pub type CPU_GATING_FIELD_R = crate::FieldReader<u16>;
7#[doc = "Field `cpu_gating_field` writer - CPU Gating Field"]
8pub type CPU_GATING_FIELD_W<'a, REG> = crate::FieldWriter<'a, REG, 16, u16>;
9#[doc = "Field `cpu_gating` reader - Gating Special Clock"]
10pub type CPU_GATING_R = crate::BitReader<CPU_GATING_A>;
11#[doc = "Gating Special Clock\n\nValue on reset: 0"]
12#[derive(Clone, Copy, Debug, PartialEq, Eq)]
13pub enum CPU_GATING_A {
14    #[doc = "0: `0`"]
15    OFF = 0,
16    #[doc = "1: `1`"]
17    ON = 1,
18}
19impl From<CPU_GATING_A> for bool {
20    #[inline(always)]
21    fn from(variant: CPU_GATING_A) -> Self {
22        variant as u8 != 0
23    }
24}
25impl CPU_GATING_R {
26    #[doc = "Get enumerated values variant"]
27    #[inline(always)]
28    pub const fn variant(&self) -> CPU_GATING_A {
29        match self.bits {
30            false => CPU_GATING_A::OFF,
31            true => CPU_GATING_A::ON,
32        }
33    }
34    #[doc = "`0`"]
35    #[inline(always)]
36    pub fn is_off(&self) -> bool {
37        *self == CPU_GATING_A::OFF
38    }
39    #[doc = "`1`"]
40    #[inline(always)]
41    pub fn is_on(&self) -> bool {
42        *self == CPU_GATING_A::ON
43    }
44}
45#[doc = "Field `cpu_gating` writer - Gating Special Clock"]
46pub type CPU_GATING_W<'a, REG> = crate::BitWriter<'a, REG, CPU_GATING_A>;
47impl<'a, REG> CPU_GATING_W<'a, REG>
48where
49    REG: crate::Writable + crate::RegisterSpec,
50{
51    #[doc = "`0`"]
52    #[inline(always)]
53    pub fn off(self) -> &'a mut crate::W<REG> {
54        self.variant(CPU_GATING_A::OFF)
55    }
56    #[doc = "`1`"]
57    #[inline(always)]
58    pub fn on(self) -> &'a mut crate::W<REG> {
59        self.variant(CPU_GATING_A::ON)
60    }
61}
62impl R {
63    #[doc = "Bits 0:15 - CPU Gating Field"]
64    #[inline(always)]
65    pub fn cpu_gating_field(&self) -> CPU_GATING_FIELD_R {
66        CPU_GATING_FIELD_R::new((self.bits & 0xffff) as u16)
67    }
68    #[doc = "Bit 31 - Gating Special Clock"]
69    #[inline(always)]
70    pub fn cpu_gating(&self) -> CPU_GATING_R {
71        CPU_GATING_R::new(((self.bits >> 31) & 1) != 0)
72    }
73}
74impl W {
75    #[doc = "Bits 0:15 - CPU Gating Field"]
76    #[inline(always)]
77    #[must_use]
78    pub fn cpu_gating_field(&mut self) -> CPU_GATING_FIELD_W<CPU_GATING_SPEC> {
79        CPU_GATING_FIELD_W::new(self, 0)
80    }
81    #[doc = "Bit 31 - Gating Special Clock"]
82    #[inline(always)]
83    #[must_use]
84    pub fn cpu_gating(&mut self) -> CPU_GATING_W<CPU_GATING_SPEC> {
85        CPU_GATING_W::new(self, 31)
86    }
87    #[doc = r" Writes raw bits to the register."]
88    #[doc = r""]
89    #[doc = r" # Safety"]
90    #[doc = r""]
91    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
92    #[inline(always)]
93    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
94        self.bits = bits;
95        self
96    }
97}
98#[doc = "CPU_GATING Configuration Register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`cpu_gating::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`cpu_gating::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
99pub struct CPU_GATING_SPEC;
100impl crate::RegisterSpec for CPU_GATING_SPEC {
101    type Ux = u32;
102}
103#[doc = "`read()` method returns [`cpu_gating::R`](R) reader structure"]
104impl crate::Readable for CPU_GATING_SPEC {}
105#[doc = "`write(|w| ..)` method takes [`cpu_gating::W`](W) writer structure"]
106impl crate::Writable for CPU_GATING_SPEC {
107    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
108    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
109}
110#[doc = "`reset()` method sets cpu_gating to value 0"]
111impl crate::Resettable for CPU_GATING_SPEC {
112    const RESET_VALUE: Self::Ux = 0;
113}