MSPM0L111X Driver Library  2.05.01.00
dl_interrupt.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2020, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 /*!****************************************************************************
33  * @file dl_interrupt.h
34  * @brief Interrupt Management Driver Library
35 * @defgroup INTERRUPT M0P Interrupts
36  *
37  * @anchor ti_dl_m0p_dl_interrupt_Overview
38  * # Overview
39  *
40  * The Cortex-M0+ architecture is limited to 32 device interrupts. To enable
41  * interrupt handling on devices that need more than 32 interrupts, the
42  * interrupts are grouped together.
43  *
44  * For example, "Group 0" contains the interrupt flags for the WWDT0, WWDT1,
45  * DEBUGSS, FLASH, and SYSCTL peripherals. Once the interrupt fires for Group 0,
46  * the application must check to see which peripheral from Group 0 was the
47  * source using the APIs in this module.
48  *
49  * This PI module is not for controlling the NVIC or the I-bit in the CPSR
50  * register. It's best to use the CMSIS-Core APIs that are delivered as part
51  * of CMSIS-Core in the `source/third_party/CMSIS/Core/Include/core_cm0plus.h`
52  * file within the SDK.
53  *
54  * <hr>
55  ******************************************************************************
56  */
60 #ifndef ti_dl_m0p_dl_interrupt__include
61 #define ti_dl_m0p_dl_interrupt__include
62 
63 #include <stdint.h>
64 
65 #include <ti/devices/msp/msp.h>
66 #include <ti/devices/msp/peripherals/m0p/hw_cpuss.h>
67 
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71 
72 /* clang-format off */
73 
81 #define DL_INTERRUPT_GROUP0_IIDX_WWDT0 (CPUSS_INT_GROUP_IIDX_STAT_INT0)
82 
88 #define DL_INTERRUPT_GROUP0_IIDX_WWDT1 (CPUSS_INT_GROUP_IIDX_STAT_INT1)
89 
93 #define DL_INTERRUPT_GROUP0_IIDX_DEBUGSS (CPUSS_INT_GROUP_IIDX_STAT_INT2)
94 
98 #define DL_INTERRUPT_GROUP0_IIDX_FLASH (CPUSS_INT_GROUP_IIDX_STAT_INT3)
99 
103 #define DL_INTERRUPT_GROUP0_IIDX_WUC_FSUB0 (CPUSS_INT_GROUP_IIDX_STAT_INT4)
104 
108 #define DL_INTERRUPT_GROUP0_IIDX_WUC_FSUB1 (CPUSS_INT_GROUP_IIDX_STAT_INT5)
109 
113 #define DL_INTERRUPT_GROUP0_IIDX_SYSCTL (CPUSS_INT_GROUP_IIDX_STAT_INT6)
114 
118 #define DL_INTERRUPT_GROUP1_IIDX_GPIOA (CPUSS_INT_GROUP_IIDX_STAT_INT0)
119 
125 #define DL_INTERRUPT_GROUP1_IIDX_GPIOB (CPUSS_INT_GROUP_IIDX_STAT_INT1)
126 
130 #define DL_INTERRUPT_GROUP1_IIDX_COMP0 (CPUSS_INT_GROUP_IIDX_STAT_INT2)
131 
137 #define DL_INTERRUPT_GROUP1_IIDX_COMP1 (CPUSS_INT_GROUP_IIDX_STAT_INT3)
138 
144 #define DL_INTERRUPT_GROUP1_IIDX_COMP2 (CPUSS_INT_GROUP_IIDX_STAT_INT4)
145 
151 #define DL_INTERRUPT_GROUP1_IIDX_TRNG (CPUSS_INT_GROUP_IIDX_STAT_INT5)
152 
158 #define DL_INTERRUPT_GROUP1_IIDX_GPIOC (CPUSS_INT_GROUP_IIDX_STAT_INT6)
159 
168 #define DL_INTERRUPT_GROUP0_WWDT0 (CPUSS_INT_GROUP_IMASK_INT_INT0)
169 
172 #define DL_INTERRUPT_GROUP0_WWDT1 (CPUSS_INT_GROUP_IMASK_INT_INT1)
173 
176 #define DL_INTERRUPT_GROUP0_DEBUGSS (CPUSS_INT_GROUP_IMASK_INT_INT2)
177 
180 #define DL_INTERRUPT_GROUP0_FLASH (CPUSS_INT_GROUP_IMASK_INT_INT3)
181 
184 #define DL_INTERRUPT_GROUP0_WUC_FSUB0 (CPUSS_INT_GROUP_IMASK_INT_INT4)
185 
188 #define DL_INTERRUPT_GROUP0_WUC_FSUB1 (CPUSS_INT_GROUP_IMASK_INT_INT5)
189 
192 #define DL_INTERRUPT_GROUP0_PMCU (CPUSS_INT_GROUP_IMASK_INT_INT6)
193 
197 #define DL_INTERRUPT_GROUP1_GPIOA (CPUSS_INT_GROUP_IMASK_INT_INT0)
198 
203 #define DL_INTERRUPT_GROUP1_GPIOB (CPUSS_INT_GROUP_IMASK_INT_INT1)
204 
209 #define DL_INTERRUPT_GROUP1_COMP0 (CPUSS_INT_GROUP_IMASK_INT_INT2)
210 
215 #define DL_INTERRUPT_GROUP1_COMP1 (CPUSS_INT_GROUP_IMASK_INT_INT3)
216 
221 #define DL_INTERRUPT_GROUP1_COMP2 (CPUSS_INT_GROUP_IMASK_INT_INT4)
222 
227 #define DL_INTERRUPT_GROUP1_TRNG (CPUSS_INT_GROUP_IMASK_INT_INT5)
228 
231 /* clang-format on */
232 
234 typedef enum {
240 
246 extern void Default_Handler(void);
247 
264 static inline uint32_t DL_Interrupt_getStatusGroup(
265  DL_INTERRUPT_GROUP group, uint32_t interruptMask)
266 {
267  return (CPUSS->INT_GROUP[(uint32_t) group].RIS & interruptMask);
268 }
269 
279 __STATIC_INLINE uint32_t DL_Interrupt_getPendingGroup(DL_INTERRUPT_GROUP group)
280 {
281  return (CPUSS->INT_GROUP[group].IIDX);
282 }
283 
296 static inline void DL_Interrupt_clearGroup(
297  DL_INTERRUPT_GROUP group, uint32_t interruptMask)
298 {
299  CPUSS->INT_GROUP[(uint32_t) group].ICLR |= interruptMask;
300 }
301 
328  uint32_t exceptionNumber, void (*intHandler)(void));
329 
346 void DL_Interrupt_unregisterInterrupt(uint32_t exceptionNumber);
347 
348 #ifdef __cplusplus
349 }
350 #endif
351 
352 #endif /* ti_dl_m0p_dl_interrupt__include */
353 
static void DL_Interrupt_clearGroup(DL_INTERRUPT_GROUP group, uint32_t interruptMask)
Clear selected interrupt flags in the selected interrupt group.
Definition: dl_interrupt.h:296
static uint32_t DL_Interrupt_getStatusGroup(DL_INTERRUPT_GROUP group, uint32_t interruptMask)
Checks interrupt flag status in the selected group of interrupts.
Definition: dl_interrupt.h:264
Definition: dl_interrupt.h:236
void Default_Handler(void)
Device default Handler.
void DL_Interrupt_unregisterInterrupt(uint32_t exceptionNumber)
Unregister a function to be called when an interrupt occurs.
void DL_Interrupt_registerInterrupt(uint32_t exceptionNumber, void(*intHandler)(void))
Register a function to be called when an interrupt occurs.
DL_INTERRUPT_GROUP
Definition: dl_interrupt.h:234
Definition: dl_interrupt.h:238
__STATIC_INLINE uint32_t DL_Interrupt_getPendingGroup(DL_INTERRUPT_GROUP group)
Get highest priority interrupt pending in the selected interrupt group.
Definition: dl_interrupt.h:279
© Copyright 1995-2025, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale