[En-Nut-Discussion] Porting means breaking the rules?

Thiago A. Corrêa thiago.correa at gmail.com
Thu Sep 2 19:50:54 CEST 2010


Hi,

On Thu, Sep 2, 2010 at 8:12 AM, Harald Kipp <harald.kipp at egnite.de> wrote:
>
> This makes sense to me. In any case, if anyone is using an exotic board
> layout, he can always modify existing driver code.
>
>
>> There is a lot of troubles with the GPIO control interface.
>
> I feel guilty. Also Michael Fischer lately criticized this while trying
> to get the AVR32 boards running. As far as I understood, he made a few
> changes on the AVR32 code to make it more unified. But I haven't found
> the time to study his code in more detail. :-(

Could you or Michael commit the changes to a branch? I'm interested in
taking a look at it.
He said that he had to keep a 3rd GPIO API to interface with the
Software Framework. Personally I don't see much value in the SF, as
it's mostly simple wrapping around registers, with except from the
USART and Network, both of which are much better implemented in Nut/OS
than in the SF.


> He also suggested to sequentially number all port bits. Let's say, port
> 33 will be PE1 on the AVR8 and PB1 on the ARM. After thinking about this
> in more detail, I don't like it. It may confuse people even more and may
> not fit to all platforms. I still recommend to divide port access into
> banks and pins. This is more flexible.
>

Actually, this is how the AVR32 platform handles the pins, they are
sequential. To make it fit better with the Nut/OS arch I made macros
that divide the number into port and pin.


>> There are defines that address the physical base address of a port. Then
>> there are defines that address a logical port number.
>
> As admitted, I did a first hack, refined it later and got confused
> myself again after some more refinements. I'm not proud of this design.
>
> Btw. although not as weird as with Nut/OS, the history of Linux GPIO
> isn't that streamlined either. ;-)
>

I think the Gpio* functions aren't so bad. They are not too different
from the linux API AFAIK.
But the macros could perhaps be imprved. They are a bit hard to understand.


Kind Regards,
     Thiago A. Correa



More information about the En-Nut-Discussion mailing list