1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
#[doc = "Register `ICSR` reader"]
pub type R = crate::R<ICSR_SPEC>;
#[doc = "Register `ICSR` writer"]
pub type W = crate::W<ICSR_SPEC>;
#[doc = "Field `VECTACTIVE` reader - Active exception number field. Reset clears the VECTACTIVE field."]
pub type VECTACTIVE_R = crate::FieldReader<u16>;
#[doc = "Field `VECTPENDING` reader - Indicates the exception number for the highest priority pending exception: 0 = no pending exceptions. Non zero = The pending state includes the effect of memory-mapped enable and mask registers. It does not include the PRIMASK special-purpose register qualifier."]
pub type VECTPENDING_R = crate::FieldReader<u16>;
#[doc = "Field `ISRPENDING` reader - External interrupt pending flag"]
pub type ISRPENDING_R = crate::BitReader;
#[doc = "Field `ISRPREEMPT` reader - The system can only access this bit when the core is halted. It indicates that a pending interrupt is to be taken in the next running cycle. If C_MASKINTS is clear in the Debug Halting Control and Status Register, the interrupt is serviced."]
pub type ISRPREEMPT_R = crate::BitReader;
#[doc = "Field `PENDSTCLR` reader - SysTick exception clear-pending bit.  
 Write:  
 0 = No effect.  
 1 = Removes the pending state from the SysTick exception.  
 This bit is WO. On a register read its value is Unknown."]
pub type PENDSTCLR_R = crate::BitReader;
#[doc = "Field `PENDSTCLR` writer - SysTick exception clear-pending bit.  
 Write:  
 0 = No effect.  
 1 = Removes the pending state from the SysTick exception.  
 This bit is WO. On a register read its value is Unknown."]
pub type PENDSTCLR_W<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `PENDSTSET` reader - SysTick exception set-pending bit.  
 Write:  
 0 = No effect.  
 1 = Changes SysTick exception state to pending.  
 Read:  
 0 = SysTick exception is not pending.  
 1 = SysTick exception is pending."]
pub type PENDSTSET_R = crate::BitReader;
#[doc = "Field `PENDSTSET` writer - SysTick exception set-pending bit.  
 Write:  
 0 = No effect.  
 1 = Changes SysTick exception state to pending.  
 Read:  
 0 = SysTick exception is not pending.  
 1 = SysTick exception is pending."]
pub type PENDSTSET_W<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `PENDSVCLR` reader - PendSV clear-pending bit.  
 Write:  
 0 = No effect.  
 1 = Removes the pending state from the PendSV exception."]
pub type PENDSVCLR_R = crate::BitReader;
#[doc = "Field `PENDSVCLR` writer - PendSV clear-pending bit.  
 Write:  
 0 = No effect.  
 1 = Removes the pending state from the PendSV exception."]
pub type PENDSVCLR_W<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `PENDSVSET` reader - PendSV set-pending bit.  
 Write:  
 0 = No effect.  
 1 = Changes PendSV exception state to pending.  
 Read:  
 0 = PendSV exception is not pending.  
 1 = PendSV exception is pending.  
 Writing 1 to this bit is the only way to set the PendSV exception state to pending."]
pub type PENDSVSET_R = crate::BitReader;
#[doc = "Field `PENDSVSET` writer - PendSV set-pending bit.  
 Write:  
 0 = No effect.  
 1 = Changes PendSV exception state to pending.  
 Read:  
 0 = PendSV exception is not pending.  
 1 = PendSV exception is pending.  
 Writing 1 to this bit is the only way to set the PendSV exception state to pending."]
pub type PENDSVSET_W<'a, REG> = crate::BitWriter<'a, REG>;
#[doc = "Field `NMIPENDSET` reader - Setting this bit will activate an NMI. Since NMI is the highest priority exception, it will activate as soon as it is registered.  
 NMI set-pending bit.  
 Write:  
 0 = No effect.  
 1 = Changes NMI exception state to pending.  
 Read:  
 0 = NMI exception is not pending.  
 1 = NMI exception is pending.  
 Because NMI is the highest-priority exception, normally the processor enters the NMI  
 exception handler as soon as it detects a write of 1 to this bit. Entering the handler then clears  
 this bit to 0. This means a read of this bit by the NMI exception handler returns 1 only if the  
 NMI signal is reasserted while the processor is executing that handler."]
