Skip to contentSkip to conversation

interrupt programm hang up the computer

Xenomai-help Andreas Vogt 2 participants 2 messages Nov 27, 2007

lore
Share & tools
lore
#0 lore raw

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

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

}

#1 lore raw
Quoted 3 lines · Andreas Vogt

Hello,

I try to implement an interrupt but I get always the error message -38.

-ENOSYS. Function not implemented.

What does this messages mean?

Quoted 12 lines

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.

Infinite loop you created yourself by not testing the status returned from rt_intr_wait().

What about testing the return code from rt_intr_create() too?

Quoted 2 lines

In my config the XENO_OPT_NATIVE_INTR is not set. Cause this any Problem?
__________________

Yes. This is why you get -ENOSYS.

_____________________________________________________

Quoted 11 lines

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

------------------------------------------------------------------------

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Signature · 1 line
Philippe.