mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] Add some help using the gpio commands at runtime
@ 2010-10-22  8:58 Juergen Beisert
  2010-10-22 12:58 ` Marc Reilly
  0 siblings, 1 reply; 5+ messages in thread
From: Juergen Beisert @ 2010-10-22  8:58 UTC (permalink / raw)
  To: barebox

From: Juergen Beisert <jbe@pengutronix.de>
Subject: [PATCH] Add some help using the gpio commands at runtime

Last time I used the gpio commands I was somehow confused about the behaviour
of the 'gpio_get_value' command. So, I decided to add some doc for it. Here's
the result.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>

---
 Documentation/commands.dox |    1 
 commands/gpio.c            |   61 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)

Index: barebox-2010.10.0/Documentation/commands.dox
===================================================================
--- barebox-2010.10.0.orig/Documentation/commands.dox
+++ barebox-2010.10.0/Documentation/commands.dox
@@ -10,6 +10,7 @@
 @li @subpage edit_command
 @li @subpage erase_command
 @li @subpage export_command
+@li @subpage gpio_for_users
 @li @subpage tftp_command
 @li @subpage loadenv_command
 @li @subpage mount_command
Index: barebox-2010.10.0/commands/gpio.c
===================================================================
--- barebox-2010.10.0.orig/commands/gpio.c
+++ barebox-2010.10.0/commands/gpio.c
@@ -120,3 +120,64 @@ BAREBOX_CMD_START(gpio_direction_output)
 	BAREBOX_CMD_HELP(cmd_gpio_direction_output_help)
 BAREBOX_CMD_END
 
+/**
+@page gpio_for_users Runtime GPIO handling
+
+@section regular_gpio General usage information
+
+These commands are available if the symbol @b CONFIG_GENERIC_GPIO and
+@b CONFIG_CMD_GPIO are enabled in the Kconfig.
+
+@note All gpio related commands take a number to identify the pad. This
+number is architecture dependend. There may be no intuitional correlation
+between available pads and the GPIO numbers to be used in the commands. Due
+to this its also possible the numbers change between @b barebox releases.
+
+@section gpio_dir_out Switch a pad into an output GPIO
+@verbatim
+gpio_direction_output <gpio_no> <initial_value>
+@endverbatim
+- @b gpio_no Architecture dependend GPIO number
+- @b initial_value Output value the pad should emit
+
+@note To avoid glitches on the pad's line, the routines will first setting up
+the pad's value and after that switching the pad itself to output (if the
+silicon is able to do so)
+
+@note If the pad is already configured into a non GPIO mode (if available)
+this command may fail (silently)
+
+@section gpio_dir_in Switch a pad into an input GPIO
+@verbatim
+gpio_direction_input <gpio_no>
+@endverbatim
+- @b gpio_no Architecture dependend GPIO number
+
+@note If the pad is already configured into a non GPIO mode (if available)
+this command may fail (silently)
+
+@section gpio_get_value Read in the value of an GPIO input pad
+@verbatim
+gpio_get_value <gpio_no>
+@endverbatim
+
+Reads in the current pad's line value from the given GPIO number. It returns
+the value as a shell return code. There is no visible output at stdout. You
+can check the return value by using "echo $?"
+
+@note If the return code is not '0' or '1' it's meant as an error code.
+
+@note If the pad is not configured for GPIO mode this command may fail
+(silently) and returns garbage
+
+@section gpio_set_value Set a new value to a GPIO output pad
+@verbatim
+gpio_set_value <gpio_no> <value>
+@endverbatim
+- @b gpio_no Architecture dependend GPIO number
+- @b value Output value the pad should emit
+
+Sets a new output @b value to the pad with GPIO number @b gpio_no
+
+@note If the pad is not configured for GPIO mode this command may fail (silently)
+*/

-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] Add some help using the gpio commands at runtime
  2010-10-22  8:58 [PATCH] Add some help using the gpio commands at runtime Juergen Beisert
@ 2010-10-22 12:58 ` Marc Reilly
  2010-10-22 13:18   ` Juergen Beisert
  2010-10-22 13:24   ` [PATCH v2] " Juergen Beisert
  0 siblings, 2 replies; 5+ messages in thread
From: Marc Reilly @ 2010-10-22 12:58 UTC (permalink / raw)
  To: 'Juergen Beisert', barebox

Hi,

This is a great step for documentation, and a few things I didn't know. 
Thanks for the effort!

