efm32gg12b410_pac/qspi0/
devsizeconfig.rs

1#[doc = "Register `DEVSIZECONFIG` reader"]
2pub struct R(crate::R<DEVSIZECONFIG_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<DEVSIZECONFIG_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<DEVSIZECONFIG_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<DEVSIZECONFIG_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `DEVSIZECONFIG` writer"]
17pub struct W(crate::W<DEVSIZECONFIG_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<DEVSIZECONFIG_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<DEVSIZECONFIG_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<DEVSIZECONFIG_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `NUMADDRBYTES` reader - Number of Address Bytes"]
38pub type NUMADDRBYTES_R = crate::FieldReader<u8, u8>;
39#[doc = "Field `NUMADDRBYTES` writer - Number of Address Bytes"]
40pub type NUMADDRBYTES_W<'a> = crate::FieldWriter<'a, u32, DEVSIZECONFIG_SPEC, u8, u8, 4, 0>;
41#[doc = "Field `BYTESPERDEVICEPAGE` reader - Number of Bytes Per Device Page"]
42pub type BYTESPERDEVICEPAGE_R = crate::FieldReader<u16, u16>;
43#[doc = "Field `BYTESPERDEVICEPAGE` writer - Number of Bytes Per Device Page"]
44pub type BYTESPERDEVICEPAGE_W<'a> =
45    crate::FieldWriter<'a, u32, DEVSIZECONFIG_SPEC, u16, u16, 12, 4>;
46#[doc = "Field `BYTESPERSUBSECTOR` reader - Number of Bytes Per Block"]
47pub type BYTESPERSUBSECTOR_R = crate::FieldReader<u8, u8>;
48#[doc = "Field `BYTESPERSUBSECTOR` writer - Number of Bytes Per Block"]
49pub type BYTESPERSUBSECTOR_W<'a> = crate::FieldWriter<'a, u32, DEVSIZECONFIG_SPEC, u8, u8, 5, 16>;
50#[doc = "Field `MEMSIZEONCS0` reader - Size of Flash Device Connected to CS\\[0\\]
51Pin"]
52pub type MEMSIZEONCS0_R = crate::FieldReader<u8, u8>;
53#[doc = "Field `MEMSIZEONCS0` writer - Size of Flash Device Connected to CS\\[0\\]
54Pin"]
55pub type MEMSIZEONCS0_W<'a> = crate::FieldWriter<'a, u32, DEVSIZECONFIG_SPEC, u8, u8, 2, 21>;
56#[doc = "Field `MEMSIZEONCS1` reader - Size of Flash Device Connected to CS\\[1\\]
57Pin"]
58pub type MEMSIZEONCS1_R = crate::FieldReader<u8, u8>;
59#[doc = "Field `MEMSIZEONCS1` writer - Size of Flash Device Connected to CS\\[1\\]
60Pin"]
61pub type MEMSIZEONCS1_W<'a> = crate::FieldWriter<'a, u32, DEVSIZECONFIG_SPEC, u8, u8, 2, 23>;
62impl R {
63    #[doc = "Bits 0:3 - Number of Address Bytes"]
64    #[inline(always)]
65    pub fn numaddrbytes(&self) -> NUMADDRBYTES_R {
66        NUMADDRBYTES_R::new((self.bits & 0x0f) as u8)
67    }
68    #[doc = "Bits 4:15 - Number of Bytes Per Device Page"]
69    #[inline(always)]
70    pub fn bytesperdevicepage(&self) -> BYTESPERDEVICEPAGE_R {
71        BYTESPERDEVICEPAGE_R::new(((self.bits >> 4) & 0x0fff) as u16)
72    }
73    #[doc = "Bits 16:20 - Number of Bytes Per Block"]
74    #[inline(always)]
75    pub fn bytespersubsector(&self) -> BYTESPERSUBSECTOR_R {
76        BYTESPERSUBSECTOR_R::new(((self.bits >> 16) & 0x1f) as u8)
77    }
78    #[doc = "Bits 21:22 - Size of Flash Device Connected to CS\\[0\\]
79Pin"]
80    #[inline(always)]
81    pub fn memsizeoncs0(&self) -> MEMSIZEONCS0_R {
82        MEMSIZEONCS0_R::new(((self.bits >> 21) & 3) as u8)
83    }
84    #[doc = "Bits 23:24 - Size of Flash Device Connected to CS\\[1\\]
85Pin"]
86    #[inline(always)]
87    pub fn memsizeoncs1(&self) -> MEMSIZEONCS1_R {
88        MEMSIZEONCS1_R::new(((self.bits >> 23) & 3) as u8)
89    }
90}
91impl W {
92    #[doc = "Bits 0:3 - Number of Address Bytes"]
93    #[inline(always)]
94    pub fn numaddrbytes(&mut self) -> NUMADDRBYTES_W {
95        NUMADDRBYTES_W::new(self)
96    }
97    #[doc = "Bits 4:15 - Number of Bytes Per Device Page"]
98    #[inline(always)]
99    pub fn bytesperdevicepage(&mut self) -> BYTESPERDEVICEPAGE_W {
100        BYTESPERDEVICEPAGE_W::new(self)
101    }
102    #[doc = "Bits 16:20 - Number of Bytes Per Block"]
103    #[inline(always)]
104    pub fn bytespersubsector(&mut self) -> BYTESPERSUBSECTOR_W {
105        BYTESPERSUBSECTOR_W::new(self)
106    }
107    #[doc = "Bits 21:22 - Size of Flash Device Connected to CS\\[0\\]
108Pin"]
109    #[inline(always)]
110    pub fn memsizeoncs0(&mut self) -> MEMSIZEONCS0_W {
111        MEMSIZEONCS0_W::new(self)
112    }
113    #[doc = "Bits 23:24 - Size of Flash Device Connected to CS\\[1\\]
114Pin"]
115    #[inline(always)]
116    pub fn memsizeoncs1(&mut self) -> MEMSIZEONCS1_W {
117        MEMSIZEONCS1_W::new(self)
118    }
119    #[doc = "Writes raw bits to the register."]
120    #[inline(always)]
121    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
122        self.0.bits(bits);
123        self
124    }
125}
126#[doc = "Device Size 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 [devsizeconfig](index.html) module"]
127pub struct DEVSIZECONFIG_SPEC;
128impl crate::RegisterSpec for DEVSIZECONFIG_SPEC {
129    type Ux = u32;
130}
131#[doc = "`read()` method returns [devsizeconfig::R](R) reader structure"]
132impl crate::Readable for DEVSIZECONFIG_SPEC {
133    type Reader = R;
134}
135#[doc = "`write(|w| ..)` method takes [devsizeconfig::W](W) writer structure"]
136impl crate::Writable for DEVSIZECONFIG_SPEC {
137    type Writer = W;
138}
139#[doc = "`reset()` method sets DEVSIZECONFIG to value 0x0010_1002"]
140impl crate::Resettable for DEVSIZECONFIG_SPEC {
141    #[inline(always)]
142    fn reset_value() -> Self::Ux {
143        0x0010_1002
144    }
145}