avr-libc-dev
[Top][All Lists]
Advanced

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

Re: [avr-libc-dev] XMEGA


From: Erik Walthinsen
Subject: Re: [avr-libc-dev] XMEGA
Date: Mon, 07 Jun 2010 15:17:10 -0700
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]