Exemplo n.º 1
0
/*
 * RTOS tick interrupt service routine.  If the cooperative scheduler is 
 * being used then this simply increments the tick count.  If the 
 * preemptive scheduler is being used a context switch can occur.
 */
void interrupt vPortTickInterrupt( void )
{
	#if configUSE_PREEMPTION == 1
	{
		/* A context switch might happen so save the context. */
		portSAVE_CONTEXT();

		/* Increment the tick ... */
		vTaskIncrementTick();

		/* ... then see if the new tick value has necessitated a
		context switch. */
		vTaskSwitchContext();

		TFLG1 = 1;								   

		/* Restore the context of a task - which may be a different task
		to that interrupted. */
		portRESTORE_CONTEXT();	
	}
	#else
	{
		vTaskIncrementTick();
		TFLG1 = 1;
	}
	#endif
}
Exemplo n.º 2
0
void prvTickISR( void )
{
	/* Increment the tick, and perform any processing the new tick value
	necessitates. */
	set_ipl( configMAX_SYSCALL_INTERRUPT_PRIORITY );
	{
		vTaskIncrementTick();
	}
	set_ipl( configKERNEL_INTERRUPT_PRIORITY );

	/* Only select a new task if the preemptive scheduler is being used. */
	#if( configUSE_PREEMPTION == 1 )
	{
		taskYIELD();
	}
	#endif

	#if configUSE_TICKLESS_IDLE == 1
	{
		/* The CPU woke because of a tick. */
		ulTickFlag = pdTRUE;

		/* If this is the first tick since exiting tickless mode then the CMT
		compare match value needs resetting. */
		CMT0.CMCOR = ( unsigned short ) ulMatchValueForOneTick;
	}
	#endif
}
Exemplo n.º 3
0
/* 
 * Handler for the timer interrupt.  This is the handler that the application
 * defined callback function vApplicationSetupTimerInterrupt() should install.
 */
void vPortTickISR( void *pvUnused )
{
extern void vApplicationClearTimerInterrupt( void );

	/* Ensure the unused parameter does not generate a compiler warning. */
	( void ) pvUnused;

	/* This port uses an application defined callback function to clear the tick
	interrupt because the kernel will run on lots of different MicroBlaze and 
	FPGA configurations - not all of which will have the same timer peripherals 
	defined or available.  An example definition of
	vApplicationClearTimerInterrupt() is provided in the official demo
	application that accompanies this port. */	
	vApplicationClearTimerInterrupt();

	/* Increment the RTOS tick - this might cause a task to unblock. */
	vTaskIncrementTick();

	/* If the preemptive scheduler is being used then a context switch should be
	requested in case incrementing the tick unblocked a task, or a time slice
	should cause another task to enter the Running state. */
	#if configUSE_PREEMPTION == 1
		/* Force vTaskSwitchContext() to be called as the interrupt exits. */
		ulTaskSwitchRequested = 1;
	#endif
}
Exemplo n.º 4
0
	/*
	 * Tick ISR for preemptive scheduler.  We can use a naked attribute as
	 * the context is saved at the start of vPortYieldFromTick().  The tick
	 * count is incremented after the context is saved.
	 */
	void ISROsTick( void )
	{
		/* Increment the tick count then switch to the highest priority task
		that is ready to run. */
		vTaskIncrementTick();
		vTaskSwitchContext();
	}
Exemplo n.º 5
0
	static void __interrupt __far prvNonPreemptiveTick( void )
	{
		/* Same as preemptive tick, but the cooperative scheduler is being used
		so we don't have to switch in the context of the next task. */
		vTaskIncrementTick();
		prvPortResetPIC();
	}
Exemplo n.º 6
0
void xPortSysTickHandler( void )
{
	/* If using preemption, also force a context switch. */
	#if configUSE_PREEMPTION == 1
		portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
	#endif

	/* Only reset the systick load register if configUSE_TICKLESS_IDLE is set to
	1.  If it is set to 0 tickless idle is not being used.  If it is set to a 
	value other than 0 or 1 then a timer other than the SysTick is being used
	to generate the tick interrupt. */
	#if configUSE_TICKLESS_IDLE == 1
		portNVIC_SYSTICK_LOAD_REG = ulTimerReloadValueForOneTick;
	#endif

	( void ) portSET_INTERRUPT_MASK_FROM_ISR();
	{
		vTaskIncrementTick();
		// wrzucam tutaj obsluge licznika dla HAL
		HAL_IncTick();
	}
	portCLEAR_INTERRUPT_MASK_FROM_ISR( 0 );




}
Exemplo n.º 7
0
	static void __interrupt __far prvNonPreemptiveTick( void )
	{
		/* Same as preemptive tick, but the cooperative scheduler is being used
		so we don't have to switch in the context of the next task. */
		vTaskIncrementTick();
		/* Reset interrupt. */
		outport( portEIO_REGISTER, portCLEAR_INTERRUPT );
	}
