A89: Re: Disabling Interrupts


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

A89: Re: Disabling Interrupts




Hi!

> I just started working with TI-GCC today, and I am running into some
> difficulties. What I am trying to do is to disable Auto-Int1 so that
> I can read from the keyboard matrix accurately. Since I am completely
> new to TI-GCC, I decided that I would try this using inline asm. The
> problem is that I am getting these address errors and illegal 
> instruction errors. I remember something from a few days ago about
> how rte does not work properly, but I could not make heads or tails
> of what it was.

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





Follow-Ups: