From: Stephan Zimmermann <s.zimmermann@domain.hid>
To: xenomai@xenomai.org
Subject: [Xenomai-help] weired behaviour around userspace interrupts
Date: Mon, 22 Jan 2007 11:46:17 +0100 [thread overview]
Message-ID: <45B495F9.6090808@domain.hid> (raw)
Hello all,
I guess I found some weired memory bug in Xenomai's (userspace?)
interrupt handling. When I run the attached testprogram (or another
program using userspace interrupt's) it happens that 'cat
/proc/xenomai/irq' delivers the following output:
linux1:/proc# cat xenomai/irq
IRQ CPU0 CPU1
7: 0 9 ?*çd
213: 9 0
216: 1949 1949 [timer]
217: 0 0
226: 28 0 [virtual]
As you can see, for IRQ 7 the output looks somehow confusing.
To run the attached program, you need a LPT loopback-device, simply
connect pin's 9 and 10 of the parallel port. (This is not necessary to
see the problem.)
Another thing I have seen, which may be related to this, happens after
re-running the program. The whole /proc/xenomai directory is empty.
Reloading the xeno modules doesn't help and a reboot is needed to get it
working. I don't know how to reproduce it reliably.
That all happens on my AMD X2 as well as on two Pentium M machines.
Maybe someone can explain this.
Thanks in advance,
Stephan
The testprogram:
-----------------------------------------------------------
#include <iostream>
#include <sys/mman.h>
#include <assert.h>
#include "native/task.h"
#include "native/timer.h"
#include "native/queue.h"
#include "native/intr.h"
#include <sys/io.h>
RT_TASK maintask;
RT_TASK inttask;
RT_TASK intcreatortask;
#define LPT_BASE 0x378
#define LPT_INT 7
bool finish = false;
void int_task(void* cookie){
int err = 0;
int counter = 0;
RT_INTR lptint;
err = rt_intr_create(&lptint,"parp_int",7,0);
std::cout << "interrupt create:" << err << std::endl;
err = rt_intr_enable(&lptint);
std::cout << "interrupt enable:" << err << std::endl;
// switch int mode on
outb_p(0x10, LPT_BASE + 2);
// all pins = 0
outb_p(0x00, LPT_BASE );
while(!finish){
err = rt_intr_wait(&lptint, 100);
if(err >= 0 ){
counter++;
std::cout << "got " << err << " loop: " << counter << std::endl;
}
}
err = rt_intr_disable(&lptint);
std::cout << "interrupt disable:" << err << std::endl;
err = rt_intr_delete(&lptint);
std::cout << "interrupt delete:" << err << std::endl;
}
void int_creator_task(void* cookie){
char ob = 0x00;
for(int i = 0; i < 1000; i++){
rt_task_sleep(100);
outb_p(ob,LPT_BASE);
if(ob){
ob = 0x00;
}else{
ob = 0xFF;
}
}
finish = true;
}
int main(void){
int err;
std::cout << "xenomai interrupt test" << std::endl;
mlockall(MCL_CURRENT | MCL_FUTURE);
if (iopl(3)) {
printf("iopl err\n");
exit(1);
}
err = rt_task_shadow (&maintask,"maintask",10,0);
std::cout << "task shadow:" << err << std::endl;
err = rt_timer_set_mode(1000000);
std::cout << "timer set mode:" << err << std::endl;
rt_task_spawn(&inttask,"interrupt-task",1024,50,T_JOINABLE,int_task,NULL);
rt_task_spawn(&intcreatortask,"interrupt-creator-task",1024,50,T_JOINABLE,int_creator_task,NULL);
rt_task_join(&intcreatortask);
rt_task_join(&inttask);
std::cout << "task's finished, exiting" << std::endl;
return 0;
}
next reply other threads:[~2007-01-22 10:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-22 10:46 Stephan Zimmermann [this message]
2007-01-22 11:36 ` [Xenomai-help] weired behaviour around userspace interrupts Jan Kiszka
2007-01-22 12:22 ` Stephan Zimmermann
2007-01-22 13:34 ` Stephan Zimmermann
2007-01-22 13:50 ` Jan Kiszka
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=45B495F9.6090808@domain.hid \
--to=s.zimmermann@domain.hid \
--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.