[En-Nut-Discussion] Nut/OS GPIO API Initial Design and Current Status

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Tue Oct 16 11:55:52 CEST 2012


>>>>> "Ole" == Ole Reinhardt <ole.reinhardt at embedded-it.de> writes:

Yes, extensability is always a good thing, but often it collides with your
request for simplicity.

    Ole> Ok, let's add some device to the io-expander, e.g. an led. Ideally
    Ole> this would be done by the following pseudo pseudo code:

    Ole> register_device(twi_port);

    Ole> twi_register_device(twi_port, ioexpander);

    Ole> ioexpander_port_nr= gpio_api_add_device(ioexpander, 16bit)


    Ole> struct led_platform_data led_pdata;

    Ole> led_pdata = { port : ioexpander_port_nr; pin : 10; }

    Ole> platform_register_device(dev_led, led_pdata);

    Ole> I don't know if my idea is clear. In doubt, just ask.

Doesn't dev/pca9555.c halfway do what you propose. But at the moment I am
so fed up on the GPIO discussion that I don't want to continue another thread...

    Ole> bitbanging driver. Bitbanging drivers should try to use only common
    Ole> API functions.
    >>  Huch: So you consider the code in
    >> e.g. arch/cm3/dev/nxp/lpc177x_8x_mci.c: // Force all MCI control pins
    >> to basic I/O mode GpioPinConfigSet(NUTGPIO_PORT0, 19,
    >> GPIO_CFG_OUTPUT); // SD_CLK GpioPinConfigSet(NUTGPIO_PORT0, 20,
    >> GPIO_CFG_OUTPUT); // SD_CMD GpioPinConfigSet(NUTGPIO_PORT1, 5,
    >> GPIO_CFG_OUTPUT); // SD_PWR

    Ole> Yes, i just removed this in r4755 (commented out).

    Ole> I will remove the comments there in the next step as soon as we
    Ole> agreed on a common way of configuration.

Probably this "way of configuration" was the reason that caused Harald to
propose the removal of GPIO. Now we discussed GPIO quite long, but we
haven't looked at the configuration yet. What a waste of electrons and time...

    >> not good?

    Ole> The main problem with configuring the pins in the driver is it's
    Ole> inflexebility when the peripheral can be mapped to different I/O
    Ole> pins.

Did you have a look at the STM32 drivers? STM32 can place drivers at several
location, and on parts other then  F1, this reloaction can be done
independant on every pin. Without configuration we place the pins on their
default location, but the configurator or the board.h file can change it.

Bye
-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------



More information about the En-Nut-Discussion mailing list