All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] error while rt_task_wait_period, code -110
@ 2007-11-30 10:52 Andreas Vogt
  2007-11-30 11:04 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Vogt @ 2007-11-30 10:52 UTC (permalink / raw)
  To: xenomai

[-- Attachment #1: Type: text/plain, Size: 391 bytes --]

Hallo,

I get an error in a simple program with a period time of 1 ms.My latency test program works with a period of 100us.The worst latenz time is about 23us
Any suggestions?

Andreas
_____________________________________________________________________
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071&distributionid=000000000066


[-- Attachment #2: speaker.c --]
[-- Type: text/x-csrc, Size: 2030 bytes --]

#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <sys/time.h>
#include <sys/io.h>
#include <sys/mman.h>
#include <native/task.h>
#include <native/queue.h>
#include <native/intr.h>
#include <native/sem.h>


#define STACK_SIZE 0
#define PRIO_TIMER 3


RT_TASK test_task;

int int_count = 0;
int end = 0;

//                     --s-ms-us-ns
RTIME task_period_ns =    001000000llu;

void test_task_fct(){
	
	int count = 0;
	int ret;
	int err =0;
	unsigned long overrun;
	unsigned char sound_byte;
  	unsigned char toggle = 0;


	ret = rt_task_set_periodic(NULL, TM_NOW, rt_timer_ns2ticks(task_period_ns));
	if (ret) {
		printf("error while set periodic, code %d\n",ret);
		return;
	}

	while(!end){

		ret = rt_task_set_mode(0, T_PRIMARY, NULL);
		if (ret) {
					
		printf("error while rt_task_set_mode, code %d\n",ret);
			return;
		}

		ret = rt_task_wait_period(&overrun);
		if (ret) {
			switch (ret) {
				case -EWOULDBLOCK:  printf("1\n");
					      break;
				case -EINTR: printf("2\n");
					      break;
				case -ETIMEDOUT: printf("3\n");
					      break;
				case -EPERM: printf("4\n");
					      break;
			}	
			printf("error while rt_task_wait_period, code %d\n",ret);
			return;
		}

		unsigned char bell = 7;
		printf("%c",bell);


		fflush(NULL);
	}
}


// signal-handler, to ensure clean exit on Ctrl-C
void clean_exit(int dummy) {
	printf("[MAIN] try clean exit\n");
	end = 1;
  	rt_task_delete(&test_task);
	printf("[MAIN] bye bye\n");

}


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

	int err, ret = 0;
	printf("[MAIN] start system\n");


	// install signal handler
	signal(SIGTERM, clean_exit);	
	signal(SIGINT, clean_exit);	
	mlockall(MCL_CURRENT | MCL_FUTURE);


	err = rt_task_spawn(&test_task, "Timer", STACK_SIZE, PRIO_TIMER, 0, &test_task_fct, NULL);
	if (err) {
		printf("error rt_task_spawn\n");
		return 0;
	}
	printf("[MAIN] test_task created\n");
	

printf("[MAIN] \n");
	pause();
	fflush(NULL);
	return 0;


}




































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

* Re: [Xenomai-help] error while rt_task_wait_period, code -110
  2007-11-30 10:52 [Xenomai-help] error while rt_task_wait_period, code -110 Andreas Vogt
@ 2007-11-30 11:04 ` Gilles Chanteperdrix
  0 siblings, 0 replies; 2+ messages in thread
From: Gilles Chanteperdrix @ 2007-11-30 11:04 UTC (permalink / raw)
  To: Andreas Vogt; +Cc: xenomai

On Nov 30, 2007 11:52 AM, Andreas Vogt <A_C_V@web.de> wrote:
> Hallo,
>
> I get an error in a simple program with a period time of 1 ms.My latency test program works with a period of 100us.The worst latenz time is about 23us
> Any suggestions?

Do not call rt_task_set_mode(0, T_PRIMARY), it is only adding
unnecessary overhead, Xenomai will automatically switch a task to
primary mode when calling rt_task_wait_period.

Do not call non real-time functions such as printf in your real-time loop.

-- 
                                               Gilles Chanteperdrix


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

end of thread, other threads:[~2007-11-30 11:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-30 10:52 [Xenomai-help] error while rt_task_wait_period, code -110 Andreas Vogt
2007-11-30 11:04 ` 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.