msp430fr247x/sys/
sysbslc.rs

1#[doc = "Register `SYSBSLC` reader"]
2pub struct R(crate::R<SYSBSLC_SPEC>);
3impl core::ops::Deref for R {
4    type Target = crate::R<SYSBSLC_SPEC>;
5    #[inline(always)]
6    fn deref(&self) -> &Self::Target {
7        &self.0
8    }
9}
10impl From<crate::R<SYSBSLC_SPEC>> for R {
11    #[inline(always)]
12    fn from(reader: crate::R<SYSBSLC_SPEC>) -> Self {
13        R(reader)
14    }
15}
16#[doc = "Register `SYSBSLC` writer"]
17pub struct W(crate::W<SYSBSLC_SPEC>);
18impl core::ops::Deref for W {
19    type Target = crate::W<SYSBSLC_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<SYSBSLC_SPEC>> for W {
32    #[inline(always)]
33    fn from(writer: crate::W<SYSBSLC_SPEC>) -> Self {
34        W(writer)
35    }
36}
37#[doc = "Field `SYSBSLR` reader - RAM assigned to BSL"]
38pub type SYSBSLR_R = crate::BitReader<SYSBSLR_A>;
39#[doc = "RAM assigned to BSL\n\nValue on reset: 0"]
40#[derive(Clone, Copy, Debug, PartialEq, Eq)]
41pub enum SYSBSLR_A {
42    #[doc = "0: No RAM assigned to BSL area"]
43    NORAM = 0,
44    #[doc = "1: Lowest 16 bytes of RAM assigned to BSL"]
45    RAM = 1,
46}
47impl From<SYSBSLR_A> for bool {
48    #[inline(always)]
49    fn from(variant: SYSBSLR_A) -> Self {
50        variant as u8 != 0
51    }
52}
53impl SYSBSLR_R {
54    #[doc = "Get enumerated values variant"]
55    #[inline(always)]
56    pub fn variant(&self) -> SYSBSLR_A {
57        match self.bits {
58            false => SYSBSLR_A::NORAM,
59            true => SYSBSLR_A::RAM,
60        }
61    }
62    #[doc = "Checks if the value of the field is `NORAM`"]
63    #[inline(always)]
64    pub fn is_noram(&self) -> bool {
65        *self == SYSBSLR_A::NORAM
66    }
67    #[doc = "Checks if the value of the field is `RAM`"]
68    #[inline(always)]
69    pub fn is_ram(&self) -> bool {
70        *self == SYSBSLR_A::RAM
71    }
72}
73#[doc = "Field `SYSBSLR` writer - RAM assigned to BSL"]
74pub type SYSBSLR_W<'a, const O: u8> = crate::BitWriter<'a, u16, SYSBSLC_SPEC, SYSBSLR_A, O>;
75impl<'a, const O: u8> SYSBSLR_W<'a, O> {
76    #[doc = "No RAM assigned to BSL area"]
77    #[inline(always)]
78    pub fn noram(self) -> &'a mut W {
79        self.variant(SYSBSLR_A::NORAM)
80    }
81    #[doc = "Lowest 16 bytes of RAM assigned to BSL"]
82    #[inline(always)]
83    pub fn ram(self) -> &'a mut W {
84        self.variant(SYSBSLR_A::RAM)
85    }
86}
87#[doc = "Field `SYSBSLOFF` reader - Bootstrap loader memory disable for the size covered in SYSBSLSIZE"]
88pub type SYSBSLOFF_R = crate::BitReader<SYSBSLOFF_A>;
89#[doc = "Bootstrap loader memory disable for the size covered in SYSBSLSIZE\n\nValue on reset: 0"]
90#[derive(Clone, Copy, Debug, PartialEq, Eq)]
91pub enum SYSBSLOFF_A {
92    #[doc = "0: BSL memory is addressed when this area is read."]
93    ON = 0,
94    #[doc = "1: BSL memory behaves like vacant memory. Reads cause 3FFFh to be read. Fetches cause JMP $ to be executed."]
95    OFF = 1,
96}
97impl From<SYSBSLOFF_A> for bool {
98    #[inline(always)]
99    fn from(variant: SYSBSLOFF_A) -> Self {
100        variant as u8 != 0
101    }
102}
103impl SYSBSLOFF_R {
104    #[doc = "Get enumerated values variant"]
105    #[inline(always)]
106    pub fn variant(&self) -> SYSBSLOFF_A {
107        match self.bits {
108            false => SYSBSLOFF_A::ON,
109            true => SYSBSLOFF_A::OFF,
110        }
111    }
112    #[doc = "Checks if the value of the field is `ON`"]
113    #[inline(always)]
114    pub fn is_on(&self) -> bool {
115        *self == SYSBSLOFF_A::ON
116    }
117    #[doc = "Checks if the value of the field is `OFF`"]
118    #[inline(always)]
119    pub fn is_off(&self) -> bool {
120        *self == SYSBSLOFF_A::OFF
121    }
122}
123#[doc = "Field `SYSBSLOFF` writer - Bootstrap loader memory disable for the size covered in SYSBSLSIZE"]
124pub type SYSBSLOFF_W<'a, const O: u8> = crate::BitWriter<'a, u16, SYSBSLC_SPEC, SYSBSLOFF_A, O>;
125impl<'a, const O: u8> SYSBSLOFF_W<'a, O> {
126    #[doc = "BSL memory is addressed when this area is read."]
127    #[inline(always)]
128    pub fn on(self) -> &'a mut W {
129        self.variant(SYSBSLOFF_A::ON)
130    }
131    #[doc = "BSL memory behaves like vacant memory. Reads cause 3FFFh to be read. Fetches cause JMP $ to be executed."]
132    #[inline(always)]
133    pub fn off(self) -> &'a mut W {
134        self.variant(SYSBSLOFF_A::OFF)
135    }
136}
137#[doc = "Field `SYSBSLPE` reader - Bootstrap loader memory protection enable for the size covered in SYSBSLSIZE. By default, this bit is cleared by hardware with a BOR event (as indicated above); however, the boot code that checks for an available BSL may set this bit in software to protect the BSL. Because devices normally come with a TI BSL preprogrammed and protected, the boot code sets this bit."]
138pub type SYSBSLPE_R = crate::BitReader<SYSBSLPE_A>;
139#[doc = "Bootstrap loader memory protection enable for the size covered in SYSBSLSIZE. By default, this bit is cleared by hardware with a BOR event (as indicated above); however, the boot code that checks for an available BSL may set this bit in software to protect the BSL. Because devices normally come with a TI BSL preprogrammed and protected, the boot code sets this bit.\n\nValue on reset: 0"]
140#[derive(Clone, Copy, Debug, PartialEq, Eq)]
141pub enum SYSBSLPE_A {
142    #[doc = "0: Area not protected. Read, program, and erase of BSL memory is possible."]
143    NOTPROT = 0,
144    #[doc = "1: Area protected"]
145    PROT = 1,
146}
147impl From<SYSBSLPE_A> for bool {
148    #[inline(always)]
149    fn from(variant: SYSBSLPE_A) -> Self {
150        variant as u8 != 0
151    }
152}
153impl SYSBSLPE_R {
154    #[doc = "Get enumerated values variant"]
155    #[inline(always)]
156    pub fn variant(&self) -> SYSBSLPE_A {
157        match self.bits {
158            false => SYSBSLPE_A::NOTPROT,
159            true => SYSBSLPE_A::PROT,
160        }
161    }
162    #[doc = "Checks if the value of the field is `NOTPROT`"]
163    #[inline(always)]
164    pub fn is_notprot(&self) -> bool {
165        *self == SYSBSLPE_A::NOTPROT
166    }
167    #[doc = "Checks if the value of the field is `PROT`"]
168    #[inline(always)]
169    pub fn is_prot(&self) -> bool {
170        *self == SYSBSLPE_A::PROT
171    }
172}
173#[doc = "Field `SYSBSLPE` writer - Bootstrap loader memory protection enable for the size covered in SYSBSLSIZE. By default, this bit is cleared by hardware with a BOR event (as indicated above); however, the boot code that checks for an available BSL may set this bit in software to protect the BSL. Because devices normally come with a TI BSL preprogrammed and protected, the boot code sets this bit."]
174pub type SYSBSLPE_W<'a, const O: u8> = crate::BitWriter<'a, u16, SYSBSLC_SPEC, SYSBSLPE_A, O>;
175impl<'a, const O: u8> SYSBSLPE_W<'a, O> {
176    #[doc = "Area not protected. Read, program, and erase of BSL memory is possible."]
177    #[inline(always)]
178    pub fn notprot(self) -> &'a mut W {
179        self.variant(SYSBSLPE_A::NOTPROT)
180    }
181    #[doc = "Area protected"]
182    #[inline(always)]
183    pub fn prot(self) -> &'a mut W {
184        self.variant(SYSBSLPE_A::PROT)
185    }
186}
187impl R {
188    #[doc = "Bit 2 - RAM assigned to BSL"]
189    #[inline(always)]
190    pub fn sysbslr(&self) -> SYSBSLR_R {
191        SYSBSLR_R::new(((self.bits >> 2) & 1) != 0)
192    }
193    #[doc = "Bit 14 - Bootstrap loader memory disable for the size covered in SYSBSLSIZE"]
194    #[inline(always)]
195    pub fn sysbsloff(&self) -> SYSBSLOFF_R {
196        SYSBSLOFF_R::new(((self.bits >> 14) & 1) != 0)
197    }
198    #[doc = "Bit 15 - Bootstrap loader memory protection enable for the size covered in SYSBSLSIZE. By default, this bit is cleared by hardware with a BOR event (as indicated above); however, the boot code that checks for an available BSL may set this bit in software to protect the BSL. Because devices normally come with a TI BSL preprogrammed and protected, the boot code sets this bit."]
199    #[inline(always)]
200    pub fn sysbslpe(&self) -> SYSBSLPE_R {
201        SYSBSLPE_R::new(((self.bits >> 15) & 1) != 0)
202    }
203}
204impl W {
205    #[doc = "Bit 2 - RAM assigned to BSL"]
206    #[inline(always)]
207    #[must_use]
208    pub fn sysbslr(&mut self) -> SYSBSLR_W<2> {
209        SYSBSLR_W::new(self)
210    }
211    #[doc = "Bit 14 - Bootstrap loader memory disable for the size covered in SYSBSLSIZE"]
212    #[inline(always)]
213    #[must_use]
214    pub fn sysbsloff(&mut self) -> SYSBSLOFF_W<14> {
215        SYSBSLOFF_W::new(self)
216    }
217    #[doc = "Bit 15 - Bootstrap loader memory protection enable for the size covered in SYSBSLSIZE. By default, this bit is cleared by hardware with a BOR event (as indicated above); however, the boot code that checks for an available BSL may set this bit in software to protect the BSL. Because devices normally come with a TI BSL preprogrammed and protected, the boot code sets this bit."]
218    #[inline(always)]
219    #[must_use]
220    pub fn sysbslpe(&mut self) -> SYSBSLPE_W<15> {
221        SYSBSLPE_W::new(self)
222    }
223    #[doc = "Writes raw bits to the register."]
224    #[inline(always)]
225    pub unsafe fn bits(&mut self, bits: u16) -> &mut Self {
226        self.0.bits(bits);
227        self
228    }
229}
230#[doc = "Bootloader Configuration\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 [sysbslc](index.html) module"]
231pub struct SYSBSLC_SPEC;
232impl crate::RegisterSpec for SYSBSLC_SPEC {
233    type Ux = u16;
234}
235#[doc = "`read()` method returns [sysbslc::R](R) reader structure"]
236impl crate::Readable for SYSBSLC_SPEC {
237    type Reader = R;
238}
239#[doc = "`write(|w| ..)` method takes [sysbslc::W](W) writer structure"]
240impl crate::Writable for SYSBSLC_SPEC {
241    type Writer = W;
242    const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
243    const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0;
244}
245#[doc = "`reset()` method sets SYSBSLC to value 0"]
246impl crate::Resettable for SYSBSLC_SPEC {
247    const RESET_VALUE: Self::Ux = 0;
248}