/* * ======== Hwi_Module_startup ======== */ Int Hwi_Module_startup (Int phase) { int i; Hwi_Object *hwi; /* must wait for these modules to initialize first */ if (!Startup_rtsDone()) { return Startup_NOTDONE; } /* okay to proceed with initialization */ #ifndef ti_sysbios_hal_Hwi_DISABLE_ALL_HOOKS for (i = 0; i < Hwi_hooks.length; i++) { if (Hwi_hooks.elem[i].registerFxn != NULL) { Hwi_hooks.elem[i].registerFxn(i); } } #endif Hwi_init(); // sets up FIQ/IRQ stackpointers, etc /* * Initialize the pointer to the isrStack. * * The dispatcher's SP is decremented to accomodate its local variables * BEFORE switching to the ISR stack. Consequently, the intial value of * the ISR stack SP must leave room for these variables. * * Leave room for up to 32 32 bit local variables. */ Hwi_module->isrStack = (Char *) (((UInt32) (Hwi_module->isrStackBase) & 0xfffffff8) + (UInt32) Hwi_module->isrStackSize - 32 * sizeof(Int)); Hwi_module->taskSP = (Char *)-1;/* signal that we're executing on the */ /* ISR stack */ Hwi_enableIER(Hwi_module->ierMask); /* IER per static Hwi settings */ Hwi_l1Intc.ITR = 0; Hwi_l2Intc.ITR1 = 0; Hwi_l2Intc.ITR2 = 0; for (i = 0; i < Hwi_NUM_INTERRUPTS; i++) { hwi = Hwi_module->dispatchTable[i]; if (hwi != NULL) { postInit(hwi, NULL); } } return (Startup_DONE); }
/* * ======== Hwi_Module_startup ======== * must initialize IRQ, FIQ, (and SWI?) SPs (R13s) */ Int Hwi_Module_startup (Int startupPhase) { int i; Hwi_Object *hwi; /* must wait for these modules to initialize first */ if (!Startup_rtsDone()) { return (Startup_NOTDONE); } /* okay to proceed with initialization */ #ifndef ti_sysbios_hal_Hwi_DISABLE_ALL_HOOKS for (i = 0; i < Hwi_hooks.length; i++) { if (Hwi_hooks.elem[i].registerFxn != NULL) { Hwi_hooks.elem[i].registerFxn(i); } } #endif /* set up FIQ stack pointer & switch to SYSTEM mode */ Hwi_init(); initIntController(); /* * Initialize the pointer to the isrStack. * * The dispatcher's SP is decremented to accomodate its local variables * BEFORE switching to the ISR stack. Consequently, the intial value of * the ISR stack SP must leave room for these variables. * * Leave room for up to 32 32 bit local variables. */ Hwi_module->isrStack = (Char *) (((UInt32) (Hwi_module->isrStackBase) & 0xfffffff8) + (UInt32) Hwi_module->isrStackSize - 32 * sizeof(Int)); Hwi_module->taskSP = (Char *)-1; /* signal that we're executing */ /* on the ISR stack */ for (i = 0; i < Hwi_NUM_INTERRUPTS; i++) { hwi = Hwi_module->dispatchTable[i]; if (hwi != NULL) { hwiPostInit(hwi, NULL); } } return Startup_DONE; /* Max startup phase needed is 0 */ }
/* * ======== Core_startup ======== * Other core's intial thread. * Executes on stack provided by Core module. */ Void Core_startup() { /* Init Cache and MMU */ Cache_startup(); /* Install vector table */ Hwi_init(); /* Init exception regs */ Exception_initCoreX(); /* * Initialize GIC CPU Interface and FIQ stack * * Note: GIC Distributor will be initialized by core 0 */ Hwi_initIntControllerCoreX(); /* Initialize this core's Hwi stack to enable stack checking */ if (Core_initStackFlag) { ti_sysbios_hal_Hwi_initStack(); } /* Signal to core 0 that this core's startup routine is complete */ Core_module->syncCores[0][Core_getId()] = TRUE; /* Wait for store to complete */ __asm__ __volatile__ ( "dmb ish" ); /* Wait for core 0's signal to start running tasks */ while(!Core_module->syncCores[0][0]); /* * Enable FIQ interrupts on this core. Task_startCore() will * enable IRQs. */ if (Hwi_enableSecureMode) { Hwi_enableFIQ(); } Task_startCore(Core_getId()); }