Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

Shm


Files

file  rtai_nam2num.h
 Conversion between characters strings and unsigned long identifiers.
file  rtai_scb.h
 SCB stand for Shared (memory) Circular Buffer.
file  rtai_shm.h
 Interface of the RTAI SHM module.

Defines

#define GLOBAL_HEAP_ID   0x9ac6d9e5
#define USE_VMALLOC   0
#define USE_GFP_KERNEL   1
#define USE_GFP_ATOMIC   2
#define USE_GFP_DMA   3
#define rtai_kmalloc(name, size)   rt_shm_alloc(name, size, USE_VMALLOC)
 Allocate a chunk of memory to be shared inter-intra kernel modules and Linux processes.
#define rtai_kfree(name)   rt_shm_free(name)
 Free a chunk of shared memory being shared inter-intra kernel modules and Linux processes.
#define RTAI_SHM_DEV   "/dev/rtai_shm"
#define rt_shm_alloc(name, size, suprt)   _rt_shm_alloc(0, name, size, suprt, 0)
#define rt_heap_open(name, size, suprt)   _rt_shm_alloc(0, name, size, suprt, 1)
#define rtai_malloc(name, size)   _rt_shm_alloc(0, name, size, USE_VMALLOC, 0)
 Allocate a chunk of memory to be shared inter-intra kernel modules and Linux processes.
#define rt_shm_alloc_adr(start_address, name, size, suprt)   _rt_shm_alloc(start_address, name, size, suprt, 0)
 Allocate a chunk of memory to be shared inter-intra kernel modules and Linux processes.
#define rt_heap_open_adr(start, name, size, suprt)   _rt_shm_alloc(start, name, size, suprt, 1)
#define rtai_malloc_adr(start_address, name, size)   _rt_shm_alloc(start_address, name, size, USE_VMALLOC, 0)
 Allocate a chunk of memory to be shared inter-intra kernel modules and Linux processes.
#define rtai_free(name, adr)   rt_shm_free(name)
 Free a chunk of shared memory being shared inter-intra kernel modules and Linux processes.
#define rt_heap_close(name, adr)   rt_shm_free(name)
 Close a real time group heap being shared inter-intra kernel modules and Linux processes.
#define rt_heap_init   rt_heap_open
#define rt_heap_create   rt_heap_open
#define rt_heap_acquire   rt_heap_open
#define rt_heap_init_adr   rt_heap_open_adr
#define rt_heap_create_adr   rt_heap_open_adr
#define rt_heap_acquire_adr   rt_heap_open_adr
#define rt_heap_delete   rt_heap_close
#define rt_heap_destroy   rt_heap_close
#define rt_heap_release   rt_heap_close
#define rt_global_heap_open()   rt_heap_open(GLOBAL_HEAP_ID, 0, 0)
 Open the global real time heap to be shared inter-intra kernel modules and Linux processes.
#define rt_global_heap_close()   rt_heap_close(GLOBAL_HEAP_ID, 0)
 Close the global real time heap being shared inter-intra kernel modules and Linux processes.

Functions

static void * _rt_shm_alloc (void *start, unsigned long name, int size, int suprt, int isheap)
static int rt_shm_free (unsigned long name)
 RTAI_PROTO (void *, rt_halloc,(int size))
 RTAI_PROTO (void, rt_hfree,(void *addr))
 RTAI_PROTO (void *, rt_named_halloc,(unsigned long name, int size))
 RTAI_PROTO (void, rt_named_hfree,(void *addr))
 RTAI_PROTO (void *, rt_malloc,(int size))
 RTAI_PROTO (void, rt_free,(void *addr))
 RTAI_PROTO (void *, rt_named_malloc,(unsigned long name, int size))
 RTAI_PROTO (void, rt_named_free,(void *addr))

Define Documentation

#define GLOBAL_HEAP_ID   0x9ac6d9e5
 

Definition at line 38 of file rtai_shm.h.

 
#define rt_global_heap_close  )     rt_heap_close(GLOBAL_HEAP_ID, 0)
 

Close the global real time heap being shared inter-intra kernel modules and Linux processes.

Definition at line 489 of file rtai_shm.h.

 
#define rt_global_heap_open  )     rt_heap_open(GLOBAL_HEAP_ID, 0, 0)
 

