INTERRUPT: INTERRUPT.h Source File

INTERRUPT

INTERRUPT
INTERRUPT.h
Go to the documentation of this file.
00001 
00059 #ifndef INTERRUPT_H
00060 #define INTERRUPT_H
00061 
00062 /***********************************************************************************************************************
00063  * HEADER FILES
00064  **********************************************************************************************************************/
00065 #include <xmc_common.h>
00066 #include <DAVE_Common.h>
00067 
00068 #if (UC_SERIES == XMC14)
00069 #include <xmc_scu.h>
00070 #endif
00071 
00072 #include "interrupt_conf.h"
00073 
00074 
00080 /*********************************************************************************************************************
00081  * MACROS
00082  ********************************************************************************************************************/
00083 
00084 /*********************************************************************************************************************
00085  * ENUMS
00086  ********************************************************************************************************************/
00094 typedef enum INTERRUPT_STATUS
00095 {
00096   INTERRUPT_STATUS_SUCCESS = 0U,  
00097   INTERRUPT_STATUS_FAILURE = 1U   
00098 } INTERRUPT_STATUS_t;
00103 /*********************************************************************************************************************
00104  * DATA STRUCTURES
00105  *********************************************************************************************************************/
00114 typedef struct INTERRUPT
00115 {
00116 #if(UC_SERIES == XMC14)
00117   const XMC_SCU_IRQCTRL_t irqctrl;  
00118 #endif  
00119   const IRQn_Type node;       
00120   const uint8_t priority;         
00121 #if(UC_FAMILY == XMC4)
00122   const uint8_t subpriority;  
00123 #endif  
00124   const bool enable_at_init;  
00125 } INTERRUPT_t;
00126 
00131 /*********************************************************************************************************************
00132  * API PROTOTYPES
00133  *********************************************************************************************************************/
00134 
00135 #ifdef __cplusplus
00136 extern "C" {
00137 #endif
00138 
00169 DAVE_APP_VERSION_t INTERRUPT_GetAppVersion(void);
00189 INTERRUPT_STATUS_t INTERRUPT_Init(const INTERRUPT_t *const handler);
00190 
00210 __STATIC_INLINE void INTERRUPT_Enable(const INTERRUPT_t *const handler)
00211 {
00212   XMC_ASSERT("Handler NULL", (handler != NULL));
00213   NVIC_EnableIRQ(handler->node);
00214 }
00215 
00235 __STATIC_INLINE void INTERRUPT_Disable(const INTERRUPT_t *const handler)
00236 {
00237   XMC_ASSERT("Handler NULL", (handler != NULL));
00238   NVIC_DisableIRQ(handler->node);
00239 }
00240 
00261 __STATIC_INLINE uint32_t INTERRUPT_GetPending(const INTERRUPT_t *const handler)
00262 {
00263   XMC_ASSERT("Handler NULL", (handler != NULL));
00264   return NVIC_GetPendingIRQ(handler->node);
00265 }
00266 
00286 __STATIC_INLINE void INTERRUPT_SetPending(const INTERRUPT_t *const handler)
00287 {
00288   XMC_ASSERT("Handler NULL", (handler != NULL));
00289   NVIC_SetPendingIRQ(handler->node);
00290 }
00291 
00324 __STATIC_INLINE void INTERRUPT_ClearPending(const INTERRUPT_t *const handler)
00325 {
00326   XMC_ASSERT("Handler NULL", (handler != NULL));
00327   NVIC_ClearPendingIRQ(handler->node);
00328 }
00329 
00330 #if(UC_FAMILY == XMC4)
00331 
00352 __STATIC_INLINE uint32_t INTERRUPT_GetActive(const INTERRUPT_t *const handler)
00353 {
00354   XMC_ASSERT("Handler NULL", (handler != NULL));
00355   return NVIC_GetActive(handler->node);
00356 }
00357 
00358 #endif
00359 
00360 #ifdef __cplusplus
00361 }
00362 #endif
00363 
00364 #include "interrupt_extern.h"
00365 
00366 #endif
00367