extern void socle_scu_show_system_info (void) { socle_scu_apb_clock_get(); SCUMSG("CPU = %d MHz , HCLCK = %d MHz ", socle_clock.cpu_clock/1000000, socle_clock.ahb_clock/1000000); if(socle_scu_sdram_bus_width_status() == SOCLE_SCU_SDRAM_BUS_WIDTH_32) SCUMSG("(32bit SDR) \n"); else SCUMSG("(16bit SDR) \n"); return ; }
/* * Set up timer interrupt, and return the current time in seconds. */ void __init socle_init_timer(void) { struct timespec tv; volatile TimerStruct_t *timer0 = (volatile TimerStruct_t *)TIMER0_VA_BASE; volatile TimerStruct_t *timer1 = (volatile TimerStruct_t *)TIMER1_VA_BASE; volatile TimerStruct_t *timer2 = (volatile TimerStruct_t *)TIMER2_VA_BASE; xtime.tv_nsec = 0; xtime.tv_sec = 0; tv.tv_nsec = 0; tv.tv_sec = 0; /* * Initialise to a known state (all timers off) */ timer0->TimerControl = 0; timer1->TimerControl = 0; timer2->TimerControl = 0; #ifdef CALCULATE_CPU_FREQ apb_clock = socle_scu_apb_clock_get(); socle_scu_show_system_info(); TIMER_RELOAD=apb_clock/HZ; #endif timer1->TimerLoad = TIMER_RELOAD; tick_usec = TICKS2USECS(TIMER_RELOAD); /* * Make irqs happen for the system timer */ do_settimeofday(&tv); timer1->TimerControl = 0x182; /* periodic + IE ; prescale factor=1*/ setup_irq(IRQ_TIMER1, &socle_timer_irq); }