efm32pg22_pac/efm32pg22c200/ldma_s/
ch0_link.rs1#[doc = "Register `CH0_LINK` reader"]
2pub struct R(crate::R<CH0_LINK_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<CH0_LINK_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<CH0_LINK_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<CH0_LINK_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `CH0_LINK` writer"]
17pub struct W(crate::W<CH0_LINK_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<CH0_LINK_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<CH0_LINK_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<CH0_LINK_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `LINKMODE` reader - Link Structure Addressing Mode"]
38pub type LINKMODE_R = crate::BitReader<LINKMODE_A>;
39#[doc = "Link Structure Addressing Mode\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum LINKMODE_A {
42 #[doc = "0: The LINKADDR field of LDMA_CHx_LINK contains the absolute address of the linked descriptor."]
43 ABSOLUTE = 0,
44 #[doc = "1: The LINKADDR field of LDMA_CHx_LINK contains the relative offset of the linked descriptor."]
45 RELATIVE = 1,
46}
47impl From<LINKMODE_A> for bool {
48 #[inline(always)]
49 fn from(variant: LINKMODE_A) -> Self {
50 variant as u8 != 0
51 }
52}
53impl LINKMODE_R {
54 #[doc = "Get enumerated values variant"]
55 #[inline(always)]
56 pub fn variant(&self) -> LINKMODE_A {
57 match self.bits {
58 false => LINKMODE_A::ABSOLUTE,
59 true => LINKMODE_A::RELATIVE,
60 }
61 }
62 #[doc = "Checks if the value of the field is `ABSOLUTE`"]
63 #[inline(always)]
64 pub fn is_absolute(&self) -> bool {
65 *self == LINKMODE_A::ABSOLUTE
66 }
67 #[doc = "Checks if the value of the field is `RELATIVE`"]
68 #[inline(always)]
69 pub fn is_relative(&self) -> bool {
70 *self == LINKMODE_A::RELATIVE
71 }
72}
73#[doc = "Field `LINK` reader - Link Next Structure"]
74pub type LINK_R = crate::BitReader<bool>;
75#[doc = "Field `LINK` writer - Link Next Structure"]
76pub type LINK_W<'a, const O: u8> = crate::BitWriter<'a, u32, CH0_LINK_SPEC, bool, O>;
77#[doc = "Field `LINKADDR` reader - Link Structure Address"]
78pub type LINKADDR_R = crate::FieldReader<u32, u32>;
79#[doc = "Field `LINKADDR` writer - Link Structure Address"]
80pub type LINKADDR_W<'a, const O: u8> = crate::FieldWriter<'a, u32, CH0_LINK_SPEC, u32, u32, 30, O>;
81impl R {
82 #[doc = "Bit 0 - Link Structure Addressing Mode"]
83 #[inline(always)]
84 pub fn linkmode(&self) -> LINKMODE_R {
85 LINKMODE_R::new((self.bits & 1) != 0)
86 }
87 #[doc = "Bit 1 - Link Next Structure"]
88 #[inline(always)]
89 pub fn link(&self) -> LINK_R {
90 LINK_R::new(((self.bits >> 1) & 1) != 0)
91 }
92 #[doc = "Bits 2:31 - Link Structure Address"]
93 #[inline(always)]
94 pub fn linkaddr(&self) -> LINKADDR_R {
95 LINKADDR_R::new((self.bits >> 2) & 0x3fff_ffff)
96 }
97}
98impl W {
99 #[doc = "Bit 1 - Link Next Structure"]
100 #[inline(always)]
101 #[must_use]
102 pub fn link(&mut self) -> LINK_W<1> {
103 LINK_W::new(self)
104 }
105 #[doc = "Bits 2:31 - Link Structure Address"]
106 #[inline(always)]
107 #[must_use]
108 pub fn linkaddr(&mut self) -> LINKADDR_W<2> {
109 LINKADDR_W::new(self)
110 }
111 #[doc = "Writes raw bits to the register."]
112 #[inline(always)]
113 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
114 self.0.bits(bits);
115 self
116 }
117}
118#[doc = "No Description\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 [ch0_link](index.html) module"]
119pub struct CH0_LINK_SPEC;
120impl crate::RegisterSpec for CH0_LINK_SPEC {
121 type Ux = u32;
122}
123#[doc = "`read()` method returns [ch0_link::R](R) reader structure"]
124impl crate::Readable for CH0_LINK_SPEC {
125 type Reader = R;
126}
127#[doc = "`write(|w| ..)` method takes [ch0_link::W](W) writer structure"]
128impl crate::Writable for CH0_LINK_SPEC {
129 type Writer = W;
130 const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
131 const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
132}
133#[doc = "`reset()` method sets CH0_LINK to value 0"]
134impl crate::Resettable for CH0_LINK_SPEC {
135 const RESET_VALUE: Self::Ux = 0;
136}