cc13x2_cc26x2_pac/cpu_fpb/
comp4.rs

1#[doc = r" Value read from the register"]
2pub struct R {
3    bits: u32,
4}
5#[doc = r" Value to write to the register"]
6pub struct W {
7    bits: u32,
8}
9impl super::COMP4 {
10    #[doc = r" Modifies the contents of the register"]
11    #[inline]
12    pub fn modify<F>(&self, f: F)
13    where
14        for<'w> F: FnOnce(&R, &'w mut W) -> &'w mut W,
15    {
16        let bits = self.register.get();
17        let r = R { bits: bits };
18        let mut w = W { bits: bits };
19        f(&r, &mut w);
20        self.register.set(w.bits);
21    }
22    #[doc = r" Reads the contents of the register"]
23    #[inline]
24    pub fn read(&self) -> R {
25        R {
26            bits: self.register.get(),
27        }
28    }
29    #[doc = r" Writes to the register"]
30    #[inline]
31    pub fn write<F>(&self, f: F)
32    where
33        F: FnOnce(&mut W) -> &mut W,
34    {
35        let mut w = W::reset_value();
36        f(&mut w);
37        self.register.set(w.bits);
38    }
39    #[doc = r" Writes the reset value to the register"]
40    #[inline]
41    pub fn reset(&self) {
42        self.write(|w| w)
43    }
44}
45#[doc = r" Value of the field"]
46pub struct REPLACER {
47    bits: u8,
48}
49impl REPLACER {
50    #[doc = r" Value of the field as raw bits"]
51    #[inline]
52    pub fn bits(&self) -> u8 {
53        self.bits
54    }
55}
56#[doc = r" Value of the field"]
57pub struct RESERVED29R {
58    bits: bool,
59}
60impl RESERVED29R {
61    #[doc = r" Value of the field as raw bits"]
62    #[inline]
63    pub fn bit(&self) -> bool {
64        self.bits
65    }
66    #[doc = r" Returns `true` if the bit is clear (0)"]
67    #[inline]
68    pub fn bit_is_clear(&self) -> bool {
69        !self.bit()
70    }
71    #[doc = r" Returns `true` if the bit is set (1)"]
72    #[inline]
73    pub fn bit_is_set(&self) -> bool {
74        self.bit()
75    }
76}
77#[doc = r" Value of the field"]
78pub struct COMPR {
79    bits: u32,
80}
81impl COMPR {
82    #[doc = r" Value of the field as raw bits"]
83    #[inline]
84    pub fn bits(&self) -> u32 {
85        self.bits
86    }
87}
88#[doc = r" Value of the field"]
89pub struct RESERVED1R {
90    bits: bool,
91}
92impl RESERVED1R {
93    #[doc = r" Value of the field as raw bits"]
94    #[inline]
95    pub fn bit(&self) -> bool {
96        self.bits
97    }
98    #[doc = r" Returns `true` if the bit is clear (0)"]
99    #[inline]
100    pub fn bit_is_clear(&self) -> bool {
101        !self.bit()
102    }
103    #[doc = r" Returns `true` if the bit is set (1)"]
104    #[inline]
105    pub fn bit_is_set(&self) -> bool {
106        self.bit()
107    }
108}
109#[doc = r" Value of the field"]
110pub struct ENABLER {
111    bits: bool,
112}
113impl ENABLER {
114    #[doc = r" Value of the field as raw bits"]
115    #[inline]
116    pub fn bit(&self) -> bool {
117        self.bits
118    }
119    #[doc = r" Returns `true` if the bit is clear (0)"]
120    #[inline]
121    pub fn bit_is_clear(&self) -> bool {
122        !self.bit()
123    }
124    #[doc = r" Returns `true` if the bit is set (1)"]
125    #[inline]
126    pub fn bit_is_set(&self) -> bool {
127        self.bit()
128    }
129}
130#[doc = r" Proxy"]
131pub struct _REPLACEW<'a> {
132    w: &'a mut W,
133}
134impl<'a> _REPLACEW<'a> {
135    #[doc = r" Writes raw bits to the field"]
136    #[inline]
137    pub unsafe fn bits(self, value: u8) -> &'a mut W {
138        const MASK: u8 = 3;
139        const OFFSET: u8 = 30;
140        self.w.bits &= !((MASK as u32) << OFFSET);
141        self.w.bits |= ((value & MASK) as u32) << OFFSET;
142        self.w
143    }
144}
145#[doc = r" Proxy"]
146pub struct _RESERVED29W<'a> {
147    w: &'a mut W,
148}
149impl<'a> _RESERVED29W<'a> {
150    #[doc = r" Sets the field bit"]
151    pub fn set_bit(self) -> &'a mut W {
152        self.bit(true)
153    }
154    #[doc = r" Clears the field bit"]
155    pub fn clear_bit(self) -> &'a mut W {
156        self.bit(false)
157    }
158    #[doc = r" Writes raw bits to the field"]
159    #[inline]
160    pub fn bit(self, value: bool) -> &'a mut W {
161        const MASK: bool = true;
162        const OFFSET: u8 = 29;
163        self.w.bits &= !((MASK as u32) << OFFSET);
164        self.w.bits |= ((value & MASK) as u32) << OFFSET;
165        self.w
166    }
167}
168#[doc = r" Proxy"]
169pub struct _COMPW<'a> {
170    w: &'a mut W,
171}
172impl<'a> _COMPW<'a> {
173    #[doc = r" Writes raw bits to the field"]
174    #[inline]
175    pub unsafe fn bits(self, value: u32) -> &'a mut W {
176        const MASK: u32 = 134217727;
177        const OFFSET: u8 = 2;
178        self.w.bits &= !((MASK as u32) << OFFSET);
179        self.w.bits |= ((value & MASK) as u32) << OFFSET;
180        self.w
181    }
182}
183#[doc = r" Proxy"]
184pub struct _RESERVED1W<'a> {
185    w: &'a mut W,
186}
187impl<'a> _RESERVED1W<'a> {
188    #[doc = r" Sets the field bit"]
189    pub fn set_bit(self) -> &'a mut W {
190        self.bit(true)
191    }
192    #[doc = r" Clears the field bit"]
193    pub fn clear_bit(self) -> &'a mut W {
194        self.bit(false)
195    }
196    #[doc = r" Writes raw bits to the field"]
197    #[inline]
198    pub fn bit(self, value: bool) -> &'a mut W {
199        const MASK: bool = true;
200        const OFFSET: u8 = 1;
201        self.w.bits &= !((MASK as u32) << OFFSET);
202        self.w.bits |= ((value & MASK) as u32) << OFFSET;
203        self.w
204    }
205}
206#[doc = r" Proxy"]
207pub struct _ENABLEW<'a> {
208    w: &'a mut W,
209}
210impl<'a> _ENABLEW<'a> {
211    #[doc = r" Sets the field bit"]
212    pub fn set_bit(self) -> &'a mut W {
213        self.bit(true)
214    }
215    #[doc = r" Clears the field bit"]
216    pub fn clear_bit(self) -> &'a mut W {
217        self.bit(false)
218    }
219    #[doc = r" Writes raw bits to the field"]
220    #[inline]
221    pub fn bit(self, value: bool) -> &'a mut W {
222        const MASK: bool = true;
223        const OFFSET: u8 = 0;
224        self.w.bits &= !((MASK as u32) << OFFSET);
225        self.w.bits |= ((value & MASK) as u32) << OFFSET;
226        self.w
227    }
228}
229impl R {
230    #[doc = r" Value of the register as raw bits"]
231    #[inline]
232    pub fn bits(&self) -> u32 {
233        self.bits
234    }
235    #[doc = "Bits 30:31 - 31:30\\] This selects what happens when the COMP address is matched. Address remapping only takes place for the 0x0 setting. 0x0: Remap to remap address. See REMAP.REMAP 0x1: Set BKPT on lower halfword, upper is unaffected 0x2: Set BKPT on upper halfword, lower is unaffected 0x3: Set BKPT on both lower and upper halfwords."]
236    #[inline]
237    pub fn replace(&self) -> REPLACER {
238        let bits = {
239            const MASK: u8 = 3;
240            const OFFSET: u8 = 30;
241            ((self.bits >> OFFSET) & MASK as u32) as u8
242        };
243        REPLACER { bits }
244    }
245    #[doc = "Bit 29 - 29:29\\] Software should not rely on the value of a reserved. Writing any other value than the reset value may result in undefined behavior."]
246    #[inline]
247    pub fn reserved29(&self) -> RESERVED29R {
248        let bits = {
249            const MASK: bool = true;
250            const OFFSET: u8 = 29;
251            ((self.bits >> OFFSET) & MASK as u32) != 0
252        };
253        RESERVED29R { bits }
254    }
255    #[doc = "Bits 2:28 - 28:2\\] Comparison address."]
256    #[inline]
257    pub fn comp(&self) -> COMPR {
258        let bits = {
259            const MASK: u32 = 134217727;
260            const OFFSET: u8 = 2;
261            ((self.bits >> OFFSET) & MASK as u32) as u32
262        };
263        COMPR { bits }
264    }
265    #[doc = "Bit 1 - 1:1\\] Software should not rely on the value of a reserved. Writing any other value than the reset value may result in undefined behavior."]
266    #[inline]
267    pub fn reserved1(&self) -> RESERVED1R {
268        let bits = {
269            const MASK: bool = true;
270            const OFFSET: u8 = 1;
271            ((self.bits >> OFFSET) & MASK as u32) != 0
272        };
273        RESERVED1R { bits }
274    }
275    #[doc = "Bit 0 - 0:0\\] Compare and remap enable comparator 4. CTRL.ENABLE must also be set to enable comparisons. 0x0: Compare and remap for comparator 4 disabled 0x1: Compare and remap for comparator 4 enabled"]
276    #[inline]
277    pub fn enable(&self) -> ENABLER {
278        let bits = {
279            const MASK: bool = true;
280            const OFFSET: u8 = 0;
281            ((self.bits >> OFFSET) & MASK as u32) != 0
282        };
283        ENABLER { bits }
284    }
285}
286impl W {
287    #[doc = r" Reset value of the register"]
288    #[inline]
289    pub fn reset_value() -> W {
290        W { bits: 0 }
291    }
292    #[doc = r" Writes raw bits to the register"]
293    #[inline]
294    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
295        self.bits = bits;
296        self
297    }
298    #[doc = "Bits 30:31 - 31:30\\] This selects what happens when the COMP address is matched. Address remapping only takes place for the 0x0 setting. 0x0: Remap to remap address. See REMAP.REMAP 0x1: Set BKPT on lower halfword, upper is unaffected 0x2: Set BKPT on upper halfword, lower is unaffected 0x3: Set BKPT on both lower and upper halfwords."]
299    #[inline]
300    pub fn replace(&mut self) -> _REPLACEW {
301        _REPLACEW { w: self }
302    }
303    #[doc = "Bit 29 - 29:29\\] Software should not rely on the value of a reserved. Writing any other value than the reset value may result in undefined behavior."]
304    #[inline]
305    pub fn reserved29(&mut self) -> _RESERVED29W {
306        _RESERVED29W { w: self }
307    }
308    #[doc = "Bits 2:28 - 28:2\\] Comparison address."]
309    #[inline]
310    pub fn comp(&mut self) -> _COMPW {
311        _COMPW { w: self }
312    }
313    #[doc = "Bit 1 - 1:1\\] Software should not rely on the value of a reserved. Writing any other value than the reset value may result in undefined behavior."]
314    #[inline]
315    pub fn reserved1(&mut self) -> _RESERVED1W {
316        _RESERVED1W { w: self }
317    }
318    #[doc = "Bit 0 - 0:0\\] Compare and remap enable comparator 4. CTRL.ENABLE must also be set to enable comparisons. 0x0: Compare and remap for comparator 4 disabled 0x1: Compare and remap for comparator 4 enabled"]
319    #[inline]
320    pub fn enable(&mut self) -> _ENABLEW {
321        _ENABLEW { w: self }
322    }
323}