efm32tg11b_pac/efm32tg11b540/ldma/
ch1_cfg.rs

1#[doc = "Register `CH1_CFG` reader"]
2pub struct R(crate::R<CH1_CFG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CH1_CFG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CH1_CFG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CH1_CFG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CH1_CFG` writer"]
17pub struct W(crate::W<CH1_CFG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CH1_CFG_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<CH1_CFG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CH1_CFG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `ARBSLOTS` reader - Arbitration Slot Number Select"]
38pub type ARBSLOTS_R = crate::FieldReader<u8, ARBSLOTS_A>;
39#[doc = "Arbitration Slot Number Select\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41#[repr(u8)]
42pub enum ARBSLOTS_A {
43    #[doc = "0: One arbitration slot selected"]
44    ONE = 0,
45    #[doc = "1: Two arbitration slots selected"]
46    TWO = 1,
47    #[doc = "2: Four arbitration slots selected"]
48    FOUR = 2,
49    #[doc = "3: Eight arbitration slots selected"]
50    EIGHT = 3,
51}
52impl From<ARBSLOTS_A> for u8 {
53    #[inline(always)]
54    fn from(variant: ARBSLOTS_A) -> Self {
55        variant as _
56    }
57}
58impl ARBSLOTS_R {
59    #[doc = "Get enumerated values variant"]
60    #[inline(always)]
61    pub fn variant(&self) -> ARBSLOTS_A {
62        match self.bits {
63            0 => ARBSLOTS_A::ONE,
64            1 => ARBSLOTS_A::TWO,
65            2 => ARBSLOTS_A::FOUR,
66            3 => ARBSLOTS_A::EIGHT,
67            _ => unreachable!(),
68        }
69    }
70    #[doc = "Checks if the value of the field is `ONE`"]
71    #[inline(always)]
72    pub fn is_one(&self) -> bool {
73        *self == ARBSLOTS_A::ONE
74    }
75    #[doc = "Checks if the value of the field is `TWO`"]
76    #[inline(always)]
77    pub fn is_two(&self) -> bool {
78        *self == ARBSLOTS_A::TWO
79    }
80    #[doc = "Checks if the value of the field is `FOUR`"]
81    #[inline(always)]
82    pub fn is_four(&self) -> bool {
83        *self == ARBSLOTS_A::FOUR
84    }
85    #[doc = "Checks if the value of the field is `EIGHT`"]
86    #[inline(always)]
87    pub fn is_eight(&self) -> bool {
88        *self == ARBSLOTS_A::EIGHT
89    }
90}
91#[doc = "Field `ARBSLOTS` writer - Arbitration Slot Number Select"]
92pub type ARBSLOTS_W<'a, const O: u8> =
93    crate::FieldWriterSafe<'a, u32, CH1_CFG_SPEC, u8, ARBSLOTS_A, 2, O>;
94impl<'a, const O: u8> ARBSLOTS_W<'a, O> {
95    #[doc = "One arbitration slot selected"]
96    #[inline(always)]
97    pub fn one(self) -> &'a mut W {
98        self.variant(ARBSLOTS_A::ONE)
99    }
100    #[doc = "Two arbitration slots selected"]
101    #[inline(always)]
102    pub fn two(self) -> &'a mut W {
103        self.variant(ARBSLOTS_A::TWO)
104    }
105    #[doc = "Four arbitration slots selected"]
106    #[inline(always)]
107    pub fn four(self) -> &'a mut W {
108        self.variant(ARBSLOTS_A::FOUR)
109    }
110    #[doc = "Eight arbitration slots selected"]
111    #[inline(always)]
112    pub fn eight(self) -> &'a mut W {
113        self.variant(ARBSLOTS_A::EIGHT)
114    }
115}
116#[doc = "Field `SRCINCSIGN` reader - Source Address Increment Sign"]
117pub type SRCINCSIGN_R = crate::BitReader<bool>;
118#[doc = "Field `SRCINCSIGN` writer - Source Address Increment Sign"]
119pub type SRCINCSIGN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CH1_CFG_SPEC, bool, O>;
120#[doc = "Field `DSTINCSIGN` reader - Destination Address Increment Sign"]
121pub type DSTINCSIGN_R = crate::BitReader<bool>;
122#[doc = "Field `DSTINCSIGN` writer - Destination Address Increment Sign"]
123pub type DSTINCSIGN_W<'a, const O: u8> = crate::BitWriter<'a, u32, CH1_CFG_SPEC, bool, O>;
124impl R {
125    #[doc = "Bits 16:17 - Arbitration Slot Number Select"]
126    #[inline(always)]
127    pub fn arbslots(&self) -> ARBSLOTS_R {
128        ARBSLOTS_R::new(((self.bits >> 16) & 3) as u8)
129    }
130    #[doc = "Bit 20 - Source Address Increment Sign"]
131    #[inline(always)]
132    pub fn srcincsign(&self) -> SRCINCSIGN_R {
133        SRCINCSIGN_R::new(((self.bits >> 20) & 1) != 0)
134    }
135    #[doc = "Bit 21 - Destination Address Increment Sign"]
136    #[inline(always)]
137    pub fn dstincsign(&self) -> DSTINCSIGN_R {
138        DSTINCSIGN_R::new(((self.bits >> 21) & 1) != 0)
139    }
140}
141impl W {
142    #[doc = "Bits 16:17 - Arbitration Slot Number Select"]
143    #[inline(always)]
144    #[must_use]
145    pub fn arbslots(&mut self) -> ARBSLOTS_W<16> {
146        ARBSLOTS_W::new(self)
147    }
148    #[doc = "Bit 20 - Source Address Increment Sign"]
149    #[inline(always)]
150    #[must_use]
151    pub fn srcincsign(&mut self) -> SRCINCSIGN_W<20> {
152        SRCINCSIGN_W::new(self)
153    }
154    #[doc = "Bit 21 - Destination Address Increment Sign"]
155    #[inline(always)]
156    #[must_use]
157    pub fn dstincsign(&mut self) -> DSTINCSIGN_W<21> {
158        DSTINCSIGN_W::new(self)
159    }
160    #[doc = "Writes raw bits to the register."]
161    #[inline(always)]
162    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
163        self.0.bits(bits);
164        self
165    }
166}
167#[doc = "Channel Configuration Register\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 [ch1_cfg](index.html) module"]
168pub struct CH1_CFG_SPEC;
169impl crate::RegisterSpec for CH1_CFG_SPEC {
170    type Ux = u32;
171}
172#[doc = "`read()` method returns [ch1_cfg::R](R) reader structure"]
173impl crate::Readable for CH1_CFG_SPEC {
174    type Reader = R;
175}
176#[doc = "`write(|w| ..)` method takes [ch1_cfg::W](W) writer structure"]
177impl crate::Writable for CH1_CFG_SPEC {
178    type Writer = W;
179    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
180    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
181}
182#[doc = "`reset()` method sets CH1_CFG to value 0"]
183impl crate::Resettable for CH1_CFG_SPEC {
184    const RESET_VALUE: Self::Ux = 0;
185}