Exemplo n.º 8
0
void vPortNonPreemptiveTick( void )
{  
    vTaskIncrementTick();

    /* Clear the interrupt in the watchdog and EIC. */
	WDG->SR = 0x0000;
    /* clear current interrupt pending flag for interupt source. */
    EIC->IPR |= 1 << EIC_CurrentIRQChannelValue();
}
Exemplo n.º 9
0
void vPortYieldFromTick( void )
{
	portSAVE_CONTEXT();
	vTaskIncrementTick();
	vTaskSwitchContext();
	portRESTORE_CONTEXT();

	asm volatile ( "ret" );
}
Exemplo n.º 10
0
	/* The cooperative scheduler requires a normal IRQ service routine to
	 * simply increment the system tick. */
	__interrupt void vPortNonPreemptiveTick( void )
	{
		/* clear clock interrupt flag */
		RTI->INTFLAG = 0x00000001;

		/* Increment the tick count - this may make a delaying task ready
		to run - but a context switch is not performed. */
		vTaskIncrementTick();
	}
Exemplo n.º 11
0
/*
 *	This is the TICK interrupt service routine, note. no SAVE/RESTORE_CONTEXT here
 *	as thats done in the bottom-half of the ISR.
 *
 *	See bt_interrupts.c in the RaspberryPi Drivers folder.
 */
void vTickISR (unsigned int nIRQ, void *pParam)
{
	vTaskIncrementTick();

	#if configUSE_PREEMPTION == 1
	vTaskSwitchContext();
	#endif

	pRegs->CLI = 0;			// Acknowledge the timer interrupt.
}
Exemplo n.º 12
0
/*
 * The ISR used for the scheduler tick depends on whether the cooperative or
 * the preemptive scheduler is being used.
 */
static void
prvPortPreemptiveTick ( void )
{
    /* The cooperative scheduler requires a normal IRQ service routine to
     * simply increment the system tick.
     */

    vTaskIncrementTick(  );
    MCF_PIT_PCSR0 |= MCF_PIT_PCSR_PIF;
}
Exemplo n.º 13
0
	static void __interrupt __far prvPreemptiveTick( void )
	{
		/* Get the scheduler to update the task states following the tick. */
		vTaskIncrementTick();

		/* Switch in the context of the next task to be run. */
		portSWITCH_CONTEXT();

		/* Reset interrupt. */
		outport( portEIO_REGISTER, portCLEAR_INTERRUPT );
	}
Exemplo n.º 14
0
/* The cooperative scheduler requires a normal IRQ service routine to
simply increment the system tick. */
__arm __irq void vPortNonPreemptiveTick( void )
{
	/* Increment the tick count - which may wake some tasks but as the
	preemptive scheduler is not being used any woken task is not given
	processor time no matter what its priority. */
	vTaskIncrementTick();

	/* Clear the interrupt in the watchdog and EIC. */
	WDG->SR = 0x0000;
	portCLEAR_EIC();		
}
Exemplo n.º 15
0
void __attribute__((__interrupt__, auto_psv)) _T1Interrupt( void )
{
	/* Clear the timer interrupt. */
	IFS0bits.T1IF = 0;

	vTaskIncrementTick();

	#if configUSE_PREEMPTION == 1
		portYIELD();
	#endif
}
Exemplo n.º 16
0
	static void __interrupt __far prvPreemptiveTick( void )
	{
		/* Get the scheduler to update the task states following the tick. */
		vTaskIncrementTick();

		/* Switch in the context of the next task to be run. */
		portSWITCH_CONTEXT();

		/* Reset the PIC ready for the next time. */
		prvPortResetPIC();
	}
Exemplo n.º 17
0
	static __arm __irq void vPortNonPreemptiveTick( void )
	{
		/* Increment the tick count - which may wake some tasks but as the
		preemptive scheduler is not being used any woken task is not given
		processor time no matter what its priority. */
		vTaskIncrementTick();
		
		/* Ready for the next interrupt. */
		T0IR = portTIMER_MATCH_ISR_BIT;
		VICVectAddr = portCLEAR_VIC_INTERRUPT;
	}
Exemplo n.º 18
0
static void prvProcessTick( void )
{
	vTaskIncrementTick();

	#if configUSE_PREEMPTION == 1
		vTaskSwitchContext();
	#endif

	/* Clear the Tick Interrupt. */
	counter1->expired = 0;
}
void RT_VECT (void)
{
	// For the preemptive scheduler, enable a context switch
	#if configUSE_PREEMPTION == 1
		vPortYieldFromTick ();
		asm volatile ( "reti" );
	#else
	// For the cooperative scheduler, all this does is increment the tick count.  
	// We don't need to switch context; that's done by manual calls to taskYIELD()
		vTaskIncrementTick ();
	#endif
}
Exemplo n.º 20
0
/*
 * The ISR used for the scheduler tick.
 */
void vTickISR( XScuTimer *Timer )
{
	/* Increment the RTOS tick count, then look for the highest priority
	task that is ready to run. */
	vTaskIncrementTick();

	#if configUSE_PREEMPTION == 1
		vTaskSwitchContext();
	#endif

	XScuTimer_ClearInterruptStatus(Timer);
}
Exemplo n.º 21
0
	interrupt (TIMERA0_VECTOR) prvTickISR( void )
	{
		/* Save the context of the interrupted task. */
		portSAVE_CONTEXT();

		/* Increment the tick count then switch to the highest priority task
		that is ready to run. */
		vTaskIncrementTick();
		vTaskSwitchContext();

		/* Restore the context of the new task. */
		portRESTORE_CONTEXT();
	}
