efm32pg12_pac/ldma/
ch7_link.rs

1#[doc = "Reader of register CH7_LINK"]
2pub type R = crate::R<u32, super::CH7_LINK>;
3#[doc = "Writer for register CH7_LINK"]
4pub type W = crate::W<u32, super::CH7_LINK>;
5#[doc = "Register CH7_LINK `reset()`'s with value 0"]
6impl crate::ResetValue for super::CH7_LINK {
7    type Type = u32;
8    #[inline(always)]
9    fn reset_value() -> Self::Type {
10        0
11    }
12}
13#[doc = "Reader of field `LINKMODE`"]
14pub type LINKMODE_R = crate::R<bool, bool>;
15#[doc = "Reader of field `LINK`"]
16pub type LINK_R = crate::R<bool, bool>;
17#[doc = "Write proxy for field `LINK`"]
18pub struct LINK_W<'a> {
19    w: &'a mut W,
20}
21impl<'a> LINK_W<'a> {
22    #[doc = r"Sets the field bit"]
23    #[inline(always)]
24    pub fn set_bit(self) -> &'a mut W {
25        self.bit(true)
26    }
27    #[doc = r"Clears the field bit"]
28    #[inline(always)]
29    pub fn clear_bit(self) -> &'a mut W {
30        self.bit(false)
31    }
32    #[doc = r"Writes raw bits to the field"]
33    #[inline(always)]
34    pub fn bit(self, value: bool) -> &'a mut W {
35        self.w.bits = (self.w.bits & !(0x01 << 1)) | (((value as u32) & 0x01) << 1);
36        self.w
37    }
38}
39#[doc = "Reader of field `LINKADDR`"]
40pub type LINKADDR_R = crate::R<u32, u32>;
41#[doc = "Write proxy for field `LINKADDR`"]
42pub struct LINKADDR_W<'a> {
43    w: &'a mut W,
44}
45impl<'a> LINKADDR_W<'a> {
46    #[doc = r"Writes raw bits to the field"]
47    #[inline(always)]
48    pub unsafe fn bits(self, value: u32) -> &'a mut W {
49        self.w.bits = (self.w.bits & !(0x3fff_ffff << 2)) | (((value as u32) & 0x3fff_ffff) << 2);
50        self.w
51    }
52}
53impl R {
54    #[doc = "Bit 0 - Link Structure Addressing Mode"]
55    #[inline(always)]
56    pub fn linkmode(&self) -> LINKMODE_R {
57        LINKMODE_R::new((self.bits & 0x01) != 0)
58    }
59    #[doc = "Bit 1 - Link Next Structure"]
60    #[inline(always)]
61    pub fn link(&self) -> LINK_R {
62        LINK_R::new(((self.bits >> 1) & 0x01) != 0)
63    }
64    #[doc = "Bits 2:31 - Link Structure Address"]
65    #[inline(always)]
66    pub fn linkaddr(&self) -> LINKADDR_R {
67        LINKADDR_R::new(((self.bits >> 2) & 0x3fff_ffff) as u32)
68    }
69}
70impl W {
71    #[doc = "Bit 1 - Link Next Structure"]
72    #[inline(always)]
73    pub fn link(&mut self) -> LINK_W {
74        LINK_W { w: self }
75    }
76    #[doc = "Bits 2:31 - Link Structure Address"]
77    #[inline(always)]
78    pub fn linkaddr(&mut self) -> LINKADDR_W {
79        LINKADDR_W { w: self }
80    }
81}