//-------------------------------------------------------------------- // PowerPC Timer Initialization functions. // For PowerPC, DEC and opb_timer can be used for Profiling. This // is selected by the user in standalone BSP // //-------------------------------------------------------------------- int powerpc405_init(void) { Xil_ExceptionInit(); Xil_ExceptionDisableMask( XIL_EXCEPTION_NON_CRITICAL ) ; // Initialize the Timer. // 1. If PowerPC DEC Timer has to be used, initialize DEC timer. // 2. Else use opb_timer. It can be directly connected or thru intc to PowerPC #ifdef PPC_PIT_INTERRUPT ppc_dec_init(); #else #ifdef TIMER_CONNECT_INTC Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_NON_CRITICAL_INT, (Xil_ExceptionHandler)XIntc_DeviceInterruptHandler,(void *)0); XIntc_RegisterHandler( INTC_BASEADDR, PROFILE_TIMER_INTR_ID, (XInterruptHandler)profile_intr_handler,(void*)0); #else Xil_ExceptionRegisterHandler( XIL_EXCEPTION_ID_NON_CRITICAL_INT, (Xil_ExceptionHandler)profile_intr_handler,(void *)0); Xil_ExceptionRegisterHandler( XIL_EXCEPTION_ID_NON_CRITICAL_INT, (Xil_ExceptionHandler)profile_intr_handler,(void *)0); #endif // Initialize the timer with Timer Ticks opb_timer_init() ; #endif // Enable Interrupts in the System, if Profile Timer is the only Interrupt // in the System. #ifdef ENABLE_SYS_INTR #ifdef PPC_PIT_INTERRUPT XTime_DECEnableInterrupt() ; #elif TIMER_CONNECT_INTC XIntc_MasterEnable( INTC_BASEADDR ); XIntc_SetIntrSvcOption( INTC_BASEADDR, XIN_SVC_ALL_ISRS_OPTION); XIntc_EnableIntr( INTC_BASEADDR, PROFILE_TIMER_INTR_MASK ); #endif Xil_ExceptionEnableMask( XEXC_NON_CRITICAL ) ; #endif return 0; }
static bool ppc_cpu_init() { skyeye_config_t* config = get_current_config(); machine_config_t *mach = config->mach; if(!strcmp(mach->machine_name, "mpc8560")){ gCPU.core_num = 1; } else if(!strcmp(mach->machine_name, "mpc8572")) gCPU.core_num = 2; else if(!strcmp(mach->machine_name, "mpc8641d")) gCPU.core_num = 2; else gCPU.core_num = 0; if(!gCPU.core_num){ fprintf(stderr, "ERROR:you need to set numbers of core in mach_init.\n"); skyeye_exit(-1); } else gCPU.core = malloc(sizeof(e500_core_t) * gCPU.core_num); /* TODO: zero the memory by malloc */ if(!gCPU.core){ fprintf(stderr, "Can not allocate memory for ppc core.\n"); skyeye_exit(-1); } else printf("%d core is initialized.\n", gCPU.core_num); int i; for(i = 0; i < gCPU.core_num; i++){ ppc_core_init(&gCPU.core[i], i); } current_core = &gCPU.core[0]; /* initialize decoder */ ppc_dec_init(); return true; }
bool ppc_cpu_init() { //memset(¤t_core-> 0, sizeof current_core->; memset(&gCPU[0], 0, sizeof gCPU[0]); memset(&gCPU[1], 0, sizeof gCPU[1]); //current_core->pvr = gConfig->getConfigInt(CPU_KEY_PVR); current_core->cpm_reg.dpram = (void *)malloc(MPC8560_DPRAM_SIZE); if(!current_core->cpm_reg.dpram){ printf("malloc failed for dpram\n"); skyeye_exit(-1); } else printf("malloc succ for dpram, dpram=0x%x\n", current_core->cpm_reg.dpram); current_core->cpm_reg.iram = (void *)malloc(MPC8560_IRAM_SIZE); if(!current_core->cpm_reg.iram){ printf("malloc failed for iram\n"); skyeye_exit(-1); } else printf("malloc succ for dpram, dpram=0x%x\n", current_core->cpm_reg.iram); ppc_dec_init(); // initialize srs (mostly for prom) int i; for (i=0; i<16; i++) { current_core->sr[i] = 0x2aa*i; } /*sys_create_mutex(&exception_mutex);*/ PPC_CPU_WARN("You are using the generic CPU!\n"); PPC_CPU_WARN("This is much slower than the just-in-time compiler and\n"); PPC_CPU_WARN("should only be used for debugging purposes or if there's\n"); PPC_CPU_WARN("no just-in-time compiler for your platform.\n"); return true; }