Just FYI, some really minor corrections below. (Sorry for being pedantic..
I'm OK if they are ignored :) )

Cheers
Marc

> -----Original Message-----
> From: barebox-bounces@lists.infradead.org [mailto:barebox-
> bounces@lists.infradead.org] On Behalf Of Juergen Beisert
> Sent: Friday, 22 October 2010 7:58 PM
> To: barebox@lists.infradead.org
> Subject: [PATCH] Add some help using the gpio commands at runtime
> 
> From: Juergen Beisert <jbe@pengutronix.de>
> Subject: [PATCH] Add some help using the gpio commands at runtime
> 
> Last time I used the gpio commands I was somehow confused about the
> behaviour of the 'gpio_get_value' command. So, I decided to add some doc
> for it. Here's the result.
> 
> Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
> 
> ---
>  Documentation/commands.dox |    1
>  commands/gpio.c            |   61
> +++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 62 insertions(+)
> 
> Index: barebox-2010.10.0/Documentation/commands.dox
> ==========================================================
> =========
> --- barebox-2010.10.0.orig/Documentation/commands.dox
> +++ barebox-2010.10.0/Documentation/commands.dox
> @@ -10,6 +10,7 @@
>  @li @subpage edit_command
>  @li @subpage erase_command
>  @li @subpage export_command
> +@li @subpage gpio_for_users
>  @li @subpage tftp_command
>  @li @subpage loadenv_command
>  @li @subpage mount_command
> Index: barebox-2010.10.0/commands/gpio.c
> ==========================================================
> =========
> --- barebox-2010.10.0.orig/commands/gpio.c
> +++ barebox-2010.10.0/commands/gpio.c
> @@ -120,3 +120,64 @@ BAREBOX_CMD_START(gpio_direction_output)
>  	BAREBOX_CMD_HELP(cmd_gpio_direction_output_help)
>  BAREBOX_CMD_END
> 
> +/**
> +@page gpio_for_users Runtime GPIO handling
> +
> +@section regular_gpio General usage information
> +
> +These commands are available if the symbol @b CONFIG_GENERIC_GPIO
> and
> +@b CONFIG_CMD_GPIO are enabled in the Kconfig.
> +
> +@note All gpio related commands take a number to identify the pad. This
> +number is architecture dependend. There may be no intuitional

s/dependend/dependent

> +correlation between available pads and the GPIO numbers to be used in
> +the commands. Due to this its also possible the numbers change between

s/its/it's

> @b barebox releases.
> +
> +@section gpio_dir_out Switch a pad into an output GPIO @verbatim
> +gpio_direction_output <gpio_no> <initial_value> @endverbatim
> +- @b gpio_no Architecture dependend GPIO number
> +- @b initial_value Output value the pad should emit
> +
> +@note To avoid glitches on the pad's line, the routines will first
> +setting up the pad's value and after that switching the pad itself to
> +output (if the silicon is able to do so)
> +
> +@note If the pad is already configured into a non GPIO mode (if
> +available) this command may fail (silently)
> +
> +@section gpio_dir_in Switch a pad into an input GPIO @verbatim
> +gpio_direction_input <gpio_no> @endverbatim
> +- @b gpio_no Architecture dependend GPIO number
> +
> +@note If the pad is already configured into a non GPIO mode (if
> +available) this command may fail (silently)
> +
> +@section gpio_get_value Read in the value of an GPIO input pad
> +@verbatim gpio_get_value <gpio_no> @endverbatim
> +
> +Reads in the current pad's line value from the given GPIO number. It
> +returns the value as a shell return code. There is no visible output at
> +stdout. You can check the return value by using "echo $?"
> +
> +@note If the return code is not '0' or '1' it's meant as an error code.
> +
> +@note If the pad is not configured for GPIO mode this command may fail
> +(silently) and returns garbage
> +
> +@section gpio_set_value Set a new value to a GPIO output pad @verbatim
> +gpio_set_value <gpio_no> <value> @endverbatim
> +- @b gpio_no Architecture dependend GPIO number

s/dependend/dependent


> +- @b value Output value the pad should emit
> +
> +Sets a new output @b value to the pad with GPIO number @b gpio_no
> +
> +@note If the pad is not configured for GPIO mode this command may fail
> +(silently) */
> 
> --
> Pengutronix e.K.                              | Juergen Beisert
|
> Linux Solutions for Science and Industry      | Phone: +49-8766-939 228
|
> Vertretung Sued/Muenchen, Germany             | Fax:
+49-5121-206917-5555 |
> Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/
|
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Add some help using the gpio commands at runtime
  2010-10-22 12:58 ` Marc Reilly
@ 2010-10-22 13:18   ` Juergen Beisert
  2010-10-22 13:24   ` [PATCH v2] " Juergen Beisert
  1 sibling, 0 replies; 5+ messages in thread
From: Juergen Beisert @ 2010-10-22 13:18 UTC (permalink / raw)
  To: barebox, marc

Hi Marc,

Marc Reilly wrote:
> This is a great step for documentation, and a few things I didn't know.
> Thanks for the effort!
>
> Just FYI, some really minor corrections below. (Sorry for being pedantic..
> I'm OK if they are ignored :) )

Thank you for the corrections. I will re-send the patch.

jbe

-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] Add some help using the gpio commands at runtime
  2010-10-22 12:58 ` Marc Reilly
  2010-10-22 13:18   ` Juergen Beisert
@ 2010-10-22 13:24   ` Juergen Beisert
  2010-10-22 17:56     ` Sascha Hauer
  1 sibling, 1 reply; 5+ messages in thread
From: Juergen Beisert @ 2010-10-22 13:24 UTC (permalink / raw)
  To: barebox, marc

From: Juergen Beisert <jbe@pengutronix.de>
Subject: [PATCH] Add some help using the gpio commands at runtime

Last time I used the gpio commands I was somehow confused about the behaviour
of the 'gpio_get_value' command. So, I decided to add some doc for it. Here's
the result.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>

---
 Documentation/commands.dox |    1 
 commands/gpio.c            |   61 
+++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)

Index: barebox-2010.10.0/Documentation/commands.dox
===================================================================
--- barebox-2010.10.0.orig/Documentation/commands.dox
+++ barebox-2010.10.0/Documentation/commands.dox
@@ -10,6 +10,7 @@
 @li @subpage edit_command
 @li @subpage erase_command
 @li @subpage export_command
+@li @subpage gpio_for_users
 @li @subpage tftp_command
 @li @subpage loadenv_command
 @li @subpage mount_command
Index: barebox-2010.10.0/commands/gpio.c
===================================================================
--- barebox-2010.10.0.orig/commands/gpio.c
+++ barebox-2010.10.0/commands/gpio.c
@@ -120,3 +120,64 @@ BAREBOX_CMD_START(gpio_direction_output)
 	BAREBOX_CMD_HELP(cmd_gpio_direction_output_help)
 BAREBOX_CMD_END
 
+/**
+@page gpio_for_users Runtime GPIO handling
+
+@section regular_gpio General usage information
+
+These commands are available if the symbol @b CONFIG_GENERIC_GPIO and
+@b CONFIG_CMD_GPIO are enabled in the Kconfig.
+
+@note All gpio related commands take a number to identify the pad. This
+number is architecture dependent. There may be no intuitional correlation
+between available pads and the GPIO numbers to be used in the commands. Due
+to this it's also possible the numbers change between @b barebox releases.
+
+@section gpio_dir_out Switch a pad into an output GPIO
+@verbatim
+gpio_direction_output <gpio_no> <initial_value>
+@endverbatim
+- @b gpio_no Architecture dependent GPIO number
+- @b initial_value Output value the pad should emit
+
+@note To avoid glitches on the pad's line, the routines will first setting up
+the pad's value and after that switching the pad itself to output (if the
+silicon is able to do so)
+
+@note If the pad is already configured into a non GPIO mode (if available)
+this command may fail (silently)
+
+@section gpio_dir_in Switch a pad into an input GPIO
+@verbatim
+gpio_direction_input <gpio_no>
+@endverbatim
+- @b gpio_no Architecture dependent GPIO number
+
+@note If the pad is already configured into a non GPIO mode (if available)
+this command may fail (silently)
+
+@section gpio_get_value Read in the value of an GPIO input pad
+@verbatim
+gpio_get_value <gpio_no>
+@endverbatim
+
+Reads in the current pad's line value from the given GPIO number. It returns
+the value as a shell return code. There is no visible output at stdout. You
+can check the return value by using "echo $?"
+
+@note If the return code is not '0' or '1' it's meant as an error code.
+
+@note If the pad is not configured for GPIO mode this command may fail
+(silently) and returns garbage
+
+@section gpio_set_value Set a new value to a GPIO output pad
+@verbatim
+gpio_set_value <gpio_no> <value>
+@endverbatim
+- @b gpio_no Architecture dependent GPIO number
+- @b value Output value the pad should emit
+
+Sets a new output @b value to the pad with GPIO number @b gpio_no
+
+@note If the pad is not configured for GPIO mode this command may fail 
(silently)
+*/



-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] Add some help using the gpio commands at runtime
  2010-10-22 13:24   ` [PATCH v2] " Juergen Beisert
@ 2010-10-22 17:56     ` Sascha Hauer
  0 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2010-10-22 17:56 UTC (permalink / raw)
  To: Juergen Beisert; +Cc: barebox

On Fri, Oct 22, 2010 at 03:24:00PM +0200, Juergen Beisert wrote:
> From: Juergen Beisert <jbe@pengutronix.de>
> Subject: [PATCH] Add some help using the gpio commands at runtime
> 
> Last time I used the gpio commands I was somehow confused about the behaviour
> of the 'gpio_get_value' command. So, I decided to add some doc for it. Here's
> the result.
> 
> Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
> 
> ---
>  Documentation/commands.dox |    1 
>  commands/gpio.c            |   61 
> +++++++++++++++++++++++++++++++++++++++++++++

Your mailer breaks lines. (Fixed while applying)

Sascha


>  2 files changed, 62 insertions(+)
> 
> Index: barebox-2010.10.0/Documentation/commands.dox
> ===================================================================
> --- barebox-2010.10.0.orig/Documentation/commands.dox
> +++ barebox-2010.10.0/Documentation/commands.dox
> @@ -10,6 +10,7 @@
>  @li @subpage edit_command
>  @li @subpage erase_command
>  @li @subpage export_command
> +@li @subpage gpio_for_users
>  @li @subpage tftp_command
>  @li @subpage loadenv_command
>  @li @subpage mount_command
> Index: barebox-2010.10.0/commands/gpio.c
> ===================================================================
> --- barebox-2010.10.0.orig/commands/gpio.c
> +++ barebox-2010.10.0/commands/gpio.c
> @@ -120,3 +120,64 @@ BAREBOX_CMD_START(gpio_direction_output)
>  	BAREBOX_CMD_HELP(cmd_gpio_direction_output_help)
>  BAREBOX_CMD_END
>  
> +/**
> +@page gpio_for_users Runtime GPIO handling
> +
> +@section regular_gpio General usage information
> +
> +These commands are available if the symbol @b CONFIG_GENERIC_GPIO and
> +@b CONFIG_CMD_GPIO are enabled in the Kconfig.
> +
> +@note All gpio related commands take a number to identify the pad. This
> +number is architecture dependent. There may be no intuitional correlation
> +between available pads and the GPIO numbers to be used in the commands. Due
> +to this it's also possible the numbers change between @b barebox releases.
> +
> +@section gpio_dir_out Switch a pad into an output GPIO
> +@verbatim
> +gpio_direction_output <gpio_no> <initial_value>
> +@endverbatim
> +- @b gpio_no Architecture dependent GPIO number
> +- @b initial_value Output value the pad should emit
> +
> +@note To avoid glitches on the pad's line, the routines will first setting up
> +the pad's value and after that switching the pad itself to output (if the
> +silicon is able to do so)
> +
> +@note If the pad is already configured into a non GPIO mode (if available)
> +this command may fail (silently)
> +
> +@section gpio_dir_in Switch a pad into an input GPIO
> +@verbatim
> +gpio_direction_input <gpio_no>
> +@endverbatim
> +- @b gpio_no Architecture dependent GPIO number
> +
> +@note If the pad is already configured into a non GPIO mode (if available)
> +this command may fail (silently)
> +
> +@section gpio_get_value Read in the value of an GPIO input pad
> +@verbatim
> +gpio_get_value <gpio_no>
> +@endverbatim
> +
> +Reads in the current pad's line value from the given GPIO number. It returns
> +the value as a shell return code. There is no visible output at stdout. You
> +can check the return value by using "echo $?"
> +
> +@note If the return code is not '0' or '1' it's meant as an error code.
> +
> +@note If the pad is not configured for GPIO mode this command may fail
> +(silently) and returns garbage
> +
> +@section gpio_set_value Set a new value to a GPIO output pad
> +@verbatim
> +gpio_set_value <gpio_no> <value>
> +@endverbatim
> +- @b gpio_no Architecture dependent GPIO number
> +- @b value Output value the pad should emit
> +
> +Sets a new output @b value to the pad with GPIO number @b gpio_no
> +
> +@note If the pad is not configured for GPIO mode this command may fail 
> (silently)
> +*/
> 
> 
> 
> -- 
> Pengutronix e.K.                              | Juergen Beisert             |
> Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
> Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
> Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-10-22 17:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-22  8:58 [PATCH] Add some help using the gpio commands at runtime Juergen Beisert
2010-10-22 12:58 ` Marc Reilly
2010-10-22 13:18   ` Juergen Beisert
2010-10-22 13:24   ` [PATCH v2] " Juergen Beisert
2010-10-22 17:56     ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox