On 06/07/2010 01:41 PM, Rob Holbert wrote:
However, there is a major difference. The fully qualified (PORTC_OUTSET)
has volatile tied to it and
the (PORTC.OUTSET) does not.
Not so sure this is the case. In the headers I have:
#define _MMIO_BYTE(mem_addr) (*(volatile uint8_t *)(mem_addr))
#define _SFR_MEM8(mem_addr) _MMIO_BYTE(mem_addr)
#define PORTC_OUT _SFR_MEM8(0x0644)
yet
typedef volatile uint8_t register8_t;
typedef struct PORT_struct {
. . .
register8_t OUT; /* I/O Port Output */
. . .
} PORT_t;
#define PORTC (*(PORT_t *) 0x0640) /* Port C */
I don't see any functional difference in the use of the volatile
keyword, unless the struct is doing something unexpected.
However, I do remember at one point having problems along these lines,
and actually putting in the _ versions of some registers. I've since
taken them out though, and I don't remember the details.
OTOH, I've recently done test code where I do PORT*.OUT = x;PORT*.OUT =
y in a loop, and I scoped the expected results.
_______________________________________________
AVR-libc-dev mailing list
AVR-libc-dev@nongnu.org
http://lists.nongnu.org/mailman/listinfo/avr-libc-dev