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

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

Re: [avr-libc-dev] Why include <ina90.h> from <avr/pgmspace.h>?


From: E. Weddington
Subject: Re: [avr-libc-dev] Why include <ina90.h> from <avr/pgmspace.h>?
Date: Mon, 07 Oct 2002 14:33:57 -0600

On 7 Oct 2002 at 22:14, Joerg Wunsch wrote:

> As E. Weddington wrote:
> 
> > On 6 Oct 2002 at 23:54, Joerg Wunsch wrote:
> > 
> > I only have one nit, having to do with underscores. I've seen where
> > other people have used _LPM(). With these changes, it will be
> > __LPM(), but you include the definition with 1 underscore in
> > ina90.h. 
> 
> Well, then those people are actually using INA90 compatibility, IMHO.
> 
> I vaguely remember that names with one leading underscore are
> something special and should not normally be used/exported.  Well,
> it's even possible they are in the application's domain, i. e. it is
> valid for application code to define their own _LPM object.
> 

Like the BV() / _BV() controversy? :-)

> > I don't necessarily think that the "1 underscore definition" would
> > be used exclusively with compatibility code, i.e. other people have
> > used _LPM() because of reasons not having to do with IAR
> > compatibility.
> 
> They should use __lpm_inline() then, or maybe PRG_RDB().
> 

Whoops. My bad. I forgot about PRG_RDB(). You're right, people should 
use PRG_RDB().

But while these changes are being made, shouldn't PRG_RDB() be 
updated to use the correct algorithm according to the MCU type?:

#ifdef RAMPZ
    #define PRG_RDB(addr)    __ELPM((unsigned long)(addr))
#else
    #define PRG_RDB(addr)    __LPM((unsigned long)(addr))
#endif


Of course, I'd prefer if it had a more readable API in lowercase like 
flash_read_byte() rather than PRG_RDB() :-)

Eric







reply via email to

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