Open the global real time heap to be shared inter-intra kernel modules and Linux processes.

Definition at line 471 of file rtai_shm.h.

#define rt_heap_acquire   rt_heap_open
 

Definition at line 445 of file rtai_shm.h.

#define rt_heap_acquire_adr   rt_heap_open_adr
 

Definition at line 448 of file rtai_shm.h.

#define rt_heap_close name,
adr   )     rt_shm_free(name)
 

Close a real time group heap being shared inter-intra kernel modules and Linux processes.

Definition at line 440 of file rtai_shm.h.

#define rt_heap_create   rt_heap_open
 

Definition at line 444 of file rtai_shm.h.

#define rt_heap_create_adr   rt_heap_open_adr
 

Definition at line 447 of file rtai_shm.h.

#define rt_heap_delete   rt_heap_close
 

Definition at line 450 of file rtai_shm.h.

#define rt_heap_destroy   rt_heap_close
 

Definition at line 451 of file rtai_shm.h.

#define rt_heap_init   rt_heap_open
 

Definition at line 443 of file rtai_shm.h.

#define rt_heap_init_adr   rt_heap_open_adr
 

Definition at line 446 of file rtai_shm.h.

#define rt_heap_open name,
size,
suprt   )     _rt_shm_alloc(0, name, size, suprt, 1)
 

Definition at line 226 of file rtai_shm.h.

#define rt_heap_open_adr start,
name,
size,
suprt   )     _rt_shm_alloc(start, name, size, suprt, 1)
 

Definition at line 296 of file rtai_shm.h.

#define rt_heap_release   rt_heap_close
 

Definition at line 452 of file rtai_shm.h.

#define rt_shm_alloc name,
size,
suprt   )     _rt_shm_alloc(0, name, size, suprt, 0)
 

Definition at line 223 of file rtai_shm.h.

Referenced by RTAI_PROTO().

#define rt_shm_alloc_adr start_address,
name,
size,
suprt   )     _rt_shm_alloc(start_address, name, size, suprt, 0)
 

Allocate a chunk of memory to be shared inter-intra kernel modules and Linux processes.

rt_shm_alloc_adr is used to allocate in user space.

Parameters:
start_address is a user desired address where the allocated memory should be mapped in user space;
name is an unsigned long identifier;
size is the amount of required shared memory.
suprt is the kernel allocation method to be used, it can be:
  • USE_VMALLOC, use vmalloc;
  • USE_GFP_KERNEL, use kmalloc with GFP_KERNEL;
  • USE_GFP_ATOMIC, use kmalloc with GFP_ATOMIC;
  • USE_GFP_DMA, use kmalloc with GFP_DMA.
Since name can be a clumsy identifier, services are provided to convert 6 characters identifiers to unsigned long, and vice versa.

See also:
the functions nam2num() and num2nam().
It must be remarked that only the very first call does a real allocation, any subsequent call to allocate with the same name from anywhere will just increase the usage count and map the area to user space, or return the related pointer to the already allocated space in kernel space. The function returns a pointer to the allocated memory, appropriately mapped to the memory space in use. So if one is really sure that the named shared memory has been allocated already parameters size and suprt are not used and can be assigned any value.

Note:
If the same process calls rtai_malloc_adr and rtai_malloc() twice in the same process it get a zero return value on the second call.
Returns:
a valid address on succes, 0 on failure.

Definition at line 293 of file rtai_shm.h.

#define rtai_free name,
adr   )     rt_shm_free(name)
 

Free a chunk of shared memory being shared inter-intra kernel modules and Linux processes.

rtai_free is used to free a shared memory chunk from user space.

Parameters:
name is the unsigned long identifier used when the memory was allocated;
adr is not used.
rtai_free is a legacy helper macro, the real job is carried out by a call to rt_shm_free with the same name. This function should not be used in newly developed applications. See rt_shm_alloc_adr for more details.

Returns:
the size of the succesfully freed memory, 0 on failure.

Definition at line 366 of file rtai_shm.h.

#define rtai_kfree name   )     rt_shm_free(name)
 

Free a chunk of shared memory being shared inter-intra kernel modules and Linux processes.

rtai_kfree is used to free a shared memory chunk from kernel space.

Parameters:
name is the unsigned long identifier used when the memory was allocated;
rtai_kfree is a legacy helper macro, the real job is carried out by a call to rt_shm_free with the same name. This function should not be used in newly developed applications. See rt_shm_free for more details.

