avr-chat
[Top][All Lists]
Advanced

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

Re: [avr-chat] question about _SFR_IO8() and friends


From: Michael Hennebry
Subject: Re: [avr-chat] question about _SFR_IO8() and friends
Date: Sun, 21 Sep 2014 12:26:54 -0500 (CDT)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

On Fri, 19 Sep 2014, Joerg Wunsch wrote:

What you need is basically explained in the FAQ:

http://www.nongnu.org/avr-libc/user-manual/FAQ.html#faq_port_pass

const volatile uint8_t *dir_reg = &DDRD;

If you can manage to declare it "const", there are chances
the compiler can really generate optimal code (using IN/OUT,
rather than memory access instructions) when your macro uses
it.

The pointer is what needs to be const:
volatile uint8_t * const dir_reg = &DDRD;

That said, why not
#define reg (DDRD)
or
#define dir_reg (&(DDRD()
?


--
Michael   address@hidden
"SCSI is NOT magic. There are *fundamental technical
reasons* why it is necessary to sacrifice a young
goat to your SCSI chain now and then."   --   John Woods



reply via email to

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