/* ndemo3 : watchdog timer using CH-3 (modified from demo7) */ /* (only add 2 lines to pre-set int_signal_to_PC) */ /* step 1 : CLK-3 select clock2=80K */ /* step 2 : J25 select CH3 */ /* step 3 : run ndemo3.exe */ /* ----------------------------------------------------------- */ #include "PCITMC12.H" #define A1_8259 0x20 #define A2_8259 0xA0 #define EOI 0x20 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); WORD init_watchdog(); WORD wBaseAddr,wIrq,wPLX; static void interrupt irq_service(); int watchdog,irqmask; int main() { int i,j; WORD wBoards,wRetVal; char c; DWORD dwVal; 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; i high_width=0.4096 sec */ /* --> the user has to refresh the watchdog before 0.4 sec */ refresh_watchdog() { pci_tmc12_c2(0xb6,0xff,0xff); /* mode_3, CNT2--> CH3 */ return(NoError); } void interrupt irq_service() { watchdog++; inport(wBaseAddr+0x18); /* pre-set int_signal_to_PC, added line 2 */ if (wIrq>=8) outportb(A2_8259,0x20); outportb(A1_8259,0x20); } /* -------------------------------------------------------------------- */ WORD pci_tmc12_select8254(char cChip) { outportb(wBaseAddr+0x10,cChip); return(NoError); } WORD pci_tmc12_c0(char cConfig, char cLow, char cHigh) { outportb(wBaseAddr+0x0C,cConfig); outportb(wBaseAddr ,cLow); outportb(wBaseAddr ,cHigh); return(NoError); } WORD pci_tmc12_c1(char cConfig, char cLow, char cHigh) { outportb(wBaseAddr+0x0C,cConfig); outportb(wBaseAddr+4 ,cLow); outportb(wBaseAddr+4 ,cHigh); return(NoError); } WORD pci_tmc12_c2(char cConfig, char cLow, char cHigh) { outportb(wBaseAddr+0x0C,cConfig); outportb(wBaseAddr+8 ,cLow); outportb(wBaseAddr+8 ,cHigh); return(NoError); }