Exemplo n.º 1
0
/*
 * Setup the timer 0 to generate the tick interrupts at the required frequency.
 */
static void
prvSetupTimerInterrupt( void )
{
    /* Setup the AIC for PIT interrupts.  The interrupt routine chosen depends
     * on whether the preemptive or cooperative scheduler is being used.
     */
#if configUSE_PREEMPTION == 0
    AT91F_AIC_ConfigureIt( AT91C_BASE_AIC, AT91C_ID_SYS, AT91C_AIC_PRIOR_HIGHEST,
                           AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL,
                           ( void ( * )( void ) )vNonPreemptiveTick );
#else
    AT91F_AIC_ConfigureIt( AT91C_BASE_AIC, AT91C_ID_SYS, AT91C_AIC_PRIOR_HIGHEST,
                           AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL,
                           ( void ( * )( void ) )vPreemptiveTick );

#endif

    /* Configure the PIT period. */
    AT91F_PITInit( AT91C_BASE_PITC, portTICK_RATE_MS * 1000U, configCPU_CLOCK_HZ / 1000000U );
    AT91F_PITEnableInt( AT91C_BASE_PITC );
    AT91F_AIC_EnableIt( AT91C_BASE_AIC, AT91C_ID_SYS );
}
Exemplo n.º 2
0
void _clock_init(void)
{
    AT91F_PITInit(AT91C_BASE_PITC, 1000, 50); /* Period = 1000 Hz, CLK = 50 MHz */
}