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. | |
file | shm.c |
Implementation of the RTAI SHM module. | |
Modules | |
Unified RTAI real-time memory management. | |
Defines | |
#define | GLOBAL_HEAP_ID 0x9ac6d9e7 |
#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. | |
#define | RTAI_SHM_MISC_MINOR 254 |
#define | ALIGN2PAGE(adr) ((void *)PAGE_ALIGN((unsigned long)adr)) |
#define | RT_SHM_OP_PERM() (!(_rt_whoami()->is_hard)) |
#define | GLOBAL 0 |
#define | SPECIFIC 1 |
#define | RTAI_TASK(return_instr) |
#define | USE_UDEV_CLASS 0 |
#define | CONFIG_RTAI_USE_TLSF 0 |
#define | CONFIG_RTAI_USE_TLSF 0 |
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) |
Free a chunk of shared memory being shared inter-intra kernel modules and Linux processes. | |
static void * | rt_halloc (int size) |
Allocate a chunk of a group real time heap in kernel/user space. | |
static void | rt_hfree (void *adr) |
Free a chunk of a group real time heap. | |
static void * | rt_named_halloc (unsigned long name, int size) |
Allocate a chunk of a group real time heap in kernel/user space. | |
static void | rt_named_hfree (void *adr) |
Free a chunk of a group real time heap. | |
static void * | rt_malloc (int size) |
static void | rt_free (void *addr) |
static void * | rt_named_malloc (unsigned long name, int size) |
Allocate a chunk of the global real time heap in kernel/user space. | |
static void | rt_named_free (void *adr) |
Free a named chunk of the global real time heap. | |
MODULE_LICENSE ("GPL") | |
static void * | _rt_shm_alloc (unsigned long name, int size, int suprt) |
static int | _rt_shm_free (unsigned long name, int size) |
void * | rt_shm_alloc (unsigned long name, int size, int suprt) |
Allocate a chunk of memory to be shared inter-intra kernel modules and Linux processes. | |
static RTAI_SYSCALL_MODE int | rt_shm_alloc_usp (unsigned long name, int size, int suprt) |
static RTAI_SYSCALL_MODE int | rt_shm_size (unsigned long *arg) |
static void | rtai_shm_vm_open (struct vm_area_struct *vma) |
static void | rtai_shm_vm_close (struct vm_area_struct *vma) |
static RTAI_SYSCALL_MODE void | rt_set_heap (unsigned long, void *) |
static int | rtai_shm_f_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) |
static int | rtai_shm_f_mmap (struct file *file, struct vm_area_struct *vma) |
static void * | _rt_halloc (int size, struct rt_heap_t *heap) |
static void | _rt_hfree (void *addr, struct rt_heap_t *heap) |
static void * | rt_halloc_typed (int size, int htype) |
static void | rt_hfree_typed (void *addr, int htype) |
static void * | rt_named_halloc_typed (unsigned long name, int size, int htype) |
static void | rt_named_hfree_typed (void *adr, int htype) |
static RTAI_SYSCALL_MODE void * | rt_malloc_usp (int size) |
static RTAI_SYSCALL_MODE void | rt_free_usp (void *adr) |
static RTAI_SYSCALL_MODE void * | rt_named_malloc_usp (unsigned long name, int size) |
static RTAI_SYSCALL_MODE void | rt_named_free_usp (void *adr) |
void * | rt_heap_open (unsigned long name, int size, int suprt) |
Open/create a named group real time heap to be shared inter-intra kernel modules and Linux processes. | |
int | set_rt_fun_entries (struct rt_native_fun_entry *entry) |
void | reset_rt_fun_entries (struct rt_native_fun_entry *entry) |
int | __rtai_shm_init (void) |
void | __rtai_shm_exit (void) |
RTAI_MODULE_PARM (rtai_global_heap_size, int) | |
static void * | alloc_extent (u_long size, int suprt) |
static void | free_extent (void *p, u_long size, int suprt) |
static void | init_extent (rtheap_t *heap, rtextent_t *extent) |
int | rtheap_init (rtheap_t *heap, void *heapaddr, u_long heapsize, u_long pagesize, int suprt) |
Initialize a memory heap. | |
void | rtheap_destroy (rtheap_t *heap, int suprt) |
static caddr_t | get_free_range (rtheap_t *heap, u_long bsize, int log2size, int mode) |
void * | rtheap_alloc (rtheap_t *heap, u_long size, int mode) |
Allocate a memory block from a memory heap. | |
int | rtheap_free (rtheap_t *heap, void *block) |
Release a memory block to a memory heap. | |
int | __rtai_heap_init (void) |
void | __rtai_heap_exit (void) |
EXPORT_SYMBOL (rtheap_init) | |
EXPORT_SYMBOL (rtheap_destroy) | |
EXPORT_SYMBOL (rtheap_alloc) | |
EXPORT_SYMBOL (rtheap_free) | |
EXPORT_SYMBOL (rtai_global_heap) | |
EXPORT_SYMBOL (rtai_global_heap_adr) | |
EXPORT_SYMBOL (rtai_global_heap_size) | |
Variables | |
static int | SUPRT [] = { 0, GFP_KERNEL, GFP_ATOMIC, GFP_DMA } |
static struct vm_operations_struct | rtai_shm_vm_ops |
static struct file_operations | rtai_shm_fops |
static struct miscdevice | rtai_shm_dev |
rtheap_t | rtai_global_heap |
void * | rtai_global_heap_adr |
int | rtai_global_heap_size |
rt_native_fun_entry | rt_shm_entries [] |
int | rtai_global_heap_size = RTHEAP_GLOBALSZ |
void * | rtai_global_heap_adr = NULL |
rtheap_t | rtai_global_heap |
int | rtai_global_heap_size = RTHEAP_GLOBALSZ |
void * | rtai_global_heap_adr = NULL |
rtheap_t | rtai_global_heap |
#define ALIGN2PAGE | ( | adr | ) | ((void *)PAGE_ALIGN((unsigned long)adr)) |
Definition at line 48 of file shm.c.
Referenced by _rt_shm_alloc(), rt_set_heap(), and rtai_shm_f_mmap().
#define CONFIG_RTAI_USE_TLSF 0 |
#define GLOBAL 0 |
Definition at line 271 of file shm.c.
Referenced by __rtai_shm_init(), rt_free_usp(), rt_malloc_usp(), rt_named_free_usp(), rt_named_malloc_usp(), and rt_set_heap().
#define GLOBAL_HEAP_ID 0x9ac6d9e7 |
Definition at line 38 of file rtai_shm.h.
Referenced by __rtai_shm_exit(), __rtai_shm_init(), _rt_shm_free(), and rt_set_heap().
#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.
For internal use only.
rt_global_heap_close is used to close the global real time heap.
Closing a global heap in user space has just the effect of deregistering its use and unmapping the related memory from a process address space. In kernel tasks just the deregistration is performed. The global real time heap is destroyed just a the rmmoding of the shared memory module.
Definition at line 539 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.
For internal use only.
rt_global_heap_open is used to open the global real time heap.
The global heap is created by the shared memory module and its opening is needed in user space to map it to the process address space. In kernel space opening the global heap in a task is not required but should be done anyhow, both for symmetry and to register its usage.
Definition at line 521 of file rtai_shm.h.
#define rt_heap_acquire rt_heap_open |
Definition at line 495 of file rtai_shm.h.
#define rt_heap_acquire_adr rt_heap_open_adr |
Definition at line 498 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.
For internal use only.
rt_heap_close is used to close a previously opened real time group heap.
name | is the unsigned long identifier used to identify the heap. | |
adr | is not used. |
Definition at line 490 of file rtai_shm.h.
#define rt_heap_create rt_heap_open |
Definition at line 494 of file rtai_shm.h.
#define rt_heap_create_adr rt_heap_open_adr |
Definition at line 497 of file rtai_shm.h.
#define rt_heap_delete rt_heap_close |
Definition at line 500 of file rtai_shm.h.
#define rt_heap_destroy rt_heap_close |
Definition at line 501 of file rtai_shm.h.
#define rt_heap_init rt_heap_open |
Definition at line 493 of file rtai_shm.h.
#define rt_heap_init_adr rt_heap_open_adr |
Definition at line 496 of file rtai_shm.h.
#define rt_heap_open | ( | name, | |||
size, | |||||
suprt | ) | _rt_shm_alloc(0, name, size, suprt, 1) |
Definition at line 270 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 346 of file rtai_shm.h.
#define rt_heap_release rt_heap_close |
Definition at line 502 of file rtai_shm.h.
#define rt_shm_alloc | ( | name, | |||
size, | |||||
suprt | ) | _rt_shm_alloc(0, name, size, suprt, 0) |
#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.
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:
|
name
can be a clumsy identifier, services are provided to convert 6 characters identifiers to unsigned long, and vice versa.
Definition at line 343 of file rtai_shm.h.
#define RT_SHM_OP_PERM | ( | ) | (!(_rt_whoami()->is_hard)) |
#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.
name | is the unsigned long identifier used when the memory was allocated; | |
adr | is not used. |
Definition at line 416 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.
name | is the unsigned long identifier used when the memory was allocated; |
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.
For internal use only.
rtai_kalloc is used to allocate shared memory from kernel space.
name | is an unsigned long identifier; | |
size | is the amount of required shared memory; |
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.
For internal use only.
rtai_malloc is used to allocate shared memory from user space.
name | is an unsigned long identifier; | |
size | is the amount of required shared memory; |
Definition at line 297 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.
For internal use only.
rtai_malloc_adr is used to allocate shared memory from user space.
start_address | is the adr were the shared memory should be mapped. | |
name | is an unsigned long identifier; | |
size | is the amount of required shared memory; |
Definition at line 372 of file rtai_shm.h.
#define RTAI_SHM_DEV "/dev/rtai_shm" |
#define RTAI_SHM_MISC_MINOR 254 |
#define RTAI_TASK | ( | return_instr | ) |
Value:
do { \ if (!(task = _rt_whoami())->is_hard) { \ if (!(task = current->rtai_tskext(TSKEXT0))) { \ return_instr; \ } \ } \ } while (0)
Definition at line 379 of file shm.c.
Referenced by rt_halloc_typed(), rt_hfree_typed(), rt_named_halloc_typed(), rt_named_hfree_typed(), and rt_set_heap().
#define SPECIFIC 1 |
#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.
void __rtai_heap_exit | ( | void | ) |
Definition at line 1420 of file malloc.c.
References printk(), rtai_global_heap, and rtheap_destroy().
Here is the call graph for this function:
int __rtai_heap_init | ( | void | ) |
Definition at line 1408 of file malloc.c.
References CONFIG_RTAI_USE_TLSF, printk(), rtai_global_heap, rtai_global_heap_adr, rtai_global_heap_size, and rtheap_init().
Here is the call graph for this function:
void __rtai_shm_exit | ( | void | ) |
Definition at line 694 of file shm.c.
References _rt_shm_free(), GLOBAL_HEAP_ID, max_slots, rt_registry_entry::name, rt_drg_on_name_cnt(), rt_get_registry_slot(), rt_printk(), and rt_registry_entry::type.
Here is the call graph for this function:
int __rtai_shm_init | ( | void | ) |
Definition at line 663 of file shm.c.
References GLOBAL, GLOBAL_HEAP_ID, printk(), rt_register(), rt_smp_linux_task, RTAI_SHM_MISC_MINOR, and set_rt_fun_entries().
Here is the call graph for this function:
static void* _rt_halloc | ( | int | size, | |
struct rt_heap_t * | heap | |||
) | [inline, static] |
Definition at line 256 of file shm.c.
References rtheap_alloc().
Referenced by rt_halloc_typed(), and rt_named_halloc_typed().
Here is the call graph for this function:
static void _rt_hfree | ( | void * | addr, | |
struct rt_heap_t * | heap | |||
) | [inline, static] |
Definition at line 266 of file shm.c.
References rtheap_free().
Referenced by rt_hfree_typed(), rt_named_halloc_typed(), and rt_named_hfree_typed().
Here is the call graph for this function:
static void* _rt_shm_alloc | ( | unsigned long | name, | |
int | size, | |||
int | suprt | |||
) | [inline, static] |
Definition at line 53 of file shm.c.
References ALIGN2PAGE, rkfree(), rkmalloc(), rt_get_adr_cnt(), rt_register(), RT_SHM_OP_PERM, rvfree(), rvmalloc(), and SUPRT.
Here is the call graph for this function:
static void* _rt_shm_alloc | ( | void * | start, | |
unsigned long | name, | |||
int | size, | |||
int | suprt, | |||
int | isheap | |||
) | [inline, static] |
Definition at line 233 of file rtai_shm.h.
References BIDX, HEAP_SET, LOW, rtai_lxrt(), RTAI_SHM_DEV, SHM_ALLOC, SHM_FREE, and SIZARG.
Referenced by rt_shm_alloc(), and rt_shm_alloc_usp().
Here is the call graph for this function:
static int _rt_shm_free | ( | unsigned long | name, | |
int | size | |||
) | [inline, static] |
Definition at line 75 of file shm.c.
References GLOBAL_HEAP_ID, rkfree(), rt_drg_on_name_cnt(), rt_get_adr(), RT_SHM_OP_PERM, and rvfree().
Referenced by __rtai_shm_exit(), rtai_shm_f_ioctl(), and rtai_shm_vm_close().
Here is the call graph for this function:
static void * alloc_extent | ( | u_long | size, | |
int | suprt | |||
) | [static] |
EXPORT_SYMBOL | ( | rtai_global_heap_size | ) |
EXPORT_SYMBOL | ( | rtai_global_heap_adr | ) |
EXPORT_SYMBOL | ( | rtai_global_heap | ) |
EXPORT_SYMBOL | ( | rtheap_free | ) |
EXPORT_SYMBOL | ( | rtheap_alloc | ) |
EXPORT_SYMBOL | ( | rtheap_destroy | ) |
EXPORT_SYMBOL | ( | rtheap_init | ) |
static void free_extent | ( | void * | p, | |
u_long | size, | |||
int | suprt | |||
) | [static] |
static caddr_t get_free_range | ( | rtheap_t * | heap, | |
u_long | bsize, | |||
int | log2size, | |||
int | mode | |||
) | [static] |
static void init_extent | ( | rtheap_t * | heap, | |
rtextent_t * | extent | |||
) | [static] |
MODULE_LICENSE | ( | "GPL" | ) |
void reset_rt_fun_entries | ( | struct rt_native_fun_entry * | entry | ) |
static void rt_free | ( | void * | addr | ) | [inline, static] |
Definition at line 449 of file rtai_shm.h.
References BIDX, FREE, rtai_lxrt(), and SIZARG.
Referenced by __rt_proxy_attach(), __task_delete(), __task_init(), _receive(), _rt_named_msgq_init(), _rt_named_rwl_init(), _rt_named_spl_init(), _rt_typed_named_mbx_init(), _rt_typed_named_sem_init(), delete_queue(), free_bad_task(), handle_lxrt_request(), linux_process_termination(), lxrt_fun_call_wbuf(), rt_bits_delete_u(), rt_bits_init_u(), rt_delete_tasklet(), rt_mbx_delete(), rt_msgq_delete(), rt_named_bits_delete(), rt_named_bits_init(), rt_named_mbx_delete(), rt_named_msgq_delete(), rt_named_rwl_delete(), rt_named_sem_delete(), rt_named_spl_delete(), rt_named_task_delete(), rt_named_task_init(), rt_named_task_init_cpuid(), rt_Proxy_detach(), rt_proxy_detach(), rt_ptimer_delete(), rt_request_signal(), and signal_suprt_fun().
Here is the call graph for this function:
static RTAI_SYSCALL_MODE void rt_free_usp | ( | void * | adr | ) | [static] |
Definition at line 545 of file shm.c.
References GLOBAL, and rt_hfree_typed().
Here is the call graph for this function:
RTAI_SYSCALL_MODE void * rt_halloc | ( | int | size | ) | [inline, static] |
Allocate a chunk of a group real time heap in kernel/user space.
Since it is not named there is no chance to retrieve and share it elsewhere.
For internal use only.
rt_halloc is used to allocate a non sharable piece of a group real time heap.
size | is the size of the requested memory in bytes; |
Definition at line 419 of file rtai_shm.h.
References BIDX, HEAP_ALLOC, rtai_lxrt(), SIZARG, and rtai_lxrt_t::v.
Here is the call graph for this function:
static void* rt_halloc_typed | ( | int | size, | |
int | htype | |||
) | [inline, static] |
Definition at line 388 of file shm.c.
References _rt_halloc(), RTAI_TASK, and task.
Referenced by rt_malloc_usp().
Here is the call graph for this function:
void* rt_heap_open | ( | unsigned long | name, | |
int | size, | |||
int | suprt | |||
) |
Open/create a named group real time heap to be shared inter-intra kernel modules and Linux processes.
For internal use only.
rt_heap_open is used to allocate open/create a shared real time heap.
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:
|
Definition at line 624 of file shm.c.
References rt_set_heap(), and rt_shm_alloc.
Here is the call graph for this function:
RTAI_SYSCALL_MODE void rt_hfree | ( | void * | adr | ) | [inline, static] |
Free a chunk of a group real time heap.
For internal use only.
rt_hfree is used to free a previously allocated chunck of a group real time heap.
adr | is the addr of the memory to be freed. |
Definition at line 425 of file rtai_shm.h.
References BIDX, HEAP_FREE, rtai_lxrt(), and SIZARG.
Here is the call graph for this function:
static void rt_hfree_typed | ( | void * | addr, | |
int | htype | |||
) | [inline, static] |
Definition at line 396 of file shm.c.
References _rt_hfree(), RTAI_TASK, and task.
Referenced by rt_free_usp().
Here is the call graph for this function:
static void* rt_malloc | ( | int | size | ) | [inline, static] |
Definition at line 443 of file rtai_shm.h.
References BIDX, MALLOC, rtai_lxrt(), SIZARG, and rtai_lxrt_t::v.
Referenced by __rt_proxy_attach(), __task_init(), _broadcast(), _rt_named_msgq_init(), _rt_named_rwl_init(), _rt_named_spl_init(), _rt_typed_named_mbx_init(), _rt_typed_named_sem_init(), _send(), handle_lxrt_request(), lxrt_fun_call_wbuf(), new_bad_task(), rt_alloc_dynamic_task(), rt_bits_init_u(), rt_msgq_init(), rt_named_bits_init(), rt_named_task_init(), rt_named_task_init_cpuid(), rt_request_signal(), rt_request_signal_(), rt_request_signal_mq(), and rt_typed_mbx_init().
Here is the call graph for this function:
static RTAI_SYSCALL_MODE void* rt_malloc_usp | ( | int | size | ) | [static] |
Definition at line 540 of file shm.c.
References GLOBAL, and rt_halloc_typed().
Here is the call graph for this function:
void rt_named_free | ( | void * | adr | ) | [inline, static] |
Free a named chunk of the global real time heap.
For internal use only.
rt_named_free is used to free a previously allocated chunk of the global real time heap.
adr | is the addr of the memory to be freed. |
Definition at line 461 of file rtai_shm.h.
References BIDX, NAMED_FREE, rtai_lxrt(), and SIZARG.
Here is the call graph for this function:
static RTAI_SYSCALL_MODE void rt_named_free_usp | ( | void * | adr | ) | [static] |
Definition at line 557 of file shm.c.
References GLOBAL, and rt_named_hfree_typed().
Here is the call graph for this function:
RTAI_SYSCALL_MODE void * rt_named_halloc | ( | unsigned long | name, | |
int | size | |||
) | [inline, static] |
Allocate a chunk of a group real time heap in kernel/user space.
Since it is named it can be retrieved and shared everywhere among the group peers, i.e all processes/tasks that have opened the same group heap.
For internal use only.
rt_named_halloc is used to allocate a sharable piece of a group real time heap.
name | is an unsigned long identifier; | |
size | is the amount of required shared memory; |
Definition at line 431 of file rtai_shm.h.
References BIDX, HEAP_NAMED_ALLOC, rtai_lxrt(), SIZARG, and rtai_lxrt_t::v.
Here is the call graph for this function:
static void* rt_named_halloc_typed | ( | unsigned long | name, | |
int | size, | |||
int | htype | |||
) | [inline, static] |
Definition at line 404 of file shm.c.
References _rt_halloc(), _rt_hfree(), IS_HPCK, rt_get_adr_cnt(), rt_register(), RTAI_TASK, and task.
Referenced by rt_named_malloc_usp().
Here is the call graph for this function:
RTAI_SYSCALL_MODE void rt_named_hfree | ( | void * | adr | ) | [inline, static] |
Free a chunk of a group real time heap.
For internal use only.
rt_named_hfree is used to free a previously allocated chunk of the global real time heap.
adr | is the address of the memory to be freed. |
Definition at line 437 of file rtai_shm.h.
References BIDX, HEAP_NAMED_FREE, rtai_lxrt(), and SIZARG.
Here is the call graph for this function:
static void rt_named_hfree_typed | ( | void * | adr, | |
int | htype | |||
) | [inline, static] |
Definition at line 422 of file shm.c.
References _rt_hfree(), rt_drg_on_name_cnt(), rt_get_name(), RTAI_TASK, and task.
Referenced by rt_named_free_usp().
Here is the call graph for this function:
void * rt_named_malloc | ( | unsigned long | name, | |
int | size | |||
) | [inline, static] |
Allocate a chunk of the global real time heap in kernel/user space.
Since it is named it can be retrieved and shared everywhere.
For internal use only.
rt_named_malloc is used to allocate a sharable piece of the global real time heap.
name | is an unsigned long identifier; | |
size | is the amount of required shared memory; |
Definition at line 455 of file rtai_shm.h.
References BIDX, NAMED_MALLOC, rtai_lxrt(), SIZARG, and rtai_lxrt_t::v.
Here is the call graph for this function:
static RTAI_SYSCALL_MODE void* rt_named_malloc_usp | ( | unsigned long | name, | |
int | size | |||
) | [static] |
Definition at line 552 of file shm.c.
References GLOBAL, and rt_named_halloc_typed().
Here is the call graph for this function:
static RTAI_SYSCALL_MODE void rt_set_heap | ( | unsigned | long, | |
void * | ||||
) | [static] |
Definition at line 564 of file shm.c.
References ALIGN2PAGE, atomic_cmpxchg(), GLOBAL, GLOBAL_HEAP_ID, rt_get_adr(), rt_get_type(), RTAI_TASK, rtheap_init(), SPECIFIC, and task.
Referenced by rt_heap_open(), and rtai_shm_f_ioctl().
Here is the call graph for this function:
void* rt_shm_alloc | ( | unsigned long | name, | |
int | size, | |||
int | suprt | |||
) |
Allocate a chunk of memory to be shared inter-intra kernel modules and Linux processes.
For internal use only.
rt_shm_alloc is used to allocate shared memory.
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:
|
Definition at line 130 of file shm.c.
References _rt_shm_alloc(), and TRACE_RTAI_SHM.
Here is the call graph for this function:
static RTAI_SYSCALL_MODE int rt_shm_alloc_usp | ( | unsigned long | name, | |
int | size, | |||
int | suprt | |||
) | [static] |
Definition at line 136 of file shm.c.
References _rt_shm_alloc(), current, rt_get_type(), TRACE_RTAI_SHM, and TSKEXT1.
Referenced by rtai_shm_f_ioctl().
Here is the call graph for this function:
RTAI_SYSCALL_MODE int rt_shm_free | ( | unsigned long | name | ) | [inline, static] |
Free a chunk of shared memory being shared inter-intra kernel modules and Linux processes.
For internal use only.
rt_shm_free is used to free a previously allocated shared memory.
name | is the unsigned long identifier used when the memory was allocated; |
Definition at line 375 of file rtai_shm.h.
References BIDX, LOW, rtai_lxrt(), RTAI_SHM_DEV, SHM_SIZE, and SIZARG.
Referenced by RTAI_SCB_PROTO().
Here is the call graph for this function:
static RTAI_SYSCALL_MODE int rt_shm_size | ( | unsigned long * | arg | ) | [static] |
Definition at line 173 of file shm.c.
References current, and rt_get_type().
Referenced by rtai_shm_f_ioctl().
Here is the call graph for this function:
RTAI_MODULE_PARM | ( | rtai_global_heap_size | , | |
int | ||||
) |
static int rtai_shm_f_ioctl | ( | struct inode * | inode, | |
struct file * | file, | |||
unsigned int | cmd, | |||
unsigned long | arg | |||
) | [static] |
Definition at line 207 of file shm.c.
References _rt_shm_free(), current, HEAP_SET, rt_get_type(), rt_set_heap(), rt_shm_alloc_usp(), rt_shm_size(), SHM_ALLOC, SHM_FREE, SHM_SIZE, and TRACE_RTAI_SHM.
Here is the call graph for this function:
static int rtai_shm_f_mmap | ( | struct file * | file, | |
struct vm_area_struct * | vma | |||
) | [static] |
Definition at line 232 of file shm.c.
References ALIGN2PAGE, current, rkmmap(), rt_get_adr(), rt_get_type(), rvmmap(), TSKEXT0, and TSKEXT1.
Here is the call graph for this function:
static void rtai_shm_vm_close | ( | struct vm_area_struct * | vma | ) | [static] |
Definition at line 193 of file shm.c.
References _rt_shm_free(), and rt_get_type().
Here is the call graph for this function:
static void rtai_shm_vm_open | ( | struct vm_area_struct * | vma | ) | [static] |
Definition at line 188 of file shm.c.
References rt_get_adr_cnt().
Here is the call graph for this function:
void * rtheap_alloc | ( | rtheap_t * | heap, | |
u_long | size, | |||
int | flags | |||
) |
Allocate a memory block from a memory heap.
Allocates a contiguous region of memory from an active memory heap. Such allocation is guaranteed to be time-bounded if the heap is non-extendable (see rtheap_init()). Otherwise, it might trigger a dynamic extension of the storage area through an internal request to the Linux allocation service (kmalloc/vmalloc).
heap | The descriptor address of the heap to get memory from. | |
size | The size in bytes of the requested block. Sizes lower or equal to the page size are rounded either to the minimum allocation size if lower than this value, or to the minimum alignment size if greater or equal to this value. In the current implementation, with MINALLOC = 16 and MINALIGN = 16, a 15 bytes request will be rounded to 16 bytes, and a 17 bytes request will be rounded to 32. | |
flags | A set of flags affecting the operation. Unless RTHEAP_EXTEND is passed and the heap is extendable, this service will return NULL without attempting to extend the heap dynamically upon memory starvation. |
Context: This routine can always be called on behalf of a thread context. It can also be called on behalf of an IST context if the heap storage area has been statically-defined at initialization time (see rtheap_init()).
Definition at line 1164 of file malloc.c.
References get_free_range(), rt_spin_lock_irqsave(), and rt_spin_unlock_irqrestore.
Referenced by _rt_halloc().
Here is the call graph for this function:
void rtheap_destroy | ( | rtheap_t * | heap, | |
int | suprt | |||
) |
Definition at line 1017 of file malloc.c.
References free_extent().
Referenced by __rtai_heap_exit(), __rtai_lxrt_exit(), and __rtai_lxrt_init().
Here is the call graph for this function:
int rtheap_free | ( | rtheap_t * | heap, | |
void * | block | |||
) |
Release a memory block to a memory heap.
Releases a memory region to the memory heap it was previously allocated from.
heap | The descriptor address of the heap to release memory to. | |
block | The address of the region to release returned by a previous call to rtheap_alloc(). |
Context: This routine can be called on behalf of a thread or IST context
Definition at line 1264 of file malloc.c.
References rt_spin_lock_irqsave(), and rt_spin_unlock_irqrestore.
Referenced by _rt_hfree().
Here is the call graph for this function:
int rtheap_init | ( | rtheap_t * | heap, | |
void * | heapaddr, | |||
u_long | heapsize, | |||
u_long | pagesize, | |||
int | suprt | |||
) |
Initialize a memory heap.
Initializes a memory heap suitable for dynamic memory allocation requests. The heap manager can operate in two modes, whether time-bounded if the heap storage area and size are statically defined at initialization time, or dynamically extendable at the expense of a less deterministic behaviour.
heap | The address of a heap descriptor the memory manager will use to store the allocation data. This descriptor must always be valid while the heap is active therefore it must be allocated in permanent memory. | |
heapaddr | The address of a statically-defined heap storage area. If this parameter is non-zero, all allocations will be made from the given area in fully time-bounded mode. In such a case, the heap is non-extendable. If a null address is passed, the heap manager will attempt to extend the heap each time a memory starvation is encountered. In the latter case, the heap manager will request additional chunks of core memory to Linux when needed, voiding the real-time guarantee for the caller. | |
heapsize | If heapaddr is non-zero, heapsize gives the size in bytes of the statically-defined storage area. Otherwise, heapsize defines the standard length of each extent that will be requested to Linux when a memory starvation is encountered for the heap. heapsize must be a multiple of pagesize and lower than 16 Mbytes. Depending on the Linux allocation service used, requests for extent memory might be limited in size. For instance, heapsize must be lower than 128Kb for kmalloc()-based allocations. In the current implementation, heapsize must be large enough to contain an internal header. The following formula gives the size of this header: hdrsize = (sizeof(rtextent_t) + ((heapsize - sizeof(rtextent_t))) / (pagesize + 1) + 15) & ~15; | |
pagesize | The size in bytes of the fundamental memory page which will be used to subdivide the heap internally. Choosing the right page size is important regarding performance and memory fragmentation issues, so it might be a good idea to take a look at http://docs.FreeBSD.org/44doc/papers/kernmalloc.pdf to pick the best one for your needs. In the current implementation, pagesize must be a power of two in the range [ 8 .. 32768] inclusive. |
Context: This routine must be called on behalf of a thread context.
Definition at line 911 of file malloc.c.
References alloc_extent(), free_extent(), and init_extent().
Referenced by __rtai_heap_init(), __rtai_lxrt_init(), and rt_set_heap().
Here is the call graph for this function:
int set_rt_fun_entries | ( | struct rt_native_fun_entry * | entry | ) |
struct rt_native_fun_entry rt_shm_entries[] |
Initial value:
{ { { 0, rt_shm_alloc_usp }, SHM_ALLOC }, { { 0, rt_shm_free }, SHM_FREE }, { { 0, rt_shm_size }, SHM_SIZE }, { { 0, rt_set_heap }, HEAP_SET}, { { 0, rt_halloc }, HEAP_ALLOC }, { { 0, rt_hfree }, HEAP_FREE }, { { 0, rt_named_halloc }, HEAP_NAMED_ALLOC }, { { 0, rt_named_hfree }, HEAP_NAMED_FREE }, { { 0, rt_malloc_usp }, MALLOC }, { { 0, rt_free_usp }, FREE }, { { 0, rt_named_malloc_usp }, NAMED_MALLOC }, { { 0, rt_named_free_usp }, NAMED_FREE }, { { 0, 0 }, 000 } }
rtheap_t rtai_global_heap |
rtheap_t rtai_global_heap |
rtheap_t rtai_global_heap |
void* rtai_global_heap_adr = NULL |
void* rtai_global_heap_adr = NULL |
void* rtai_global_heap_adr |
int rtai_global_heap_size = RTHEAP_GLOBALSZ |
int rtai_global_heap_size = RTHEAP_GLOBALSZ |
struct miscdevice rtai_shm_dev [static] |
Initial value:
{ RTAI_SHM_MISC_MINOR, "rtai_shm", &rtai_shm_fops }
struct file_operations rtai_shm_fops [static] |
Initial value:
{ ioctl: rtai_shm_f_ioctl, mmap: rtai_shm_f_mmap }
struct vm_operations_struct rtai_shm_vm_ops [static] |
Initial value:
{ open: rtai_shm_vm_open, close: rtai_shm_vm_close }
int SUPRT[] = { 0, GFP_KERNEL, GFP_ATOMIC, GFP_DMA } [static] |