All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] interrupt programm hang up the computer
@ 2007-11-27 10:12 Andreas Vogt
  2007-11-27 10:27 ` Philippe Gerum
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Vogt @ 2007-11-27 10:12 UTC (permalink / raw)
  To: xenomai

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

Hello,

I try to implement an interrupt but I get always the error message -38. What does this messages mean?
And when i delete in the section...

if (err > 0) {int_count++;}
	 else {
			printf("interrupt_task_2 error = %i\n", err);
		}
		rt_intr_enable (&intr_desc); 
       
	   }

 ... the printf command the program hang up.

In my config the XENO_OPT_NATIVE_INTR is not set. Cause this any Problem?
_______________________________________________________________________
Jetzt neu! Schützen Sie Ihren PC mit McAfee und WEB.DE. 3 Monate
kostenlos testen. http://www.pc-sicherheit.web.de/startseite/?mc=022220


[-- Attachment #2: timer.c --]
[-- Type: text/x-csrc, Size: 1433 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>
 
#define IRQ_NUMBER 7  /* Intercept interrupt #7 */
#define TASK_PRIO  99 /* Highest RT priority */
#define TASK_MODE  0  /* No flags */
#define TASK_STKSZ 0  /* Stack size (use default one) */
int end = 0;
RT_INTR intr_desc; 
RT_TASK server_desc;



void irq_server (void *cookie){
int err=0;
int int_count;		
    
while(!end){
        /* Wait for the next interrupt on channel #7. */
        err = rt_intr_wait(&intr_desc,TM_INFINITE);
	if (err > 0) {int_count++;printf("interrupt_task error = %i\n", int_count);}
	 else {
			printf("interrupt_task_2 error = %i\n", err);
		}
		rt_intr_enable (&intr_desc); 
       
	   }
 }

int main (int argc, char *argv[]){
int err = 0;
mlockall(MCL_CURRENT|MCL_FUTURE);


err = rt_intr_create(&intr_desc,"MyIrq",IRQ_NUMBER,0);

err = rt_task_create(&server_desc,"MyIrqServer",TASK_STKSZ,TASK_PRIO,TASK_MODE);
if (err) {
		printf("error rt_task_spawn\n");
		return 0;
	 }
else printf("start\n");
    
err = rt_task_start(&server_desc,&irq_server,NULL);
if (err) {
		printf("error rt_task_spawn\n");
		return 0;
	 }
else printf("start\n");
 }

 void cleanup (void)
 
 {
     end = 1;
     rt_intr_delete(&intr_desc);
     rt_task_delete(&server_desc);
 }

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-27 10:12 [Xenomai-help] interrupt programm hang up the computer Andreas Vogt
2007-11-27 10:27 ` Philippe Gerum

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.