예제 #1
0
파일: platform.c 프로젝트: ARMinARM/elua
static void platform_systimer_init()
{
  PIT_SetPIV( SYSTIMER_LIMIT );
  AIC_ConfigureIT( AT91C_ID_SYS, 0, ISR_Pit );
  PIT_EnableIT();
  AIC_EnableIT( AT91C_ID_SYS );
  PIT_Enable();
}
예제 #2
0
void PitInit(unsigned int msperiod)
{
	PIT_DisableIT();
    // Initialize the PIT to the desired frequency
    PIT_Init(0, 0);
	// PIT timer runs at MCK/16 
	// calculates the PIT Value accurate to a Millisecond interrupt
	// msperiod can not be larget than 349 because PIV is at a 20bit limit
	if(msperiod > 349) msperiod = 349;
    PIT_SetPIV((MCK/(16*1000))*msperiod);
	
    // Configure interrupt on PIT
    AIC_DisableIT(AT91C_ID_SYS);
    AIC_ConfigureIT(AT91C_ID_SYS, AT91C_AIC_PRIOR_LOWEST, ISR_Pit);
    AIC_EnableIT(AT91C_ID_SYS);
    PIT_EnableIT();
	
    // Enable the pit
    PIT_Enable();
}