/*~~~~~~~ Main Code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ int main(void) { initModesAndClock(); /* Disable Watchdog */ disableWatchdog(); /*Initialize LEDs on TRK-MPC560xB board */ vfnGPIO_LED_Init(); /*Initialize PUSHs on TRK-MPC560xB board */ vfnGPIO_PUSH_Init(); /*Initialize Interrupts */ INTC_InitINTCInterrupts(); /*Initialize Exception Handlers */ EXCEP_InitExceptionHandlers(); PIT_device_init(); PIT_channel_configure(PIT_CHANNEL_0 , dummy_500us); PIT_channel_start(PIT_CHANNEL_0); /* Enable External Interrupts*/ enableIrq(); /* Infinite loop */ dummy_endless_loop(); for (;;) { BackgroundSubsystemTasks(); } }
/************************************************************** * Name : SchM_Init * Description : Scheduler initialization routines * Parameters : Input: SchConfigType *SchM_Config * Return : * Critical/explanation : [yes / No] **************************************************************/ void SchM_Init(const SchConfigType *SchM_Config) { T_UBYTE i; /* Index for initializing(i) tasks */ SchController.SchStatus = SCH_INIT; /* MemAlloc here */ for(i=0; i<SchM_Config->SchNumberOfTasks; i++) { ras_TasksController[i].TaskFunctionControlPtr = SchM_Config->SchTaskDescriptor[i].TaskFunctionPtr; ras_TasksController[i].SchTaskState = TASK_STATE_SUSPENDED; } PIT_device_init(); PIT_channel_configure(PIT_CHANNEL_0 , &SchM_OSTick); }
void SchM_Init(const SchConfigType *SchM_Config) { /*inicializar todo en suspended task control estado y la funcion a donde tiene que ir*/ T_UBYTE lub_index; SchM_ConfigGlobal=SchM_Config; PIT_device_init(); PIT_channel_configure(PIT_CHANNEL_0 , &SchM_OsTick); SchTCBPtr=(SchTCB*)MemAlloc(SchM_ConfigGlobal->SchNumberOfTasks*sizeof(SchTCB)); /*crear una variable global inicializarla con SchM_Config*/ for(lub_index=0; lub_index<SchM_ConfigGlobal->SchNumberOfTasks;lub_index++) { SchTCBPtr[lub_index].SchTaskState=TASK_STATE_SUSPENDED; SchTCBPtr[lub_index].TaskFunctionControlPtr= SchM_ConfigGlobal->SchTaskTable[lub_index].TaskFunctionPtr; } SchControl.SchStatus=SCH_INIT; }