ts-7000
[Top] [All Lists]

Re: [ts-7000] How to use the timer interrupt???????

To:
Subject: Re: [ts-7000] How to use the timer interrupt???????
From: "Rich Wilson" <>
Date: Wed, 31 Dec 2008 22:49:42 -0800
I suspect that when you're running linux, you can't expect to service a hardware interrupt in user space.
Someone please correct me if I'm wrong.
Also, if I'm not mistaken, timer 1 is used by the kernel, and if you fiddle with
it, you can expect no good to come of it.

I'm currently working on an interrupt-driven project, and I'm using the code from
the file gps_pps.tgz  from the files/example code area of the group as a template.
This shows how to write a kernel module which handles interrupts.

Rich

On Mon, Dec 29, 2008 at 1:25 AM, anadigpune <> wrote:

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;
}




--
Rich Wilson

__._,_.___

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: =Email Delivery: Digest | m("yahoogroups.com?subject","ts-7000-fullfeatured");=Change Delivery Format: Fully Featured">Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | =Unsubscribe

__,_._,___
<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU