All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Vogt <A_C_V@web.de>
To: xenomai@xenomai.org
Subject: [Xenomai-help] interrupt programm hang up the computer
Date: Tue, 27 Nov 2007 11:12:00 +0100	[thread overview]
Message-ID: <1820393698@domain.hid> (raw)

[-- 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);
 }

             reply	other threads:[~2007-11-27 10:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-27 10:12 Andreas Vogt [this message]
2007-11-27 10:27 ` [Xenomai-help] interrupt programm hang up the computer Philippe Gerum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1820393698@domain.hid \
    --to=a_c_v@web.de \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.