Date: Sat, 22 Aug 2015 19:27:38 -0500 From: Karl Denninger <karl@denninger.net> To: freebsd-embedded@freebsd.org Subject: Re: spigen(4) SPI Generic IO interface -- need comments Message-ID: <55D9137A.4000403@denninger.net> In-Reply-To: <CAEv1%2BOXe4w8hJXQu2MsoMLz6ixeG3hU3BmLZpssG15SaPd9JGw@mail.gmail.com> References: <CAEv1%2BOU4cFpMpeQGfnCP7L4Q_k18rOSOA9JBnKUa99DS5dFnWA@mail.gmail.com> <20150817160423.GB3078@gmail.com> <CAEv1%2BOUhSAJxxWAfW2GUFVw=H-_KOs2dGg2d7uhZnFbqsHE5Qw@mail.gmail.com> <CAEv1%2BOXe4w8hJXQu2MsoMLz6ixeG3hU3BmLZpssG15SaPd9JGw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] This is extremely cool stuff, and will make adding analog inputs to the Pi under FreeBSD easy..... which is exactly what I needed as a gating function for a project I wanted to undertake. On 8/22/2015 13: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 <jones@sdf.org> 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" -- Karl Denninger karl@denninger.net <mailto:karl@denninger.net> /The Market Ticker/ /[S/MIME encrypted email preferred]/ [-- Attachment #2 --] 0 *H 010 + 0 *H _0[0C)0 *H 010 UUS10UFlorida10U Niceville10U Cuda Systems LLC10UCuda Systems LLC CA1"0 *H Cuda Systems LLC CA0 150421022159Z 200419022159Z0Z10 UUS10UFlorida10U Cuda Systems LLC10UKarl Denninger (OCSP)0"0 *H 0 X@vkY Tq/vE]5#֯MX\8LJ/V?5Da+ sJc*/r{ȼnS+ w")ąZ^DtdCOZ ~7Q '@a#ijc۴oZdB&!Ӝ-< ?HN5y 5}F|ef"Vلio74zn">a1qWuɖbFeGE&3(KhixG3!#e_XƬϜ/,$+;4y'Bz<qT9_?rRUpn5 Jn&Rx/p Jyel*pN8/#9u/YPEC)TY>~/˘N[vyiDKˉ,^" ?$T8 v&K%z8C @?K{9f`+@,|Mbia 007++0)0'+0http://cudasystems.net:88880 U0 0 `HB0U0, `HB OpenSSL Generated Certificate0U-h\Ff Y0U#0$q}ݽʒm50U0karl@denninger.net0 *H Owbabɺx&Uk[(Oj!%p MQ0I!#QH}.>~2&D}<wm_>V6v]f>=Nn+8;q wfΰ/RLyUG#b}n!Dր_up|_ǰc/%ۥ nN8:d;-UJd/m1~VނיnN I˾$tF1&}|?q?\đXԑ&\4V<lKۮ3%Am_(q-(cAeGX)f}-˥6cv~Kg8m~v;|9:-iAPқ6ېn-.)<[$KJtt/L4ᖣ^Cmu4vb{+BG$M0c\[MR|0FԸP&78"4p#}DZ9;V9#>Sw"[UP7100010 UUS10UFlorida10U Niceville10U Cuda Systems LLC10UCuda Systems LLC CA1"0 *H Cuda Systems LLC CA)0 + !0 *H 1 *H 0 *H 1 150823002738Z0# *H 1YTV!:4lv0l *H 1_0]0 `He*0 `He0 *H 0*H 0 *H @0+0 *H (0 +710010 UUS10UFlorida10U Niceville10U Cuda Systems LLC10UCuda Systems LLC CA1"0 *H Cuda Systems LLC CA)0*H 1010 UUS10UFlorida10U Niceville10U Cuda Systems LLC10UCuda Systems LLC CA1"0 *H Cuda Systems LLC CA)0 *H y.Pl"PKYrٺD?{-ڦK,.ƫ6q0STXwtb`NeNg n/$n+I<&,,$f@qco.AdU@y}nΈi,NXgr4+;;BZb `wY<WTOuOkO(FU-ׯZRق;:C])w%f[Jy& a:|YB\=8MoE!HxTgHBGrRSۯgm:ƒlYV,mF+Bu3g#D07h rD*,H.%P?){c[;ck]H"Wڶ=%\5 NΓj>kAA߅Pfi9ǡlb3Ǭ^t h\c!͔&x(-dَ;±d6Y7# I[$nS#MB$߭{\hD\DŔVM'zu>)+_GjMr柅*:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?55D9137A.4000403>
