lpc55_pac/prince/
base_addr2.rs1#[doc = "Register `BASE_ADDR2` reader"]
2pub struct R(crate::R<BASE_ADDR2_SPEC>);
3impl core::ops::Deref for R {
4 type Target = crate::R<BASE_ADDR2_SPEC>;
5 #[inline(always)]
6 fn deref(&self) -> &Self::Target {
7 &self.0
8 }
9}
10impl From<crate::R<BASE_ADDR2_SPEC>> for R {
11 #[inline(always)]
12 fn from(reader: crate::R<BASE_ADDR2_SPEC>) -> Self {
13 R(reader)
14 }
15}
16#[doc = "Register `BASE_ADDR2` writer"]
17pub struct W(crate::W<BASE_ADDR2_SPEC>);
18impl core::ops::Deref for W {
19 type Target = crate::W<BASE_ADDR2_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<BASE_ADDR2_SPEC>> for W {
32 #[inline(always)]
33 fn from(writer: crate::W<BASE_ADDR2_SPEC>) -> Self {
34 W(writer)
35 }
36}
37#[doc = "Field `ADDR_FIXED` reader - Fixed portion of the base address of region 2."]
38pub struct ADDR_FIXED_R(crate::FieldReader<u32, u32>);
39impl ADDR_FIXED_R {
40 #[inline(always)]
41 pub(crate) fn new(bits: u32) -> Self {
42 ADDR_FIXED_R(crate::FieldReader::new(bits))
43 }
44}
45impl core::ops::Deref for ADDR_FIXED_R {
46 type Target = crate::FieldReader<u32, u32>;
47 #[inline(always)]
48 fn deref(&self) -> &Self::Target {
49 &self.0
50 }
51}
52#[doc = "Field `ADDR_PRG` reader - Programmable portion of the base address of region 2."]
53pub struct ADDR_PRG_R(crate::FieldReader<u8, u8>);
54impl ADDR_PRG_R {
55 #[inline(always)]
56 pub(crate) fn new(bits: u8) -> Self {
57 ADDR_PRG_R(crate::FieldReader::new(bits))
58 }
59}
60impl core::ops::Deref for ADDR_PRG_R {
61 type Target = crate::FieldReader<u8, u8>;
62 #[inline(always)]
63 fn deref(&self) -> &Self::Target {
64 &self.0
65 }
66}
67#[doc = "Field `ADDR_PRG` writer - Programmable portion of the base address of region 2."]
68pub struct ADDR_PRG_W<'a> {
69 w: &'a mut W,
70}
71impl<'a> ADDR_PRG_W<'a> {
72 #[doc = r"Writes raw bits to the field"]
73 #[inline(always)]
74 pub unsafe fn bits(self, value: u8) -> &'a mut W {
75 self.w.bits = (self.w.bits & !(0x03 << 18)) | ((value as u32 & 0x03) << 18);
76 self.w
77 }
78}
79impl R {
80 #[doc = "Bits 0:17 - Fixed portion of the base address of region 2."]
81 #[inline(always)]
82 pub fn addr_fixed(&self) -> ADDR_FIXED_R {
83 ADDR_FIXED_R::new((self.bits & 0x0003_ffff) as u32)
84 }
85 #[doc = "Bits 18:19 - Programmable portion of the base address of region 2."]
86 #[inline(always)]
87 pub fn addr_prg(&self) -> ADDR_PRG_R {
88 ADDR_PRG_R::new(((self.bits >> 18) & 0x03) as u8)
89 }
90}
91impl W {
92 #[doc = "Bits 18:19 - Programmable portion of the base address of region 2."]
93 #[inline(always)]
94 pub fn addr_prg(&mut self) -> ADDR_PRG_W {
95 ADDR_PRG_W { w: self }
96 }
97 #[doc = "Writes raw bits to the register."]
98 #[inline(always)]
99 pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
100 self.0.bits(bits);
101 self
102 }
103}
104#[doc = "Base Address for region 2 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 [base_addr2](index.html) module"]
105pub struct BASE_ADDR2_SPEC;
106impl crate::RegisterSpec for BASE_ADDR2_SPEC {
107 type Ux = u32;
108}
109#[doc = "`read()` method returns [base_addr2::R](R) reader structure"]
110impl crate::Readable for BASE_ADDR2_SPEC {
111 type Reader = R;
112}
113#[doc = "`write(|w| ..)` method takes [base_addr2::W](W) writer structure"]
114impl crate::Writable for BASE_ADDR2_SPEC {
115 type Writer = W;
116}
117#[doc = "`reset()` method sets BASE_ADDR2 to value 0x0008_0000"]
118impl crate::Resettable for BASE_ADDR2_SPEC {
119 #[inline(always)]
120 fn reset_value() -> Self::Ux {
121 0x0008_0000
122 }
123}