pub type NMIPENDSET_R = crate::BitReader;
#[doc = "Field `NMIPENDSET` writer - Setting this bit will activate an NMI. Since NMI is the highest priority exception, it will activate as soon as it is registered.  
 NMI set-pending bit.  
 Write:  
 0 = No effect.  
 1 = Changes NMI exception state to pending.  
 Read:  
 0 = NMI exception is not pending.  
 1 = NMI exception is pending.  
 Because NMI is the highest-priority exception, normally the processor enters the NMI  
 exception handler as soon as it detects a write of 1 to this bit. Entering the handler then clears  
 this bit to 0. This means a read of this bit by the NMI exception handler returns 1 only if the  
 NMI signal is reasserted while the processor is executing that handler."]
pub type NMIPENDSET_W<'a, REG> = crate::BitWriter<'a, REG>;
impl R {
    #[doc = "Bits 0:8 - Active exception number field. Reset clears the VECTACTIVE field."]
    #[inline(always)]
    pub fn vectactive(&self) -> VECTACTIVE_R {
        VECTACTIVE_R::new((self.bits & 0x01ff) as u16)
    }
    #[doc = "Bits 12:20 - Indicates the exception number for the highest priority pending exception: 0 = no pending exceptions. Non zero = The pending state includes the effect of memory-mapped enable and mask registers. It does not include the PRIMASK special-purpose register qualifier."]
    #[inline(always)]
    pub fn vectpending(&self) -> VECTPENDING_R {
        VECTPENDING_R::new(((self.bits >> 12) & 0x01ff) as u16)
    }
    #[doc = "Bit 22 - External interrupt pending flag"]
    #[inline(always)]
    pub fn isrpending(&self) -> ISRPENDING_R {
        ISRPENDING_R::new(((self.bits >> 22) & 1) != 0)
    }
    #[doc = "Bit 23 - The system can only access this bit when the core is halted. It indicates that a pending interrupt is to be taken in the next running cycle. If C_MASKINTS is clear in the Debug Halting Control and Status Register, the interrupt is serviced."]
    #[inline(always)]
    pub fn isrpreempt(&self) -> ISRPREEMPT_R {
        ISRPREEMPT_R::new(((self.bits >> 23) & 1) != 0)
    }
    #[doc = "Bit 25 - SysTick exception clear-pending bit.  
 Write:  
 0 = No effect.  
 1 = Removes the pending state from the SysTick exception.  
 This bit is WO. On a register read its value is Unknown."]
    #[inline(always)]
    pub fn pendstclr(&self) -> PENDSTCLR_R {
        PENDSTCLR_R::new(((self.bits >> 25) & 1) != 0)
    }
    #[doc = "Bit 26 - SysTick exception set-pending bit.  
 Write:  
 0 = No effect.  
 1 = Changes SysTick exception state to pending.  
 Read:  
 0 = SysTick exception is not pending.  
 1 = SysTick exception is pending."]
    #[inline(always)]
    pub fn pendstset(&self) -> PENDSTSET_R {
        PENDSTSET_R::new(((self.bits >> 26) & 1) != 0)
    }
    #[doc = "Bit 27 - PendSV clear-pending bit.  
 Write:  
 0 = No effect.  
 1 = Removes the pending state from the PendSV exception."]
    #[inline(always)]
    pub fn pendsvclr(&self) -> PENDSVCLR_R {
        PENDSVCLR_R::new(((self.bits >> 27) & 1) != 0)
    }
    #[doc = "Bit 28 - PendSV set-pending bit.  
 Write:  
 0 = No effect.  
 1 = Changes PendSV exception state to pending.  
 Read:  
 0 = PendSV exception is not pending.  
 1 = PendSV exception is pending.  
 Writing 1 to this bit is the only way to set the PendSV exception state to pending."]
    #[inline(always)]
    pub fn pendsvset(&self) -> PENDSVSET_R {
        PENDSVSET_R::new(((self.bits >> 28) & 1) != 0)
    }
    #[doc = "Bit 31 - Setting this bit will activate an NMI. Since NMI is the highest priority exception, it will activate as soon as it is registered.  
 NMI set-pending bit.  
 Write:  
 0 = No effect.  
 1 = Changes NMI exception state to pending.  
 Read:  
 0 = NMI exception is not pending.  
 1 = NMI exception is pending.  
 Because NMI is the highest-priority exception, normally the processor enters the NMI  
 exception handler as soon as it detects a write of 1 to this bit. Entering the handler then clears  
 this bit to 0. This means a read of this bit by the NMI exception handler returns 1 only if the  
 NMI signal is reasserted while the processor is executing that handler."]
    #[inline(always)]
    pub fn nmipendset(&self) -> NMIPENDSET_R {
        NMIPENDSET_R::new(((self.bits >> 31) & 1) != 0)
    }
}
impl W {
    #[doc = "Bit 25 - SysTick exception clear-pending bit.  
 Write:  
 0 = No effect.  
 1 = Removes the pending state from the SysTick exception.  
 This bit is WO. On a register read its value is Unknown."]
    #[inline(always)]
    #[must_use]
    pub fn pendstclr(&mut self) -> PENDSTCLR_W<ICSR_SPEC> {
        PENDSTCLR_W::new(self, 25)
    }
    #[doc = "Bit 26 - SysTick exception set-pending bit.  
 Write:  
 0 = No effect.  
 1 = Changes SysTick exception state to pending.  
 Read:  
 0 = SysTick exception is not pending.  
 1 = SysTick exception is pending."]
    #[inline(always)]
    #[must_use]
    pub fn pendstset(&mut self) -> PENDSTSET_W<ICSR_SPEC> {
        PENDSTSET_W::new(self, 26)
    }
    #[doc = "Bit 27 - PendSV clear-pending bit.  
 Write:  
 0 = No effect.  
 1 = Removes the pending state from the PendSV exception."]
    #[inline(always)]
    #[must_use]
    pub fn pendsvclr(&mut self) -> PENDSVCLR_W<ICSR_SPEC> {
        PENDSVCLR_W::new(self, 27)
    }
    #[doc = "Bit 28 - PendSV set-pending bit.  
 Write:  
 0 = No effect.  
 1 = Changes PendSV exception state to pending.  
 Read:  
 0 = PendSV exception is not pending.  
 1 = PendSV exception is pending.  
 Writing 1 to this bit is the only way to set the PendSV exception state to pending."]
    #[inline(always)]
    #[must_use]
    pub fn pendsvset(&mut self) -> PENDSVSET_W<ICSR_SPEC> {
        PENDSVSET_W::new(self, 28)
    }
    #[doc = "Bit 31 - Setting this bit will activate an NMI. Since NMI is the highest priority exception, it will activate as soon as it is registered.  
 NMI set-pending bit.  
 Write:  
 0 = No effect.  
 1 = Changes NMI exception state to pending.  
 Read:  
 0 = NMI exception is not pending.  
 1 = NMI exception is pending.  
 Because NMI is the highest-priority exception, normally the processor enters the NMI  
 exception handler as soon as it detects a write of 1 to this bit. Entering the handler then clears  
 this bit to 0. This means a read of this bit by the NMI exception handler returns 1 only if the  
 NMI signal is reasserted while the processor is executing that handler."]
    #[inline(always)]
    #[must_use]
    pub fn nmipendset(&mut self) -> NMIPENDSET_W<ICSR_SPEC> {
        NMIPENDSET_W::new(self, 31)
    }
    #[doc = r" Writes raw bits to the register."]
    #[doc = r""]
    #[doc = r" # Safety"]
    #[doc = r""]
    #[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"]
    #[inline(always)]
    pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
        self.bits = bits;
        self
    }
}
#[doc = "Use the Interrupt Control State Register to set a pending Non-Maskable Interrupt (NMI), set or clear a pending PendSV, set or clear a pending SysTick, check for pending exceptions, check the vector number of the highest priority pended exception, check the vector number of the active exception.  

You can [`read`](crate::generic::Reg::read) this register and get [`icsr::R`](R).  You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`icsr::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."]
pub struct ICSR_SPEC;
impl crate::RegisterSpec for ICSR_SPEC {
    type Ux = u32;
}
#[doc = "`read()` method returns [`icsr::R`](R) reader structure"]
impl crate::Readable for ICSR_SPEC {}
#[doc = "`write(|w| ..)` method takes [`icsr::W`](W) writer structure"]
impl crate::Writable for ICSR_SPEC {
    const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
    const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0;
}
#[doc = "`reset()` method sets ICSR to value 0"]
impl crate::Resettable for ICSR_SPEC {
    const RESET_VALUE: u32 = 0;
}