Yuhong et al.,

> I am using Qt & RT Linux to develop a package. I need to 
> fetch data via
> RTFIFO to be plotted within GUI designed by Qt. My  three 
> questions are
> as follows :

        I am doing substantially similar things...

> /************** Question 1**********/
> When I create RT FIFO using "rtf_create(fifo, size)", how can I decide
> the "size" of the RT FIFO? I even don't know the unit of the 
> size, is it
> Byte?

        The size is in bytes.  I generally look at the size of my available
memory, the price of figuring out *exactly* how big it should be, and the
cost of making it too big (none, unless memory limited).  After all that I
set them based on expected fill level moderated by available memory.  On my
current system I have 128MB of RAM, so I just set them all to 16384 and do
not worry about filling them.  If you were putting a lot of data through the
FIFO, you might consider something larger.  If you are severely memory
limited, you might choose something smaller.

> /************** Question 2**********/
> Also, say, I tried to create a FIFO by using "rtf_create(3, 300)",

        That is, in my experience, a very small FIFO.  If you are not
severely memory limited, try raising it to 16384.

> however, I found that the data to be passed to the Qt plotter 
> seemed to
> be displayed contineously, sometimes the data shown is wrong. 

        Are you certain that all of your writes to the FIFO succeed?  If you
are missing data points, your UI could be getting confused.

>  Could you
> please kindly give me a clear idea about the RT FIFO's working
> mechanism?  If I take the data out of the FIFO, will it still stay in
> the FIFO, or be deleted at once?

        Once data is read from the FIFO, it is removed from the FIFO at
once.

> /************** Question 3**********/
> In my kernel module,  I set the "pthread" periodical time as 5ms, and
> output one double data to RTF3, then I will fetch the data 
> from RTF3 to
> be plotted in GUI. I also set a 5ms QTimer event (plus a
> QSocketNotifier) to plot the data, but sometimes the data shown is not
> correct. My question is: Will the user space's 5ms match the kernel
> module's 5ms well?

        Not at all is probably the best thing to assume.  Not well is an
alternative, if you can't accept not at all.  In fact, the Kernel probably
only reschedules itself 100 times per second, so setting anything for 5ms in
regular Linux is unlikely to happen when you expect it.

        The probable scenario for your graphs getting plotted incorrectly is
that the data is being put into the FIFO fast enough that the FIFO fills.
This is due to the fact that the non-RT task only gets run periodically to
read the FIFO.  The routine writing to the FIFO also probably does not check
for the full condition before writing.

        The hard solution is to do some sort of handshaking between the RT
world and the non-RT world.  The easy solution is generally to make the
FIFOs much bigger. :-)

Regards,

Steve Cohen
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to