On Thu, Mar 17, 2022 at 2:41 AM Xiang Xiao <xiaoxiang781...@gmail.com> wrote:
>
> We are working on this to provide multiple read/poll support. The basic
> idea is that:
>
>    1. Upper half driver hold FIFO shared by all client
>    2. Each client hold the offset into the share FIFO
>
> The benefit is that we don't need to maintain multiple queues and avoid the
> memory duplication.

Sounds interesting, but is it a FIFO or a ring buffer? The difference
being that the location of the head pointer doesn't advance upon reads
with a ring buffer so all threads get the same data.

Did you already bring up this concept on the mailing list? I don't
recall.... The reason I brought this up before I started writing code
is because it's important to define the scope and details of the
problem and specify what the solution needs to do, before trying to
solve it. And get feedback. That would certainly help avoid
reinventing the driver model periodically.

> Nor do they support filtering or
> >
>
> Kernel side only support the resample filter to handle the different sample
> frequency request:
>
>    1. Upper half collect the sample frequency from all client
>    2. Forward the fast request to the lower half
>    3. Down sample to match slow client in the read callback
>
>  We think that other advanced filter or algorithm is better to put to the
> userspace, and will provide an interface compatible with uORB:
> https://docs.px4.io/master/en/middleware/uorb.html

Ok... but that approach is not necessarily suitable for
resource-constrained applications. Performing the filtering in
userspace and copying the data around with sockets or message queues
means many extra context switches.

Besides, you need to implement some kind of filtering in kernel space
anyway to avoid aliasing when downsampling.

(Incidentally, who exactly is the "we" that thinks other advanced
filters are better put in userspace? Tim's email suggests that's not
quite everyone's opinion.)

~~~

Greg, I did look at the sensor cluster driver; it might be possible to
extend that and retain API compatibility but otherwise it really
doesn't do enough for my needs. Would need to see if it can be
decoupled from SPI and I2C.

Do you have feedback on the userspace pointer concept and its
POSIX-ness or lack thereof?

Matt

Reply via email to