[En-Nut-Discussion] Low level port access with porttran.h
Ulrich Prinz
uprinz2 at netscape.net
Mon Sep 7 15:29:21 CEST 2009
On Mon, 07 Sep 2009 12:12:08 +0200, Andre Riesberg <andre at riesberg-net.de>
wrote:
> Hi Harald,
>
> I have just finished my 1-Wire interface for the AVR's. But this
> interface works only with a (quick) fix in the "porttran.h" file.:
>
> Line 404:
>
> #if defined(GPIO_PDS_REG)
> //#define GPIO_GET(b) ((inr(GPIO_PDS_REG) & _BV(b)) == _BV(b))
> #define GPIO_GET(b) ((inb(GPIO_PDS_REG) & _BV(b)) == _BV(b))
> #else
> #define GPIO_GET(b)
> #endif
>
> This works fine, but I think this is not the solution you prefer! In the
> moment I am not sure in with file I have to add the "inb" function for
> AVR's.
> Can anybody make this modification or help me to make this modification?
> Then I be able to post my 1-Write interface...
>
Hmm...
In include/arch/avr.h there is no definition for inr. inr is only defined
for ARM and AVR32.
So normally there must have been a compiler error if using GPIO_GET(b) with
the original code. With Andres code it should work.
May no one stumbled accross that one as no one used a recent compiler where
the libc is updated?
Harald, I like this patch and if Andre verified it to work...
Optionally inr and outr should be mapped to inb and outb for 8-bit
architecture, what may be more elegant for the arch-independance.
Best regards,
Ulrich
More information about the En-Nut-Discussion
mailing list