lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1255739684.9801.5.camel@ben-desktop>
Date:	Sat, 17 Oct 2009 11:34:43 +1100
From:	Ben Nizette <bn@...sdigital.com>
To:	Bertrand Roussel <bertrand.roussel@...-net.org>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: Kernel driver with multiple SPI sources

On Fri, 2009-10-16 at 21:50 +1300, Bertrand Roussel wrote:

>  _____      ______
> |     | <> |  ADC |
> |     |    |______|
> | IMU |     ______  <> Bus SPI
> |     | <> |  MAG |
> |_____|    |______|
> 
> Each block correspond to a driver:
> * IMU is a basic char driver, depending on both ADC and MAG driver,
> and that register new spi_device to the spi_master
> * ADC and MAG are instances of an spi_driver, with a char driver as an interface
> 

Why is the IMU part a kernel driver?  Surely the kernel only needs to
know about the ADC and the MAG unit, expose interfaces for them to the
outside world and have all the IMU maths in userspace?

The ADC and MAG drivers there fit exactly in to the model of the new IIO
subsystem (industrial I/O).  This subsystem is in staging/ at the moment
rather than being a first-class citizen but don't let that stop you
using it.  IIO gives each device registered through it a number of sysfs
knobs to control things like sample rate etc and then a time-stamped
ring buffer holding the actual data.  Your IMU then just sits in
userspace consuming that buffer, matching ADC and MAG entries with the
same (similar) timestamps and doing the maths.

And no, you certainly should not spin-wait on the data to become
available.  Just set up an interrupt handler for the pin change, from
the interrupt start an spi_async transfer or spawn a workqueue to get
the data out.  The async callback or workqueue then can submit the data
to IIO for buffering for userspace.

	--Ben.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