1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

GPIO pins can be programmed to invert input or output on some devices.

Introduce new flags, GPIO_PIN_INVIN and GPIO_PIN_INVOUT, for this.

ok grange
This commit is contained in:
mbalmer 2007-11-17 16:55:05 +00:00
parent 8a1cd61df4
commit c6dcffec31
4 changed files with 16 additions and 4 deletions

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: gpio.4,v 1.10 2007/11/17 10:10:26 mbalmer Exp $
.\" $OpenBSD: gpio.4,v 1.11 2007/11/17 16:55:05 mbalmer Exp $
.\"
.\" Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
.\"
@ -135,6 +135,10 @@ output disabled
internal pull-up enabled
.It Dv GPIO_PIN_PULLDOWN
internal pull-down enabled
.It Dv GPIO_PIN_INVIN
invert input
.It Dv GPIO_PIN_INVOUT
invert output
.El
.Pp
Note that the

View File

@ -1,4 +1,4 @@
/* $OpenBSD: gpio.h,v 1.2 2007/11/17 09:05:23 mbalmer Exp $ */
/* $OpenBSD: gpio.h,v 1.3 2007/11/17 16:55:05 mbalmer Exp $ */
/*
* Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
*
@ -31,6 +31,8 @@
#define GPIO_PIN_TRISTATE 0x0020 /* output disabled */
#define GPIO_PIN_PULLUP 0x0040 /* internal pull-up enabled */
#define GPIO_PIN_PULLDOWN 0x0080 /* internal pull-down enabled */
#define GPIO_PIN_INVIN 0x0100 /* invert input */
#define GPIO_PIN_INVOUT 0x0200 /* invert output */
/* GPIO controller description */
struct gpio_info {

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: gpioctl.8,v 1.11 2007/11/17 10:19:20 jmc Exp $
.\" $OpenBSD: gpioctl.8,v 1.12 2007/11/17 16:55:05 mbalmer Exp $
.\"
.\" Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
.\"
@ -102,6 +102,10 @@ tri-state (output disabled)
internal pull-up enabled
.It pd
internal pull-down enabled
.It iin
invert input
.It iout
invert output
.El
.Pp
Note that not all the flags can be supported by the particular

View File

@ -1,4 +1,4 @@
/* $OpenBSD: gpioctl.c,v 1.6 2007/11/17 09:05:23 mbalmer Exp $ */
/* $OpenBSD: gpioctl.c,v 1.7 2007/11/17 16:55:05 mbalmer Exp $ */
/*
* Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
*
@ -56,6 +56,8 @@ const struct bitstr {
{ GPIO_PIN_TRISTATE, "tri" },
{ GPIO_PIN_PULLUP, "pu" },
{ GPIO_PIN_PULLDOWN, "pd" },
{ GPIO_PIN_INVIN, "iin" },
{ GPIO_PIN_INVOUT, "iout" },
{ 0, NULL },
};