Hi,
I would like to catch signal send to serial port 1.
I send via my frequency generator to the DTR pin the signal
and got no interrupt (i also tested the other pin).
I also killed the devc-ser* to avoid conflict.
So what’s wrong ?
TIA
My code :
#include <stdio.h>
#include <sys/neutrino.h>
#include <sys/syspage.h>
#include <hw/inout.h>
#define BASECOM1 0x3f8
#define VALIRQCOM1 BASECOM1 + 1
#define IdIRQCOM1 BASECOM1 + 2
#define IRQ 4
struct sigevent event;
int d=0;
const struct sigevent *handler(void *area, int id)
{
register int c;
c= in8(IdIRQCOM1) & 0x7;
switch (c) {
case 4:
d++;
break;
case 2:
break;
case 0:
break;
}
return(&event);
}
int main()
{
int i, id;
ThreadCtl(_NTO_TCTL_IO, NULL);
id = InterruptAttach(IRQ, &handler, NULL, 0, 0);
InterruptUnmask(IRQ, id);
while (d > 100) {
InterruptWait(NULL, NULL);
InterruptUnmask(IRQ, id);
printf("%d\n",d);
}
InterruptDetach(id);
return 0;
}
You have to at least setup the UART to enable interrupt on DTR. You should
be able to pind plenty of UART register documentation on the web.
–
Jens
“Y.LEROUX” <A_ENLEVER_y.leroux@actris.com> wrote in message
news:bdbkhf$q4k$1@inn.qnx.com…
Hi,
I would like to catch signal send to serial port 1.
I send via my frequency generator to the DTR pin the signal
and got no interrupt (i also tested the other pin).
I also killed the devc-ser* to avoid conflict.
So what’s wrong ?
TIA
My code :
#include <stdio.h
#include <sys/neutrino.h
#include <sys/syspage.h
#include <hw/inout.h
#define BASECOM1 0x3f8
#define VALIRQCOM1 BASECOM1 + 1
#define IdIRQCOM1 BASECOM1 + 2
#define IRQ 4
struct sigevent event;
int d=0;
const struct sigevent *handler(void *area, int id)
{
register int c;
c= in8(IdIRQCOM1) & 0x7;
switch (c) {
case 4:
d++;
break;
case 2:
break;
case 0:
break;
}
return(&event);
}
int main()
{
int i, id;
ThreadCtl(_NTO_TCTL_IO, NULL);
id = InterruptAttach(IRQ, &handler, NULL, 0, 0);
InterruptUnmask(IRQ, id);
while (d > 100) {
InterruptWait(NULL, NULL);
InterruptUnmask(IRQ, id);
printf("%d\n",d);
}
InterruptDetach(id);
return 0;
}