Re: A89: Re: Disabling Interrupts


[Prev][Next][Index][Thread]

Re: A89: Re: Disabling Interrupts




I am gonna redo that code since scott noveck informed me that you have
to preserve certain registers...

void myHandler(void)
{
   asm("movem.l %d0-%d2/%a0-%a1,-(%sp)");

   // Your code

   asm("movem.l (%sp)+,%d0-%d2/%a0-%a1; unlk %a6; rte");
}

Scott Dial wrote:
> 
> hmm... I apologize if this ends up here twice, but it didn't seem to
> show up on the list...
> 
> That is not entirely true that you'd have to make a "wrapper" for the
> interrupt. Check this:
> 
> void myHandler(void)
> {
>    // Your code
>    asm("unlk %a6; rte");
> }
> 
> Zeljko Juric wrote:
> > Such handler is incorrect
> >
> > void myHandler(void)
> > {
> >   // Your code
> >   asm("rte");
> > }
> >
> > because "rte" will not be happy with the content of the stack frame
> > which is created on the beginning of each function. So, the interrupt
> > handler must be a pure assembly procedure (which may call any other
> > C procedure). I suggest the following handler:
> >
> > void myHandler(void);
> > asm("myHandler:
> > movem.l %a0-%a6/%d0-%d7,-(%sp)
> > bsr myHandler_main
> > movem.l (%sp)+,%a0-%a6/%d0-%d7
> > rte");
> >
> > void myHandler_main(void)
> > {
> >   // Your code (in C)
> > }
> >
> > I hope that it helps.
> >
> > Cheers,
> >
> > Zeljko Juric
> 
> --
> Scott "Wrath" Dial
> wrath@calc.org
> ICQ#3608935
> Member of TCPA - tcpa.calc.org
> PGP key available
> 
> ____________NetZero Free Internet Access and Email_________
> Download Now     http://www.netzero.net/download/index.html
> Request a CDROM  1-800-333-3633
> ___________________________________________________________

-- 
Scott "Wrath" Dial
wrath@calc.org
ICQ#3608935
Member of TCPA - tcpa.calc.org
PGP key available

_____NetZero Free Internet Access and Email______
   http://www.netzero.net/download/index.html



References: