/* demo 2 : D/I demo */ /* step 1 : connect a 20-pin flat cable between CON2 & CON3 */ /* step 2 : run DEMO2.EXE */ /* ----------------------------------------------------------- */ #include "PCITMC12.H" WORD pci_tmc12_do(WORD wDo); void pci_tmc12_di(WORD *wDi); WORD wBaseAddr,wIrq,wPLX; int main() { int i,j,k; WORD wBoards,wRetVal; char c; clrscr(); wRetVal=PTMC12_DriverInit(&wBoards); printf("\n(1) Threr are %d PCI-TMC12 Cards in this PC",wBoards); if ( wBoards==0 ) { putch(0x07); putch(0x07); putch(0x07); printf("(1) There are no PCI-TMC12 card in this PC !!!\n"); exit(0); } printf("\n(2) Show the Configuration Space of all PCI-TMC12:"); for(i=0; i1) PTMC12_GetConfigAddressSpace(1,&wBaseAddr,&wIrq,&wPLX); /* card_1 */ else PTMC12_GetConfigAddressSpace(0,&wBaseAddr,&wIrq,&wPLX); /* card_0 */ printf("\n(3) *** D/I/O test , wBaseAddr=%x ***",wBaseAddr); j=1; for(i=0; i<16; i++) { pci_tmc12_do(j); pci_tmc12_di(&k); printf("\nTEST_%2d --> DO = %x , DI=%x",i,j,k); if (j!=k) printf(" <-- TEST ERROR"); else printf(" <-- TEST OK"); j=j<<1; if (j==0) j=1; } PTMC12_DriverClose(); } /* ----------------------------------------------------------- */ WORD pci_tmc12_do(WORD wDo) { outport(wBaseAddr+0x14,wDo); return(NoError); } /* ----------------------------------------------------------- */ void pci_tmc12_di(WORD *wDi) { WORD wRetVal; (*wDi)=(inport(wBaseAddr+0x14))&0xffff; }