4.7 DEMO 6: Outport of | ||
/* | */ | |
/* demo 6 : D/O demo | */ | |
/* step 1 | : connect a | */ |
/* step 2 | : run DEMO6.EXE | */ |
/* step 3 | : check the LED's of | */ |
/*
#include "PIO.H" #include
{
int i; char c; WORD wBoards;
WORD wBase,wIrq,wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice;
clrscr();
PIO_DriverInit(&wBoards,0x80,0x01,0x00); /* for
putch(0x07); putch(0x07); putch(0x07);
printf("(1) There are no
exit(0);
}
printf("\n(2) The Configuration Space
PIO_GetConfigAddressSpace(i,&wBase,&wIrq,&wSubVendor,&wSubDevice, &wSubAux,&wSlotBus,&wSlotDevice);
printf("\nCard_%d: wBase=%x,wIrq=%x,subID=[%x,%x,%x],SlotID=[%x,%x]" ,i,wBase,wIrq,wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice);
}
PIO_GetConfigAddressSpace(0,&wBase,&wIrq,&wSubVendor,&wSubDevice,
| &wSubAux,&wSlotBus,&wSlotDevice); |
printf("\n(3) *** Card_0 D/O test, wBase=%x ***",wBase); | |
outp(D144,Disable); | /* Reset DIO of D144 */ |
outp(D144,Enable); |
|
outp(IO_SCR0,0x00); |
|
while(1) { printf("\n"); for(i=1;i<=0x80;i=i<<1) {
printf("\nCN1: PA=%02xH, PB=%02xH, PC=%02xH, press Q to stop",i,i,i); outp(Act_IOPCR,CN1_PA);
outp(RW_8BitDR,i); outp(Act_IOPCR,CN1_PB); outp(RW_8BitDR,i); outp(Act_IOPCR,CN1_PC); outp(RW_8BitDR,i); sleep(1);
}
printf("\n"); for(i=1;i<=0x80;i=i<<1) {
printf("\nCN2: PA=%02xH, PB=%02xH, PC=%02xH, press Q to stop",i,i,i); outp(Act_IOPCR,CN2_PA);
outp(RW_8BitDR,i); outp(Act_IOPCR,CN2_PB); outp(RW_8BitDR,i); outp(Act_IOPCR,CN2_PC); outp(RW_8BitDR,i);
|