public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 0/2] arm nomadik: gpio and i2c
Date: Tue, 21 Jul 2009 08:11:49 +0200	[thread overview]
Message-ID: <4A655C25.8080507@denx.de> (raw)
In-Reply-To: <20090720151222.73E47832E416@gemini.denx.de>

Hello Wolfgang,

Wolfgang Denk wrote:
> 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?

Yesterday, when I emailed with Alessandro, it looked like, if we
call gpio_set(), we also set the direction to output, so I thought,
it would be nice to have a function which really just sets the value.

Now, I think, we should set the direction only with gpio_dir()
(if output also set the value).

And with gpio_set() we only set the output value, without switching
the direction ...

Or should we do allways a set direction, when calling gpio_set() ...?

> 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) ?

Yes, you are right, also redundant.

> gpio_get() returns the current state of the pin?

Yep.

> 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)".

Yes, thats a good point.

bye
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

  reply	other threads:[~2009-07-21  6:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-19 11:01 [U-Boot] [PATCH 0/2] arm nomadik: gpio and i2c Alessandro Rubini
2009-07-19 17:13 ` Wolfgang Denk
2009-07-20  7:55   ` Heiko Schocher
2009-07-20  8:09     ` Alessandro Rubini
2009-07-20  9:23       ` Heiko Schocher
2009-07-20  9:31         ` Alessandro Rubini
2009-07-20  9:48           ` Heiko Schocher
2009-07-20 15:14         ` Wolfgang Denk
2009-07-21  6:31           ` Heiko Schocher
2009-07-20 15:12     ` Wolfgang Denk
2009-07-21  6:11       ` Heiko Schocher [this message]
2009-07-21  7:19         ` Wolfgang Denk
2009-07-20  7:40 ` Heiko Schocher
2009-07-28  7:16   ` Daniel Gorsulowski
2009-07-28  9:39     ` Jean-Christophe PLAGNIOL-VILLARD
2009-07-28 10:25     ` Heiko Schocher
2009-07-28 10:55       ` Wolfgang Denk
2009-07-28 13:02         ` Heiko Schocher
2009-07-28 13:22           ` Wolfgang Denk
2009-07-28 13:49             ` Heiko Schocher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A655C25.8080507@denx.de \
    --to=hs@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox