rtel wrote on Monday, May 26, 2008:
You probably know all this already, but just in case.
The previous version installed __FreeRTOS_interrupt_handler as the interrupt handler, with the following code:
__FreeRTOS_interrupt_handler:
portSAVE_CONTEXT
/* Entered via an interrupt so interrupts must be enabled in msr. */
ori r31, r31, 2
/* Stack msr. */
swi r31, r1, 8
/* Stack the return address. As we entered via an interrupt we do
not need to modify the return address prior to stacking. */
swi r14, r1, 76
/* Now switch to use the ISR stack. */
lwi r3, r0, pulISRStack
add r1, r3, r0
bralid r15, vTaskISRHandler
or r0, r0, r0
portRESTORE_CONTEXT
This is defined in portasm.s. vTaskISRHandler then found the source of the interrupt and ran the correct handler, in the case of the timer interrupt this was vTickISR(). When vTickISR() is called the context has already been saved by __FreeRTOS_interrupt_handler, so this does not need to happen again. vTickISR() is therefore (in port.c):
void vTickISR( void *pvBaseAddress )
{
unsigned portLONG ulCSR;
/* Increment the RTOS tick - this might cause a task to unblock. */
vTaskIncrementTick();
/* Clear the timer interrupt */
ulCSR = XTmrCtr_mGetControlStatusReg(XPAR_OPB_TIMER_1_BASEADDR, 0);
XTmrCtr_mSetControlStatusReg( XPAR_OPB_TIMER_1_BASEADDR, portCOUNTER_0, ulCSR );
/* If we are using the preemptive scheduler then we also need to determine
if this tick should cause a context switch. */
#if configUSE_PREEMPTION == 1
vTaskSwitchContext();
#endif
}
So provided the timer interrupt is installed correctly into the interrupt controller array of handlers, it should work.
Regards.