Hello, Everybody :
I have to write again and ask for help on how to connect 2 modules
via a FIFO properly.
I have 2 modules (mem.o and rt_tulip.o).
Now, when rt_tulip sends a message to the mem.o via a
FIFO, the message is being written to the FIFO, but my
RT handler in mem.o that is created on this FIFO is not waking up.
.. untill I do a cat /dev/rtf4 from a user side. Then-
guess what ? the RT Handler in the module mem.o sees the message in the
FIFO and triggers a response.
I have re-read Gabor's answer to my old posting, and he is saying
that semaphores can be used to make a reader task to wake the handler up.
How do you do that ?
Do you start a periodic task in mem.o module that periodically waits on
a semaphore,
and if there is smth in a fifo (semaphore indicates that ) -- it should
read the fifo?
The problem with that is that when I have a periodic RT task, it is like
polling- IT eats my CPU time.
Can I make a handler to trigger on a semaphore ? (could be a damn
question), but I need an asynchronous response to a FIFO message.
Besides, I always thought that semaphores can be set on a user side
only,but in kernel you should use spinlocks?
Am I wrong ?
Does RT Linux have semaphores ?
I am using 2.2.13-RTL2.0 from fsmlabs.
Here I am including my code.
-------------------mem.c (kernel module, has a
handler, must respond to a FIFO message )
--------------------
int mem_rcv_handler(unsigned int fifo)
{
struct my_msg_struct msg;
int err, r;
while ( (err = rtf_get(RCV_PIPE1 , &msg, sizeof(msg) ) ) == sizeof(msg)
)
{
printk("??mem.c: RT handler\n ");
}
if (err != 0) {
return -EINVAL;
}
return 0;
} // end of my_handler ()
....
rtf_create_handler(RCV_PIPE1 , &mem_rcv_handler);
----------------rt_tulip.c (kernel, sender)-----------------
transmitted = rtf_put(RCV_PIPE1, &msg, sizeof(msg) );
Sincerely,
Olga
---------- Forwarded message ----------
Date: Tue, 01 Aug 2000 09:23:08 +0200 (MET DST)
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: Re: [rtl] Fifo is not available (continued)
> Again, my question is
> 1. Can FIFOs be used in module-to-module communications or
Again, the answer is definetely yes.
I do this for a year.
> 2. IF I can use FIFO in module-to-module communications how can I
> make it so the module that writes to a FIFO does not keep it from another
> module reading from the same fifo so the data is dequeued finally and FiFO
> does not get full
Pardon?
(My English is limited a bit.)
Do you want to make the reader task woken up and empty the FIFO?
Use semaphores.
Regards
Gabor
-- [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/