Returns:
the size of the succesfully freed memory, 0 on failure.

Definition at line 86 of file rtai_shm.h.

#define rtai_kmalloc name,
size   )     rt_shm_alloc(name, size, USE_VMALLOC)
 

Allocate a chunk of memory to be shared inter-intra kernel modules and Linux processes.

Definition at line 66 of file rtai_shm.h.

#define rtai_malloc name,
size   )     _rt_shm_alloc(0, name, size, USE_VMALLOC, 0)
 

Allocate a chunk of memory to be shared inter-intra kernel modules and Linux processes.

Definition at line 250 of file rtai_shm.h.

#define rtai_malloc_adr start_address,
name,
size   )     _rt_shm_alloc(start_address, name, size, USE_VMALLOC, 0)
 

Allocate a chunk of memory to be shared inter-intra kernel modules and Linux processes.

Definition at line 322 of file rtai_shm.h.

#define RTAI_SHM_DEV   "/dev/rtai_shm"
 

Definition at line 184 of file rtai_shm.h.

Referenced by _rt_shm_alloc(), and rt_shm_free().

#define USE_GFP_ATOMIC   2
 

Definition at line 42 of file rtai_shm.h.

#define USE_GFP_DMA   3
 

Definition at line 43 of file rtai_shm.h.

#define USE_GFP_KERNEL   1
 

Definition at line 41 of file rtai_shm.h.

#define USE_VMALLOC   0
 

Definition at line 40 of file rtai_shm.h.


Function Documentation

static void* _rt_shm_alloc void *  start,
unsigned long  name,
int  size,
int  suprt,
int  isheap
[inline, static]
 

Definition at line 186 of file rtai_shm.h.

References BIDX, HEAP_SET, i, LOW, rtai_lxrt(), RTAI_SHM_DEV, SHM_ALLOC, SHM_FREE, and SIZARG.

static int rt_shm_free unsigned long  name  )  [inline, static]
 

Definition at line 325 of file rtai_shm.h.

References BIDX, i, LOW, rtai_lxrt(), RTAI_SHM_DEV, SHM_SIZE, and SIZARG.

Referenced by RTAI_PROTO().

RTAI_PROTO void  ,
rt_named_free  ,
(void *addr) 
 

Definition at line 411 of file rtai_shm.h.

References BIDX, NAMED_FREE, rtai_lxrt(), and SIZARG.

RTAI_PROTO void *  ,
rt_named_malloc  ,
(unsigned long name, int size) 
 

Definition at line 405 of file rtai_shm.h.

References BIDX, NAMED_MALLOC, rtai_lxrt(), SIZARG, and rtai_lxrt_t::v.

RTAI_PROTO void  ,
rt_free  ,
(void *addr) 
 

Definition at line 399 of file rtai_shm.h.

References BIDX, FREE, rtai_lxrt(), and SIZARG.

RTAI_PROTO void *  ,
rt_malloc  ,
(int size) 
 

Definition at line 393 of file rtai_shm.h.

References BIDX, MALLOC, rtai_lxrt(), SIZARG, and rtai_lxrt_t::v.

RTAI_PROTO void  ,
rt_named_hfree  ,
(void *addr) 
 

Definition at line 387 of file rtai_shm.h.

References BIDX, HEAP_NAMED_FREE, rtai_lxrt(), and SIZARG.

RTAI_PROTO void *  ,
rt_named_halloc  ,
(unsigned long name, int size) 
 

Definition at line 381 of file rtai_shm.h.

References BIDX, HEAP_NAMED_ALLOC, rtai_lxrt(), SIZARG, and rtai_lxrt_t::v.

RTAI_PROTO void  ,
rt_hfree  ,
(void *addr) 
 

Definition at line 375 of file rtai_shm.h.

References BIDX, HEAP_FREE, rtai_lxrt(), and SIZARG.

RTAI_PROTO void *  ,
rt_halloc  ,
(int size) 
 

Definition at line 369 of file rtai_shm.h.

References BIDX, HEAP_ALLOC, rtai_lxrt(), SIZARG, and rtai_lxrt_t::v.


Generated on Fri Sep 1 14:26:03 2006 for Raptor by  doxygen 1.4.4