Пример #1
0
/* Cortex-M0 core of LPC4337 uses RIT Timer for periodic IRQ */
void RIT_IRQHandler(void)
{
   if(Chip_RIT_GetIntStatus(LPC_RITIMER) == SET)
   {
      /* Store the calling context in a variable. */
      ContextType actualContext = GetCallingContext();

      /* Set ISR2 context. */
      SetActualContext(CONTEXT_ISR2);

#if (ALARMS_COUNT != 0)

      /* Counter increment. */
      static CounterIncrementType CounterIncrement = 1; /* TODO remove me. */

      (void)CounterIncrement; /* This avoids a compiler warning because the variable is not being used. */

      /*
       * Enter critical section.
       * */
      IntSecure_Start();

      /*
       * The the RTOS counter increment handler.
       * */
      CounterIncrement = IncrementCounter(0, 1 /* CounterIncrement */); /* TODO FIXME */

      /*
       * Exit the critical section.
       * */
      IntSecure_End();

#endif /* #if (ALARMS_COUNT != 0) */

      /* reset context */
      SetActualContext(actualContext);

#if (NON_PREEMPTIVE == OSEK_DISABLE)

      /*
       * Check if the currently active task is preemptive;
       * if it is, call schedule().
       * */

      if ( ( CONTEXT_TASK == actualContext ) &&
            ( TasksConst[GetRunningTask()].ConstFlags.Preemtive ) )
      {
         /* This shall force a call to the scheduler. */
         PostIsr2_Arch(isr);
      }

#endif /* #if (NON_PREEMPTIVE == OSEK_DISABLE) */

      Chip_RIT_ClearInt(LPC_RITIMER);

      NVIC_ClearPendingIRQ(RITIMER_IRQn);
   }
}
Пример #2
0
/* Periodic Interrupt Timer, included in all Cortex-M4 processors */
void SysTick_Handler(void)
{
   /* store the calling context in a variable */
   ContextType actualContext = GetCallingContext();
   /* set isr 2 context */
   SetActualContext(CONTEXT_ISR2);

#if (ALARMS_COUNT != 0)
   /* counter increment */
   static CounterIncrementType CounterIncrement = 1;
   (void)CounterIncrement; /* TODO remove me */

   /* increment the disable interrupt conter to avoid enable the interrupts */
   IntSecure_Start();

   /* call counter interrupt handler */
   CounterIncrement = IncrementCounter(0, 1 /* CounterIncrement */); /* TODO FIXME */

   /* set the disable interrupt counter back */
   IntSecure_End();

#endif /* #if (ALARMS_COUNT != 0) */

   /* reset context */
   SetActualContext(actualContext);

#if (NON_PREEMPTIVE == OSEK_DISABLE)
   /* check if the actual task is preemptive */
   if ( ( CONTEXT_TASK == actualContext ) &&
        ( TasksConst[GetRunningTask()].ConstFlags.Preemtive ) )
   {
      /* indicate that the scheduler will be called from isr2 */
//      OSEK_ISR2_SchedulerCall = 1;
      OSEK_ISR2_SchedulerCall++;

      /* this shall force a call to the scheduler */
      PostIsr2_Arch(isr);
   }
#endif /* #if (NON_PREEMPTIVE == OSEK_DISABLE) */
}
Пример #3
0
/*==================[external functions definition]==========================*/
void OSEK_ISR2_ISRtec(void)
{
   /* store the calling context in a variable */
   ContextType actualContext = GetCallingContext();
   /* set isr 2 context */
   SetActualContext(CONTEXT_ISR2);

   /* trigger isr 2 */
   OSEK_ISR_ISRtec();

   /* reset context */
   SetActualContext(actualContext);

#if (NON_PREEMPTIVE == OSEK_DISABLE)
   /* check if the actual task is preemptive */
   if ( ( CONTEXT_TASK == actualContext ) &&
        ( TasksConst[GetRunningTask()].ConstFlags.Preemtive ) )
   {
      /* this shall force a call to the scheduler */
      PostIsr2_Arch(isr);
   }
#endif /* #if (NON_PREEMPTIVE == OSEK_ENABLE) */
}