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-2023 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 //
252 //
253 //*****************************************************************************
254 extern void IntEnable(uint32_t intNum);
255 
256 //*****************************************************************************
257 //
268 //
269 //*****************************************************************************
270 extern void IntDisable(uint32_t intNum);
271 
272 //*****************************************************************************
273 //
289 //
290 //*****************************************************************************
291 extern void IntSetPend(uint32_t intNum);
292 
293 //*****************************************************************************
294 //
313 //
314 //*****************************************************************************
315 extern bool IntGetPend(uint32_t intNum);
316 
317 //*****************************************************************************
318 //
333 //
334 //*****************************************************************************
335 extern void IntClearPend(uint32_t intNum);
336 
337 //*****************************************************************************
338 //
346 //
347 //*****************************************************************************
349 {
350  uint32_t interruptsDisabled = __get_PRIMASK();
351  // Enable CPU interrupts.
352  __enable_irq();
353  return (interruptsDisabled);
354 }
355 
356 //*****************************************************************************
357 //
367 //
368 //*****************************************************************************
370 {
371  uint32_t interruptsDisabled = __get_PRIMASK();
372  // Disable CPU interrupts.
373  __disable_irq();
374  return (interruptsDisabled);
375 }
376 
377 //*****************************************************************************
378 //
379 // Mark the end of the C bindings section for C++ compilers.
380 //
381 //*****************************************************************************
382 #ifdef __cplusplus
383 }
384 #endif
385 
386 //*****************************************************************************
387 //
391 //
392 //*****************************************************************************
393 
394 #endif // __INTERRUPT_H__
__STATIC_INLINE bool IntDisableMaster(void)
Disables the CPU interrupts with configurable priority.
Definition: interrupt.h:369
void IntEnable(uint32_t intNum)
Enables an interrupt or system exception.
Definition: interrupt.c:222
int32_t IntGetPriority(uint32_t intNum)
Gets the priority of an interrupt.
Definition: interrupt.c:193
#define __STATIC_INLINE
Definition: hw_types.h:58
__STATIC_INLINE bool IntEnableMaster(void)
Enables the CPU interrupt.
Definition: interrupt.h:348
bool IntGetPend(uint32_t intNum)
Checks if an interrupt is pending.
Definition: interrupt.c:301
__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:332
void IntUnregister(uint32_t intNum)
Unregisters an interrupt handler in the dynamic vector table.
Definition: interrupt.c:123
void IntSetPriority(uint32_t intNum, uint8_t priority)
Sets the priority of an interrupt.
Definition: interrupt.c:137
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:268
__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:245