portBASE_TYPE xPortStartScheduler( void ) { extern void vPortStartFirstTask( void ); extern void *pxCurrentTCB; /* Clear the software interrupt flag. */ IFS0CLR = _IFS0_CS0IF_MASK; /* Set software timer priority. */ IPC0CLR = _IPC0_CS0IP_MASK; IPC0SET = ( configKERNEL_INTERRUPT_PRIORITY << _IPC0_CS0IP_POSITION ); /* Enable software interrupt. */ IEC0CLR = _IEC0_CS0IE_MASK; IEC0SET = 1 << _IEC0_CS0IE_POSITION; /* Setup the timer to generate the tick. Interrupts will have been disabled by the time we get here. */ vApplicationSetupTickTimerInterrupt(); /* Kick off the highest priority task that has been created so far. Its stack location is loaded into uxSavedTaskStackPointer. */ uxSavedTaskStackPointer = *( unsigned portBASE_TYPE * ) pxCurrentTCB; vPortStartFirstTask(); /* Should never get here as the tasks will now be executing. */ return pdFALSE; }
BaseType_t xPortStartScheduler( void ) { /* Setup a timer for the tick ISR. */ vApplicationSetupTickTimerInterrupt(); /* Restore the context of the first task to run. */ portRESTORE_CONTEXT(); /* Simulate the end of the yield function. */ asm volatile ( "return" ); /* Should not reach here. */ return pdTRUE; }
BaseType_t xPortStartScheduler( void ) { extern void vPortStartFirstTask( void ); extern void *pxCurrentTCB; #if ( configCHECK_FOR_STACK_OVERFLOW > 2 ) { /* Fill the ISR stack to make it easy to asses how much is being used. */ memset( ( void * ) xISRStack, portISR_STACK_FILL_BYTE, sizeof( xISRStack ) ); } #endif /* configCHECK_FOR_STACK_OVERFLOW > 2 */ /* Clear the software interrupt flag. */ IFS0CLR = _IFS0_CS0IF_MASK; /* Set software timer priority. */ IPC0CLR = _IPC0_CS0IP_MASK; IPC0SET = ( configKERNEL_INTERRUPT_PRIORITY << _IPC0_CS0IP_POSITION ); /* Enable software interrupt. */ IEC0CLR = _IEC0_CS0IE_MASK; IEC0SET = 1 << _IEC0_CS0IE_POSITION; /* Setup the timer to generate the tick. Interrupts will have been disabled by the time we get here. */ vApplicationSetupTickTimerInterrupt(); /* Kick off the highest priority task that has been created so far. Its stack location is loaded into uxSavedTaskStackPointer. */ uxSavedTaskStackPointer = *( UBaseType_t * ) pxCurrentTCB; vPortStartFirstTask(); /* Should never get here as the tasks will now be executing! Call the task exit error function to prevent compiler warnings about a static function not being called in the case that the application writer overrides this functionality by defining configTASK_RETURN_ADDRESS. */ prvTaskExitError(); return pdFALSE; }