All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] POSIX API
@ 2012-05-15  8:02 ali hagigat
  2012-05-15  8:55 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 5+ messages in thread
From: ali hagigat @ 2012-05-15  8:02 UTC (permalink / raw)
  To: xenomai

I am looking for all POSIX functions of Linux, i wonder if any body
has POSIX.1-2008 manual or IEEE1003.1 or a similar document.
Does xenomai change libc.a ? As far as I understood, xenomai adds new
functions(they start with rt_), besides it changes some of posix
functions while it keeps some posix functions untouched.
Is there any book regarding to the real time programming in xenomai?
Sorry for too many questions...
Regards


^ permalink raw reply	[flat|nested] 5+ messages in thread
* [Xenomai-help] POSIX API
@ 2008-05-13  3:51 Breno Carneiro Pinheiro
  2008-05-13  6:17 ` Wolfgang Grandegger
  2008-05-13  8:49 ` Gilles Chanteperdrix
  0 siblings, 2 replies; 5+ messages in thread
From: Breno Carneiro Pinheiro @ 2008-05-13  3:51 UTC (permalink / raw)
  To: xenomai@xenomai.org


[-- Attachment #1.1: Type: text/plain, Size: 1989 bytes --]

Hi all, I wanna some help with my application. I'm learning about Xenomai
POSIX and Native API. I wonder know what is wrong with my code below because
both don't worked out:

POSIX:

#include <sys/mman.h>

#include <posix/pthread.h>
#include <posix/time.h>

#include <stdio.h>

static pthread_t task_desc;
void task_body (void *cookie)
 {
     struct timespec time;
     clock_gettime(CLOCK_MONOTONIC, &time);;
     pthread_make_periodic_np(pthread_self(),&time, 1000000000);
     while(1) {
     printf("%s\n","a");
     }
 }

int main (int argc, char *argv[])

 {
     int ret;
     pthread_attr_t thattr;

     pthread_attr_init(&thattr);
     pthread_attr_setdetachstate(&thattr, 0);
     pthread_attr_setstacksize(&thattr, 1024);
     ret = pthread_create(&task_desc, NULL, &task_body, NULL);

     if(!ret)
      pthread_join(task_desc, NULL);

 }

and NATIVE

#include <sys/mman.h>
#include <native/task.h>
#include <native/queue.h>
#include <native/intr.h>
#include <native/pipe.h>

#include <stdio.h>
#define TASK_PRIO  99 /* Highest RT priority */
#define TASK_MODE  0  /* No flags */
#define TASK_STKSZ 0  /* Stack size (use default one) */

RT_TASK task_desc;
RTIME period_ns =  1000000000llu;
void task_body (void *cookie)
 {
     unsigned long overrun;
     rt_task_set_periodic(NULL, TM_NOW, rt_timer_ns2ticks(period_ns));
     while(1) {
     rt_task_wait_period(&overrun);
     printf("%s\n","a");
     }
 }

int main (int argc, char *argv[])

 {
     int err;
     int ret;
     pthread_attr_t thattr;
     mlockall(MCL_CURRENT|MCL_FUTURE);

     err = rt_task_create(&task_desc,
                          "teste",
                          TASK_STKSZ,
                          TASK_PRIO,
                          TASK_MODE);


    if (!err)
         rt_task_start(&task_desc,&task_body,NULL);

     /* ... */
 }

 void cleanup (void)

 {
    rt_task_delete(&task_desc);
 }

I used the Makefile attached and tried to run on powerpc processor using
NFS.

Thanks,

Breno

[-- Attachment #1.2: Type: text/html, Size: 3774 bytes --]

[-- Attachment #2: Makefile --]
[-- Type: application/octet-stream, Size: 2504 bytes --]

###### CONFIGURATION ######

### List of applications to be build
APPLICATIONS = task_test

### 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=..."

all::

#task_test: task_test.c


###### USER SPACE BUILD (no change required normally) ######
ifeq ($(KERNELRELEASE),)
ifneq ($(APPLICATIONS),)

### Default Xenomai installation path
XENO ?= /home/breno/ELDK/ppc_6xx/usr/local/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) -I/usr/local/xenomai/include

CFLAGS=-DCONSUMER $(shell $(XENOCONFIG) --posix-cflags) $(APP_CFLAGS)

LDFLAGS=$(shell $(XENOCONFIG) --posix-ldflags) $(APP_LDFLAGS)

# 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) -lpsos 

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 ?= /home/breno/ELDK/ppc_6xx/lib/modules/$(shell uname -r)/build
KSRC ?= /home/breno/ELDK/ppc_6xx/usr/src/Denx-kernel-tree-2
#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
PATCHLEVEL:=$(shell sed 's/PATCHLEVEL = \(.*\)/\1/;t;d' $(KSRC)/Makefile)
ifeq ($(PATCHLEVEL),6)

obj-m        := $(OBJS)
EXTRA_CFLAGS := -DPRODUCER -I$(KSRC)/include/xenomai -I$(KSRC)/include/xenomai/posix $(ADD_CFLAGS) 

all::
	$(MAKE) -C $(KSRC) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) SUBDIRS=$(PWD) modules
	$(RM) *.o

### 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
	$(RM) -R .tmp*
	$(RM) .runinfo

endif


[-- Attachment #3: Makefile.native --]
[-- Type: application/octet-stream, Size: 2467 bytes --]

###### CONFIGURATION ######

### List of applications to be build
#APPLICATIONS = trivial-periodic sigxcpu rtprint
APPLICATIONS = task_test_native
### 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
XENO ?= /home/breno/ELDK/ppc_6xx/usr/local/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) -lnative

# 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



###### SPECIAL TARGET RULES ######
#task_test_native: task_test_native.c
#	$(CC) $(CFLAGS) $? $(LDFLAGS) -lrtdk -o $@
#	$(CC) $(CFLAGS) $? $(LDFLAGS) -lpsos -o $@



###### KERNEL MODULE BUILD (no change required normally) ######
ifneq ($(MODULES),)

### Default to sources of currently running kernel
#KSRC ?= /lib/modules/$(shell uname -r)/build
KSRC ?= /home/breno/ELDK/ppc_6xx/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
	$(RM) -R .tmp*

endif

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-05-15  8:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-15  8:02 [Xenomai-help] POSIX API ali hagigat
2012-05-15  8:55 ` Gilles Chanteperdrix
  -- strict thread matches above, loose matches on Subject: below --
2008-05-13  3:51 Breno Carneiro Pinheiro
2008-05-13  6:17 ` Wolfgang Grandegger
2008-05-13  8:49 ` Gilles Chanteperdrix

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.