efm32wg330_pac/etm/
etmccr.rs

1#[doc = "Register `ETMCCR` reader"]
2pub struct R(crate::R<ETMCCR_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<ETMCCR_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<ETMCCR_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<ETMCCR_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Field `ADRCMPPAIR` reader - Number of Address Comparator Pairs"]
17pub type ADRCMPPAIR_R = crate::FieldReader<u8, u8>;
18#[doc = "Field `DATACMPNUM` reader - Number of Data Value Comparators"]
19pub type DATACMPNUM_R = crate::FieldReader<u8, u8>;
20#[doc = "Field `MMDECCNT` reader - Number of Memeory Map Decoders"]
21pub type MMDECCNT_R = crate::FieldReader<u8, u8>;
22#[doc = "Field `COUNTNUM` reader - Number of Counters"]
23pub type COUNTNUM_R = crate::FieldReader<u8, u8>;
24#[doc = "Field `SEQPRES` reader - Sequencer Present"]
25pub type SEQPRES_R = crate::BitReader<bool>;
26#[doc = "Number of External Inputs\n\nValue on reset: 0"]
27#[derive(Clone, Copy, Debug, PartialEq)]
28#[repr(u8)]
29pub enum EXTINPNUM_A {
30    #[doc = "0: Zero inputs presents"]
31    ZERO = 0,
32    #[doc = "1: One inputs presents"]
33    ONE = 1,
34    #[doc = "2: Two inputs presents"]
35    TWO = 2,
36}
37impl From<EXTINPNUM_A> for u8 {
38    #[inline(always)]
39    fn from(variant: EXTINPNUM_A) -> Self {
40        variant as _
41    }
42}
43#[doc = "Field `EXTINPNUM` reader - Number of External Inputs"]
44pub type EXTINPNUM_R = crate::FieldReader<u8, EXTINPNUM_A>;
45impl EXTINPNUM_R {
46    #[doc = "Get enumerated values variant"]
47    #[inline(always)]
48    pub fn variant(&self) -> Option<EXTINPNUM_A> {
49        match self.bits {
50            0 => Some(EXTINPNUM_A::ZERO),
51            1 => Some(EXTINPNUM_A::ONE),
52            2 => Some(EXTINPNUM_A::TWO),
53            _ => None,
54        }
55    }
56    #[doc = "Checks if the value of the field is `ZERO`"]
57    #[inline(always)]
58    pub fn is_zero(&self) -> bool {
59        *self == EXTINPNUM_A::ZERO
60    }
61    #[doc = "Checks if the value of the field is `ONE`"]
62    #[inline(always)]
63    pub fn is_one(&self) -> bool {
64        *self == EXTINPNUM_A::ONE
65    }
66    #[doc = "Checks if the value of the field is `TWO`"]
67    #[inline(always)]
68    pub fn is_two(&self) -> bool {
69        *self == EXTINPNUM_A::TWO
70    }
71}
72#[doc = "Field `EXTOUTNUM` reader - Number of External Output"]
73pub type EXTOUTNUM_R = crate::FieldReader<u8, u8>;
74#[doc = "Field `FIFOFULLPRES` reader - FIFIO FULL present"]
75pub type FIFOFULLPRES_R = crate::BitReader<bool>;
76#[doc = "Field `IDCOMPNUM` reader - Number of context ID Comparators"]
77pub type IDCOMPNUM_R = crate::FieldReader<u8, u8>;
78#[doc = "Field `TRACESS` reader - Trace Start/Stop Block Present"]
79pub type TRACESS_R = crate::BitReader<bool>;
80#[doc = "Field `MMACCESS` reader - Coprocessor and Memeory Access"]
81pub type MMACCESS_R = crate::BitReader<bool>;
82#[doc = "Field `ETMID` reader - ETM ID Register Present"]
83pub type ETMID_R = crate::BitReader<bool>;
84impl R {
85    #[doc = "Bits 0:3 - Number of Address Comparator Pairs"]
86    #[inline(always)]
87    pub fn adrcmppair(&self) -> ADRCMPPAIR_R {
88        ADRCMPPAIR_R::new((self.bits & 0x0f) as u8)
89    }
90    #[doc = "Bits 4:7 - Number of Data Value Comparators"]
91    #[inline(always)]
92    pub fn datacmpnum(&self) -> DATACMPNUM_R {
93        DATACMPNUM_R::new(((self.bits >> 4) & 0x0f) as u8)
94    }
95    #[doc = "Bits 8:12 - Number of Memeory Map Decoders"]
96    #[inline(always)]
97    pub fn mmdeccnt(&self) -> MMDECCNT_R {
98        MMDECCNT_R::new(((self.bits >> 8) & 0x1f) as u8)
99    }
100    #[doc = "Bits 13:15 - Number of Counters"]
101    #[inline(always)]
102    pub fn countnum(&self) -> COUNTNUM_R {
103        COUNTNUM_R::new(((self.bits >> 13) & 7) as u8)
104    }
105    #[doc = "Bit 16 - Sequencer Present"]
106    #[inline(always)]
107    pub fn seqpres(&self) -> SEQPRES_R {
108        SEQPRES_R::new(((self.bits >> 16) & 1) != 0)
109    }
110    #[doc = "Bits 17:19 - Number of External Inputs"]
111    #[inline(always)]
112    pub fn extinpnum(&self) -> EXTINPNUM_R {
113        EXTINPNUM_R::new(((self.bits >> 17) & 7) as u8)
114    }
115    #[doc = "Bits 20:22 - Number of External Output"]
116    #[inline(always)]
117    pub fn extoutnum(&self) -> EXTOUTNUM_R {
118        EXTOUTNUM_R::new(((self.bits >> 20) & 7) as u8)
119    }
120    #[doc = "Bit 23 - FIFIO FULL present"]
121    #[inline(always)]
122    pub fn fifofullpres(&self) -> FIFOFULLPRES_R {
123        FIFOFULLPRES_R::new(((self.bits >> 23) & 1) != 0)
124    }
125    #[doc = "Bits 24:25 - Number of context ID Comparators"]
126    #[inline(always)]
127    pub fn idcompnum(&self) -> IDCOMPNUM_R {
128        IDCOMPNUM_R::new(((self.bits >> 24) & 3) as u8)
129    }
130    #[doc = "Bit 26 - Trace Start/Stop Block Present"]
131    #[inline(always)]
132    pub fn tracess(&self) -> TRACESS_R {
133        TRACESS_R::new(((self.bits >> 26) & 1) != 0)
134    }
135    #[doc = "Bit 27 - Coprocessor and Memeory Access"]
136    #[inline(always)]
137    pub fn mmaccess(&self) -> MMACCESS_R {
138        MMACCESS_R::new(((self.bits >> 27) & 1) != 0)
139    }
140    #[doc = "Bit 31 - ETM ID Register Present"]
141    #[inline(always)]
142    pub fn etmid(&self) -> ETMID_R {
143        ETMID_R::new(((self.bits >> 31) & 1) != 0)
144    }
145}
146#[doc = "Configuration Code Register\n\nThis register you can [`read`](crate::generic::Reg::read). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [etmccr](index.html) module"]
147pub struct ETMCCR_SPEC;
148impl crate::RegisterSpec for ETMCCR_SPEC {
149    type Ux = u32;
150}
151#[doc = "`read()` method returns [etmccr::R](R) reader structure"]
152impl crate::Readable for ETMCCR_SPEC {
153    type Reader = R;
154}
155#[doc = "`reset()` method sets ETMCCR to value 0x8c80_2000"]
156impl crate::Resettable for ETMCCR_SPEC {
157    #[inline(always)]
158    fn reset_value() -> Self::Ux {
159        0x8c80_2000
160    }
161}