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

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

[avr-gcc-list] Winavr / gcc include files


From: Steve @ Franks Development, LLC
Subject: [avr-gcc-list] Winavr / gcc include files
Date: Wed, 21 Jul 2004 10:10:25 -0700

Hello,

We have been working with gccavr now for a few months, and we have a couple
of questions about the default WinAVR include files for general digestion:

1) All the commercial compilers have a "byte.bit" notation for working with
bits.  A lot of source code out there uses this notation as well.  If you
look at the "Vic's byte" struct in our sfr_defs.h file, you will find an
incomplete example of how to do this.  Is this a good thing to include in
the general distribution?  It also makes for more readable code in our
opinions...thoughts?  Also, how would we go about officially proposing this
as an addition to the distribution?  (I have placed our sfr_defs code at the
end of this message, in case the list doesn't allow includes)

2) The includes for various parts tend to conflict a bit (i.e. TCCR on
Mega32, TCCR0 on Mega128), making code somewhat non-portable between
machines.  Is there a reason for this, or just a lack of someone willing to
step forward and bring the older parts in line with the newer ones? As they
say, "he who complains about the cooking"...


Best,
Steve


Steve Franks
Staff Engineer & General Manager
Franks Development, LLC
(520) 312-0089 voice
(360) 368-8006 fax
http://www.franks-development.com 




union vicsbyte
{
        unsigned char all;
        struct {
                unsigned char zero:1;
                unsigned char one:1;
                unsigned char two:1;
                unsigned char three:1;
                unsigned char four:1;
                unsigned char five:1;
                unsigned char six:1;
                unsigned char seven:1;
        }
#ifndef  __cplusplus
        bits;
#else
        ;
        void operator =(unsigned char const& x)volatile
        {all = x;}
        void operator |=(unsigned char const& x)volatile
        {all |= x;}
        void operator &=(unsigned char const& x)volatile
        {all &= x;}
        operator unsigned char()volatile
        {return all;}
#endif
};


#ifndef __ASSEMBLER__
/* These only work in C programs.  */
#define _MMIO_BYTE(mem_addr) (*(volatile union vicsbyte*)(mem_addr))
//#define _MMIO_BYTE(mem_addr) (*(volatile unsigned char*)(mem_addr))
#define _MMIO_WORD(mem_addr) (*(volatile unsigned int *)(mem_addr))
#endif

reply via email to

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