#include <config.h>
#define led1 (1<<22)
#define led2 (1<<23)
#define led3 (1<<24)
#define led4 (1<<25)
///////////////////////////////////////////////////////////////////////
__irq __arm void irq_t0_led (void)
{
while(1);
}
///////////////////////////////////////////////////////////////////////
void int_timer_irq()
{
T0TCR=0x00;
VICVectAddr0=0x00;
VICVectCntl0=0x00;
VICIntSelect=0x00000000;
VICVectCntl0=((1<<5)|0x04);
VICVectAddr0=(uint32)irq_t0_led;
T0IR=(T0IR|0x01);
VICIntEnable=1<<4;
T0PR=99;
T0MCR=0x03;
T0MR0=Fpclk/(99+1)/2;
T0TCR=0x03;
T0TCR=0x01;
}
///////////////////////////////////////////////////////////////////////
void int_pll()
{
PLLCON=1;
switch(Fcclk/Fpclk)
{
case 1: APBDIV=1; break;
case 2: APBDIV=2; break;
case 4: APBDIV=0; break;
}
switch(Fcco/Fcclk)
{
case 2: PLLCFG=((Fcclk/Fosc)-1)|(0<<5);break;
case 4: PLLCFG=((Fcclk/Fosc)-1)|(1<<5);break;
case 8: PLLCFG=((Fcclk/Fosc)-1)|(2<<5);break;
case 16: PLLCFG=((Fcclk/Fosc)-1)|(3<<5);break;
}
PLLFEED=0xaa;PLLFEED=0x55;
while(PLLSTAT&(1<<10)==0);
PLLCON=3;
PLLFEED=0xaa;PLLFEED=0x55;
}
///////////////////////////////////////////////////////////////////////
void main(void)
{
PINSEL0=0x00000050;
PINSEL1=0x00000000;
IO0DIR=(led1|led2|led3|led4);
int_pll();
int_timer_irq();
while(1)
{
}
} |