efm32gg12b110_pac/ldma/
ch11_cfg.rs

1#[doc = "Register `CH11_CFG` reader"]
2pub struct R(crate::R<CH11_CFG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<CH11_CFG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<CH11_CFG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<CH11_CFG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `CH11_CFG` writer"]
17pub struct W(crate::W<CH11_CFG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<CH11_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<CH11_CFG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<CH11_CFG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Arbitration Slot Number Select\n\nValue on reset: 0"]
38#[derive(Clone, Copy, Debug, PartialEq)]
39#[repr(u8)]
40pub enum ARBSLOTS_A {
41    #[doc = "0: One arbitration slot selected"]
42    ONE = 0,
43    #[doc = "1: Two arbitration slots selected"]
44    TWO = 1,
45    #[doc = "2: Four arbitration slots selected"]
46    FOUR = 2,
47    #[doc = "3: Eight arbitration slots selected"]
48    EIGHT = 3,
49}
50impl From<ARBSLOTS_A> for u8 {
51    #[inline(always)]
52    fn from(variant: ARBSLOTS_A) -> Self {
53        variant as _
54    }
55}
56#[doc = "Field `ARBSLOTS` reader - Arbitration Slot Number Select"]
57pub type ARBSLOTS_R = crate::FieldReader<u8, ARBSLOTS_A>;
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> = crate::FieldWriterSafe<'a, u32, CH11_CFG_SPEC, u8, ARBSLOTS_A, 2, 16>;
93impl<'a> ARBSLOTS_W<'a> {
94    #[doc = "One arbitration slot selected"]
95    #[inline(always)]
96    pub fn one(self) -> &'a mut W {
97        self.variant(ARBSLOTS_A::ONE)
98    }
99    #[doc = "Two arbitration slots selected"]
100    #[inline(always)]
101    pub fn two(self) -> &'a mut W {
102        self.variant(ARBSLOTS_A::TWO)
103    }
104    #[doc = "Four arbitration slots selected"]
105    #[inline(always)]
106    pub fn four(self) -> &'a mut W {
107        self.variant(ARBSLOTS_A::FOUR)
108    }
109    #[doc = "Eight arbitration slots selected"]
110    #[inline(always)]
111    pub fn eight(self) -> &'a mut W {
112        self.variant(ARBSLOTS_A::EIGHT)
113    }
114}
115#[doc = "Field `SRCINCSIGN` reader - Source Address Increment Sign"]
116pub type SRCINCSIGN_R = crate::BitReader<bool>;
117#[doc = "Field `SRCINCSIGN` writer - Source Address Increment Sign"]
118pub type SRCINCSIGN_W<'a> = crate::BitWriter<'a, u32, CH11_CFG_SPEC, bool, 20>;
119#[doc = "Field `DSTINCSIGN` reader - Destination Address Increment Sign"]
120pub type DSTINCSIGN_R = crate::BitReader<bool>;
121#[doc = "Field `DSTINCSIGN` writer - Destination Address Increment Sign"]
122pub type DSTINCSIGN_W<'a> = crate::BitWriter<'a, u32, CH11_CFG_SPEC, bool, 21>;
123impl R {
124    #[doc = "Bits 16:17 - Arbitration Slot Number Select"]
125    #[inline(always)]
126    pub fn arbslots(&self) -> ARBSLOTS_R {
127        ARBSLOTS_R::new(((self.bits >> 16) & 3) as u8)
128    }
129    #[doc = "Bit 20 - Source Address Increment Sign"]
130    #[inline(always)]
131    pub fn srcincsign(&self) -> SRCINCSIGN_R {
132        SRCINCSIGN_R::new(((self.bits >> 20) & 1) != 0)
133    }
134    #[doc = "Bit 21 - Destination Address Increment Sign"]
135    #[inline(always)]
136    pub fn dstincsign(&self) -> DSTINCSIGN_R {
137        DSTINCSIGN_R::new(((self.bits >> 21) & 1) != 0)
138    }
139}
140impl W {
141    #[doc = "Bits 16:17 - Arbitration Slot Number Select"]
142    #[inline(always)]
143    pub fn arbslots(&mut self) -> ARBSLOTS_W {
144        ARBSLOTS_W::new(self)
145    }
146    #[doc = "Bit 20 - Source Address Increment Sign"]
147    #[inline(always)]
148    pub fn srcincsign(&mut self) -> SRCINCSIGN_W {
149        SRCINCSIGN_W::new(self)
150    }
151    #[doc = "Bit 21 - Destination Address Increment Sign"]
152    #[inline(always)]
153    pub fn dstincsign(&mut self) -> DSTINCSIGN_W {
154        DSTINCSIGN_W::new(self)
155    }
156    #[doc = "Writes raw bits to the register."]
157    #[inline(always)]
158    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
159        self.0.bits(bits);
160        self
161    }
162}
163#[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 [ch11_cfg](index.html) module"]
164pub struct CH11_CFG_SPEC;
165impl crate::RegisterSpec for CH11_CFG_SPEC {
166    type Ux = u32;
167}
168#[doc = "`read()` method returns [ch11_cfg::R](R) reader structure"]
169impl crate::Readable for CH11_CFG_SPEC {
170    type Reader = R;
171}
172#[doc = "`write(|w| ..)` method takes [ch11_cfg::W](W) writer structure"]
173impl crate::Writable for CH11_CFG_SPEC {
174    type Writer = W;
175}
176#[doc = "`reset()` method sets CH11_CFG to value 0"]
177impl crate::Resettable for CH11_CFG_SPEC {
178    #[inline(always)]
179    fn reset_value() -> Self::Ux {
180        0
181    }
182}