From owner-freebsd-embedded@FreeBSD.ORG Sun Apr 12 08:44:48 2015 Return-Path: Delivered-To: embedded@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CEA3BA13; Sun, 12 Apr 2015 08:44:48 +0000 (UTC) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8741C131; Sun, 12 Apr 2015 08:44:48 +0000 (UTC) Received: from slw by zxy.spb.ru with local (Exim 4.84 (FreeBSD)) (envelope-from ) id 1YhDVO-0003fZ-Jj; Sun, 12 Apr 2015 11:44:38 +0300 Date: Sun, 12 Apr 2015 11:44:38 +0300 From: Slawa Olhovchenkov To: Adrian Chadd Subject: Re: using libgpio to bitbang LCDs! Message-ID: <20150412084438.GM1394@zxy.spb.ru> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false Cc: "freebsd-embedded@freebsd.org" , "freebsd-arch@freebsd.org" X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 12 Apr 2015 08:44:48 -0000 On Sat, Apr 11, 2015 at 05:11:47PM -0700, 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. May be best choise is write() or netmap-like interface?