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 [email protected]
"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
_______________________________________________
AVR-chat mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/avr-chat