RTDM in user mode
PATCH 2/2 RTDM in user mode
Patch 2: examples.
Makefile | 94 ++++++++++++++++++++++++++++ test01_task.c | 62 ++++++++++++++++++ test02_event_sem.c | 160 +++++++++++++++++++++++++++++++++++++++++++++++ test03_timer.c | 60 +++++++++++++++++ test04_mutex.c | 86 +++++++++++++++++++++++++ test05_nrtsig.c | 82 ++++++++++++++++++++++++ test06_spinlock.c | 84 +++++++++++++++++++++++++ test07_heap.c | 76 ++++++++++++++++++++++ test08_device.c | 131 +++++++++++++++++++++++++++++++++++++++ test09_driver.c | 150 ++++++++++++++++++++++++++++++++++++++++++++ test10_mmap.c | 177 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 11 files changed, 1162 insertions(+)
rtdm/user-api/Makefile +94 -0
@@ -0,0 +1,94 @@ + +###### CONFIGURATION ###### + +### List of applications to be build +APPLICATIONS = test01_task test02_event_sem test03_timer \ + test04_mutex test05_nrtsig test06_spinlock test07_heap \ + test08_device test09_driver test10_mmap + +### Note: to override the search path for the xeno-config script, use "make XENO=..." + + +### List of modules to be build +MODULES = + +### Note: to override the kernel source path, use "make KSRC=..." + + + +###### USER SPACE BUILD (no change required normally) ###### +ifeq ($(KERNELRELEASE),) +ifneq ($(APPLICATIONS),) + +### Default Xenomai installation path +XENO ?= /usr/xenomai + +XENOCONFIG=$(shell PATH=$(XENO):$(XENO)/bin:$(PATH) which xeno-config 2>/dev/null) + +### Sanity check +ifeq ($(XENOCONFIG),) +all:: + @echo ">>> Invoke make like this: \"make XENO=/path/to/xeno-config\" <<<" + @echo +endif + + +CC=$(shell $(XENOCONFIG) --cc) + +CFLAGS=$(shell $(XENOCONFIG) --xeno-cflags) $(MY_CFLAGS) + +LDFLAGS=$(shell $(XENOCONFIG) --xeno-ldflags) $(MY_LDFLAGS) -lrtdm_user + +# This includes the library path of given Xenomai into the binary to make live +# easier for beginners if Xenomai's libs are not in any default search path. +LDFLAGS+=-Xlinker -rpath -Xlinker $(shell $(XENOCONFIG) --libdir) + +all:: $(APPLICATIONS) + +clean:: + $(RM) $(APPLICATIONS) *.o + +endif +endif + + + +###### KERNEL MODULE BUILD (no change required normally) ###### +ifneq ($(MODULES),) + +### Default to sources of currently running kernel +KSRC ?= /lib/modules/$(shell uname -r)/build + +OBJS := ${patsubst %, %.o, $(MODULES)} +CLEANMOD := ${patsubst %, .%*, $(MODULES)} +PWD := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi) + +### Kernel 2.6 +ifeq ($(findstring 2.6,$(KSRC)),2.6) + +obj-m := $(OBJS) +EXTRA_CFLAGS := -I$(KSRC)/include/xenomai -I$(KSRC)/include/xenomai/posix $(ADD_CFLAGS) + +all:: + $(MAKE) -C $(KSRC) SUBDIRS=$(PWD) modules + +### Kernel 2.4 +else + +ARCH ?= $(shell uname -i) +INCLUDE := -I$(KSRC)/include/xenomai -I$(KSRC)/include/xenomai/compat -I$(KSRC)/include/xenomai/posix +CFLAGS += $(shell $(MAKE) -s -C $(KSRC) CC=$(CC) ARCH=$(ARCH) SUBDIRS=$(PWD) modules) $(INCLUDE) + +all:: $(OBJS) + +endif + +## Target for capturing 2.4 module CFLAGS +modules: + @echo "$(CFLAGS)" + +clean:: + $(RM) $(CLEANMOD) *.o *.ko *.mod.c Module*.symvers Module.markers modules.order + $(RM) -R .tmp* + +endif
rtdm/user-api/test01_task.c +62 -0
62 lines not on this page · raw message
rtdm/user-api/test02_event_sem.c +160 -0
160 lines not on this page · raw message
rtdm/user-api/test03_timer.c +60 -0
60 lines not on this page · raw message
rtdm/user-api/test04_mutex.c +86 -0
86 lines not on this page · raw message
rtdm/user-api/test05_nrtsig.c +82 -0
82 lines not on this page · raw message
rtdm/user-api/test06_spinlock.c +84 -0
84 lines not on this page · raw message
rtdm/user-api/test07_heap.c +76 -0
76 lines not on this page · raw message
rtdm/user-api/test08_device.c +131 -0
131 lines not on this page · raw message
rtdm/user-api/test09_driver.c +150 -0
150 lines not on this page · raw message
rtdm/user-api/test10_mmap.c +177 -0
177 lines not on this page · raw message