I’m trying to use the interruption and I would liko to know how do it using the edge. That’s my code:

struct sigevent event;
void* int_thread (void *arg);
const struct sigevent * isr_handler (void *arg, int id);
int var=0;

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

event.sigev_notify = SIGEV_INTR;


    pthread_create (NULL, NULL, int_thread, NULL);



const struct sigevent * isr_handler (void *arg, int id) {
var ++;
return (&event);

void* int_thread (void *arg)
int errvalue, erroWait, valor;

ThreadCtl (_NTO_TCTL_IO, NULL); // enable I/O privilege


//errvalue = errno;
//printf(“Erro: %s\n”, strerror(errvalue));

while (1)
InterruptWait (NULL, NULL);

    printf("erroWait=%s %d\n", strerror(erroWait),var);


I’m doing the interruption on IRQ15, but when I run this code, it interrupts alone, without doing anything.

(Sorry about my english.)


I’m not sure what you mean when you say ‘it interrupts alone, without doing anything’.

Are you saying your ISR never gets trriggered or are you saying your var variable isn’t being incremented?

If the problem is the var variable not being incremented then you should know that variables modified inside ISR’s must be declared volatile.


The var is increasing when it have to be 0, because isn’t happenning a interruption. I declared as volatile, but I didn’t see any change.

In other forum, a guy sad it to me:
" The fact that you have strange value for “var” is probably because there are more than one instance of the interrupt thread. "

I’m that other guy :wink: Seems like the language barrier is causing a problem.

In your post on foundry you reported var was changing? Is it increasing or not?

You did not comment on my first reply: Your program is starting int_thread() many times. This can create strange results.

Yeah… hehe

yes… it’s changing… it’s increasing…

if I don’t start int_thread() many times, the program run a little and stops… and there’s a infinite while inside int_thread()… it’s weird…

It’s not weird, you are starting a thread with pthread_create() that means int_thread will run on it’s own, just as if you started another program. The call to pthread_create() will return right away, that’s why the program stop almost right away.

Basically every second the program is starting a new thread. After 10 seconds there is 10 copy of int_thread running at the same time… That means that after 10 seconds the 10 copy of int_thread will wake up and print the value of var…

To solve that you can get rid of the while loop in main and call int_thread directly. Or use pthread_create but after do a sleep (100000);

Is the interrupt coming from PCI or ISA?

in thread:

//Whatever you like to do
printf(…); // ← this will take a lot of time, really quite a lot

and in main:

do not call endless count of threads.
just create ONE other thread, the way you do it you will have a lot of threads running all doing the same thing.
As mario said, in your actual configuration i also would just call your int_thread() directly, but i guess you would like to get into threads.
Therefore just try it with one thread :stuck_out_tongue_winking_eye:

I’m using this processor: VIA Mark CoreFusion
Can use “edge”?

I found this information about that processor:

Offering full legacy support through ISA (Industry Standard Architecture), the VIA Mark CoreFusion processor platform provides usability of up to five PCI masters, USB 1.1 and up to two communication ports.

ISA Support - Yes with VIA 686B SouthBridge solution

Can use the interruption by edge?


Now, my code is like this:

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

//event.sigev_notify = SIGEV_INTR;
SIGEV_INTR_INIT( &event );


volatile int var=0;

const struct sigevent * isr_handler (void *arg, int id) {
var ++;
return (&event);

void* int_thread (void *arg)
int errvalue, erroWait, valor, irq;

ThreadCtl (_NTO_TCTL_IO, NULL);


while (1)
	if( InterruptWait (NULL, NULL) == -1 )
	    printf("erroWait=%s ", strerror(erroWait));
		printf("Var %d\n", var );
	//printf("irq=%d \n",irq);  --> it returns 0 always.


And returns it:
Var 1
Var 2
Var 3
Var 4
Var 5
Var 6
Var 7
Var 8
Var 9
Var 10
Var 11
Var 12
Var 13
Var 14
Var 16

I don’t understand because the IRQ15 is in 0… and the var is increasing, so the interruption is happenning… i don’t know why…

Not sure what you mean by “IRQ15 is in 0”. Are you talking about the in8(0x0e) returning 0. Reading port 15 will NOT give you the status of the interrupt line.

Yes, it’s… and irq15 is connected to GND… but, why is “interrupting”? the interruption has to happens just when I change the irq, like connect it to vcc for example, isn’t??

and about edge-sensitive? Can I use a edge interruption?

IRQ15 address is 0x0F and not 0x0E… hehehe
now, I’m testing…

About edge-sensitive, as I told you before on ISA its edge-sensitive on PCI its level sensitive.

And using my processor? Can the interruption be edge-sensitive?

Ah, my code is working… thanks!