Search the list archive for more info about using shared memory.

You may need the vremap() call in your RT-Linux module:

   shmem = (SHMEM_ST *)vremap(SHMEM_BASE_ADDRESS,sizeof(SHMEM_ST));

Followed later by:

   //clean-up shared memory
   vfree(shmem);

-Don

On Thu, 17 Jun 1999, Olaf Petzold wrote:

> Hallo,
> 
> I'm using shared memory described in 
> <http://www.isd.cme.nist.gov/projects/emc/shmem.html> 
> "Using Shared Memory in Real-Time Linux" from Frederick M. Proctor.
> I expanded the structures for using data like this inside
> common.h:
> ...
> typedef struct 
> {
>   unsigned int inuse;
>   int arg1;
>   double arg2;
>   double LUT[4096];   /* my LoockUpTable for DAU */
> } MY_DATA;
> ...
> typedef struct 
> {
>   MY_COMMAND cmd;
>   MY_DATA data;
>   MY_STATUS status;
>   MY_ERROR error;
> } MY_STRUCT;
> ...
> 
> inside rt_process.c I wrote:
> 
> static void task_code(int t)
> {
> ...
>   for (;;)
>     {
>       ...
> 
> 
>       my_struct.status.heartbeat++;
> 
>       /* DAQ - Only for fun at moment */
>       my_struct.data.arg1=0;
>       my_struct.data.arg2=0.0;
>     
>       /* write data to shmem */
>       if (0 == my_struct_ptr->data.inuse)
>                       memcpy(&my_struct_ptr->data, 
>                       &my_struct.data, 
>                       sizeof(MY_DATA));
> 
>       ...
>       rt_task_wait();
>     }
> }
> 
> with the result, my system is frozen for a long time 
> (mostly a hard reset was following..) while insmod rtmod
> 
> # time insmod rtmod.o && rmmod rtmod && echo DONE
> real  0m0.010s
> user  0m0.010s
> sys   0m0.000s
> DONE
> 
> This is was time says. What is wrong with this code? 
> or is there another/better/faster way? Without this
> structure data all things are fine.
> 
> Olaf
> --- [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/

Reply via email to