CC23x0r2DriverLibrary
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/cc23x0r2.h"
65 #include "../cmsis/core/core_cm0plus.h"
66 
67 #include "cpu.h"
68 
69 //*****************************************************************************
70 //
71 // API Functions and prototypes
72 //
73 //*****************************************************************************
74 
75 //*****************************************************************************
76 //
123 //
124 //*****************************************************************************
125 extern void IntRegister(uint32_t intNum, void (*handler)(void));
126 
127 //*****************************************************************************
128 //
143 //
144 //*****************************************************************************
145 extern void IntUnregister(uint32_t intNum);
146 
147 //*****************************************************************************
148 //
206 //
207 //*****************************************************************************
208 extern void IntSetPriority(uint32_t intNum, uint8_t priority);
209 
210 //*****************************************************************************
211 //
230 //
231 //*****************************************************************************
232 extern int32_t IntGetPriority(uint32_t intNum);
233 
234 //*****************************************************************************
235 //
246 //
247 //*****************************************************************************
248 extern bool IntIsEnabled(uint32_t intNum);
249 
250 //*****************************************************************************
251 //
264 //
265 //*****************************************************************************
266 extern void IntEnable(uint32_t intNum);
267 
268 //*****************************************************************************
269 //
280 //
281 //*****************************************************************************
282 extern void IntDisable(uint32_t intNum);
283 
284 //*****************************************************************************
285 //
301 //
302 //*****************************************************************************
303 extern void IntSetPend(uint32_t intNum);
304 
305 //*****************************************************************************
306 //
325 //
326 //*****************************************************************************
327 extern bool IntGetPend(uint32_t intNum);
328 
329 //*****************************************************************************
330 //
345 //
346 //*****************************************************************************
347 extern void IntClearPend(uint32_t intNum);
348 
349 //*****************************************************************************
350 //
358 //
359 //*****************************************************************************
361 {
362  uint32_t interruptsDisabled = __get_PRIMASK();
363  // Enable CPU interrupts.
364  __enable_irq();
365  return (interruptsDisabled);
366 }
367 
368 //*****************************************************************************
369 //
379 //
380 //*****************************************************************************
382 {
383  uint32_t interruptsDisabled = __get_PRIMASK();
384  // Disable CPU interrupts.
385  __disable_irq();
386  return (interruptsDisabled);
387 }
388 
389 //*****************************************************************************
390 //
391 // Mark the end of the C bindings section for C++ compilers.
392 //
393 //*****************************************************************************
394 #ifdef __cplusplus
395 }
396 #endif
397 
398 //*****************************************************************************
399 //
403 //
404 //*****************************************************************************
405 
406 #endif // __INTERRUPT_H__
__STATIC_INLINE bool IntDisableMaster(void)
Disables the CPU interrupts with configurable priority.
Definition: interrupt.h:381
void IntEnable(uint32_t intNum)
Enables an interrupt or system exception.
Definition: interrupt.c:248
int32_t IntGetPriority(uint32_t intNum)
Gets the priority of an interrupt.
Definition: interrupt.c:194
__STATIC_INLINE bool IntEnableMaster(void)
Enables the CPU interrupt.
Definition: interrupt.h:360
bool IntIsEnabled(uint32_t intNum)
Check whether an interrupt is enabled.
Definition: interrupt.c:221
bool IntGetPend(uint32_t intNum)
Checks if an interrupt is pending.
Definition: interrupt.c:331
__STATIC_FORCEINLINE void __disable_irq(void)
Disable IRQ Interrupts.
Definition: cmsis_gcc.h:207
__STATIC_FORCEINLINE uint32_t __get_PRIMASK(void)
Get Priority Mask.
Definition: cmsis_gcc.h:449
void IntClearPend(uint32_t intNum)
Unpends an interrupt.
Definition: interrupt.c:362
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:294
#define __STATIC_INLINE
Definition: cmsis_gcc.h:47
__STATIC_FORCEINLINE void __enable_irq(void)
Enable IRQ Interrupts.
Definition: cmsis_gcc.h:196
void IntDisable(uint32_t intNum)
Disables an interrupt or system exception.
Definition: interrupt.c:271