[En-Nut-Discussion] Unified GPIO implementation

Thiago A. Corrêa thiago.correa at gmail.com
Wed Oct 6 21:06:39 CEST 2010


On Wed, Oct 6, 2010 at 3:46 PM, Ulrich Prinz <uprinz2 at netscape.net> wrote:
>>> There is also one area that is not covered in the document. The
>>> AVR32 toolchain defines which references the GPIO set their values as
>>> pin numbers, not ports/pins. So, some sort of conversion macro is
>>> needed, to use that convention with the port/pin convention in Nut/OS.
>>
>> I think Michael Fischer already implemented such a macro. In general it
>> is not a bad idea to use pin numbers only. It would save one parameter
>> in the function call.
>>
> I don't know about AVR32 but with ARM/Cortex it would produce overhead
> as you have to recalculate from pin number back to address of port.
> That produces much more overhead than to pass over a second parameter.

In the case of AVR32, a macro that converts pin to port/pin parameters
will get calculated in compile-time.

> I would like to remind that we have two entry ways into Nut/OS:
> 1) High portability
> 2) High optimization
>
> 1) Is for people that like to start fast into the controller world and
> use our example code. People that try to understand.
> It is for people who like to contribute in general and like to write
> drivers apart from the architecture ( that what goes into nut/dev).
>
> 2) Is for power users that optimize to the last bit. Code often needs
> high efficiency tweaks that no one else needs to understand if the
> product is into production. And it is for us low-level driver
> programmers that don't accept an LCD that get 100 pixel per second if
> using gpio functions instead of 5Mega-pixel/s if using optimized GPIO
> with SPI and DMA.

It should be possible to write optimized platform independent drivers
using the proposed GPIO macros and if we agree on some function
signatures for DMA and SPI, as the SPI bus, TWI bus, etc.
One thing that has always bothered me is that features are sometimes
only available in just one platform, but they could be available in
all platforms.

> I will add my proposals now for GPIO into the Wiki and now with respect
> for AVR32.
>

I'm available at the IRC if you would like to chat. Freenode #ethernut
It's still 16:00hs in Brazil, so I should be there for a while :)



More information about the En-Nut-Discussion mailing list