typedef struct mypcic{
pthread_mutex_t mutex;
int chid;
int coid;
int int_line;
int iid;
int tid;
}mypcic_t;
int main()
{ ULONG testdata=0x13579246;
ULONG datareceived;
mypcic_t pcip;
int iRet = ThreadCtl(_NTO_TCTL_IO, 0);
if(iRet == -1)
{
printf("Failed to gain IO privilege
");
}
memset(&pcip,0,sizeof(pcip));
pcip.int_line=5;
h429=open("/dev/c429",O_RDWR | O_NONBLOCK);
printf("h429 is %x
",h429);
WritePortLong(0x04,0x00,h429);
WritePortLong(0,0,h429); //////clear fifo
WritePortLong(0x1c,0x20,h429);
WritePortLong(0x28,0x00,h429); //cw1 //////set channel 1 cmdW
WritePortLong(0x2c,0x00,h429); //cw2 //////set channel 2 cmdw
while( !(ReadPortLong(0x08,h429)&0x10));
while( !(ReadPortLong(0x08,h429)&0x20)); //////read status reg ,see if channel1/2 cmdw over
WritePortLong(0x30,0,h429);
WritePortLong(0x10,50,h429); //////set channel 1 clock divider
WritePortLong(0x14,50,h429);
WritePortLong(0x18,0x01,h429);
//////set channel 2 clock divider
intmask = ReadPortLong(0x04,h429);
printf("the intmask is %x
",intmask);
intmask =intmask |0x04;
printf("the intmask is %x
",intmask);
WritePortLong(0x04,intmask,h429);
register_interrupt(&pcip);
ch1sendsingledata(testdata,h429);
//datareceived=readsingledata(h429);
// printf(“main data received is %x”,datareceived);
return 1;}