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.diff -r1.6 -r1.7 src/sys/sys/gpio.h
(mbalmer)
--- 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 */ | |
46 | struct gpio_info { | 46 | struct 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) */ | |
51 | struct gpio_req { | 51 | struct 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 | }; |
--- 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 | |||
127 | open-drain output | 127 | open-drain output | |
128 | .It pp | 128 | .It pp | |
129 | push-pull output | 129 | push-pull output | |
130 | .It tri | 130 | .It tri | |
131 | tri-state (output disabled) | 131 | tri-state (output disabled) | |
132 | .It pu | 132 | .It pu | |
133 | internal pull-up enabled | 133 | internal pull-up enabled | |
134 | .It pd | 134 | .It pd | |
135 | internal pull-down enabled | 135 | internal pull-down enabled | |
136 | .It iin | 136 | .It iin | |
137 | invert input | 137 | invert input | |
138 | .It iout | 138 | .It iout | |
139 | invert output | 139 | invert output | |
140 | .It pulse | 140 | .It pulsate | |
141 | pulse output | 141 | pulsate output at a hardware-defined frequency and duty cycle | |
142 | .El | 142 | .El | |
143 | .Pp | 143 | .Pp | |
144 | Note that not all the flags may be supported by the particular GPIO controller. | 144 | Note that not all the flags may be supported by the particular GPIO controller. | |
145 | .Pp | 145 | .Pp | |
146 | When executed with only the | 146 | When executed with only the | |
147 | .Xr gpio 4 | 147 | .Xr gpio 4 | |
148 | device name as argument, | 148 | device name as argument, | |
149 | .Nm | 149 | .Nm | |
150 | reads information about the | 150 | reads information about the | |
151 | .Tn GPIO | 151 | .Tn GPIO | |
152 | device and displays it. | 152 | device and displays it. | |
153 | At securelevel 0 the number of physically available pins is displayed, | 153 | At securelevel 0 the number of physically available pins is displayed, | |
154 | at higher securelevels the number of configured (set) pins is displayed. | 154 | at higher securelevels the number of configured (set) pins is displayed. |
--- 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 | |||
74 | int | 74 | int | |
75 | main(int argc, char *argv[]) | 75 | main(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; |