Exemplo n.º 22
0
ISR (TCC0_OVF_vect, ISR_NAKED) {
    /*
     * Context switch function used by the tick.  This must be identical to
     * vPortYield() from the call to vTaskSwitchContext() onwards.  The only
     * difference from vPortYield() is the tick count is incremented as the
     * call comes from the tick ISR.
     */
    portSAVE_CONTEXT();
    vTaskIncrementTick();
    vTaskSwitchContext();
    portRESTORE_CONTEXT();
    asm volatile ( "reti" );
}
Exemplo n.º 23
0
static void
prvPortPreemptiveTick( void )
{
    asm volatile ( "move.w  #0x2700, %sr\n\t" );
#if _GCC_USES_FP == 1
    asm volatile ( "unlk %fp\n\t" );
#endif
    portSAVE_CONTEXT(  );
    MCF_PIT_PCSR0 |= MCF_PIT_PCSR_PIF;
    vTaskIncrementTick(  );
    vTaskSwitchContext(  );
    portRESTORE_CONTEXT(  );
}
Exemplo n.º 24
0
/*-----------------------------------------------------------*/
void SysTick_Handler( void ) /* ATMEL */
{
	/* If using preemption, also force a context switch. */
	#if configUSE_PREEMPTION == 1
	portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT;
	#endif

	(void)portSET_INTERRUPT_MASK_FROM_ISR();
	{
		vTaskIncrementTick();
	}
	portCLEAR_INTERRUPT_MASK_FROM_ISR( 0 );
}
Exemplo n.º 25
0
Arquivo: port.c Projeto: fmorel/SoC
static void prvTimerInterrupt(unsigned int intrLevel, void *pContext)
{
    Timer_t *pISRTimer = (Timer_t *)pContext;

	#if configUSE_PREEMPTION == 1
	/*
	 * Tick ISR for preemptive scheduler.
	 */
	vTaskIncrementTick();
	vTaskSwitchContext();
	#else
	/*
	 * Tick ISR for the cooperative scheduler.  All this does is increment the
	 * tick count.  We don't need to switch context, this can only be done by
	 * manual calls to taskYIELD();
	 */
	vTaskIncrementTick();
	#endif
	
	/* Clear Timer Status */
    pISRTimer->Status = 0;	
}
Exemplo n.º 26
0
void vPortSysTickHandler( void * context, alt_u32 id )
{
	/* Increment the Kernel Tick. */
	vTaskIncrementTick();

	/* If using preemption, also force a context switch. */
	#if configUSE_PREEMPTION == 1
        vTaskSwitchContext();
	#endif

	/* Clear the interrupt. */
	IOWR_ALTERA_AVALON_TIMER_STATUS( SYS_CLK_BASE, ~ALTERA_AVALON_TIMER_STATUS_TO_MSK );
}
Exemplo n.º 27
0
	void vPortPreemptiveTick( void )
	{
		/* Increment the tick counter. */
		vTaskIncrementTick();
	
		/* The new tick value might unblock a task.  Ensure the highest task that
		is ready to execute is the task that will execute when the tick ISR
		exits. */
		vTaskSwitchContext();
	
		/* Ready for the next interrupt. */
		T0IR = portTIMER_MATCH_ISR_BIT;
		VICVectAddr = portCLEAR_VIC_INTERRUPT;
	}
Exemplo n.º 28
0
void xPortSysTickHandler( void )
{
unsigned long ulDummy;
	/* If using preemption, also force a context switch. */
	#if configUSE_PREEMPTION == 1
		*(portNVIC_INT_CTRL) = portNVIC_PENDSVSET;
	#endif

	ulDummy = portSET_INTERRUPT_MASK_FROM_ISR();
	{
		vTaskIncrementTick();
	}
	portCLEAR_INTERRUPT_MASK_FROM_ISR( ulDummy );
}
Exemplo n.º 29
0
/* This function is called from an asm wrapper, so does not require the __irq
keyword. */
void vPortPreemptiveTick( void )
{
	/* Increment the tick counter. */
	vTaskIncrementTick();

	/* The new tick value might unblock a task.  Ensure the highest task that
	is ready to execute is the task that will execute when the tick ISR 
	exits. */
	vTaskSwitchContext();

	/* Clear the interrupt in the watchdog and EIC. */
	WDG->SR = 0x0000;
	portCLEAR_EIC();			
}
Exemplo n.º 30
0
__arm void vPortPreemptiveTick( void )
{
	/* Increment the tick counter. */
	vTaskIncrementTick();

	/* The new tick value might unblock a task.  Ensure the highest task that
	is ready to execute is the task that will execute when the tick ISR
	exits. */
	#if configUSE_PREEMPTION == 1
		vTaskSwitchContext();
	#endif

	TB_ClearITPendingBit( TB_IT_Update );
}