On Tue, Oct 31, 2000 at 08:36:57AM +0100, S.A. wrote:
> [EMAIL PROTECTED] wrote:
> > 
> > There is no way to do this.  Why would you want to?
> > 
> 
> In user space  the user has the ability to update tables for the rttasks 
> When the table is updated (we will say a memcpy drived by an  order from
> the user in the GUI)  the table must be shared with a semaphore for
> exclusive access . 
> 
> Of course, the rttask will not wait , but work as follow :
> 
> evaluate availability of semaphore
> if (available)
>  then 
>    1.lock semaphore 
>    2. read the updated table 
>    3. unlock semaphore
>  else will check  for it on next timeslice

If I were doing this, I would have a shared data 
structure like this:
       struct { int user_stamp;
                int rt_stamp;
                int buf[BSIZE];}x = {0,1, ..}, y = {0,1, ..};

in user code:
         if(x.rt_stamp) p = &x
            else if (y.rt_stamp ) = = &y;
                 else p = (lastp == &x? &y: &x);

          p->user_stamp=1;
          fill buffer
          p->user_busy = 0;
          p->rt_stamp = 0;
          lastp = p;
         


in rt code
         
       get x and y addresses

       if(xptr->rt_stamp){ /* data in x */
          if(xprt->user_busy)break; /* data invalid */
            else copy data, x->rt_stamp=1;

 ...

making use of the atomicity of rt actions
in the eyes of the user process. If the user
is updating, the rt side can't use data. But
the user alternates, so that the fresher buffer
is always available. 
This is a just the very old flip buffer method.

If you want the user program to wait for the
rt side to read the data, do a rtfifo read
and have the rt side put a token in the 
fifo every time it clears the buffer - it
could even put the shared address in the fifo.


user:
     if(sharedbuf->rt_done == 0){
           read(fd,&bpacket, sizeof bpacket);
           bpacket.ptr is pointer to free space
           bpacket.size is count of free bytes 

or something.

anyways, you get the idea.



       


in rt code:
         if
      
> 
> That is one of the reasons...
> 
> Imagine a robot with GUI and automation task on the same platform, a lot
> of dialog is 
> needed between both rt and user space
> 
> bye 
> s.a.
> -- [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/

-- 
---------------------------------------------------------
Victor Yodaiken 
Finite State Machine Labs: The RTLinux Company.
 www.fsmlabs.com  www.rtlinux.com

-- [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