[En-Nut-Discussion] Low level port access with porttran.h

Andre Riesberg andre at riesberg-net.de
Mon Sep 7 12:12:08 CEST 2009


Harald Kipp wrote:

>Hi Andre,
>
>Andre Riesberg wrote:
>
>  
>
>>I am writing a 1-wire interface. This interface has a strict timing so I 
>>use the macros from "porttran.h".
>>    
>>
>
>This is exactly the reason why we have slow, but convenient GpioXXX
>functions and weird, but fast GPIO_XXX macros.
>
>
>  
>
>>I use an AT90CAN128 and I think "inb" ist the typical macro (for an AVR) 
>>to read one byte from a port. "inr" is for the ARM cpu's.
>>    
>>
>
>There should have been an inr() (r stands for register) for the AVR as
>well, which is exactly the same as inb() on this platform.
>
>Thanks for reporting this.
>
>Harald
>_______________________________________________
>http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>
>
>  
>
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...


Greetings
André



More information about the En-Nut-Discussion mailing list