1 /******************************************************************************
2 *  Filename:       interrupt.h
3 *  Revised:        2020-02-14 11:30:20 +0100 (Fri, 14 Feb 2020)
4 *  Revision:       56760
5 *
6 *  Description:    Defines and prototypes for the NVIC Interrupt Controller
7 *
8 *  Copyright (c) 2015 - 2017, Texas Instruments Incorporated
9 *  All rights reserved.
10 *
11 *  Redistribution and use in source and binary forms, with or without
12 *  modification, are permitted provided that the following conditions are met:
13 *
14 *  1) Redistributions of source code must retain the above copyright notice,
15 *     this list of conditions and the following disclaimer.
16 *
17 *  2) Redistributions in binary form must reproduce the above copyright notice,
18 *     this list of conditions and the following disclaimer in the documentation
19 *     and/or other materials provided with the distribution.
20 *
21 *  3) Neither the name of the ORGANIZATION nor the names of its contributors may
22 *     be used to endorse or promote products derived from this software without
23 *     specific prior written permission.
24 *
25 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
29 *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 *  POSSIBILITY OF SUCH DAMAGE.
36 *
37 ******************************************************************************/
38 
39 //*****************************************************************************
40 //
41 //! \addtogroup system_cpu_group
42 //! @{
43 //! \addtogroup interrupt_api
44 //! @{
45 //
46 //*****************************************************************************
47 
48 #ifndef __INTERRUPT_H__
49 #define __INTERRUPT_H__
50 
51 //*****************************************************************************
52 //
53 // If building with a C++ compiler, make all of the definitions in this header
54 // have a C binding.
55 //
56 //*****************************************************************************
57 #ifdef __cplusplus
58 extern "C"
59 {
60 #endif
61 
62 #include <stdbool.h>
63 #include <stdint.h>
64 #include "../inc/hw_ints.h"
65 #include "../inc/hw_types.h"
66 #include "../inc/hw_nvic.h"
67 #include "debug.h"
68 #include "cpu.h"
69 
70 //*****************************************************************************
71 //
72 // Support for DriverLib in ROM:
73 // This section renames all functions that are not "static inline", so that
74 // calling these functions will default to implementation in flash. At the end
75 // of this file a second renaming will change the defaults to implementation in
76 // ROM for available functions.
77 //
78 // To force use of the implementation in flash, e.g. for debugging:
79 // - Globally: Define DRIVERLIB_NOROM at project level
80 // - Per function: Use prefix "NOROM_" when calling the function
81 //
82 //*****************************************************************************
83 #if !defined(DOXYGEN)
84     #define IntRegister                     NOROM_IntRegister
85     #define IntUnregister                   NOROM_IntUnregister
86     #define IntPriorityGroupingSet          NOROM_IntPriorityGroupingSet
87     #define IntPriorityGroupingGet          NOROM_IntPriorityGroupingGet
88     #define IntPrioritySet                  NOROM_IntPrioritySet
89     #define IntPriorityGet                  NOROM_IntPriorityGet
90     #define IntEnable                       NOROM_IntEnable
91     #define IntDisable                      NOROM_IntDisable
92     #define IntPendSet                      NOROM_IntPendSet
93     #define IntPendGet                      NOROM_IntPendGet
94     #define IntPendClear                    NOROM_IntPendClear
95 #endif
96 
97 //*****************************************************************************
98 //
99 // Macro to generate an interrupt priority mask based on the number of bits
100 // of priority supported by the hardware. For CC26xx the number of priority
101 // bit is 3 as defined in <tt>hw_types.h</tt>. The priority mask is
102 // defined as
103 //
104 // INT_PRIORITY_MASK = ((0xFF << (8 - NUM_PRIORITY_BITS)) & 0xFF)
105 //
106 //*****************************************************************************
107 #define INT_PRIORITY_MASK       0x000000E0
108 #define INT_PRI_LEVEL0          0x00000000
109 #define INT_PRI_LEVEL1          0x00000020
110 #define INT_PRI_LEVEL2          0x00000040
111 #define INT_PRI_LEVEL3          0x00000060
112 #define INT_PRI_LEVEL4          0x00000080
113 #define INT_PRI_LEVEL5          0x000000A0
114 #define INT_PRI_LEVEL6          0x000000C0
115 #define INT_PRI_LEVEL7          0x000000E0
116 
117 //*****************************************************************************
118 //
119 // API Functions and prototypes
120 //
121 //*****************************************************************************
122 
123 //*****************************************************************************
124 //
125 //! \brief Registers a function as an interrupt handler in the dynamic vector table.
126 //!
127 //! \note Only use this function if you want to use the dynamic vector table (in SRAM)!
128 //!
129 //! This function writes a function pointer to the dynamic interrupt vector table
130 //! in SRAM to register the function as an interrupt handler (ISR). When the corresponding
131 //! interrupt occurs, and it has been enabled (see \ref IntEnable()), the function
132 //! pointer is fetched from the dynamic vector table, and the System CPU will
133 //! execute the interrupt handler.
134 //!
135 //! \note The first call to this function (directly or indirectly via a peripheral
136 //! driver interrupt register function) copies the interrupt vector table from
137 //! Flash to SRAM. NVIC uses the static vector table (in Flash) until this function
138 //! is called.
139 //!
140 //! \param ui32Interrupt specifies the index in the vector table to modify.
141 //! - System exceptions (vectors 0 to 15):
142 //!   - INT_NMI_FAULT
143 //!   - INT_HARD_FAULT
144 //!   - INT_MEMMANAGE_FAULT
145 //!   - INT_BUS_FAULT
146 //!   - INT_USAGE_FAULT
147 //!   - INT_SVCALL
148 //!   - INT_DEBUG
149 //!   - INT_PENDSV
150 //!   - INT_SYSTICK
151 //! - Interrupts (vectors >15):
152 //!   - INT_AON_GPIO_EDGE
153 //!   - INT_I2C_IRQ
154 //!   - INT_RFC_CPE_1
155 //!   - INT_PKA_IRQ
156 //!   - INT_AON_RTC_COMB
157 //!   - INT_UART0_COMB
158 //!   - INT_AUX_SWEV0
159 //!   - INT_SSI0_COMB
160 //!   - INT_SSI1_COMB
161 //!   - INT_RFC_CPE_0
162 //!   - INT_RFC_HW_COMB
163 //!   - INT_RFC_CMD_ACK
164 //!   - INT_I2S_IRQ
165 //!   - INT_AUX_SWEV1
166 //!   - INT_WDT_IRQ
167 //!   - INT_GPT0A
168 //!   - INT_GPT0B
169 //!   - INT_GPT1A
170 //!   - INT_GPT1B
171 //!   - INT_GPT2A
172 //!   - INT_GPT2B
173 //!   - INT_GPT3A
174 //!   - INT_GPT3B
175 //!   - INT_CRYPTO_RESULT_AVAIL_IRQ
176 //!   - INT_DMA_DONE_COMB
177 //!   - INT_DMA_ERR
178 //!   - INT_FLASH
179 //!   - INT_SWEV0
180 //!   - INT_AUX_COMB
181 //!   - INT_AON_PROG0
182 //!   - INT_PROG0 (Programmable interrupt, see \ref EventRegister())
183 //!   - INT_AUX_COMPA
184 //!   - INT_AUX_ADC_IRQ
185 //!   - INT_TRNG_IRQ
186 //!   - INT_OSC_COMB
187 //!   - INT_AUX_TIMER2_EV0
188 //!   - INT_UART1_COMB
189 //!   - INT_BATMON_COMB
190 //! \param pfnHandler is a pointer to the function to register as interrupt handler.
191 //!
192 //! \return None.
193 //!
194 //! \sa \ref IntUnregister(), \ref IntEnable()
195 //
196 //*****************************************************************************
197 extern void IntRegister(uint32_t ui32Interrupt, void (*pfnHandler)(void));
198 
199 //*****************************************************************************
200 //
201 //! \brief Unregisters an interrupt handler in the dynamic vector table.
202 //!
203 //! This function removes an interrupt handler from the dynamic vector table and
204 //! replaces it with the default interrupt handler \ref IntDefaultHandler().
205 //!
206 //! \note Remember to disable the interrupt before removing its interrupt handler
207 //! from the vector table.
208 //!
209 //! \param ui32Interrupt specifies the index in the vector table to modify.
210 //! - See \ref IntRegister() for list of valid arguments.
211 //!
212 //! \return None.
213 //!
214 //! \sa \ref IntRegister(), \ref IntDisable()
215 //
216 //*****************************************************************************
217 extern void IntUnregister(uint32_t ui32Interrupt);
218 
219 //*****************************************************************************
220 //
221 //! \brief Sets the priority grouping of the interrupt controller.
222 //!
223 //! This function specifies the split between preemptable priority levels and
224 //! subpriority levels in the interrupt priority specification.
225 //!
226 //! Three bits are available for hardware interrupt prioritization thus priority
227 //! grouping values of three through seven have the same effect.
228 //!
229 //! \param ui32Bits specifies the number of bits of preemptable priority.
230 //! - 0   : No pre-emption priority, eight bits of subpriority.
231 //! - 1   : One bit of pre-emption priority, seven bits of subpriority
232 //! - 2   : Two bits of pre-emption priority, six bits of subpriority
233 //! - 3-7 : Three bits of pre-emption priority, five bits of subpriority
234 //!
235 //! \return None
236 //!
237 //! \sa \ref IntPrioritySet()
238 //
239 //*****************************************************************************
240 extern void IntPriorityGroupingSet(uint32_t ui32Bits);
241 
242 //*****************************************************************************
243 //
244 //! \brief Gets the priority grouping of the interrupt controller.
245 //!
246 //! This function returns the split between preemptable priority levels and
247 //! subpriority levels in the interrupt priority specification.
248 //!
249 //! \return Returns the number of bits of preemptable priority.
250 //! - 0   : No pre-emption priority, eight bits of subpriority.
251 //! - 1   : One bit of pre-emption priority, seven bits of subpriority
252 //! - 2   : Two bits of pre-emption priority, six bits of subpriority
253 //! - 3-7 : Three bits of pre-emption priority, five bits of subpriority
254 //
255 //*****************************************************************************
256 extern uint32_t IntPriorityGroupingGet(void);
257 
258 //*****************************************************************************
259 //
260 //! \brief Sets the priority of an interrupt.
261 //!
262 //! This function sets the priority of an interrupt, including system exceptions.
263 //! When multiple interrupts are asserted simultaneously, the ones with the highest
264 //! priority are processed before the lower priority interrupts. Smaller numbers
265 //! correspond to higher interrupt priorities thus priority 0 is the highest
266 //! interrupt priority.
267 //!
268 //! \warning This function does not support setting priority of interrupt vectors
269 //! one through three which are:
270 //! - 1: Reset handler
271 //! - 2: NMI handler
272 //! - 3: Hard fault handler
273 //!
274 //! \param ui32Interrupt specifies the index in the vector table to change priority for.
275 //! - System exceptions:
276 //!   - INT_MEMMANAGE_FAULT
277 //!   - INT_BUS_FAULT
278 //!   - INT_USAGE_FAULT
279 //!   - INT_SVCALL
280 //!   - INT_DEBUG
281 //!   - INT_PENDSV
282 //!   - INT_SYSTICK
283 //! - Interrupts:
284 //!   - INT_AON_GPIO_EDGE
285 //!   - INT_I2C_IRQ
286 //!   - INT_RFC_CPE_1
287 //!   - INT_PKA_IRQ
288 //!   - INT_AON_RTC_COMB
289 //!   - INT_UART0_COMB
290 //!   - INT_AUX_SWEV0
291 //!   - INT_SSI0_COMB
292 //!   - INT_SSI1_COMB
293 //!   - INT_RFC_CPE_0
294 //!   - INT_RFC_HW_COMB
295 //!   - INT_RFC_CMD_ACK
296 //!   - INT_I2S_IRQ
297 //!   - INT_AUX_SWEV1
298 //!   - INT_WDT_IRQ
299 //!   - INT_GPT0A
300 //!   - INT_GPT0B
301 //!   - INT_GPT1A
302 //!   - INT_GPT1B
303 //!   - INT_GPT2A
304 //!   - INT_GPT2B
305 //!   - INT_GPT3A
306 //!   - INT_GPT3B
307 //!   - INT_CRYPTO_RESULT_AVAIL_IRQ
308 //!   - INT_DMA_DONE_COMB
309 //!   - INT_DMA_ERR
310 //!   - INT_FLASH
311 //!   - INT_SWEV0
312 //!   - INT_AUX_COMB
313 //!   - INT_AON_PROG0
314 //!   - INT_PROG0 (Programmable interrupt, see \ref EventRegister())
315 //!   - INT_AUX_COMPA
316 //!   - INT_AUX_ADC_IRQ
317 //!   - INT_TRNG_IRQ
318 //!   - INT_OSC_COMB
319 //!   - INT_AUX_TIMER2_EV0
320 //!   - INT_UART1_COMB
321 //!   - INT_BATMON_COMB
322 //! \param ui8Priority specifies the priority of the interrupt.
323 //! - \ref INT_PRI_LEVEL0 : Highest priority.
324 //! - \ref INT_PRI_LEVEL1
325 //! - \ref INT_PRI_LEVEL2
326 //! - \ref INT_PRI_LEVEL3
327 //! - \ref INT_PRI_LEVEL4
328 //! - \ref INT_PRI_LEVEL5
329 //! - \ref INT_PRI_LEVEL6
330 //! - \ref INT_PRI_LEVEL7 : Lowest priority.
331 //!
332 //! \return None
333 //!
334 //! \sa \ref IntPriorityGroupingSet()
335 //
336 //*****************************************************************************
337 extern void IntPrioritySet(uint32_t ui32Interrupt, uint8_t ui8Priority);
338 
339 //*****************************************************************************
340 //
341 //! \brief Gets the priority of an interrupt.
342 //!
343 //! This function gets the priority of an interrupt.
344 //!
345 //! \warning This function does not support getting priority of interrupt vectors
346 //! one through three which are:
347 //! - 1: Reset handler
348 //! - 2: NMI handler
349 //! - 3: Hard fault handler
350 //!
351 //! \param ui32Interrupt specifies the index in the vector table to read priority of.
352 //! - See \ref IntPrioritySet() for list of valid arguments.
353 //!
354 //! \return Returns the interrupt priority:
355 //! - \ref INT_PRI_LEVEL0 : Highest priority.
356 //! - \ref INT_PRI_LEVEL1
357 //! - \ref INT_PRI_LEVEL2
358 //! - \ref INT_PRI_LEVEL3
359 //! - \ref INT_PRI_LEVEL4
360 //! - \ref INT_PRI_LEVEL5
361 //! - \ref INT_PRI_LEVEL6
362 //! - \ref INT_PRI_LEVEL7 : Lowest priority.
363 //
364 //*****************************************************************************
365 extern int32_t IntPriorityGet(uint32_t ui32Interrupt);
366 
367 //*****************************************************************************
368 //
369 //! \brief Enables an interrupt or system exception.
370 //!
371 //! This function enables the specified interrupt in the interrupt controller.
372 //!
373 //! \note If a fault condition occurs while the corresponding system exception
374 //! is disabled, the fault is treated as a Hard Fault.
375 //!
376 //! \param ui32Interrupt specifies the index in the vector table to enable.
377 //! - System exceptions:
378 //!   - INT_MEMMANAGE_FAULT
379 //!   - INT_BUS_FAULT
380 //!   - INT_USAGE_FAULT
381 //!   - INT_SYSTICK
382 //! - Interrupts:
383 //!   - INT_AON_GPIO_EDGE
384 //!   - INT_I2C_IRQ
385 //!   - INT_RFC_CPE_1
386 //!   - INT_PKA_IRQ
387 //!   - INT_AON_RTC_COMB
388 //!   - INT_UART0_COMB
389 //!   - INT_AUX_SWEV0
390 //!   - INT_SSI0_COMB
391 //!   - INT_SSI1_COMB
392 //!   - INT_RFC_CPE_0
393 //!   - INT_RFC_HW_COMB
394 //!   - INT_RFC_CMD_ACK
395 //!   - INT_I2S_IRQ
396 //!   - INT_AUX_SWEV1
397 //!   - INT_WDT_IRQ
398 //!   - INT_GPT0A
399 //!   - INT_GPT0B
400 //!   - INT_GPT1A
401 //!   - INT_GPT1B
402 //!   - INT_GPT2A
403 //!   - INT_GPT2B
404 //!   - INT_GPT3A
405 //!   - INT_GPT3B
406 //!   - INT_CRYPTO_RESULT_AVAIL_IRQ
407 //!   - INT_DMA_DONE_COMB
408 //!   - INT_DMA_ERR
409 //!   - INT_FLASH
410 //!   - INT_SWEV0
411 //!   - INT_AUX_COMB
412 //!   - INT_AON_PROG0
413 //!   - INT_PROG0 (Programmable interrupt, see \ref EventRegister())
414 //!   - INT_AUX_COMPA
415 //!   - INT_AUX_ADC_IRQ
416 //!   - INT_TRNG_IRQ
417 //!   - INT_OSC_COMB
418 //!   - INT_AUX_TIMER2_EV0
419 //!   - INT_UART1_COMB
420 //!   - INT_BATMON_COMB
421 //!
422 //! \return None
423 //!
424 //! \sa \ref IntDisable()
425 //
426 //*****************************************************************************
427 extern void IntEnable(uint32_t ui32Interrupt);
428 
429 //*****************************************************************************
430 //
431 //! \brief Disables an interrupt or system exception.
432 //!
433 //! This function disables the specified interrupt in the interrupt controller.
434 //!
435 //! \param ui32Interrupt specifies the index in the vector table to disable.
436 //! - See \ref IntEnable() for list of valid arguments.
437 //!
438 //! \return None
439 //!
440 //! \sa \ref IntEnable()
441 //
442 //*****************************************************************************
443 extern void IntDisable(uint32_t ui32Interrupt);
444 
445 //*****************************************************************************
446 //
447 //! \brief Pends an interrupt.
448 //!
449 //! This function pends the specified interrupt in the interrupt controller.
450 //! This causes the interrupt controller to execute the corresponding interrupt
451 //! handler at the next available time, based on the current interrupt state
452 //! priorities.
453 //!
454 //! This interrupt controller automatically clears the pending interrupt once the
455 //! interrupt handler is executed.
456 //!
457 //! \param ui32Interrupt specifies the index in the vector table to pend.
458 //! - System exceptions:
459 //!   - INT_NMI_FAULT
460 //!   - INT_PENDSV
461 //!   - INT_SYSTICK
462 //! - Interrupts:
463 //!   - INT_AON_GPIO_EDGE
464 //!   - INT_I2C_IRQ
465 //!   - INT_RFC_CPE_1
466 //!   - INT_PKA_IRQ
467 //!   - INT_AON_RTC_COMB
468 //!   - INT_UART0_COMB
469 //!   - INT_AUX_SWEV0
470 //!   - INT_SSI0_COMB
471 //!   - INT_SSI1_COMB
472 //!   - INT_RFC_CPE_0
473 //!   - INT_RFC_HW_COMB
474 //!   - INT_RFC_CMD_ACK
475 //!   - INT_I2S_IRQ
476 //!   - INT_AUX_SWEV1
477 //!   - INT_WDT_IRQ
478 //!   - INT_GPT0A
479 //!   - INT_GPT0B
480 //!   - INT_GPT1A
481 //!   - INT_GPT1B
482 //!   - INT_GPT2A
483 //!   - INT_GPT2B
484 //!   - INT_GPT3A
485 //!   - INT_GPT3B
486 //!   - INT_CRYPTO_RESULT_AVAIL_IRQ
487 //!   - INT_DMA_DONE_COMB
488 //!   - INT_DMA_ERR
489 //!   - INT_FLASH
490 //!   - INT_SWEV0
491 //!   - INT_AUX_COMB
492 //!   - INT_AON_PROG0
493 //!   - INT_PROG0 (Programmable interrupt, see \ref EventRegister())
494 //!   - INT_AUX_COMPA
495 //!   - INT_AUX_ADC_IRQ
496 //!   - INT_TRNG_IRQ
497 //!   - INT_OSC_COMB
498 //!   - INT_AUX_TIMER2_EV0
499 //!   - INT_UART1_COMB
500 //!   - INT_BATMON_COMB
501 //!
502 //! \return None
503 //!
504 //! \sa \ref IntEnable()
505 //
506 //*****************************************************************************
507 extern void IntPendSet(uint32_t ui32Interrupt);
508 
509 //*****************************************************************************
510 //
511 //! \brief Checks if an interrupt is pending.
512 //!
513 //! This function checks the interrupt controller to see if an interrupt is pending.
514 //!
515 //! The interrupt must be enabled in order for the corresponding interrupt handler
516 //! to be executed, so an interrupt can be pending waiting to be enabled or waiting
517 //! for an interrupt of higher priority to be done executing.
518 //!
519 //! \note This function does not support reading pending status for system exceptions
520 //! (vector table indexes <16).
521 //!
522 //! \param ui32Interrupt specifies the index in the vector table to check pending
523 //! status for.
524 //! - See \ref IntPendSet() for list of valid arguments (except system exceptions).
525 //!
526 //! \return Returns:
527 //! - \c true  : Specified interrupt is pending.
528 //! - \c false : Specified interrupt is not pending.
529 //
530 //*****************************************************************************
531 extern bool IntPendGet(uint32_t ui32Interrupt);
532 
533 //*****************************************************************************
534 //
535 //! \brief Unpends an interrupt.
536 //!
537 //! This function unpends the specified interrupt in the interrupt controller.
538 //! This causes any previously generated interrupts that have not been handled yet
539 //! (due to higher priority interrupts or the interrupt no having been enabled
540 //! yet) to be discarded.
541 //!
542 //! \note It is not possible to unpend the NMI because it takes effect
543 //! immediately when being pended.
544 //!
545 //! \param ui32Interrupt specifies the index in the vector table to unpend.
546 //! - See \ref IntPendSet() for list of valid arguments (except NMI).
547 //!
548 //! \return None
549 //
550 //*****************************************************************************
551 extern void IntPendClear(uint32_t ui32Interrupt);
552 
553 //*****************************************************************************
554 //
555 //! \brief Enables the CPU interrupt.
556 //!
557 //! Allows the CPU to respond to interrupts.
558 //!
559 //! \return Returns:
560 //! - \c true  : Interrupts were disabled and are now enabled.
561 //! - \c false : Interrupts were already enabled when the function was called.
562 //
563 //*****************************************************************************
564 __STATIC_INLINE bool
IntMasterEnable(void)565 IntMasterEnable(void)
566 {
567     // Enable CPU interrupts.
568     return(CPUcpsie());
569 }
570 
571 //*****************************************************************************
572 //
573 //! \brief Disables the CPU interrupts with configurable priority.
574 //!
575 //! Prevents the CPU from receiving interrupts except NMI and hard fault. This
576 //! does not affect the set of interrupts enabled in the interrupt controller;
577 //! it just gates the interrupt from the interrupt controller to the CPU.
578 //!
579 //! \return Returns:
580 //! - \c true  : Interrupts were already disabled when the function was called.
581 //! - \c false : Interrupts were enabled and are now disabled.
582 //
583 //*****************************************************************************
584 __STATIC_INLINE bool
IntMasterDisable(void)585 IntMasterDisable(void)
586 {
587     // Disable CPU interrupts.
588     return(CPUcpsid());
589 }
590 
591 //*****************************************************************************
592 //
593 //! \brief Sets the priority masking level.
594 //!
595 //! This function sets the interrupt priority masking level so that all
596 //! interrupts at the specified or lesser priority level are masked. This
597 //! can be used to globally disable a set of interrupts with priority below
598 //! a predetermined threshold. A value of 0 disables priority
599 //! masking.
600 //!
601 //! Smaller numbers correspond to higher interrupt priorities. So for example
602 //! a priority level mask of 4 will allow interrupts of priority level 0-3,
603 //! and interrupts with a numerical priority of 4 and greater will be blocked.
604 //! The device supports priority levels 0 through 7.
605 //!
606 //! \param ui32PriorityMask is the priority level that will be masked.
607 //! - 0 : Disable priority masking.
608 //! - 1 : Allow priority 0 interrupts, mask interrupts with priority 1-7.
609 //! - 2 : Allow priority 0-1 interrupts, mask interrupts with priority 2-7.
610 //! - 3 : Allow priority 0-2 interrupts, mask interrupts with priority 3-7.
611 //! - 4 : Allow priority 0-3 interrupts, mask interrupts with priority 4-7.
612 //! - 5 : Allow priority 0-4 interrupts, mask interrupts with priority 5-7.
613 //! - 6 : Allow priority 0-5 interrupts, mask interrupts with priority 6-7.
614 //! - 7 : Allow priority 0-6 interrupts, mask interrupts with priority 7.
615 //!
616 //! \return None.
617 //
618 //*****************************************************************************
619 __STATIC_INLINE void
IntPriorityMaskSet(uint32_t ui32PriorityMask)620 IntPriorityMaskSet(uint32_t ui32PriorityMask)
621 {
622     CPUbasepriSet(ui32PriorityMask);
623 }
624 
625 //*****************************************************************************
626 //
627 //! \brief Gets the priority masking level.
628 //!
629 //! This function gets the current setting of the interrupt priority masking
630 //! level. The value returned is the priority level such that all interrupts
631 //! of that and lesser priority are masked. A value of 0 means that priority
632 //! masking is disabled.
633 //!
634 //! Smaller numbers correspond to higher interrupt priorities. So for example
635 //! a priority level mask of 4 will allow interrupts of priority level 0-3,
636 //! and interrupts with a numerical priority of 4 and greater will be blocked.
637 //!
638 //! \return Returns the value of the interrupt priority level mask.
639 //
640 //*****************************************************************************
641 __STATIC_INLINE uint32_t
IntPriorityMaskGet(void)642 IntPriorityMaskGet(void)
643 {
644     return(CPUbasepriGet());
645 }
646 
647 //*****************************************************************************
648 //
649 // Support for DriverLib in ROM:
650 // Redirect to implementation in ROM when available.
651 //
652 //*****************************************************************************
653 #if !defined(DRIVERLIB_NOROM) && !defined(DOXYGEN)
654     #include "../driverlib/rom.h"
655     #ifdef ROM_IntRegister
656         #undef  IntRegister
657         #define IntRegister                     ROM_IntRegister
658     #endif
659     #ifdef ROM_IntUnregister
660         #undef  IntUnregister
661         #define IntUnregister                   ROM_IntUnregister
662     #endif
663     #ifdef ROM_IntPriorityGroupingSet
664         #undef  IntPriorityGroupingSet
665         #define IntPriorityGroupingSet          ROM_IntPriorityGroupingSet
666     #endif
667     #ifdef ROM_IntPriorityGroupingGet
668         #undef  IntPriorityGroupingGet
669         #define IntPriorityGroupingGet          ROM_IntPriorityGroupingGet
670     #endif
671     #ifdef ROM_IntPrioritySet
672         #undef  IntPrioritySet
673         #define IntPrioritySet                  ROM_IntPrioritySet
674     #endif
675     #ifdef ROM_IntPriorityGet
676         #undef  IntPriorityGet
677         #define IntPriorityGet                  ROM_IntPriorityGet
678     #endif
679     #ifdef ROM_IntEnable
680         #undef  IntEnable
681         #define IntEnable                       ROM_IntEnable
682     #endif
683     #ifdef ROM_IntDisable
684         #undef  IntDisable
685         #define IntDisable                      ROM_IntDisable
686     #endif
687     #ifdef ROM_IntPendSet
688         #undef  IntPendSet
689         #define IntPendSet                      ROM_IntPendSet
690     #endif
691     #ifdef ROM_IntPendGet
692         #undef  IntPendGet
693         #define IntPendGet                      ROM_IntPendGet
694     #endif
695     #ifdef ROM_IntPendClear
696         #undef  IntPendClear
697         #define IntPendClear                    ROM_IntPendClear
698     #endif
699 #endif
700 
701 //*****************************************************************************
702 //
703 // Mark the end of the C bindings section for C++ compilers.
704 //
705 //*****************************************************************************
706 #ifdef __cplusplus
707 }
708 #endif
709 
710 #endif // __INTERRUPT_H__
711 
712 //*****************************************************************************
713 //
714 //! Close the Doxygen group.
715 //! @}
716 //! @}
717 //
718 //*****************************************************************************
719