Skip to contentSkip to conversation

RTDM in user mode

PATCH In review Alexis Berlemont 1 participant 1 message Dec 31, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 RTDM in user mode

Patch 1: user-side code.

Alexis.

 Makefile.am |   15 +
 device.c    |  569 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 drvlib.c    |  636 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 init.c      |    6 
 internal.h  |  119 +++++++++++
 wrappers.c  |   95 ++++++++
 wrappers.h  |   26 ++
 7 files changed, 1463 insertions(+), 3 deletions(-)
skins/rtdm/Makefile.am +14 -1
Index: src/skins/rtdm/Makefile.am
===================================================================
@@ -1,4 +1,4 @@
-lib_LTLIBRARIES = librtdm.la
+lib_LTLIBRARIES = librtdm.la librtdm_user.la
 
 librtdm_la_LDFLAGS = -version-info 1:0:0 -lpthread
 
@@ -9,3 +9,16 @@
 librtdm_la_CPPFLAGS = \
 	@XENO_USER_CFLAGS@ \
 	-I$(top_srcdir)/include
+
+librtdm_user_la_LDFLAGS = -version-info 1:0:0 -lpthread
+
+librtdm_user_la_SOURCES = \
+	init.c \
+	drvlib.c \
+	device.c \
+	wrappers.c \
+	wrappers.h
+
+librtdm_user_la_CPPFLAGS = \
+	@XENO_USER_CFLAGS@ \
+	-I$(top_srcdir)/include
skins/rtdm/device.c +569 -0

569 lines not on this page · raw message

skins/rtdm/drvlib.c +636 -0

636 lines not on this page · raw message

skins/rtdm/init.c +4 -2
Index: src/skins/rtdm/init.c
===================================================================
@@ -20,12 +20,13 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
+#include <rtdm/rtdm_driver.h>
 #include <rtdm/syscall.h>
 #include <asm-generic/bits/bind.h>
 
 int __rtdm_muxid = -1;
 
-static __attribute__ ((constructor))
+static __attribute__ ((constructor(101)))
 void __init_rtdm_interface(void)
 {
 	/* The following call may fail; binding errors will be
@@ -35,5 +36,6 @@
 	__rtdm_muxid =
 		xeno_bind_skin_opt(RTDM_SKIN_MAGIC, "rtdm", "xeno_rtdm");
 	__rtdm_muxid = __xn_mux_shifted_id(__rtdm_muxid);
+}
 
-}
+
skins/rtdm/internal.h +119 -0

119 lines not on this page · raw message

skins/rtdm/wrappers.c +95 -0

95 lines not on this page · raw message

skins/rtdm/wrappers.h +26 -0
Index: src/skins/rtdm/wrappers.h
===================================================================
@@ -0,0 +1,26 @@
+#ifndef _XENO_WRAPPERS_H
+#define _XENO_WRAPPERS_H
+
+#include <sys/types.h>
+#include <pthread.h>
+
+int __real_pthread_create(pthread_t *tid,
+			  const pthread_attr_t * attr,
+			  void *(*start) (void *), void *arg);
+
+int __real_pthread_setschedparam(pthread_t thread,
+				 int policy, const struct sched_param *param);
+
+
+int __real_open(const char *path, int oflag, ...);
+
+int __real_close(int fd);
+
+int __real_ioctl(int fd, int request, ...);
+
+void *__real_mmap(void *addr,
+		  size_t len, int prot, int flags, int fd, off_t off);
+
+int __real_munmap(void *addr, size_t len);
+
+#endif /* !_XENO_WRAPPERS_H */