From owner-freebsd-arm@FreeBSD.ORG Fri Apr 17 10:47:20 2015 Return-Path: Delivered-To: freebsd-arm@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 EF181AA9 for ; Fri, 17 Apr 2015 10:47:20 +0000 (UTC) Received: from kabab.cs.huji.ac.il (kabab.cs.huji.ac.il [132.65.116.210]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A3380B9B for ; Fri, 17 Apr 2015 10:47:20 +0000 (UTC) Received: from th-04.cs.huji.ac.il ([132.65.80.125]) by kabab.cs.huji.ac.il with esmtp id 1Yj3nZ-0005M8-9B; Fri, 17 Apr 2015 13:47:01 +0300 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Subject: Re: help with coding a loadable kernel module From: Daniel Braniss In-Reply-To: <20150417095536.GA38091@gmail.com> Date: Fri, 17 Apr 2015 13:46:59 +0300 Cc: freebsd-arm@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <32D7EBD3-813E-4062-8A06-ED8E82BA50DA@cs.huji.ac.il> References: <20150417080839.GO2743@home.opsec.eu> <9B835088-661C-456E-84A7-47BC1835C0CB@cs.huji.ac.il> <20150417095536.GA38091@gmail.com> To: Tom Jones X-Mailer: Apple Mail (2.2070.6) X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Apr 2015 10:47:21 -0000 > On Apr 17, 2015, at 12:55 PM, Tom Jones wrote: >=20 > On Fri, Apr 17, 2015 at 12:15:33PM +0300, Daniel Braniss wrote: >>=20 >>> On Apr 17, 2015, at 11:08 AM, Kurt Jaeger wrote: >>>=20 >>> Hi! >>>=20 >>>> I know I'm embarking on a dangerous trip, but I want to use a = Raspberry Pi >>>> and or a BeagleBone to read (and write) RFID cards. >>>> Since a driver is needed to use the spibus, I have 2 options while >>>> developing: >>> [...] >>>> So before I give up on option 2, is there some examples/help? >>>=20 >>> Are you aware of this book ? >>>=20 >>> http://www.nostarch.com/bsddrivers.htm = >>=20 >> no, but before I spend more money (this is getting expensive :-), >> does it explain how to write a loadable module that needs to to talk >> to a spibus?=20 >=20 > I don't think it does. >=20 > spibus is very simple, there is one interface call >=20 > SPIBUS_TRANSFER(device_t, device_t, strcut spi_command); >=20 chicken and egg issue :-), what device_t dev should I use? it must point to the spibus =E2=80=A6 > struct spi_command { > void *tx_cmd; > uint32_t tx_cmd_sz; > void *rx_cmd; > uint32_t rx_cmd_sz; > void *tx_data; > uint32_t tx_data_sz; > void *rx_data; > uint32_t rx_data_sz; > }; >=20 > The rx and tx buffers need to be the same size. >=20 > I there isn't an interface for configuring spibuses, the bcm2835_spi = driver > uses sysctl's directly to set clock speed and other configuration. I = imagine > the other drivers are similar or don't offer config. >=20 > I can also assume you have hardware for the rfid. If not you might be = able to > find a reader that is supported by libnfc[1] which supports the rfid = tags you > need to use. I have 2 different RFIds, both are configured to talk via spi. thanks, danny >=20 > [0]: svnweb.freebsd.org/base/head/sys/dev/spibus > [1]: nfc-tools.org >=20 > --=20 > Tom > @adventureloop > adventurist.me >=20 > #pragma summon cthulhu > :wq > _______________________________________________ > freebsd-arm@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arm > To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org"