eos_s3/cru/
c21_clk_gate.rs1#[doc = "Register `C21_CLK_GATE` reader"]
2pub struct R(crate::R<C21_CLK_GATE_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<C21_CLK_GATE_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<C21_CLK_GATE_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<C21_CLK_GATE_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `C21_CLK_GATE` writer"]
17pub struct W(crate::W<C21_CLK_GATE_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<C21_CLK_GATE_SPEC>;
20 #[inline(always)]
21 fn deref(&self) -> &Self::Target {
22 &self.0
23 }
24}
25impl core::ops::DerefMut for W {
26 #[inline(always)]
27 fn deref_mut(&mut self) -> &mut Self::Target {
28 &mut self.0
29 }
30}
31impl From<crate::W<C21_CLK_GATE_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<C21_CLK_GATE_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "To FB (additional CLK)\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39pub enum PATH_0_GATING_CONTROL_A {
40 #[doc = "0: Clock is stop"]
41 STOP = 0,
42 #[doc = "1: Clock is runnig"]
43 RUN = 1,
44}
45impl From<PATH_0_GATING_CONTROL_A> for bool {
46 #[inline(always)]
47 fn from(variant: PATH_0_GATING_CONTROL_A) -> Self {
48 variant as u8 != 0
49 }
50}
51#[doc = "Field `Path_0_Gating_Control` reader - To FB (additional CLK)"]
52pub struct PATH_0_GATING_CONTROL_R(
53 crate::FieldReader<bool, PATH_0_GATING_CONTROL_A>,
54);
55impl PATH_0_GATING_CONTROL_R {
56 #[inline(always)]
57 pub(crate) fn new(bits: bool) -> Self {
58 PATH_0_GATING_CONTROL_R(crate::FieldReader::new(bits))
59 }
60 #[doc = r"Get enumerated values variant"]
61 #[inline(always)]
62 pub fn variant(&self) -> PATH_0_GATING_CONTROL_A {
63 match self.bits {
64 false => PATH_0_GATING_CONTROL_A::STOP,
65 true => PATH_0_GATING_CONTROL_A::RUN,
66 }
67 }
68 #[doc = "Checks if the value of the field is `STOP`"]
69 #[inline(always)]
70 pub fn is_stop(&self) -> bool {
71 **self == PATH_0_GATING_CONTROL_A::STOP
72 }
73 #[doc = "Checks if the value of the field is `RUN`"]
74 #[inline(always)]
75 pub fn is_run(&self) -> bool {
76 **self == PATH_0_GATING_CONTROL_A::RUN
77 }
78}
79impl core::ops::Deref for PATH_0_GATING_CONTROL_R {
80 type Target = crate::FieldReader<bool, PATH_0_GATING_CONTROL_A>;
81 #[inline(always)]
82 fn deref(&self) -> &Self::Target {
83 &self.0
84 }
85}
86#[doc = "Field `Path_0_Gating_Control` writer - To FB (additional CLK)"]
87pub struct PATH_0_GATING_CONTROL_W<'a> {
88 w: &'a mut W,
89}
90impl<'a> PATH_0_GATING_CONTROL_W<'a> {
91 #[doc = r"Writes `variant` to the field"]
92 #[inline(always)]
93 pub fn variant(self, variant: PATH_0_GATING_CONTROL_A) -> &'a mut W {
94 self.bit(variant.into())
95 }
96 #[doc = "Clock is stop"]
97 #[inline(always)]
98 pub fn stop(self) -> &'a mut W {
99 self.variant(PATH_0_GATING_CONTROL_A::STOP)
100 }
101 #[doc = "Clock is runnig"]
102 #[inline(always)]
103 pub fn run(self) -> &'a mut W {
104 self.variant(PATH_0_GATING_CONTROL_A::RUN)
105 }
106 #[doc = r"Sets the field bit"]
107 #[inline(always)]
108 pub fn set_bit(self) -> &'a mut W {
109 self.bit(true)
110 }
111 #[doc = r"Clears the field bit"]
112 #[inline(always)]
113 pub fn clear_bit(self) -> &'a mut W {
114 self.bit(false)
115 }
116 #[doc = r"Writes raw bits to the field"]
117 #[inline(always)]
118 pub fn bit(self, value: bool) -> &'a mut W {
119 self.w.bits = (self.w.bits & !0x01) | (value as u32 & 0x01);
120 self.w
121 }
122}
123impl R {
124 #[doc = "Bit 0 - To FB (additional CLK)"]
125 #[inline(always)]
126 pub fn path_0_gating_control(&self) -> PATH_0_GATING_CONTROL_R {
127 PATH_0_GATING_CONTROL_R::new((self.bits & 0x01) != 0)
128 }
129}
130impl W {
131 #[doc = "Bit 0 - To FB (additional CLK)"]
132 #[inline(always)]
133 pub fn path_0_gating_control(&mut self) -> PATH_0_GATING_CONTROL_W {
134 PATH_0_GATING_CONTROL_W { w: self }
135 }
136 #[doc = "Writes raw bits to the register."]
137 #[inline(always)]
138 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
139 self.0.bits(bits);
140 self
141 }
142}
143#[doc = "Gating control for FB additional clock 21\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [c21_clk_gate](index.html) module"]
144pub struct C21_CLK_GATE_SPEC;
145impl crate::RegisterSpec for C21_CLK_GATE_SPEC {
146 type Ux = u32;
147}
148#[doc = "`read()` method returns [c21_clk_gate::R](R) reader structure"]
149impl crate::Readable for C21_CLK_GATE_SPEC {
150 type Reader = R;
151}
152#[doc = "`write(|w| ..)` method takes [c21_clk_gate::W](W) writer structure"]
153impl crate::Writable for C21_CLK_GATE_SPEC {
154 type Writer = W;
155}
156#[doc = "`reset()` method sets C21_CLK_GATE to value 0"]
157impl crate::Resettable for C21_CLK_GATE_SPEC {
158 #[inline(always)]
159 fn reset_value() -> Self::Ux {
160 0
161 }
162}