Esempio n. 1
0
static void calibrate_apic_timer() {
  // Setup a one-shot timer
  apic_setup_local_timer(SCHEDULER_TIMER_DIVIDER, LOCAL_APIC_CALIBRATION_IV, APIC_TIMER_ONE_SHOT,
                         SCHEDULER_TIMER_CALIBRATION_PERIOD);
  interrupt_register_handler(LOCAL_APIC_CALIBRATION_IV, apic_timer_calibration_isr);

  uint64_t calibration_start = timer_ticks();
  apic_set_local_timer_masked(false);

  // Spin until we get the APIC timer interrupt
  while(calibration_end == 0);

  // Determine APIC frequency pased on number of PIC ticks that happened
  scheduler_data.apic_timer_frequency = (uint64_t)SCHEDULER_TIMER_CALIBRATION_PERIOD *
    TIMER_FREQUENCY / (calibration_end - calibration_start);
}
Esempio n. 2
0
void platform_initialize( void )
{
	omap3430_p_intc = omap3430_mpu_intc_initialize( OMAP3430_MPU_INTC_BASE );
	omap3430_p_systimer = omap3430_gptimer_initialize ( OMAP3430_GPTIMER0_BASE );

	interrupt_register_handler(OMAP3430_MPU_IRQ_GPTIMER1, &omap3430_systick_isr, NULL);	

	omap3430_mpu_intc_config_irq( omap3430_p_intc, OMAP3430_MPU_IRQ_GPTIMER1, 0, 23 );
	omap3430_mpu_intc_unmask_int( omap3430_p_intc, OMAP3430_MPU_IRQ_GPTIMER1 );

	omap3430_gptimer_set_prescaler( omap3430_p_systimer, 0);
	omap3430_gptimer_enable_overflow_int ( omap3430_p_systimer );
	omap3430_gptimer_start_count ( omap3430_p_systimer, 2, 0 );

	timer_freq  = 32768/2;
	timer_mfreq = 33/2;

}
void keyboard_init(void) {
    file_attach_path("/dev/", &Keyboard_Device);
    interrupt_register_handler(Keyboard_IRQ_Number, keyboard_handler);
}