mimxrt685s_pac/sema42/
gate.rs1#[doc = "Register `GATE%s` reader"]
2pub type R = crate::R<GateSpec>;
3#[doc = "Register `GATE%s` writer"]
4pub type W = crate::W<GateSpec>;
5#[doc = "ate Finite State Machine. The hardware gate is maintained in a 16-state implementation\n\nValue on reset: 0"]
6#[cfg_attr(feature = "defmt", derive(defmt::Format))]
7#[derive(Clone, Copy, Debug, PartialEq, Eq)]
8#[repr(u8)]
9pub enum Gtfsm {
10 #[doc = "0: The gate is unlocked (free)."]
11 Gtfsm0 = 0,
12 #[doc = "1: The gate has been locked by processor 0."]
13 Gtfsm1 = 1,
14 #[doc = "2: The gate has been locked by processor 1."]
15 Gtfsm2 = 2,
16}
17impl From<Gtfsm> for u8 {
18 #[inline(always)]
19 fn from(variant: Gtfsm) -> Self {
20 variant as _
21 }
22}
23impl crate::FieldSpec for Gtfsm {
24 type Ux = u8;
25}
26impl crate::IsEnum for Gtfsm {}
27#[doc = "Field `GTFSM` reader - ate Finite State Machine. The hardware gate is maintained in a 16-state implementation"]
28pub type GtfsmR = crate::FieldReader<Gtfsm>;
29impl GtfsmR {
30 #[doc = "Get enumerated values variant"]
31 #[inline(always)]
32 pub const fn variant(&self) -> Option<Gtfsm> {
33 match self.bits {
34 0 => Some(Gtfsm::Gtfsm0),
35 1 => Some(Gtfsm::Gtfsm1),
36 2 => Some(Gtfsm::Gtfsm2),
37 _ => None,
38 }
39 }
40 #[doc = "The gate is unlocked (free)."]
41 #[inline(always)]
42 pub fn is_gtfsm_0(&self) -> bool {
43 *self == Gtfsm::Gtfsm0
44 }
45 #[doc = "The gate has been locked by processor 0."]
46 #[inline(always)]
47 pub fn is_gtfsm_1(&self) -> bool {
48 *self == Gtfsm::Gtfsm1
49 }
50 #[doc = "The gate has been locked by processor 1."]
51 #[inline(always)]
52 pub fn is_gtfsm_2(&self) -> bool {
53 *self == Gtfsm::Gtfsm2
54 }
55}
56#[doc = "Field `GTFSM` writer - ate Finite State Machine. The hardware gate is maintained in a 16-state implementation"]
57pub type GtfsmW<'a, REG> = crate::FieldWriter<'a, REG, 4, Gtfsm>;
58impl<'a, REG> GtfsmW<'a, REG>
59where
60 REG: crate::Writable + crate::RegisterSpec,
61 REG::Ux: From<u8>,
62{
63 #[doc = "The gate is unlocked (free)."]
64 #[inline(always)]
65 pub fn gtfsm_0(self) -> &'a mut crate::W<REG> {
66 self.variant(Gtfsm::Gtfsm0)
67 }
68 #[doc = "The gate has been locked by processor 0."]
69 #[inline(always)]
70 pub fn gtfsm_1(self) -> &'a mut crate::W<REG> {
71 self.variant(Gtfsm::Gtfsm1)
72 }
73 #[doc = "The gate has been locked by processor 1."]
74 #[inline(always)]
75 pub fn gtfsm_2(self) -> &'a mut crate::W<REG> {
76 self.variant(Gtfsm::Gtfsm2)
77 }
78}
79impl R {
80 #[doc = "Bits 0:3 - ate Finite State Machine. The hardware gate is maintained in a 16-state implementation"]
81 #[inline(always)]
82 pub fn gtfsm(&self) -> GtfsmR {
83 GtfsmR::new(self.bits & 0x0f)
84 }
85}
86#[cfg(feature = "debug")]
87impl core::fmt::Debug for R {
88 fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
89 f.debug_struct("GATE")
90 .field("gtfsm", &self.gtfsm())
91 .finish()
92 }
93}
94impl W {
95 #[doc = "Bits 0:3 - ate Finite State Machine. The hardware gate is maintained in a 16-state implementation"]
96 #[inline(always)]
97 pub fn gtfsm(&mut self) -> GtfsmW<GateSpec> {
98 GtfsmW::new(self, 0)
99 }
100}
101#[doc = "Semphores2 Gate n\n\nYou can [`read`](crate::Reg::read) this register and get [`gate::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`gate::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
102pub struct GateSpec;
103impl crate::RegisterSpec for GateSpec {
104 type Ux = u8;
105}
106#[doc = "`read()` method returns [`gate::R`](R) reader structure"]
107impl crate::Readable for GateSpec {}
108#[doc = "`write(|w| ..)` method takes [`gate::W`](W) writer structure"]
109impl crate::Writable for GateSpec {
110 type Safety = crate::Unsafe;
111 const ZERO_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
112 const ONE_TO_MODIFY_FIELDS_BITMAP: u8 = 0;
113}
114#[doc = "`reset()` method sets GATE%s to value 0"]
115impl crate::Resettable for GateSpec {
116 const RESET_VALUE: u8 = 0;
117}