atsamd51n/dsu/
cfg.rs

1#[doc = "Register `CFG` reader"]
2pub type R = crate::R<CfgSpec>;
3#[doc = "Register `CFG` writer"]
4pub type W = crate::W<CfgSpec>;
5#[doc = "Field `LQOS` reader - Latency Quality Of Service"]
6pub type LqosR = crate::FieldReader;
7#[doc = "Field `LQOS` writer - Latency Quality Of Service"]
8pub type LqosW<'a, REG> = crate::FieldWriter<'a, REG, 2>;
9#[doc = "DMA Trigger Level\n\nValue on reset: 0"]
10#[derive(Clone, Copy, Debug, PartialEq, Eq)]
11#[repr(u8)]
12pub enum Dccdmalevelselect {
13    #[doc = "0: Trigger rises when DCC is empty"]
14    Empty = 0,
15    #[doc = "1: Trigger rises when DCC is full"]
16    Full = 1,
17}
18impl From<Dccdmalevelselect> for u8 {
19    #[inline(always)]
20    fn from(variant: Dccdmalevelselect) -> Self {
21        variant as _
22    }
23}
24impl crate::FieldSpec for Dccdmalevelselect {
25    type Ux = u8;
26}
27impl crate::IsEnum for Dccdmalevelselect {}
28#[doc = "Field `DCCDMALEVEL` reader - DMA Trigger Level"]
29pub type DccdmalevelR = crate::FieldReader<Dccdmalevelselect>;
30impl DccdmalevelR {
31    #[doc = "Get enumerated values variant"]
32    #[inline(always)]
33    pub const fn variant(&self) -> Option<Dccdmalevelselect> {
34        match self.bits {
35            0 => Some(Dccdmalevelselect::Empty),
36            1 => Some(Dccdmalevelselect::Full),
37            _ => None,
38        }
39    }
40    #[doc = "Trigger rises when DCC is empty"]
41    #[inline(always)]
42    pub fn is_empty(&self) -> bool {
43        *self == Dccdmalevelselect::Empty
44    }
45    #[doc = "Trigger rises when DCC is full"]
46    #[inline(always)]
47    pub fn is_full(&self) -> bool {
48        *self == Dccdmalevelselect::Full
49    }
50}
51#[doc = "Field `DCCDMALEVEL` writer - DMA Trigger Level"]
52pub type DccdmalevelW<'a, REG> = crate::FieldWriter<'a, REG, 2, Dccdmalevelselect>;
53impl<'a, REG> DccdmalevelW<'a, REG>
54where
55    REG: crate::Writable + crate::RegisterSpec,
56    REG::Ux: From<u8>,
57{
58    #[doc = "Trigger rises when DCC is empty"]
59    #[inline(always)]
60    pub fn empty(self) -> &'a mut crate::W<REG> {
61        self.variant(Dccdmalevelselect::Empty)
62    }
63    #[doc = "Trigger rises when DCC is full"]
64    #[inline(always)]
65    pub fn full(self) -> &'a mut crate::W<REG> {
66        self.variant(Dccdmalevelselect::Full)
67    }
68}
69#[doc = "Field `ETBRAMEN` reader - Trace Control"]
70pub type EtbramenR = crate::BitReader;
71#[doc = "Field `ETBRAMEN` writer - Trace Control"]
72pub type EtbramenW<'a, REG> = crate::BitWriter<'a, REG>;
73impl R {
74    #[doc = "Bits 0:1 - Latency Quality Of Service"]
75    #[inline(always)]
76    pub fn lqos(&self) -> LqosR {
77        LqosR::new((self.bits & 3) as u8)
78    }
79    #[doc = "Bits 2:3 - DMA Trigger Level"]
80    #[inline(always)]
81    pub fn dccdmalevel(&self) -> DccdmalevelR {
82        DccdmalevelR::new(((self.bits >> 2) & 3) as u8)
83    }
84    #[doc = "Bit 4 - Trace Control"]
85    #[inline(always)]
86    pub fn etbramen(&self) -> EtbramenR {
87        EtbramenR::new(((self.bits >> 4) & 1) != 0)
88    }
89}
90impl W {
91    #[doc = "Bits 0:1 - Latency Quality Of Service"]
92    #[inline(always)]
93    #[must_use]
94    pub fn lqos(&mut self) -> LqosW<CfgSpec> {
95        LqosW::new(self, 0)
96    }
97    #[doc = "Bits 2:3 - DMA Trigger Level"]
98    #[inline(always)]
99    #[must_use]
100    pub fn dccdmalevel(&mut self) -> DccdmalevelW<CfgSpec> {
101        DccdmalevelW::new(self, 2)
102    }
103    #[doc = "Bit 4 - Trace Control"]
104    #[inline(always)]
105    #[must_use]
106    pub fn etbramen(&mut self) -> EtbramenW<CfgSpec> {
107        EtbramenW::new(self, 4)
108    }
109}
110#[doc = "Configuration\n\nYou can [`read`](crate::Reg::read) this register and get [`cfg::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`cfg::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
111pub struct CfgSpec;
112impl crate::RegisterSpec for CfgSpec {
113    type Ux = u32;
114}
115#[doc = "`read()` method returns [`cfg::R`](R) reader structure"]
116impl crate::Readable for CfgSpec {}
117#[doc = "`write(|w| ..)` method takes [`cfg::W`](W) writer structure"]
118impl crate::Writable for CfgSpec {
119    type Safety = crate::Unsafe;
120    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
121    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
122}
123#[doc = "`reset()` method sets CFG to value 0x02"]
124impl crate::Resettable for CfgSpec {
125    const RESET_VALUE: u32 = 0x02;
126}