CC27xxDriverLibrary
interrupt.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Filename: interrupt.h
3  *
4  * Description: Defines and prototypes for the NVIC Interrupt Controller
5  *
6  * Copyright (c) 2022-2025 Texas Instruments Incorporated
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * 1) Redistributions of source code must retain the above copyright notice,
12  * this list of conditions and the following disclaimer.
13  *
14  * 2) Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  *
18  * 3) Neither the name of the copyright holder nor the names of its
19  * contributors may be used to endorse or promote products derived from this
20  * software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
26  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  ******************************************************************************/
35 
36 #ifndef __INTERRUPT_H__
37 #define __INTERRUPT_H__
38 
39 //*****************************************************************************
40 //
45 //
46 //*****************************************************************************
47 
48 //*****************************************************************************
49 //
50 // If building with a C++ compiler, make all of the definitions in this header
51 // have a C binding.
52 //
53 //*****************************************************************************
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
58 #include <stdbool.h>
59 #include <stdint.h>
60 
61 #include "../inc/hw_ints.h"
62 #include "../inc/hw_types.h"
63 
64 #include "../cmsis/cc27xx.h"
65 #include "../cmsis/core/core_cm33.h"
66 
67 #include "cpu.h"
68 
69 //*****************************************************************************
70 //
71 // API Functions and prototypes
72 //
73 //*****************************************************************************
74 
75 //*****************************************************************************
76 //
144 //
145 //*****************************************************************************
146 extern void IntRegister(uint32_t intNum, void (*handler)(void));
147 
148 //*****************************************************************************
149 //
164 //
165 //*****************************************************************************
166 extern void IntUnregister(uint32_t intNum);
167 
168 //*****************************************************************************
169 //
248 //
249 //*****************************************************************************
250 extern void IntSetPriority(uint32_t intNum, uint8_t priority);
251 
252 //*****************************************************************************
253 //
284 //
285 //*****************************************************************************
286 extern int32_t IntGetPriority(uint32_t intNum);
287 
288 //*****************************************************************************
289 //
300 //
301 //*****************************************************************************
302 extern bool IntIsEnabled(uint32_t intNum);
303 
304 //*****************************************************************************
305 //
318 //
319 //*****************************************************************************
320 extern void IntEnable(uint32_t intNum);
321 
322 //*****************************************************************************
323 //
334 //
335 //*****************************************************************************
336 extern void IntDisable(uint32_t intNum);
337 
338 //*****************************************************************************
339 //
355 //
356 //*****************************************************************************
357 extern void IntSetPend(uint32_t intNum);
358 
359 //*****************************************************************************
360 //
379 //
380 //*****************************************************************************
381 extern bool IntGetPend(uint32_t intNum);
382 
383 //*****************************************************************************
384 //
399 //
400 //*****************************************************************************
401 extern void IntClearPend(uint32_t intNum);
402 
403 //*****************************************************************************
404 //
412 //
413 //*****************************************************************************
415 {
416  uint32_t interruptsDisabled = __get_PRIMASK();
417  // Enable CPU interrupts.
418  __enable_irq();
419  return (interruptsDisabled);
420 }
421 
422 //*****************************************************************************
423 //
433 //
434 //*****************************************************************************
436 {
437  uint32_t interruptsDisabled = __get_PRIMASK();
438  // Disable CPU interrupts.
439  __disable_irq();
440  return (interruptsDisabled);
441 }
442 
443 //*****************************************************************************
444 //
445 // Mark the end of the C bindings section for C++ compilers.
446 //
447 //*****************************************************************************
448 #ifdef __cplusplus
449 }
450 #endif
451 
452 //*****************************************************************************
453 //
457 //
458 //*****************************************************************************
459 
460 #endif // __INTERRUPT_H__
__STATIC_INLINE bool IntDisableMaster(void)
Disables the CPU interrupts with configurable priority.
Definition: interrupt.h:435
void IntEnable(uint32_t intNum)
Enables an interrupt or system exception.
Definition: interrupt.c:223
int32_t IntGetPriority(uint32_t intNum)
Gets the priority of an interrupt.
Definition: interrupt.c:166
__STATIC_INLINE bool IntEnableMaster(void)
Enables the CPU interrupt.
Definition: interrupt.h:414
bool IntIsEnabled(uint32_t intNum)
Check whether an interrupt is enabled.
Definition: interrupt.c:193
bool IntGetPend(uint32_t intNum)
Checks if an interrupt is pending.
Definition: interrupt.c:315
__STATIC_FORCEINLINE void __disable_irq(void)
Disable IRQ Interrupts.
Definition: cmsis_gcc.h:966
__STATIC_FORCEINLINE uint32_t __get_PRIMASK(void)
Get Priority Mask.
Definition: cmsis_gcc.h:1210
void IntClearPend(uint32_t intNum)
Unpends an interrupt.
Definition: interrupt.c:345
void IntUnregister(uint32_t intNum)
Unregisters an interrupt handler in the dynamic vector table.
Definition: interrupt.c:124
void IntSetPriority(uint32_t intNum, uint8_t priority)
Sets the priority of an interrupt.
Definition: interrupt.c:138
void IntRegister(uint32_t intNum, void(*handler)(void))
Registers a function as an interrupt handler in the dynamic vector table.
void IntSetPend(uint32_t intNum)
Pends an interrupt.
Definition: interrupt.c:275
#define __STATIC_INLINE
Definition: cmsis_gcc.h:47
__STATIC_FORCEINLINE void __enable_irq(void)
Enable IRQ Interrupts.
Definition: cmsis_gcc.h:955
void IntDisable(uint32_t intNum)
Disables an interrupt or system exception.
Definition: interrupt.c:249