From owner-freebsd-embedded@freebsd.org Sat Aug 22 21:55:30 2015 Return-Path: Delivered-To: freebsd-embedded@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 936A49BEC08 for ; Sat, 22 Aug 2015 21:55:30 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 72200FFF for ; Sat, 22 Aug 2015 21:55:30 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 6FC709BEC07; Sat, 22 Aug 2015 21:55:30 +0000 (UTC) Delivered-To: embedded@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 56F0E9BEC05 for ; Sat, 22 Aug 2015 21:55:30 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-io0-x22b.google.com (mail-io0-x22b.google.com [IPv6:2607:f8b0:4001:c06::22b]) (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 21EE4FFE; Sat, 22 Aug 2015 21:55:30 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by iods203 with SMTP id s203so114542112iod.0; Sat, 22 Aug 2015 14:55:29 -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=dmU19OGoWj5DDOCS1J6UD59LkYVoWR7C8qsRcxMkNM8=; b=C0/QzHy+Lu69+xM6X6lA43cwe3sjz8mqInWOayuOjKJHkL8edKAxVazyIDTxYrryg+ QlHWYtWJ2jPFSXncXw6eMPjj1VsKPsKb/q5mz9SNAKmUI0bR9T89TqQz2P4nDy3Tn+46 0xiXFKyrdSPn/9tpX/ZBELXyK/QwXhWp782D8sHarfmeDwnhnauuDj8d9mwjejx0Uw3u wX3OHYYleexviup3Q0MhtGd0dTHja7+W0hVDlVnztKVjCE27SGDXLBkaxdemAusFBmBt C1ZwkW0I/+OcJ7TaiMJdJK7vcqtl5mRatiYGIoUX2HK8jRhya2I7Z5i5vfC081oH3cho JP+A== MIME-Version: 1.0 X-Received: by 10.107.131.196 with SMTP id n65mr12680307ioi.75.1440280529537; Sat, 22 Aug 2015 14:55:29 -0700 (PDT) Received: by 10.36.38.133 with HTTP; Sat, 22 Aug 2015 14:55:27 -0700 (PDT) In-Reply-To: References: <20150817160423.GB3078@gmail.com> Date: Sat, 22 Aug 2015 14:55:27 -0700 Message-ID: Subject: Re: spigen(4) SPI Generic IO interface -- need comments From: Adrian Chadd To: Brian Fundakowski Feldman Cc: Tom Jones , Luiz Otavio O Souza , "freebsd-embedded@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Aug 2015 21:55:30 -0000 Hi! This looks cool! Is there any reason why the clock isn't per transaction? -a On 22 August 2015 at 11:23, Brian Fundakowski Feldman wrote: > I've added a couple more features: > * clock adjustment via ioctl, independent per spigenN device > * mmap(2) support for very low latency > > On Tue, Aug 18, 2015 at 6:47 PM, Brian Fundakowski Feldman < > brianfundakowskifeldman@gmail.com> wrote: > >> On Mon, Aug 17, 2015 at 12:04 PM Tom Jones wrote: >> >>> On Mon, Aug 17, 2015 at 10:00:26AM -0400, Brian Fundakowski Feldman wrote: >>> > I'm woefully out-of-practice with my kernel hackery (but still pretty >>> > proficient in jiggery-pokery) so I would like to get comments on a >>> little >>> > driver I just made for interfacing arbitrarily in userland with SPI >>> > components. The only thing I'm exposing is a /dev/spigenN node with a >>> > single transfer ioctl and I put together a test circuit and program >>> with an >>> > MCP3008 10-bit ADC IC to validate that it basically works, other than >>> the >>> > limitation that the transfers must be octet-multiply-sized, but I >>> haven't >>> > looked at the SoC's (I'm using a Raspberry Pi 2) data sheet to tell >>> whether >>> > that's just a limit on the spibus(4) interface or the Broadcom SPI >>> driver >>> > or the Broadcom SoC itself. >>> > >>> > I hit one snag in development where I simply called the ioctl wrong and >>> > found copyin(9) to page fault HARD if given a bogus user address to copy >>> > from, and panic the kernel. I can post up the test program if anyone >>> wants >>> > but it's very trivial: I just align the start bit and the command data >>> into >>> > the least significant bits of the first octet, shift it up two >>> positions so >>> > the NULs get clocked out as part of the command field, and provide two >>> > octets for the data field to retrieve back the 10-bit digital value. >>> >>> Oh, cool. >>> >>> I did the same earlier this year, have you seen[1]?. >>> >>> The FreeBSD i2c api is the same/very similar the linux one[2][3]. Have you >>> considered adding some of the ioctls[3] or the data structures to make it >>> easier to port code? >>> >>> [1]: >>> https://lists.freebsd.org/pipermail/freebsd-embedded/2015-April/002466.html >>> [2]: https://www.kernel.org/doc/Documentation/i2c/dev-interface >>> [3]: >>> https://www.freebsd.org/cgi/man.cgi?query=iic&apropos=0&sektion=0&manpath=FreeBSD+10.2-RELEASE&arch=default&format=html >>> [4]: https://www.kernel.org/doc/Documentation/spi/spidev >> >> >> I've iterated a bit on this to try to make some more sensible API, >> behaving reasonably about being able to set the SPI clock speed. I'm going >> to implement an mmap handler so I can have my low-latency operation mode, >> as well. I don't like the Linux APIs one bit because it's just not safe to >> allow all those configuration changes on a per-transfer basis... >> >> Moving this to -embedded because it's more apt than -hackers. >> > > _______________________________________________ > freebsd-embedded@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-embedded > To unsubscribe, send any mail to "freebsd-embedded-unsubscribe@freebsd.org"