2004-04-22 Theodore A. Roth
[This fixes bug #8649.] * include/avr/sfr_defs.h (bit_is_set): Wrap sfr arg with _SFR_BYTE(). (bit_is_clear): Ditto. * include/avr/sfr_defs.h: Move _SFR_BYTE() and _SFR_WORD() #defines to be before first usage. Index: include/avr/sfr_defs.h =================================================================== RCS file: /cvsroot/avr-libc/avr-libc/include/avr/sfr_defs.h,v retrieving revision 1.11 diff -u -p -p -r1.11 sfr_defs.h --- include/avr/sfr_defs.h 9 Oct 2003 04:27:29 -0000 1.11 +++ include/avr/sfr_defs.h 22 Apr 2004 16:18:03 -0000 @@ -167,6 +167,9 @@ #endif /* !_SFR_ASM_COMPAT */ +#define _SFR_BYTE(sfr) _MMIO_BYTE(_SFR_ADDR(sfr)) +#define _SFR_WORD(sfr) _MMIO_WORD(_SFR_ADDR(sfr)) + /** \name Bit manipulation */ /address@hidden/ @@ -207,7 +210,7 @@ This will return a 0 if the bit is clear, and non-zero if the bit is set. */ -#define bit_is_set(sfr, bit) (sfr & _BV(bit)) +#define bit_is_set(sfr, bit) (_SFR_BYTE(sfr) & _BV(bit)) /** \def bit_is_clear \ingroup avr_sfr @@ -218,7 +221,7 @@ This will return non-zero if the bit is clear, and a 0 if the bit is set. */ -#define bit_is_clear(sfr, bit) (!(sfr & _BV(bit))) +#define bit_is_clear(sfr, bit) (!(_SFR_BYTE(sfr) & _BV(bit))) /** \def loop_until_bit_is_set \ingroup avr_sfr @@ -298,10 +301,6 @@ #define outb(sfr, val) (_SFR_BYTE(sfr) = (val)) - - -#define _SFR_BYTE(sfr) _MMIO_BYTE(_SFR_ADDR(sfr)) -#define _SFR_WORD(sfr) _MMIO_WORD(_SFR_ADDR(sfr)) /* The outb/outw macros now have the correct order of arguments. */