portBASE_TYPE xPortStartScheduler( void ) { extern void vApplicationSetupTimerInterrupt( void ); /* Use pxCurrentTCB just so it does not get optimised away. */ if( pxCurrentTCB != NULL ) { /* Call an application function to set up the timer that will generate the tick interrupt. This way the application can decide which peripheral to use. A demo application is provided to show a suitable example. */ vApplicationSetupTimerInterrupt(); /* Enable the software interrupt. */ _IEN( _ICU_SWINT ) = 1; /* Ensure the software interrupt is clear. */ _IR( _ICU_SWINT ) = 0; /* Ensure the software interrupt is set to the kernel priority. */ _IPR( _ICU_SWINT ) = configKERNEL_INTERRUPT_PRIORITY; /* Start the first task. */ prvStartFirstTask(); } /* Just to make sure the function is not optimised away. */ ( void ) vSoftwareInterruptISR(); /* Should not get here. */ return pdFAIL; }
BaseType_t xPortStartScheduler( void ) { extern void ( vPortStartFirstTask )( void ); extern uint32_t _stack[]; /* Setup the hardware to generate the tick. Interrupts are disabled when this function is called. This port uses an application defined callback function to install the tick interrupt handler 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 vApplicationSetupTimerInterrupt() is provided in the official demo application that accompanies this port. */ vApplicationSetupTimerInterrupt(); /* Reuse the stack from main() as the stack for the interrupts/exceptions. */ pulISRStack = ( uint32_t * ) _stack; /* Ensure there is enough space for the functions called from the interrupt service routines to write back into the stack frame of the caller. */ pulISRStack -= 2; /* Restore the context of the first task that is going to run. From here on, the created tasks will be executing. */ vPortStartFirstTask(); /* Should not get here as the tasks are now running! */ return pdFALSE; }
portBASE_TYPE xPortStartScheduler( void ) { extern void vApplicationSetupTimerInterrupt( void ); /* Call an application function to set up the timer that will generate the tick interrupt. This way the application can decide which peripheral to use. A demo application is provided to show a suitable example. */ vApplicationSetupTimerInterrupt(); /* Start the first task. This will only restore the standard registers and not the flop registers. This does not really matter though because the only flop register that is initialised to a particular value is fpscr, and it is only initialised to the current value, which will still be the current value when the first task starts executing. */ trapa( portSTART_SCHEDULER_TRAP_NO ); /* Should not get here. */ return pdFAIL; }
/* * Hardware initialisation to generate the RTOS tick. */ void vPortSetupTimerInterrupt( void ) { vApplicationSetupTimerInterrupt(); }