/* demo 3 : Square Wave Generator */ /* step 1 : all CLK select clock1=8M */ /* step 2 : run DEMO3.EXE */ /* step 3 : check all Cout of four 8254 by scope */ /* ----------------------------------------------------------- */ #include "PCITMC12.H" WORD pci_tmc12_select8254(char cChip); WORD pci_tmc12_c0(char cConfig, char cLow, char cHigh); WORD pci_tmc12_c1(char cConfig, char cLow, char cHigh); WORD pci_tmc12_c2(char cConfig, char cLow, char cHigh); void pci_tmc12_di(WORD *wDi); WORD pci_tmc12_do(WORD wDo); WORD find_h_l(int v, float *h, float *l); WORD wBaseAddr,wIrq; int main() { int i,j,count; WORD wBoards,wRetVal,wPLX; char c,h,l; float is_h,is_l; 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; i3000) {(*h)=0; (*l)=0; return;} if (kbhit()!=0) {getch(); return;} } count=0; for (;;) /* 2: find high */ { count++; pci_tmc12_di(&j); j=j&v; if (j!=0) break; if (count>3000) {(*h)=0; (*l)=0; return;} if (kbhit()!=0) {getch(); return;} } count=0; hh=0; for (;;) /* 3: inc_High & find low */ { count++; hh++; pci_tmc12_di(&j); j=j&v; if (j==0) break; if (count>3000) {(*h)=0; (*l)=0; return;} if (kbhit()!=0) {getch(); return;} } count=0; ll=0; for (;;) /* 4: inc_Low & find high */ { count++; ll++; pci_tmc12_di(&j); j=j&v; if (j!=0) break; if (count>3000) {(*h)=0; (*l)=0; return;} if (kbhit()!=0) {getch(); return;} } (*h)=hh; (*l)=ll; }