Hi Bill,
To communicate with an RT fifo from the RT Linux side you declare a
handler for the RT fifo using rtf_create_handler. The handler can then
transfer data between the RT Linux side and the user space process via
the RT fifo using the rtf_get and rtf_put calls.
The relevant parts in the frank example program are:
1/ init_module
pthread_attr_init (&attr);
sched_param.sched_priority = 5;
pthread_attr_setschedparam (&attr, &sched_param);
ret = pthread_create (&tasks[1], &attr, thread_code, (void
*)2);
rtf_create_handler(3, &my_handler); <-- Create a handler for RT
fifo #3
return 0;
2/ fifo handler routine, my_handler
int my_handler(unsigned int fifo)
{
struct my_msg_struct msg;
int err;
<-- rtf_get reads data from the COMMAND_FIFO RT fifo
while ((err = rtf_get(COMMAND_FIFO, &msg, sizeof(msg))) ==
sizeof(msg)) {
<-- rtf_put writes data to the msg.task + TASK_CONTROL_FIFO_OFFSET RT
fifo
rtf_put (msg.task + TASK_CONTROL_FIFO_OFFSET, &msg,
sizeof(msg));
rtl_printf("FIFO handler: sending the \"%d\" command to
task %d; period %d\n", msg.command,
msg.task, msg.period);
pthread_wakeup_np (tasks [msg.task]);
}
if (err != 0) {
return -EINVAL;
}
return 0;
}
Best regards,
Steve
"Skipworth, William" wrote:
>
> Hello,
>
> I am a newcomer to RT Linux. I was studying the frank example programs to
> understand how to implement fifos.
> How do you open a RT fifo from the RT Linux side? I would like to do this,
> if possible, so that the RT thread can receive a command from the regular
> Linux process via a rt FIFO.
>
> Thanks,
>
> Bill
>
> -- [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/
-- [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/