INTERRUPT: INTERRUPT.c Source File

INTERRUPT

INTERRUPT
INTERRUPT.c
Go to the documentation of this file.
00001 
00055 /***********************************************************************************************************************
00056  * HEADER FILES
00057  **********************************************************************************************************************/
00058 
00059 #include "interrupt.h"
00060 
00061 /***********************************************************************************************************************
00062         * MACROS
00063  **********************************************************************************************************************/
00064 
00065 /***********************************************************************************************************************
00066  * LOCAL DATA
00067  **********************************************************************************************************************/
00068 
00069 /***********************************************************************************************************************
00070  * LOCAL ROUTINES
00071  **********************************************************************************************************************/
00072 
00073 /**********************************************************************************************************************
00074 * API IMPLEMENTATION
00075 **********************************************************************************************************************/
00076 /*
00077  * API to retrieve the version of the INTERRUPT APP
00078  */
00079 DAVE_APP_VERSION_t INTERRUPT_GetAppVersion(void)
00080 {
00081   DAVE_APP_VERSION_t version;
00082 
00083   version.major = INTERRUPT_MAJOR_VERSION;
00084   version.minor = INTERRUPT_MINOR_VERSION;
00085   version.patch = INTERRUPT_PATCH_VERSION;
00086 
00087   return (version);
00088 }
00089 
00090 /*
00091  * API to initialize the INTERRUPT APP
00092  */
00093 INTERRUPT_STATUS_t INTERRUPT_Init(const INTERRUPT_t *const handler)
00094 {
00095   XMC_ASSERT("INTERRUPT_Init:HandlePtr NULL", (handler != NULL));
00096   
00097 #if(UC_FAMILY == XMC4)
00098 
00099   NVIC_SetPriority(handler->node,
00100                    NVIC_EncodePriority(NVIC_GetPriorityGrouping(),
00101                                        handler->priority,
00102                                        handler->subpriority));
00103   if (handler->enable_at_init == true)
00104   {
00105     INTERRUPT_Enable(handler);
00106   }
00107 #endif
00108 
00109 #if(UC_FAMILY == XMC1)
00110   NVIC_SetPriority(handler->node, handler->priority);
00111   
00112 #if (UC_SERIES == XMC14)
00113   XMC_SCU_SetInterruptControl((uint8_t)handler->node, (XMC_SCU_IRQCTRL_t)((handler->node << 8) | handler->irqctrl));
00114 #endif
00115 
00116   /* Enable the interrupt if enable_at_init is enabled */
00117   if (handler->enable_at_init == true)
00118   {
00119     INTERRUPT_Enable(handler);
00120   }
00121 #endif
00122 
00123   return (INTERRUPT_STATUS_SUCCESS);
00124 }