Dear All,
I am using TS-TPC-7390 SBC with the Ecllipse IDE.
Can anyone tell me how to use the timer interrupt with Ecllipse IDE.
I am posting what ever code i have written, but my code hangs
whenever the interrupt occurs.
void Timer(void) __attribute__ ((interrupt("IRQ")));
void main(void)
{
unsigned char *start;
int fd = open("/dev/mem", O_RDWR|O_SYNC);
start = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED,
fd, 0x80840000);
PEDR = (unsigned int *)(start + 0x20); // port e data
PEDDR = (unsigned int *)(start + 0x24); // port e dir reg
start = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED,
fd, 0x80810000);
T1LOAD = (unsigned int *)(start + 0x00);
T1VAL = (unsigned int *)(start + 0x04);
T1CTRL = (unsigned int *)(start + 0x08);
TC1EOI = (unsigned int *)(start + 0x0C);
start = mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED,
fd, 0x800B0000);
VIC1IntEnClear = (unsigned int *)(start + 0x14);
VIC1IntEnable = (unsigned int *)(start + 0x10);
VIC1VectAddr0 = (unsigned int *)(start + 0x100);
VIC1VectCntl0 = (unsigned int *)(start + 0x200);
*PEDDR = 0xff;
*PEDR = 0x00;
*T1LOAD = 0x07D0;
*T1CTRL = 0x0C;
*VIC1IntEnClear = 0x07F7FFFF;
*VIC1VectAddr0 = (unsigned int *)Timer;
*VIC1VectCntl0 = 0x20 | 4;
*VIC1IntEnable = 0x10;
.
.
close(fd);
}
void Timer(void)
{
*TC1EOI = 0x04;
*PEDR = 0xff;
sleep(2);
*PEDR = 0x00;
}
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|