Fri Sep 25 20:27:50 2009 UTC ()
Rename 'pulse' to 'pulsate' to make clear it is a continuous strain of
pulses and and not a single shot pulse that is emitted by devices
supporting this kind of operation.


(mbalmer)
diff -r1.6 -r1.7 src/sys/sys/gpio.h
diff -r1.6 -r1.7 src/usr.sbin/gpioctl/gpioctl.8
diff -r1.7 -r1.8 src/usr.sbin/gpioctl/gpioctl.c

cvs diff -r1.6 -r1.7 src/sys/sys/gpio.h (expand / switch to unified diff)

--- src/sys/sys/gpio.h 2009/09/25 19:37:03 1.6
+++ src/sys/sys/gpio.h 2009/09/25 20:27:50 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: gpio.h,v 1.6 2009/09/25 19:37:03 mbalmer Exp $ */ 1/* $NetBSD: gpio.h,v 1.7 2009/09/25 20:27:50 mbalmer Exp $ */
2/* $OpenBSD: gpio.h,v 1.7 2008/11/26 14:51:20 mbalmer Exp $ */ 2/* $OpenBSD: gpio.h,v 1.7 2008/11/26 14:51:20 mbalmer Exp $ */
3/* 3/*
4 * Copyright (c) 2009 Marc Balmer <marc@msys.ch> 4 * Copyright (c) 2009 Marc Balmer <marc@msys.ch>
5 * Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org> 5 * Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
6 * 6 *
7 * Permission to use, copy, modify, and distribute this software for any 7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above 8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies. 9 * copyright notice and this permission notice appear in all copies.
10 * 10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
@@ -29,27 +29,27 @@ @@ -29,27 +29,27 @@
29 29
30/* GPIO pin configuration flags */ 30/* GPIO pin configuration flags */
31#define GPIO_PIN_INPUT 0x0001 /* input direction */ 31#define GPIO_PIN_INPUT 0x0001 /* input direction */
32#define GPIO_PIN_OUTPUT 0x0002 /* output direction */ 32#define GPIO_PIN_OUTPUT 0x0002 /* output direction */
33#define GPIO_PIN_INOUT 0x0004 /* bi-directional */ 33#define GPIO_PIN_INOUT 0x0004 /* bi-directional */
34#define GPIO_PIN_OPENDRAIN 0x0008 /* open-drain output */ 34#define GPIO_PIN_OPENDRAIN 0x0008 /* open-drain output */
35#define GPIO_PIN_PUSHPULL 0x0010 /* push-pull output */ 35#define GPIO_PIN_PUSHPULL 0x0010 /* push-pull output */
36#define GPIO_PIN_TRISTATE 0x0020 /* output disabled */ 36#define GPIO_PIN_TRISTATE 0x0020 /* output disabled */
37#define GPIO_PIN_PULLUP 0x0040 /* internal pull-up enabled */ 37#define GPIO_PIN_PULLUP 0x0040 /* internal pull-up enabled */
38#define GPIO_PIN_PULLDOWN 0x0080 /* internal pull-down enabled */ 38#define GPIO_PIN_PULLDOWN 0x0080 /* internal pull-down enabled */
39#define GPIO_PIN_INVIN 0x0100 /* invert input */ 39#define GPIO_PIN_INVIN 0x0100 /* invert input */
40#define GPIO_PIN_INVOUT 0x0200 /* invert output */ 40#define GPIO_PIN_INVOUT 0x0200 /* invert output */
41#define GPIO_PIN_USER 0x0400 /* user != 0 can access */ 41#define GPIO_PIN_USER 0x0400 /* user != 0 can access */
42#define GPIO_PIN_PULSE 0x0800 /* pulse in hardware */ 42#define GPIO_PIN_PULSATE 0x0800 /* pulsate in hardware */
43#define GPIO_PIN_SET 0x8000 /* set for securelevel access */ 43#define GPIO_PIN_SET 0x8000 /* set for securelevel access */
44 44
45/* GPIO controller description */ 45/* GPIO controller description */
46struct gpio_info { 46struct gpio_info {
47 int gpio_npins; /* total number of pins available */ 47 int gpio_npins; /* total number of pins available */
48}; 48};
49 49
50/* GPIO pin request (read/write/toggle) */ 50/* GPIO pin request (read/write/toggle) */
51struct gpio_req { 51struct gpio_req {
52 char gp_name[GPIOMAXNAME]; /* pin name */ 52 char gp_name[GPIOMAXNAME]; /* pin name */
53 int gp_pin; /* pin number */ 53 int gp_pin; /* pin number */
54 int gp_value; /* value */ 54 int gp_value; /* value */
55}; 55};

cvs diff -r1.6 -r1.7 src/usr.sbin/gpioctl/gpioctl.8 (expand / switch to unified diff)

