From owner-freebsd-arm@FreeBSD.ORG Tue Sep 30 04:41:40 2014 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9780019A for ; Tue, 30 Sep 2014 04:41:40 +0000 (UTC) Received: from mail-wi0-x22b.google.com (mail-wi0-x22b.google.com [IPv6:2a00:1450:400c:c05::22b]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 334CB852 for ; Tue, 30 Sep 2014 04:41:40 +0000 (UTC) Received: by mail-wi0-f171.google.com with SMTP id ho1so4704464wib.4 for ; Mon, 29 Sep 2014 21:41:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=WkKgbFrHd+yNdaKecoE2WNMcbLSNdEohB7cE7XC03NU=; b=gHeT16rzZ+Eh54c5h5M0y2Imb/KMVuddVy7AWDuKTGQ4D3kRvY2lxFyNbFQ8l8rRSg qBaQfV292/XBIapklWa1hkGMk8wT355tAvCRI9WIuCtfRVI0NgXfAxpPEHWtr78XI91C W4MDV+p3k4AleHh/QqFOE2H0Mfv5wRDpAd9E8tLNvkOXRrOxIm1IoniwXW2KNcik0OcG zEnkiHPe38GiyOVU3BrK2Mstg+nx+9XAWvQ5z3rJPCJ95sw5KzSQYqZ+fmZ4FMetRAXk DikFArKd+JeYo8DXKWiyS+jpAiFw9pHo+2fe7pAv3uq2+GQAhCzUAQq5pWvriYUuH3Io yYGA== MIME-Version: 1.0 X-Received: by 10.180.74.9 with SMTP id p9mr2716888wiv.54.1412052098295; Mon, 29 Sep 2014 21:41:38 -0700 (PDT) Received: by 10.216.166.198 with HTTP; Mon, 29 Sep 2014 21:41:38 -0700 (PDT) In-Reply-To: <20140930081618.122a0c79@X220.alogt.com> References: <20140929080337.46bbb5a3@X220.alogt.com> <20140930081618.122a0c79@X220.alogt.com> Date: Tue, 30 Sep 2014 01:41:38 -0300 Message-ID: Subject: Re: Documentation for using GPIO From: Luiz Otavio O Souza To: Erich Dollansky Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-arm@freebsd.org" X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Sep 2014 04:41:40 -0000 On 29 September 2014 21:16, Erich Dollansky wrote: > Hi Luiz, > > On Mon, 29 Sep 2014 16:27:26 -0300 > Luiz Otavio O Souza wrote: > >> > is there some documentation available of how to use GPIO on a >> > Raspberry Pi B+ than man gpio, man gpioctl etc? >> > >> Unfortunately not, there is the Wiki page >> (https://wiki.freebsd.org/FreeBSD/GPIO) but it doesn't add much. >> > I ave read this. > >> But we can try to help you whenever possible, just post your questions >> and we'll try to address them. > > I am currently working on a C program which should use GPIO to switch > relais and read the state of switches via GPIO. I would like to make > this program as simple as possible by creating first a layer which > provides then functions like set (Pin), reset (Pin) and read (Pin) > only. Of course plus the things needed to open, close and configure the > interface. > > The best I have found until now are the sources of gpioctl. I am > currently looking at the source. > > Is this the best start? You can use the excellent rpaulo's libgpio: https://bitbucket.org/rpaulo/libgpio/src/1dfe793d0b0cd6caff2e196cf667a5c06bbade8d/libgpio.h?at=default It provides all the GPIO low level functions in a clear and simple way. Luiz