Demo10: find card number, Umber, 8 demo10: find card number – Omega OME-PIO-D144 User Manual

Page 50

Advertising
background image

4.8 Demo10: Find Card Number

/* ------------------------------------------------------------- */

/* demo 10: Find card number

*/

/* step 1 : run demo10.exe

*/

/* step 2 : connect a 50-pin flat-cable to CON2 & CON3 of card_? */

/* step 3 : The card number is shown in screen as TEST OK */

/* ------------------------------------------------------------- */

#include "PIO.H"

WORD wBase,wIrq;

WORD wBoards,wRetVal;

WORD wBase,wIrq,wSubVendor,wSubDevice,wSubAux,wSlotBus,wSlotDevice;

int main()

{

int i,j,k;

char c;

clrscr();

PIO_DriverInit(&wBoards,0x80,0x01,0x00); /* for OME-PIO-D144 */

printf("\n(1) Threr are %d OME-PIO-D144 Cards in this PC",wBoards);

if ( wBoards==0 )

{

putch(0x07); putch(0x07); putch(0x07);

printf("(1) There are no OME-PIO-D144 card in this PC !!!\n");

exit(0);

}

printf("\n(2) The Configuration Space -> wBase");

for(i=0; i<wBoards; i++)

{

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);

for (;;)

{

printf("\n------------- press any key to stop -------------");

for (i=0; i<wBoards; i++) test_card(i);

delay_ms(1000); /* delay 1 sec */

if (kbhit()!=0) {getch(); break;}

}

PIO_DriverClose();

}

/* ----------------------------------------------------------- */

test_card(int card)

{

int i,j,k,ok,val;

PIO_GetConfigAddressSpace(card,&wBase,&wIrq,&wSubVendor,&wSubDevice,

&wSubAux,&wSlotBus,&wSlotDevice);

outp(wBase,1); /* enable D/I/O */

OME-PIO-D144 User’s Manual (Ver.2.1, Sep/2001)

---- 48

Advertising