--- src/usr.sbin/gpioctl/gpioctl.8 2009/09/25 19:37:03 1.6
+++ src/usr.sbin/gpioctl/gpioctl.8 2009/09/25 20:27:50 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1.\" $NetBSD: gpioctl.8,v 1.6 2009/09/25 19:37:03 mbalmer Exp $ 1.\" $NetBSD: gpioctl.8,v 1.7 2009/09/25 20:27:50 mbalmer Exp $
2.\" 2.\"
3.\" Copyright (c) 2009 Marc Balmer <marc@msys.ch> 3.\" Copyright (c) 2009 Marc Balmer <marc@msys.ch>
4.\" Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org> 4.\" Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
5.\" 5.\"
6.\" Permission to use, copy, modify, and distribute this software for any 6.\" Permission to use, copy, modify, and distribute this software for any
7.\" purpose with or without fee is hereby granted, provided that the above 7.\" purpose with or without fee is hereby granted, provided that the above
8.\" copyright notice and this permission notice appear in all copies. 8.\" copyright notice and this permission notice appear in all copies.
9.\" 9.\"
10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
@@ -127,28 +127,28 @@ bi-directional @@ -127,28 +127,28 @@ bi-directional
127open-drain output 127open-drain output
128.It pp 128.It pp
129push-pull output 129push-pull output
130.It tri 130.It tri
131tri-state (output disabled) 131tri-state (output disabled)
132.It pu 132.It pu
133internal pull-up enabled 133internal pull-up enabled
134.It pd 134.It pd
135internal pull-down enabled 135internal pull-down enabled
136.It iin 136.It iin
137invert input 137invert input
138.It iout 138.It iout
139invert output 139invert output
140.It pulse 140.It pulsate
141pulse output 141pulsate output at a hardware-defined frequency and duty cycle
142.El 142.El
143.Pp 143.Pp
144Note that not all the flags may be supported by the particular GPIO controller. 144Note that not all the flags may be supported by the particular GPIO controller.
145.Pp 145.Pp
146When executed with only the 146When executed with only the
147.Xr gpio 4 147.Xr gpio 4
148device name as argument, 148device name as argument,
149.Nm 149.Nm
150reads information about the 150reads information about the
151.Tn GPIO 151.Tn GPIO
152device and displays it. 152device and displays it.
153At securelevel 0 the number of physically available pins is displayed, 153At securelevel 0 the number of physically available pins is displayed,
154at higher securelevels the number of configured (set) pins is displayed. 154at higher securelevels the number of configured (set) pins is displayed.

cvs diff -r1.7 -r1.8 src/usr.sbin/gpioctl/gpioctl.c (expand / switch to unified diff)

--- src/usr.sbin/gpioctl/gpioctl.c 2009/09/25 19:37:03 1.7
+++ src/usr.sbin/gpioctl/gpioctl.c 2009/09/25 20:27:50 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: gpioctl.c,v 1.7 2009/09/25 19:37:03 mbalmer Exp $ */ 1/* $NetBSD: gpioctl.c,v 1.8 2009/09/25 20:27:50 mbalmer Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2008 Marc Balmer <mbalmer@openbsd.org> 4 * Copyright (c) 2008 Marc Balmer <mbalmer@openbsd.org>
5 * Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org> 5 * Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
6 * 6 *
7 * Permission to use, copy, modify, and distribute this software for any 7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above 8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies. 9 * copyright notice and this permission notice appear in all copies.
10 * 10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
@@ -57,27 +57,27 @@ const struct bitstr { @@ -57,27 +57,27 @@ const struct bitstr {
57 unsigned int mask; 57 unsigned int mask;
58 const char *string; 58 const char *string;
59} pinflags[] = { 59} pinflags[] = {
60 { GPIO_PIN_INPUT, "in" }, 60 { GPIO_PIN_INPUT, "in" },
61 { GPIO_PIN_OUTPUT, "out" }, 61 { GPIO_PIN_OUTPUT, "out" },
62 { GPIO_PIN_INOUT, "inout" }, 62 { GPIO_PIN_INOUT, "inout" },
63 { GPIO_PIN_OPENDRAIN, "od" }, 63 { GPIO_PIN_OPENDRAIN, "od" },
64 { GPIO_PIN_PUSHPULL, "pp" }, 64 { GPIO_PIN_PUSHPULL, "pp" },
65 { GPIO_PIN_TRISTATE, "tri" }, 65 { GPIO_PIN_TRISTATE, "tri" },
66 { GPIO_PIN_PULLUP, "pu" }, 66 { GPIO_PIN_PULLUP, "pu" },
67 { GPIO_PIN_PULLDOWN, "pd" }, 67 { GPIO_PIN_PULLDOWN, "pd" },
68 { GPIO_PIN_INVIN, "iin" }, 68 { GPIO_PIN_INVIN, "iin" },
69 { GPIO_PIN_INVOUT, "iout" }, 69 { GPIO_PIN_INVOUT, "iout" },
70 { GPIO_PIN_PULSE, "pulse" }, 70 { GPIO_PIN_PULSATE, "pulsate" },
71 { 0, NULL }, 71 { 0, NULL },
72}; 72};
73 73
74int 74int
75main(int argc, char *argv[]) 75main(int argc, char *argv[])
76{ 76{
77 const struct bitstr *bs; 77 const struct bitstr *bs;
78 int pin, ch, n, fl = 0, value = 0; 78 int pin, ch, n, fl = 0, value = 0;
79 const char *errstr; 79 const char *errstr;
80 char *ep; 80 char *ep;
81 int ga_offset = -1; 81 int ga_offset = -1;
82 u_int32_t ga_mask = 0; 82 u_int32_t ga_mask = 0;
83 long lval; 83 long lval;