Hi,

those interested in an easy way to use shared memory anywhere should
look for portable_shm.tgz at http://www.aero.polimi.it/projects/rtai/. 
It contains a portable module that allows sharing memory among kernel
and user space and thus among different real time tasks and Linux
processes, simoultaneously. Naturally it can be used also in RTL because
it is self contained.
The services are symmetricall, i.e. the same calls can be used both in
real
time tasks, i.e. within the kernel (possibly at init because vmalloc is
GFP_KERNEL and can block in real time), and Linux processes:

They are (recall to do "make hook" to set up a hook to the underlaying
dev):

#include "rtai_shm.h"
unsigned long name;
void *adr;
int size;

call to allocate memory:
adr = rtai_malloc(name, size);   //in user space
adr = rtai_kmalloc(name, size);  //in kernel (module) space

call to free memory:
rtai_free(name, adr);  //in user space
rtai_kfree(name);      //in kernel (module) space

If you are disturbed by the "rtai"s just change them. They are there
because the all stuff is derived from an RTAI implementation based on
rtai specific sysreqs, to get rid of using file operations as much as
possible.
 
The first allocation does a real allocation, any subsequent call to
allocate    
with the same name from Linux processes just maps the area to the user
space    
or return the related pointer to the already allocated space in kernel
space.   
Analogously the freeing calls have just the effect of unmapping till the
last one is done, as that is the one the really frees allocated memory.
Clearly cooperating users have to use the same
"name".                                  
                                                                                
Once more the all stuff is based on an implementation of basic services
made available by Tomasz (Tomek) Motylewski
([EMAIL PROTECTED]), i.e kvmem.h as obtained from
motylewski.h.orig in portable_shm
distribution.                           
Such an implementation makes it easier for users to code the related
services, as calls similar to Unix OS services can be
used.                               
                                                                                
Many thanks are due to Tomek for his help and patience in answering my
questions. This shared memory implementation has been very fast, in my
standard, thank to his code and help. However blames about the module
API must be put only on
me.                                                            
                                                                                
Complaints about the use of static arrays for data lists manipulations
are welcomed but will not be satisfied any soon. I'll be glad of
receiving back a better implementation of them.

Ciao, Paolo.
--- [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