From owner-freebsd-arm@FreeBSD.ORG Fri Apr 17 09:56:02 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 63AF1ED2 for ; Fri, 17 Apr 2015 09:56:02 +0000 (UTC) Received: from mail-wi0-x22f.google.com (mail-wi0-x22f.google.com [IPv6:2a00:1450:400c:c05::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EDA0339F for ; Fri, 17 Apr 2015 09:56:01 +0000 (UTC) Received: by wiun10 with SMTP id n10so14551774wiu.1 for ; Fri, 17 Apr 2015 02:56:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:hackerspace:user-agent; bh=kKUxJgoRmYVKPg6iBnVX9PI4MWbuT1I1gZIThL/Fc4A=; b=EQdRSrcJaF4SrU/29n0H7iHlATGkwdcbGcEVn9vtBboYoD1szkhmvgaNec0RVe7lxT znRRXagoBovJWnslOnatMyaRvlujbI6vin0wlD0CWahzKGCSqK6upvCvMNx0TK9boAzx 1a8s4DsKzxL5IR0DSJd6G7F7aNl182e3ol7vkB1B/vBV/xXwrh5AuIwt1bgWSXjDztDk B1EReXd8GCQkBs/zDcc1Z7s2s9lBXy/Y+h00pJwIrp7rRZ5fEzwteqTeJgqv8uaZrKkV w2NFIeLc9PCbr5zVkW06DtUi/0Ut9lJXow+pPdtPbXFfxBdXcNttgedr4mePcOb/7ocR c6Dg== X-Received: by 10.194.88.131 with SMTP id bg3mr4139625wjb.119.1429264560367; Fri, 17 Apr 2015 02:56:00 -0700 (PDT) Received: from gmail.com (tom-desk.erg.abdn.ac.uk. [139.133.204.4]) by mx.google.com with ESMTPSA id h5sm13927750wjn.20.2015.04.17.02.55.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 17 Apr 2015 02:55:59 -0700 (PDT) Sender: Tom Jones Date: Fri, 17 Apr 2015 10:55:37 +0100 From: Tom Jones To: freebsd-arm@freebsd.org Subject: Re: help with coding a loadable kernel module Message-ID: <20150417095536.GA38091@gmail.com> References: <20150417080839.GO2743@home.opsec.eu> <9B835088-661C-456E-84A7-47BC1835C0CB@cs.huji.ac.il> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9B835088-661C-456E-84A7-47BC1835C0CB@cs.huji.ac.il> Hackerspace: 57North Hacklab User-Agent: Mutt/1.5.23 (2014-03-12) 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 09:56:02 -0000 On Fri, Apr 17, 2015 at 12:15:33PM +0300, Daniel Braniss wrote: > > > On Apr 17, 2015, at 11:08 AM, Kurt Jaeger wrote: > > > > Hi! > > > >> 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? > > > > Are you aware of this book ? > > > > http://www.nostarch.com/bsddrivers.htm > > 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? I don't think it does. spibus is very simple, there is one interface call SPIBUS_TRANSFER(device_t, device_t, strcut spi_command); 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; }; The rx and tx buffers need to be the same size. 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. 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. [0]: svnweb.freebsd.org/base/head/sys/dev/spibus [1]: nfc-tools.org -- Tom @adventureloop adventurist.me #pragma summon cthulhu :wq