Xenomai API
2.5.6.1
|
00001 00023 #ifndef _XENO_NUCLEUS_MAP_H 00024 #define _XENO_NUCLEUS_MAP_H 00025 00029 #include <nucleus/types.h> 00030 00031 #define XNMAP_MAX_KEYS (BITS_PER_LONG * BITS_PER_LONG) 00032 00033 typedef struct xnmap { 00034 00035 int nkeys; 00036 int ukeys; 00037 int offset; 00038 unsigned long himask; 00039 unsigned long himap; 00040 #define __IDMAP_LONGS ((XNMAP_MAX_KEYS+BITS_PER_LONG-1)/BITS_PER_LONG) 00041 unsigned long lomap[__IDMAP_LONGS]; 00042 #undef __IDMAP_LONGS 00043 void *objarray[1]; 00044 00045 } xnmap_t; 00046 00047 xnmap_t *xnmap_create(int nkeys, 00048 int reserve, 00049 int offset); 00050 00051 void xnmap_delete(xnmap_t *map); 00052 00053 int xnmap_enter(xnmap_t *map, 00054 int key, 00055 void *objaddr); 00056 00057 int xnmap_remove(xnmap_t *map, 00058 int key); 00059 00060 static inline void *xnmap_fetch_nocheck(xnmap_t *map, int key) 00061 { 00062 int ofkey = key - map->offset; 00063 return map->objarray[ofkey]; 00064 } 00065 00066 static inline void *xnmap_fetch(xnmap_t *map, int key) 00067 { 00068 int ofkey = key - map->offset; 00069 00070 if (ofkey < 0 || ofkey >= map->nkeys) 00071 return NULL; 00072 00073 return map->objarray[ofkey]; 00074 } 00075 00078 #endif /* !_XENO_NUCLEUS_MAP_H */