Date: Fri, 7 Nov 2014 08:44:30 -0700 From: Warner Losh <imp@bsdimp.com> To: Rui Paulo <rpaulo@me.com> Cc: arm@freebsd.org, embedded@freebsd.org Subject: Re: libgpio Message-ID: <58908C87-6046-4873-87B1-74995EFA72D1@bsdimp.com> In-Reply-To: <B3B50210-8AE9-411A-84B1-AE6C10494149@me.com>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] On Nov 6, 2014, at 11:41 PM, Rui Paulo <rpaulo@me.com> wrote: > Hi, > > Some time ago, I wrote a gpio library as a way to interact with the kernel gpio driver in a more sensible way (hiding the details of opening a /dev file, handling all the ioctls, etc.). > > Here's the project code: > > https://bitbucket.org/rpaulo/libgpio/src > > Here's the header file: > > https://bitbucket.org/rpaulo/libgpio/src/1dfe793d0b0cd6caff2e196cf667a5c06bbade8d/libgpio.h?at=default > > It looks like some people started using the library and I was wondering if it would be a good candidate for the base system. I would rewrite gpioctl to use it and I'm open to changing the library API. > > Any comments? I generally like it. Here’s some suggestions, though many may be hard given that our gpio interface is a bit weak. First, there’s no way to set multiple pins at the same time. That’s likely a reflection of our GPIO system, I know, but it is a deficiency. Fortunately, most devices can tolerate multiple pins changing at different times before a ‘clock’ or ‘enable’ pin forces them to latch their state. What the heck is g_caps? There’s nothing at all to describe it. Not even an indirection to look at sys/gpio.h For systems that have multiple GPIO devices (some have a few hundred I/O lines that can be addressed), how do you handle that? Do you just kinda have to know these details? There’s no facilities for interrupts (usually you’d like to say “wait for this line to change and let me know”). I know that the Atmel gpio stuff did this, but I don’t think that made it into the generalization that was later done. I’m not sure that I like the gpio_pin_* helper functions causing the thing to change, rather than operating on a gpio_config_t. But since you don’t normally change a bunch at a time, that’s not so bad. Finally a question: What does Linux do here? Is there a standard interface that we could use to leverage off applications written for Linux? Perhaps beyond the scope of what you’re trying to do, but any discussion about pushing things into the base should ask the question “Is this the right, most useful interface?” Warner [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Comment: GPGTools - https://gpgtools.org iQIcBAEBCgAGBQJUXOjeAAoJEGwc0Sh9sBEA1RoP/2piAIsGxJ32VaI2x3Bj5p2A hzg8VpRsYSdJmLfaHbcVoSWY0h/HAJiKqSIvEnFE+1D97s91nNU7VhiYSayvGc6R NRKfZqugAzPSZUDACx6dY6huYpva4JlVdDHnQgoG6Wxdlcy565NlJVXTLuu5yeB4 OzQzX7upJUNUckFIWReTJmWAwYuGMQqSHQmWBEW0Hrg/94zemaCBXpekb4rOyiOx cVjvxr204KWfCk5iUVmo/MIKPOwMSBschUx+oyQQLAaE2ROnPQzYwmHKBN16NaMG SuzaO9TNKerGJxRaMGc5KyRAcprJ4C2I6A0HQUCZEcE0/d59D14FGi3zAqHffXCp qmYN7hmWBoYlb2ctlKhDcWmB2QrZ4z6V0E0ZI2RAkeoR2bmFfNmmbeUUWR8IjeRq roKjJfJj+Zvk52Du9OoNLPXd+YM6MdZCYQumbRRufVdK/+zKUgseGZzqwa8l+ivt knXVDPUa71v1703iHz1oFknuc2fpnPogKZFH2KW/LfRAXDtMpFtqYxd0UcCJgyZR 0rFKiwjKyZPu0X9lnYLbL98DYmVhB6eKOdLXQIudLs+QCuc9FyEgPTU6o1jjb+lb Io/+DTwO9tKrO9WFrrIoQwA1qTp7Y+ukG8/4VivcQTPmJvhhGcQ+IlT/Xa6j16vh eQrsQLn3nuJC4VxxBgQg =7WX+ -----END PGP SIGNATURE-----home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?58908C87-6046-4873-87B1-74995EFA72D1>
