00001
00049 #ifndef _RTAI_HEAP_H
00050 #define _RTAI_HEAP_H
00051
00052 #include <nucleus/synch.h>
00053 #include <nucleus/heap.h>
00054 #include <rtai/types.h>
00055
00056 struct RT_TASK;
00057
00058
00059 #define H_PRIO XNSYNCH_PRIO
00060 #define H_FIFO XNSYNCH_FIFO
00061 #define H_DMA 0x100
00062 #define H_SHARED 0x200
00063
00064 typedef struct rt_heap_info {
00065
00066 int nwaiters;
00067
00068 int mode;
00069
00070 size_t heapsize;
00071
00072 char name[XNOBJECT_NAME_LEN];
00073
00074 } RT_HEAP_INFO;
00075
00076 typedef struct rt_heap_placeholder {
00077
00078 rt_handle_t opaque;
00079
00080 void *opaque2;
00081
00082 caddr_t mapbase;
00083
00084 size_t mapsize;
00085
00086 } RT_HEAP_PLACEHOLDER;
00087
00088 #if defined(__KERNEL__) || defined(__RTAI_SIM__)
00089
00090 #define RTAI_HEAP_MAGIC 0x55550808
00091
00092 typedef struct rt_heap {
00093
00094 unsigned magic;
00095
00096 xnsynch_t synch_base;
00097
00098 xnheap_t heap_base;
00099
00100 int mode;
00101
00102 void *shm_block;
00103
00104 rt_handle_t handle;
00105
00106 char name[XNOBJECT_NAME_LEN];
00107
00108 #if defined(__KERNEL__) && defined(CONFIG_RTAI_OPT_FUSION)
00109 int source;
00110 #endif
00111
00112 } RT_HEAP;
00113
00114 #ifdef __cplusplus
00115 extern "C" {
00116 #endif
00117
00118 int __heap_pkg_init(void);
00119
00120 void __heap_pkg_cleanup(void);
00121
00122 #ifdef __cplusplus
00123 }
00124 #endif
00125
00126 #else
00127
00128 typedef RT_HEAP_PLACEHOLDER RT_HEAP;
00129
00130 int rt_heap_bind(RT_HEAP *heap,
00131 const char *name);
00132
00133 int rt_heap_unbind(RT_HEAP *heap);
00134
00135 #endif
00136
00137 #ifdef __cplusplus
00138 extern "C" {
00139 #endif
00140
00141
00142
00143 int rt_heap_create(RT_HEAP *heap,
00144 const char *name,
00145 size_t heapsize,
00146 int mode);
00147
00148 int rt_heap_delete(RT_HEAP *heap);
00149
00150 int rt_heap_alloc(RT_HEAP *heap,
00151 size_t size,
00152 RTIME timeout,
00153 void **blockp);
00154
00155 int rt_heap_free(RT_HEAP *heap,
00156 void *block);
00157
00158 int rt_heap_inquire(RT_HEAP *heap,
00159 RT_HEAP_INFO *info);
00160
00161 #ifdef __cplusplus
00162 }
00163 #endif
00164
00165 #endif