Hi Rich,
Thanks for your help, but I have tried the same program on Timer 2,
3 and 64Hz interrupt. But none of them is working. the only error it
shows is the typecasting error for the following line.
*VIC1VectAddr0 = (unsigned int *)Timer;
will this help you to help me?
--- In "Rich Wilson" <> wrote:
>
> 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<http://f1.grp.yahoofs.com/v1/sDFcSaojrTkP3_CPSeWd4SkOPBLp
RvUc91RWI8GYHJx9oZGPR5HSr51zb4ktfSfaPoqBpw_sp_2mxekxqMZA0KMXvZJwQw/Ex
ample%20Code/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
>
------------------------------------
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/
|