Date: Sun, 26 Apr 2015 20:06:03 -0700 From: Adrian Chadd <adrian@freebsd.org> To: Tom Jones <jones@sdf.org> Cc: "freebsd-embedded@freebsd.org" <freebsd-embedded@freebsd.org> Subject: Re: SPI User Space Interface Message-ID: <CAJ-VmokuB6vXV-uP7ezXqdifcDmCDzN3Txg9HWpsDHKqhE3wqQ@mail.gmail.com> In-Reply-To: <20150426203344.GA27490@gmail.com> References: <20150426203344.GA27490@gmail.com>
index | next in thread | previous in thread | raw e-mail
Hey, this is cool!
What can we do to spibus to make it better?
-adrian
On 26 April 2015 at 13:33, Tom Jones <jones@sdf.org> wrote:
> This atteched patch adds user space access to spi drivers. Access is possible
> via read, write and an ioctl call. I have tested this patch on a raspberry-pi B
> against an avr running a simple program and a small monochrome oled screen
> based on the ssd1306 display driver.
>
> The ioctl requires the use of two new structs. The spi_rdwr_data struct takes a
> number of spi_ioc_transfer structs, this is modeled on the iic driver. The
> spi_ioc_transfer struct is compatible with the linux spidev implementation.
>
> There is no support for ioctls to set spi device settings are there is in
> linux, this is due to the limited driver interface in spibus. Only the buffer
> and length options are used from the spi_ioc_transfer struct, this is from the
> lack of driver interface on spibus.
>
> struct spi_ioc_transfer {
> void *tx_buf;
> void *rx_buf;
>
> uint32_t len;
> uint32_t speed_hz;
>
> uint16_t delay_usecs;
> uint8_t bits_per_word;
> uint8_t cs_change;
> uint32_t pad;
> };
>
> struct spi_rdwr_data {
> struct spi_ioc_transfer *msgs;
> uint32_t nmsgs;
> };
>
> #define SPIRDWR _IOW('S', 1, struct spi_rdwr_data)
>
> I have only managed to test this code on one platform and against a limited
> number of spi devices. I think it needs more testing against real hardware, I
> don't have any lying around.
>
> --
> Tom
> @adventureloop
> adventurist.me
>
> :wq
>
> _______________________________________________
> freebsd-embedded@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-embedded
> To unsubscribe, send any mail to "freebsd-embedded-unsubscribe@freebsd.org"
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-VmokuB6vXV-uP7ezXqdifcDmCDzN3Txg9HWpsDHKqhE3wqQ>
