Date: Mon, 25 Nov 2013 10:59:53 -0500 From: Lowell Gilbert <freebsd-ports-local@be-well.ilk.org> To: Alexander Leidinger <Alexander@Leidinger.net> Cc: ports@FreeBSD.org Subject: Re: Porting a software which uses INP_GPIO? Message-ID: <44pppo79qe.fsf@lowell-desk.lan> In-Reply-To: <20131122225042.00007aad@unknown> (Alexander Leidinger's message of "Fri, 22 Nov 2013 22:50:42 %2B0100") References: <20131121214359.000006f6@unknown> <44bo1d5u3z.fsf@be-well.ilk.org> <20131122225042.00007aad@unknown>
next in thread | previous in thread | raw e-mail | index | archive | help
Alexander Leidinger <Alexander@Leidinger.net> writes: > On Thu, 21 Nov 2013 16:21:20 -0500 > Lowell Gilbert <freebsd-ports-local@be-well.ilk.org> wrote: > >> Alexander Leidinger <Alexander@Leidinger.net> writes: >> >> > I try to compile a software on FreeBSD which wants to use INP_GPIO, >> > OUTP_GPIO and some oder *GPIO* things. >> > >> > A quick googling shows me some raspberry pi sites. Is this something >> > linux-specific (so that I can forget this software on FreeBSD as >> > long as we don't gain something similar)? >> > >> > Searching for gpio in names of ports didn't show a hit and in the >> > basesystem includes I can't find it either. >> >> GPIO is a way to do pin assignments for a chip package at run-time. I >> use it on embedded platforms all the time, but it isn't normally >> available on a PC. There's a gpioctl(1) that should be able to set the >> a pin for input or output, as those flags indicate, or >> programmatically I guess it would be GPIO_PIN_INPUT or >> GPIO_PIN_OUTPUT in /usr/include/sys/gpio.h but again, you need to >> have the hardware for it. > > I have the hardware. Currently it is accessed from an old Laptop with > the Windows-binary of the program. I would like to replace the Laptop > and use a FreeBSD version of the program. > > The code in question is: > ---snip--- > const int banks[4]={18,23,24,25}; > [...] > for(i=0;i<4;i++) > { > INP_GPIO(banks[i]); > OUT_GPIO(banks[i]); > if(i==bank) > { > GPIO_SET = 1 << banks[i]; // enable bank > } > else > { > GPIO_CLR = 1 << banks[i];// disable bank > } > } > ---snip--- > > When looking at sys/gpio.h, I have no idea how I shall translate the > above into something FreeBSD understands. Could you please explain how > the above translates into "FreeBSD-gpio-speak"? Not offhand, no; that would take some work, and would require some knowledge of the hardware devices installed, and preferably their wiring configurations as well. It would be a reasonable guess that INP_GPIO is equivalent to a GPIOSETCONFIG with a state structure that (at least) includes GPIO_PIN_INPUT in its flags. But the code seems to be operating on whole banks at once, no just individual pins.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44pppo79qe.fsf>