avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] Newbie - should this work?


From: Christian Vogel
Subject: Re: [avr-gcc-list] Newbie - should this work?
Date: Mon, 20 Jan 2003 11:48:53 +0100
User-agent: Mutt/1.4i

Hi,

> old), the PORTD is define to 0x12 (example of a 8515).

No, PORTD is defined as... (I have a rpm of avr-libc-20021111cvs-1)

io8515.h:78
  #define PORTD   _SFR_IO8(0x12)

sfr_defs.h:157 (0x20 is the offset of the IO registers in memory space!)
  #define _SFR_IO8(io_addr) _MMIO_BYTE((io_addr) + 0x20)

sfr_defs.h:122
  #define _MMIO_BYTE(mem_addr) (*(volatile unsigned char *)(mem_addr))

So of you code PORTD=0x00 this translates roughly to:

  *((char*)(0x12+0x20)) = 0x00;

gcc will realise that there is an io-register at address 0x12+0x20 and
in turn will optimize it into "out 0x12,r1".

sfr_defs.h actually defined outb(rev,val) as _SFR_BYTE(sfr)=(val) :-)

        Chris

-- 
If Bill Gates had a nickel for every time Windows crashed... Oh wait, he does!
 -- A signature spotted on Slashdot (www.i-want-a-website.com/about-linux)
avr-gcc-list at http://avr1.org



reply via email to

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