hi,I want to do something about hardware interrupt.
where can i get some examples ?
thanks.
“summer” <gpjin@nairc.ac.cn> wrote in message
news:acuteo$gn8$1@inn.qnx.com…
hi,I want to do something about hardware interrupt.
where can i get some examples ?
thanks.
#include <i86.h>
#include <sys/proxy.h>
#include <sys/irqinfo.h>
#define IRQ_NUMBER 10
static pid_t ProxyPid;
static pid_t InputPid;
static int IntId;
static volatile int IntCounter = 0;
#pragma off(check_stack)
static pid_t far IntFnc(void) {
Counter++;
return ProxyPid;
} /* IntFnc */
ProxyPid = qnx_proxy_attach(0,NULL,0,-1);
if (ProxyPid == -1) {
/* Cannot attach proxy */
return;
}
IntId = qnx_hint_attach(IRQ_NUMBER,IntFnc,FP_SEG(&IntCounter));
if (IntId == -1) {
/* Cannot attach interrupt handler */
return;
}
do {
InputPid = Receive(0,NULL,0);
if (InputPid == ProxyPid) {
/* Interrupt proxy was triggered /
/ … /
continue;
}
/ … */
} while (InputPid != -1);
qnx_hint_detach(IntId);
qnx_proxy_detach(ProxyPid);
// wbr