CC23x0R5DriverLibrary
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/cc23x0r5.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 //
125 //
126 //*****************************************************************************
127 extern void IntRegister(uint32_t intNum, void (*handler)(void));
128 
129 //*****************************************************************************
130 //
145 //
146 //*****************************************************************************
147 extern void IntUnregister(uint32_t intNum);
148 
149 //*****************************************************************************
150 //
210 //
211 //*****************************************************************************
212 extern void IntSetPriority(uint32_t intNum, uint8_t priority);
213 
214 //*****************************************************************************
215 //
234 //
235 //*****************************************************************************
236 extern int32_t IntGetPriority(uint32_t intNum);
237 
238 //*****************************************************************************
239 //
250 //
251 //*****************************************************************************
252 extern bool IntIsEnabled(uint32_t intNum);
253 
254 //*****************************************************************************
255 //
268 //
269 //*****************************************************************************
270 extern void IntEnable(uint32_t intNum);
271 
272 //*****************************************************************************
273 //
284 //
285 //*****************************************************************************
286 extern void IntDisable(uint32_t intNum);
287 
288 //*****************************************************************************
289 //
305 //
306 //*****************************************************************************
307 extern void IntSetPend(uint32_t intNum);
308 
309 //*****************************************************************************
310 //
329 //
330 //*****************************************************************************
331 extern bool IntGetPend(uint32_t intNum);
332 
333 //*****************************************************************************
334 //
349 //
350 //*****************************************************************************
351 extern void IntClearPend(uint32_t intNum);
352 
353 //*****************************************************************************
354 //
362 //
363 //*****************************************************************************
365 {
366  uint32_t interruptsDisabled = __get_PRIMASK();
367  // Enable CPU interrupts.
368  __enable_irq();
369  return (interruptsDisabled);
370 }
371 
372 //*****************************************************************************
373 //
383 //
384 //*****************************************************************************
386 {
387  uint32_t interruptsDisabled = __get_PRIMASK();
388  // Disable CPU interrupts.
389  __disable_irq();
390  return (interruptsDisabled);
391 }
392 
393 //*****************************************************************************
394 //
395 // Mark the end of the C bindings section for C++ compilers.
396 //
397 //*****************************************************************************
398 #ifdef __cplusplus
399 }
400 #endif
401 
402 //*****************************************************************************
403 //
407 //
408 //*****************************************************************************
409 
410 #endif // __INTERRUPT_H__
__STATIC_INLINE bool IntDisableMaster(void)
Disables the CPU interrupts with configurable priority.
Definition: interrupt.h:385
void IntEnable(uint32_t intNum)
Enables an interrupt or system exception.
Definition: interrupt.c:250
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:364
bool IntIsEnabled(uint32_t intNum)
Check whether an interrupt is enabled.
Definition: interrupt.c:223
bool IntGetPend(uint32_t intNum)
Checks if an interrupt is pending.
Definition: interrupt.c:333
__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:364
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:296
#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:273