From: Wolfgang Denk Date: Mon, 20 Jul 2009 17:12:22 +0200 Subject: [U-Boot] [PATCH 0/2] arm nomadik: gpio and i2c In-Reply-To: <4A6422FC.6030508@invitel.hu> References: <20090719171353.5A910832E416@gemini.denx.de> <4A6422FC.6030508@invitel.hu> Message-ID: <20090720151222.73E47832E416@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Heiko Schocher, In message <4A6422FC.6030508@invitel.hu> you wrote: > > typedef struct gpio_adapter { > int (*init_pin)(int pin); > int (*set)(int pin, value); > int (*get)(int pin); > int (*dir)(int pin, int direction); > int (*level)(int pin, int level); > } > > int gpio_init(gpio_adapter *adap); > int gpio_init_pin(pin); > ? maybe with setting a marker, that this pin is initialized, > so this can be checked in the above functions ... ? > int gpio_set(pin, value); > int gpio_get(pin); > int gpio_dir(pin, dir); > int gpio_level(pin, dir); What does "level" mean in this context? gpio_init_pin() and gpio_dir() seem to be redundant - or does pin initialization not include the setting of the direction (and, in case of an output pin, it's initial state) ? gpio_get() returns the current state of the pin? gpio_set() returns the previous state of the pin? Or the new state? If it returns the new state, we could use value=1 to set a pin, value=0 to unset a pin, and value=-1 to just read it's value without changing it; then we could "#define gpio_get(pin) gpio_set(pin,-1)". Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de The speed of time is one second per second.