Masking interrupts?

Michael Schwingen
Mon Jul 5 11:34:00 GMT 1999

On Fri, Jul 02, 1999 at 10:11:28PM -0700, Scott Howard wrote:
> Try this:
> asm (" ori.l %1,%0" : "=m" (EZ328_IMR) : "i" (EZ328_INT_UART));

OK - I also had this problem (also on a M68k), only a bit more difficult: I
have a structure which maps to some UART hardware registers. Now, I want do
do this:

static inline void txint_off(UART *regs)
#if 0
  regs->ier &= ~TXLDL_IE; /* not atomic :-( */
  asm volatile ("bclr.b #1,1(%0)"
	       : : "a" (regs) : "cc");

The first does not procude atomic code. However, the asm is not very
maintainable, too: I would like to specify "&regs->ier" somehow so that I do
not have to hardcode the offset for the address register in the asm code,
but I could not get this to work - all constraints produced some kind of
invalid asm code, because the '1' may *not* be prefixed by a '#'.

Any idea?

Best would be to somehow make gcc produce atomic code in the first place,
but a working asm without hardcoded offsets would be fine, too.

Michael Schwingen, Ahornstrasse 36, 52074 Aachen
New CrossGCC FAQ:
To remove yourself from the crossgcc list, send
mail to with the
text 'unsubscribe' (without the quotes) in the
body of the message.

More information about the crossgcc mailing list