]> begriffs open source - cmsis/blob - CMSIS/DoxyGen/Core/src/Ref_CoreReg.txt
NVIC Virtualization documented
[cmsis] / CMSIS / DoxyGen / Core / src / Ref_CoreReg.txt
1 /**************************************************************************************************/\r
2 /** \defgroup Core_Register_gr Core Register Access\r
3 \brief Functions to access the Cortex-M core registers.\r
4 \details\r
5   The following functions provide access to Cortex-M core registers. \r
6 \r
7   @{ \r
8 */\r
9 \r
10 \r
11 /**************************************************************************************************/\r
12 /** \brief  Read the CONTROL register\r
13     \details\r
14     The function reads the CONTROL register value using the instruction \b MRS. \r
15     \n\n\r
16     The CONTROL register controls the stack used and the privilege level for software execution\r
17     when the processor is in thread mode and, if implemented, indicates whether the FPU state is\r
18     active. This register uses the following bits:\r
19     \n\r
20     - \b CONTROL[2] [only Cortex-M4 and Cortex-M7]\r
21         - =0 FPU not active\r
22         - =1 FPU active\r
23         \n\n\r
24     - \b CONTROL[1] \r
25         - =0 In handler mode - MSP is selected. No alternate stack possible for handler mode.\r
26         - =0 In thread mode - Default stack pointer MSP is used.\r
27         - =1 In thread mode - Alternate stack pointer PSP is used.\r
28         \n\n\r
29     - \b CONTROL[0] [not Cortex-M0]\r
30         - =0 In thread mode and privileged state.\r
31         - =1 In thread mode and user state.\r
32      \r
33     \returns    CONTROL register value\r
34     \r
35     \remarks    \r
36             - The processor can be in user state or privileged state when running in thread mode.\r
37             - Exception handlers always run in privileged state.\r
38             - On reset, the processor is in thread mode with privileged access  rights.\r
39     \r
40     \sa     \r
41             - \ref __set_CONTROL; CONTROL_Type \r
42             - \ref ref_man_sec\r
43  */\r
44 uint32_t __get_CONTROL(void);\r
45 \r
46 \r
47 /**************************************************************************************************/\r
48 /** \brief  Set the CONTROL Register\r
49     \details \r
50     The function sets the CONTROL register value using the instruction \b MSR. \r
51     \n\n\r
52     The CONTROL register controls the stack used and the privilege level for software execution\r
53     when the processor is in thread mode and, if implemented, indicates whether the FPU state is\r
54     active. This register uses the following bits:\r
55     \n\r
56     - \b CONTROL[2] [only Cortex-M4 and Cortex-M7]\r
57         - =0 FPU not active\r
58         - =1 FPU active\r
59         \n\n\r
60     - \b CONTROL[1] \r
61         - Writeable only when the processor is in thread mode and privileged state (CONTROL[0]=0).\r
62         - =0 In handler mode - MSP is selected. No alternate stack pointer possible for handler mode.\r
63         - =0 In thread mode - Default stack pointer MSP is used.\r
64         - =1 In thread mode - Alternate stack pointer PSP is used.\r
65         \n\n\r
66     - \b CONTROL[0] [not writeable for Cortex-M0]\r
67         - Writeable only when the processor is in privileged state.\r
68         - Can be used to switch the processor to user state (thread mode).\r
69         - Once in user state, trigger an interrupt and change the state to privileged in the \r
70         exception handler (the only way).\r
71         - =0 In thread mode and privileged state.\r
72         - =1 In thread mode and user state.\r
73 \r
74      \r
75     \param [in] control  CONTROL register value to set    \r
76     \r
77     \remarks    \r
78             - The processor can be in user state or privileged state when running in thread mode.\r
79             - Exception handlers always run in privileged state.\r
80             - On reset, the processor is in thread mode with privileged access  rights.\r
81 \r
82     \sa     \r
83             - \ref __get_CONTROL; __set_PSP; __set_MSP; CONTROL_Type \r
84             - \ref ref_man_sec\r
85 */\r
86 void __set_CONTROL(uint32_t control);\r
87 \r
88 \r
89 /**************************************************************************************************/\r
90 /** \brief  Read the IPSR register\r
91     \details \r
92     The function reads the Interrupt Program Status Register (IPSR) using the instruction \b MRS. \r
93     \n\n\r
94     The ISPR contains the exception type number of the current Interrupt Service Routine (ISR). \r
95     Each exception has an assocciated unique IRQn number. The following bits are used:\r
96     \r
97     - \b ISR_NUMBER (IPSR[8:0])\r
98         - =0 Thread mode\r
99         - =1 Reserved\r
100         - =2 NMI\r
101         - =3 HardFault\r
102         - =4 MemManage\r
103         - =5 BusFault\r
104         - =6 UsageFault\r
105         - =7-10  Reserved\r
106         - =11 SVCall\r
107         - =12 Reserved for Debug\r
108         - =13 Reserved\r
109         - =14 PendSV\r
110         - =15 SysTick\r
111         - =16 IRQ0\r
112         - ...\r
113         - =n+15 IRQ(n-1)\r
114 \r
115     \returns    ISPR register value\r
116 \r
117     \remarks    \r
118             - This register is read-only.\r
119 \r
120     \sa     \r
121             - \ref __get_xPSR; IPSR_Type\r
122             - \ref NVIC_gr\r
123             - \ref ref_man_sec\r
124 */\r
125 uint32_t __get_IPSR(void);\r
126 \r
127 \r
128 /**************************************************************************************************/\r
129 /** \brief  Read the APSR register\r
130     \details\r
131     The function reads the Application Program Status Register (APSR) using the instruction \b MRS.\r
132     \n\n\r
133     The APSR contains the current state of the condition flags from instructions executed previously.\r
134     The APSR is essential for controlling conditional branches. The following flags are used:\r
135     \r
136     - \b N (APSR[31]) (Negative flag)\r
137         - =1 The instruction result has a negative value (when interpreted as signed integer).\r
138         - =0 The instruction result has a positive value or equal zero.\r
139     \n\n\r
140     - \b Z (APSR[30]) (Zero flag)\r
141         - =1 The instruction result is zero. Or, after a compare instruction, when the two values\r
142             are the same.\r
143     \n\n\r
144     - \b C (APSR[29]) (Carry or borrow flag)\r
145         - =1 For unsigned additions, if an unsigned overflow occurred.\r
146         - =<i>inverse of borrow output status</i> For unsigned subtract operations.\r
147     \n\n\r
148     - \b V (APSR[28]) (Overflow flag)\r
149         - =1 A signed overflow occurred (for signed additions or subtractions).\r
150     \n\n\r
151     - \b Q (APSR[27]) (DSP overflow or saturation flag) [not Cortex-M0]\r
152         - This flag is a \em sticky flag. Saturating and certain mutliplying instructions can set the\r
153         flag, but cannot clear it. \r
154         - =1 When saturation or an overflow occurred.\r
155     \n\n\r
156     - \b GE (APSR[19:16]) (Greater than or Equal flags) [not Cortex-M0]\r
157         - Can be set by the parallel add and subtract instructions.\r
158         - Are used by the <kbd>SEL</kbd> instruction to perform byte-based selection from two registers.\r
159     \r
160     \r
161     \returns    APSR register value\r
162 \r
163     \remarks    \r
164             - Some instructions update all flags; some instructions update a subset of the flags. \r
165             - If a flag is not updated, the original value is preserved. \r
166             - Conditional instructions that are not executed have no effect on the flags.\r
167             - The CMSIS does not provide a function to update this register.\r
168 \r
169     \sa     \r
170             - \ref __get_xPSR; APSR_Type \r
171             - \ref ref_man_sec\r
172 \r
173  */\r
174 uint32_t __get_APSR(void);\r
175 \r
176 \r
177 /**************************************************************************************************/\r
178 /** \brief  Read the xPSR register \r
179     \details \r
180     The function reads the combined Program Status Register (xPSR) using the instruction \b MRS. \r
181     \n\n\r
182     xPSR provides information about program execution and the APSR flags. It consists of the \r
183     following PSRs:\r
184     \li Application Program Status Register (APSR)\r
185     \li Interrupt Program Status Register (IPSR)\r
186     \li Execution Program Status Register (EPSR)\r
187     \r
188     In addition to the flags described in \ref __get_APSR and \ref __get_IPSR, the register provides \r
189     the following flags:\r
190     - \b IT (xPSR[26:25]) (If-Then condition instruction)\r
191         - Contains up to four instructions following an IT instruction. \r
192         - Each instruction in the block is conditional. \r
193         - The conditions for the instructions are either all the same, or some can be the inverse \r
194         of others.\r
195     \n\n\r
196     - \b T (xPSR[24]) (Thumb bit) \r
197         - =1 Indicates that that the processor is in Thumb state. \r
198         - =0 Attempting to execute instructions when the T bit is 0 results in a fault or lockup. \r
199         - The conditions for the instructions are either all the same, or some can be the inverse \r
200         of others.\r
201     \r
202     \returns    xPSR register value \r
203     \r
204     \remarks\r
205         - The CMSIS does not provide functions that access EPSR.\r
206 \r
207     \sa     \r
208             - \ref __get_APSR; __get_IPSR; xPSR_Type\r
209             - \ref ref_man_sec\r
210     \r
211  */\r
212 uint32_t __get_xPSR(void);\r
213 \r
214 \r
215 /**************************************************************************************************/\r
216 /** \brief  Read the PSP register\r
217     \details \r
218     The function reads the Program Status Pointer (PSP) value using the instruction \b MRS.\r
219     \n\n\r
220     Physically two different stack pointers (SP) exist: \r
221     - The Main Stack Pointer (MSP) is the default stack pointer after reset. It is also used when \r
222     running exception handlers (handler mode).\r
223     - The Process Stack Pointer (PSP), which can be used only in thread mode. \r
224     \r
225     Register R13 banks the SP. The SP selection is determined by the bit[1] of the CONTROL register: \r
226     - =0 MSP is the current stack pointer. This is also the default SP. The initial value is loaded \r
227     from the first 32-bit word of the vector table from the program memory.\r
228     - =1 PSP is the current stack pointer. The initial value is undefined. \r
229   \r
230     \returns    PSP register value\r
231         \r
232     \remarks\r
233         - Only one of the two SPs is visible at a time.\r
234         - For many applications, the system can completely rely on the MSP.\r
235         - The PSP is normally used in designs with an OS where the stack memory for OS Kernel must \r
236         be separated from the application code.  \r
237 \r
238     \sa \r
239         - \ref __set_PSP; __get_MSP; __get_CONTROL\r
240         - \ref ref_man_sec\r
241 \r
242     \r
243  */\r
244 uint32_t __get_PSP(void);\r
245 \r
246 \r
247 /**************************************************************************************************/\r
248 /** \brief  Set the PSP register\r
249     \details\r
250     The function sets the Program Status Pointer (PSP) value using the instruction \b MSR.\r
251     \n\n\r
252     Physically two different stack pointers (SP) exist: \r
253     - The Main Stack Pointer (MSP) is the default stack pointer after reset. It is also used when \r
254     running exception handlers (handler mode).\r
255     - The Process Stack Pointer (PSP), which can be used only in thread mode. \r
256     \r
257     Register R13 banks the SP. The SP selection is determined by the bit[1] of the CONTROL register: \r
258     - =0 MSP is the current stack pointer. This is also the default SP. The initial value is loaded \r
259     from the first 32-bit word of the vector table from the program memory.\r
260     - =1 PSP is the current stack pointer. The initial value is undefined. \r
261     \r
262     \param [in]    topOfProcStack  PSP value to set\r
263         \r
264     \remarks\r
265         - Only one of the two SPs is visible at a time.\r
266         - For many applications, the system can completely rely on the MSP.\r
267         - The PSP is normally used in designs with an OS where the stack memory for OS Kernel must \r
268         be separated from the application code.  \r
269         \r
270     \sa \r
271         - \ref __get_PSP; __set_MSP; __set_CONTROL\r
272         - \ref ref_man_sec\r
273  */\r
274 void __set_PSP(uint32_t topOfProcStack);\r
275 \r
276 \r
277 /**************************************************************************************************/\r
278 /** \brief  Read the MSP register\r
279     \details \r
280     The function reads the Main Status Pointer (MSP) value using the instruction \b MRS.\r
281     \n\n\r
282     Physically two different stack pointers (SP) exist: \r
283     - The Main Stack Pointer (MSP) is the default stack pointer after reset. It is also used when \r
284     running exception handlers (handler mode).\r
285     - The Process Stack Pointer (PSP), which can be used only in thread mode. \r
286     \r
287     Register R13 banks the SP. The SP selection is determined by the bit[1] of the CONTROL register: \r
288     - =0 MSP is the current stack pointer. This is also the default SP. The initial value is loaded \r
289     from the first 32-bit word of the vector table from the program memory.\r
290     - =1 PSP is the current stack pointer. The initial value is undefined. \r
291     \r
292     \returns    MSP Register value \r
293 \r
294     \remarks\r
295         - Only one of the two SPs is visible at a time.\r
296         - For many applications, the system can completely rely on the MSP.\r
297         - The PSP is normally used in designs with an OS where the stack memory for OS Kernel must \r
298         be separated from the application code.  \r
299         \r
300     \sa \r
301         - \ref __set_MSP; __get_PSP; __get_CONTROL\r
302         - \ref ref_man_sec\r
303 \r
304  */\r
305 uint32_t __get_MSP(void);\r
306 \r
307 \r
308 /**************************************************************************************************/\r
309 /** \brief  Set the MSP register\r
310     \details \r
311     The function sets the Main Status Pointer (MSP) value using the instruction \b MSR.\r
312     \n\n\r
313     Physically two different stack pointers (SP) exist: \r
314     - The Main Stack Pointer (MSP) is the default stack pointer after reset. It is also used when \r
315     running exception handlers (handler mode).\r
316     - The Process Stack Pointer (PSP), which can be used only in thread mode. \r
317     \r
318     Register R13 banks the SP. The SP selection is determined by the bit[1] of the CONTROL register: \r
319     - =0 MSP is the current stack pointer. This is also the default SP. The initial value is loaded \r
320     from the first 32-bit word of the vector table from the program memory.\r
321     - =1 PSP is the current stack pointer. The initial value is undefined. \r
322     \r
323     \param [in]    topOfMainStack  MSP value to set\r
324 \r
325     \remarks\r
326         - Only one of the two SPs is visible at a time.\r
327         - For many applications, the system can completely rely on the MSP.\r
328         - The PSP is normally used in designs with an OS where the stack memory for OS Kernel must \r
329         be separated from the application code.  \r
330         \r
331     \sa \r
332         - \ref __get_MSP; __set_PSP; __set_CONTROL\r
333         - \ref ref_man_sec\r
334 \r
335  */\r
336 void __set_MSP(uint32_t topOfMainStack);\r
337 \r
338 \r
339 /**************************************************************************************************/\r
340 /** \brief  Read the PRIMASK register bit \r
341     \details \r
342     The function reads the Priority Mask register (PRIMASK) value using the instruction \b MRS. \r
343     \n\n\r
344     PRIMASK is a 1-bit-wide interrupt mask register. When set,\r
345     it blocks all interrupts apart from the non-maskable interrupt (NMI) and the hard fault exception.\r
346     The PRIMASK prevents activation of all exceptions with configurable priority.\r
347 \r
348     \returns    PRIMASK register value\r
349                 - =0 no effect\r
350                 - =1 prevents the activation of all exceptions with configurable priority\r
351            \r
352     \sa \r
353         - \ref __set_PRIMASK; __get_BASEPRI; __get_FAULTMASK\r
354         - \ref ref_man_sec                    \r
355                     \r
356  */\r
357 uint32_t __get_PRIMASK(void);\r
358 \r
359 \r
360 /**************************************************************************************************/\r
361 /** \brief  Set the Priority Mask bit\r
362     \details \r
363     The function sets the Priority Mask register (PRIMASK) value using the instruction \b MSR. \r
364     \n\n\r
365     PRIMASK is a 1-bit-wide interrupt mask register. When set,\r
366     it blocks all interrupts apart from the non-maskable interrupt (NMI) and the hard fault exception.\r
367     The PRIMASK prevents activation of all exceptions with configurable priority.\r
368 \r
369     \param [in]    priMask  Priority Mask\r
370                     - =0 no effect\r
371                     - =1 prevents the activation of all exceptions with configurable priority\r
372 \r
373     \remarks\r
374         - When set, PRIMASK effectively changes the current priority level to 0. \r
375         This is the highest programmable level.\r
376         - When set and a fault occurs, the hard fault handler will be executed.\r
377         - Useful for temprorarily disabling all interrupts for timing critical tasks. \r
378         - Does not have the ability to mask BusFault or bypass MPU.\r
379 \r
380     \sa \r
381         - \ref __get_PRIMASK; __set_BASEPRI; __set_FAULTMASK\r
382         - \ref ref_man_sec                    \r
383 \r
384  */\r
385 void __set_PRIMASK(uint32_t priMask);\r
386  \r
387 \r
388 /**************************************************************************************************/\r
389 /** \brief  Read the BASEPRI register [not for Cortex-M0, Cortex-M0+, or SC000]\r
390     \details \r
391     The function returns the Base Priority Mask register (BASEPRI) using the instruction \b MRS. \r
392     \n\n\r
393     BASEPRI defines the minimum priority for exception processing. When BASEPRI is set to a non-zero \r
394     value, it prevents the activation of all exceptions with the same or lower priority level as \r
395     the BASEPRI value.\r
396     \r
397     \returns    BASEPRI register value\r
398 \r
399     \remarks    \r
400         - Not for Cortex-M0, Cortex-M0+, or SC000.\r
401                     \r
402     \sa \r
403         - \ref __set_BASEPRI;  __set_BASEPRI_MAX; __get_FAULTMASK; __get_PRIMASK\r
404         - \ref ref_man_sec\r
405 \r
406     */\r
407 uint32_t __get_BASEPRI(void);\r
408 \r
409 \r
410 /**************************************************************************************************/\r
411 /** \brief  Set the BASEPRI register [not for Cortex-M0, Cortex-M0+, or SC000]\r
412     \details \r
413     The function sets the Base Priority Mask register (BASEPRI) value using the instruction \b MSR.\r
414     \n\n\r
415     BASEPRI defines the minimum priority for exception processing. \r
416     When BASEPRI is set to a non-zero value, it prevents the activation of all exceptions with the \r
417     same or lower priority level as the BASEPRI value.\r
418     \r
419     \param [in]    basePri  BASEPRI value to set\r
420 \r
421     \remarks    \r
422         - Not for Cortex-M0, Cortex-M0+, or SC000.\r
423         - Cannot be set in user state.\r
424         - Useful for changing the masking level or disabling the masking.\r
425 \r
426     \sa \r
427         - \ref __get_BASEPRI;  __set_BASEPRI_MAX; __set_FAULTMASK; __set_PRIMASK\r
428         - \ref ref_man_sec\r
429     \r
430  */\r
431 void __set_BASEPRI(uint32_t basePri); \r
432  \r
433  \r
434 /**************************************************************************************************/\r
435 /** \brief  Increase the BASEPRI register [not for Cortex-M0, Cortex-M0+, or SC000]\r
436     \details \r
437     The function only increases the Base Priority Mask register (BASEPRI) value using the instruction \b MSR.\r
438         The value is set only if BASEPRI masking is disabled, or the new value increases the BASEPRI priority level.\r
439     \n\n\r
440     BASEPRI defines the minimum priority for exception processing. \r
441         \r
442     \param [in]    basePri  BASEPRI value to set\r
443 \r
444     \remarks    \r
445         - Not for Cortex-M0, Cortex-M0+, or SC000.\r
446         - Cannot be set in user state.\r
447         - Useful for increasing the masking level.\r
448         - Has no effect when \em basePri is lower than the current value of BASEPRI.\r
449         - Use \ref __set_BASEPRI to lower the Base Priority Mask register.\r
450 \r
451     \sa \r
452         - \ref __set_BASEPRI; __get_BASEPRI; __set_FAULTMASK; __set_PRIMASK\r
453         - \ref ref_man_sec\r
454     \r
455  */\r
456 void __set_BASEPRI_MAX(uint32_t basePri); \r
457 \r
458 \r
459 /**************************************************************************************************/\r
460 /** \brief  Read the FAULTMASK register [not for Cortex-M0, Cortex-M0+, or SC000]\r
461     \details \r
462     The function reads the Fault Mask register (FAULTMASK) value using the instruction \b MRS. \r
463     \n\n\r
464     FAULTMASK prevents activation of all exceptions except for the Non-Maskable Interrupt (NMI).\r
465 \r
466     \returns    FAULTMASK register value\r
467 \r
468     \remarks    \r
469         - not for Cortex-M0, Cortex-M0+, or SC000.\r
470         - Is cleared automatically upon exiting the exception handler, except when returning \r
471         from the NMI handler.\r
472 \r
473     \sa \r
474         - \ref __set_FAULTMASK; __get_BASEPRI; __get_PRIMASK \r
475         - \ref ref_man_sec\r
476  */\r
477 uint32_t __get_FAULTMASK(void);\r
478 \r
479 \r
480 /**************************************************************************************************/\r
481 /** \brief  Set the FAULTMASK register [not for Cortex-M0, Cortex-M0+, or SC000]\r
482     \details \r
483     The function sets the Fault Mask register (FAULTMASK) value using the instruction \b MSR.\r
484     \n\n\r
485     FAULTMASK prevents activation of all exceptions except for Non-Maskable Interrupt (NMI).\r
486     FAULTMASK can be used to escalate a configurable fault handler (BusFault, usage fault, or \r
487     memory management fault) to hard fault level without invoking a hard fault. This allows the \r
488     fault handler to pretend to be the hard fault handler, whith the ability to:\r
489     -# <b>Mask BusFault</b> by setting the BFHFNMIGN in the Configuration Control register.\r
490     It can be used to test the bus system without causing a lockup. \r
491     -# <b>Bypass the MPU</b>, allowing accessing the MPU protected memory location without \r
492     reprogramming the MPU to just carry out a few transfers for fixing faults.\r
493 \r
494     \param [in]    faultMask  FAULTMASK register value to set \r
495 \r
496     \remarks    \r
497         - not for Cortex-M0, Cortex-M0+, or SC000.\r
498         - Is cleared automatically upon exiting the exception handler, except when returning \r
499         from the NMI handler.\r
500         - When set, it changes the effective current priority level to -1, so that even the hard\r
501         fault handler is blocked.\r
502         - Can be used by fault handlers to change their priority to -1 to have access to some \r
503         features for hard fault exceptions (see above).\r
504         - When set, lockups can still be caused by incorrect or undefined instructions, or by using\r
505         SVC in the wrong priority level.\r
506 \r
507     \sa \r
508         - \ref __get_FAULTMASK; __set_BASEPRI; __set_PRIMASK \r
509         - \ref ref_man_sec\r
510  */\r
511 void __set_FAULTMASK(uint32_t faultMask);\r
512 \r
513 \r
514 /**************************************************************************************************/\r
515 /** \brief  Read the FPSCR register [only Cortex-M4 and Cortex-M7]\r
516     \details \r
517     The function reads the Floating-Point Status Control Register (FPSCR) value. \r
518     \n\n\r
519     FPSCR provides all necessary User level controls of the floating-point system. \r
520         \r
521     \returns    \r
522             - FPSCR register value, when __FPU_PRESENT=1\r
523             - =0, when __FPU_PRESENT=0\r
524 \r
525     \remarks\r
526             - Only for Cortex-M4 and Cortex-M7.\r
527                 \r
528     \sa \r
529             - \ref __set_FPSCR\r
530             - \ref ref_man_sec\r
531                     \r
532  */\r
533 uint32_t __get_FPSCR(void);\r
534 \r
535 \r
536 /**************************************************************************************************/\r
537 /** \brief  Set the FPSC register [only for Cortex-M4 and Cortex-M7]\r
538     \details \r
539     The function sets the Floating-Point Status Control Register (FPSCR) value. \r
540     \n\n\r
541     FPSCR provides all necessary User level control of the floating-point system. \r
542     \n\r
543     - \b N (FPSC[31]) (Negative flag)\r
544         - =1 The instruction result has a negative value (when interpreted as signed integer).\r
545         - =0 The instruction result has a positive value or equal zero.\r
546     \n\n\r
547     - \b Z (FPSC[30]) (Zero flag)\r
548         - =1 The instruction result is zero. Or, after a compare instruction, when the two values\r
549             are the same.\r
550     \n\n\r
551     - \b C (FPSC[29]) (Carry or borrow flag)\r
552         - =1 For unsigned additions, if an unsigned overflow occurred.\r
553         - =<i>inverse of borrow output status</i> For unsigned subtract operations.\r
554     \n\n\r
555     - \b V (FPSC[28]) (Overflow flag)\r
556         - =1 A signed overflow occurred (for signed additions or subtractions).\r
557     \n\n\r
558     - \b AHP (FPSC[26]) (Alternative half-precision flag)\r
559         - =1 Alternative half-precision format selected.\r
560         - =0 IEEE half-precision format selected.\r
561     \n\n\r
562     - \b DN (FPSC[25]) (Default NaN mode control flag)\r
563         - =1 Any operation involving one or more NaNs returns the Default NaN.\r
564         - =0 NaN operands propagate through to the output of a floating-point operation.\r
565     \n\n\r
566     - \b FZ (FPSC[24]) (Flush-to-zero mode control flag)\r
567         - =1 Flush-to-zero mode enabled.\r
568         - =0 Flush-to-zero mode disabled. Behavior of the floating-point system is fully \r
569         compliant with the IEEE 754 standard.\r
570     \n\n\r
571     - \b RMode (FPSC[23:22]) (Rounding Mode control flags)\r
572         - =0b00 Round to Nearest (RN) mode.\r
573         - =0b01 Round towards Plus Infinity (RP) mode.\r
574         - =0b10 Round towards Minus Infinity (RM) mode.\r
575         - =0b11 Round towards Zero (RZ) mode.\r
576         - The specified rounding mode is used by almost all floating-point instructions.\r
577     \n\n\r
578     - \b IDC (FPSC[7]) (Input Denormal cumulative exception flags)\r
579         - See Cumulative exception bits (FPSC[4:0]).\r
580     \n\n\r
581     - \b IXC (FPSC[4]) (Inexact cumulative exception flag)\r
582         - =1 Exception occurred. \r
583         - =0 Value has to be set explicitly. \r
584         - Flag is not cleared automatically.\r
585     \n\n\r
586     - \b UFC (FPSC[3]) (Underflow cumulative exception flag)\r
587         - =1 Exception occurred. \r
588         - =0 Value has to be set explicitly. \r
589         - Flag is not cleared automatically.\r
590     \n\n\r
591     - \b OFC (FPSC[2]) (Overflow cumulative exception flag)\r
592         - =1 Exception occurred. \r
593         - =0 Value has to be set explicitly. \r
594         - Flag is not cleared automatically.\r
595     \n\n\r
596     - \b DZC (FPSC[1]) (Division by Zero cumulative exception flag)\r
597         - =1 Exception occurred. \r
598         - =0 Value has to be set explicitly. \r
599         - Flag is not cleared automatically.\r
600     \n\n\r
601     - \b IOC (FPSC[0]) (Invalid Operation cumulative exception flag)\r
602         - =1 Exception occurred. \r
603         - =0 Value has to be set explicitly. \r
604         - Flag is not cleared automatically.\r
605         \r
606     \param [in]    fpscr  FPSCR value to set\r
607 \r
608     \remarks\r
609             - Only for Cortex-M4 and Cortex-M7.\r
610             - The variable \b __FPU_PRESENT has to be set to 1.\r
611     \r
612     \sa \r
613             - \ref __get_FPSCR\r
614             - \ref ref_man_sec\r
615  */\r
616 void __set_FPSCR(uint32_t fpscr);\r
617 \r
618 \r
619 /**************************************************************************************************/\r
620 /** \brief  Globally enables interrupts and configurable fault handlers\r
621     \details\r
622     The function enables interrupts and all configurable fault handlers by clearing PRIMASK.\r
623     The function uses the instruction <b>CPSIE i</b>.\r
624 \r
625     \remarks\r
626             - Can be executed in privileged mode only. \r
627             \r
628     \sa \r
629         - \ref __disable_irq; __set_BASEPRI; __set_CONTROL; __set_PRIMASK\r
630  */\r
631 void __enable_irq(void);\r
632 \r
633 \r
634 /**************************************************************************************************/\r
635 /** \brief  Globally disables interrupts and configurable fault handlers\r
636     \details \r
637     The function disables interrupts and all configurable fault handlers by setting PRIMASK. \r
638     The function uses the instruction <b>CPSID i</b>.\r
639 \r
640     \remarks\r
641         - Can be executed in privileged mode only. \r
642         - An interrupt can enter pending state even if it is disabled. Disabling an interrupt \r
643         only prevents the processor from taking that interrupt.\r
644 \r
645     \sa \r
646         - \ref __enable_irq;  __set_BASEPRI; __set_CONTROL; __set_PRIMASK\r
647  */\r
648 void __disable_irq(void);\r
649 \r
650 \r
651 /**************************************************************************************************/\r
652 /** \brief  Enables interrupts and all fault handlers [not for Cortex-M0, Cortex-M0+, or SC000]\r
653     \details \r
654     The function enables interrupts and all fault handlers by clearing FAULTMASK.\r
655     The function uses the instruction <b>CPSIE f</b>.\r
656 \r
657     \remarks\r
658             - not for Cortex-M0, Cortex-M0+, or SC000.\r
659             - Can be executed in privileged mode only. \r
660     \r
661     \sa \r
662         - \ref __disable_fault_irq; __set_BASEPRI; __set_CONTROL; __set_FAULTMASK\r
663  */\r
664  void __enable_fault_irq(void);\r
665 \r
666 \r
667 /**************************************************************************************************/\r
668 /** \brief  Disables interrupts and all fault handlers [not for Cortex-M0, Cortex-M0+, or SC000]\r
669     \details \r
670     The function disables interrupts and all fault handlers by setting FAULTMASK.\r
671     The function uses the instruction <b>CPSID f</b>.\r
672 \r
673     \remarks\r
674         - not for Cortex-M0, Cortex-M0+, or SC000.\r
675         - Can be executed in privileged mode only. \r
676         - An interrupt can enter pending state even if it is disabled. Disabling an interrupt \r
677         only prevents the processor from taking that interrupt.\r
678 \r
679     \sa \r
680         - \ref __enable_fault_irq; __set_BASEPRI; __set_CONTROL; __set_FAULTMASK\r
681  */\r
682 void __disable_fault_irq(void);\r
683 \r
684 \r
685 /**\r
686   \brief   Get Process Stack Pointer Limit\r
687   \details Returns the current value of the Process Stack Pointer Limit (PSPLIM).\r
688   \return               PSPLIM Register value\r
689   \note    Only availabe for ARMv8-M Architecture. \r
690  */\r
691 uint32_t __get_PSPLIM(void);\r
692 \r
693 /**\r
694   \brief   Set Process Stack Pointer Limit\r
695   \details Assigns the given value to the Process Stack Pointer Limit (PSPLIM).\r
696   \param [in]    ProcStackPtrLimit  Process Stack Pointer Limit value to set\r
697   \note    Only availabe for ARMv8-M Architecture. \r
698  */\r
699 void __set_PSPLIM(uint32_t ProcStackPtrLimit);\r
700 \r
701 /**\r
702   \brief   Get Main Stack Pointer Limit\r
703   \details Returns the current value of the Main Stack Pointer Limit (MSPLIM).\r
704   \return               MSPLIM Register value\r
705   \note    Only availabe for ARMv8-M Architecture. \r
706  */\r
707 uint32_t __get_MSPLIM(void);\r
708 \r
709 /**\r
710   \brief   Set Main Stack Pointer Limit\r
711   \details Assigns the given value to the Main Stack Pointer Limit (MSPLIM).\r
712   \param [in]    MainStackPtrLimit  Main Stack Pointer Limit value to set\r
713   \note    Only availabe for ARMv8-M Architecture. \r
714  */\r
715 __set_MSPLIM(uint32_t MainStackPtrLimit);\r
716 \r
717 \r
718 \r
719 /** @} */ /** end of Core_Register_gr **/\r
720 \r
721 \r
722 \r
723 /*********************************************\r
724 \r
725     -todo next year\r
726             - Some embedded systems might have to execute system restore tasks after\r
727 the processor wakes up, and before it executes an interrupt handler. To achieve this set the\r
728 PRIMASK bit to 1 and the FAULTMASK bit to 0. (\ref __WFI);\r
729 \r
730 **********************************************/