Date: Sun, 12 Apr 2015 11:45:40 -0300 From: Luiz Otavio O Souza <lists.br@gmail.com> To: Rui Paulo <rpaulo@me.com> Cc: "freebsd-embedded@freebsd.org" <embedded@freebsd.org>, freebsd-arch@freebsd.org Subject: Re: using libgpio to bitbang LCDs! Message-ID: <CAB=2f8ymqOK5%2BL73eN2KQWUis50ubsHSLNei6cM9kALUMK=ofQ@mail.gmail.com> In-Reply-To: <7527478.9HOi23WthO@akita> References: <CAJ-Vmo=n=Lfh_XqkxwAA43jUi7suoPjWV1uSv4VnKNncw3%2BPfw@mail.gmail.com> <7527478.9HOi23WthO@akita>
index | next in thread | previous in thread | raw e-mail
On 11 April 2015 at 22:00, Rui Paulo wrote: > On Saturday 11 April 2015 17:11:47 Adrian Chadd wrote: >> Hi! >> >> I just ported an adafruit LCD driver to FreeBSD. This was a pretty trivial >> task: >> >> * convert C++ to C, which was done primarily to not rely on the >> arduino-isms; * use libgpio to bitbang the SPI bus needed to write to the >> LCD. >> >> It worked third time. First was "oh it runs on 5v power and 3.3v >> signaling", and I had it hooked up to 3.3. Second was "Oh, I haven't >> set the pins to be output pins yet." Third time worked - just slowly. >> >> However - using libgpio was just pleasant. Get a handle, set the pin >> config, set the pins high/low. It was pretty damned wonderful. >> >> It turns out that to fill the screen with individual pixel writes >> takes quite a few seconds pinning my AR9331 CPU doing ~ 190,000 >> syscalls a second. Ian's suggested something sensible - a bulk data >> ioctl() that can bit bang a series of GPIO pins in the kernel. Ie, one >> syscall, a big chunk of data with instructions and timings. > > Since this is an LCD, you probably want a way to export the GPIO bank via mmap > with write-combining enabled. It's not really a safe operation as it could > hang the GPIO driver, but it could be useful. > >> The other interesting thing would be a kind of bulk pin set/get - ie, >> instead of doing rmw for one pin at a time, communicate down masks of >> pins to do together. > > I think that's sensible and could be done via a separate (new) ioctl. I've patches for this (bank read and writing), it is pretty simple and should not block other approaches (mmap, bulk transfers, ...). Luizhome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAB=2f8ymqOK5%2BL73eN2KQWUis50ubsHSLNei6cM9kALUMK=ofQ>
