
#include "UniDAQ.h"
#include "windows.h"
#include "stdio.h"
#include "conio.h"
#include "process.h"
#include "dos.h"
#include "time.h"



void main(int argc, char* argv[])
{
	WORD wTotalBoards;
	WORD wReturnCode,i;
	WORD wBoardNo;
	WORD wSelect;
	DWORD dwValue;
	WORD wRtn;

    IXUD_DEVICE_INFO A;
    IXUD_CARD_INFO B;
	char szModelName[20]="Unknow Device";


	wReturnCode=Ixud_DriverInit(&wTotalBoards);
	
	printf("The Total Boards is %d\n",wTotalBoards);

	printf("ModelName ModelNo. VendorID  DeviceID  SubVendor  SubDevice  SubAux\n");
	//printf("Bar0 Bar1 Bar2 Bar3 Bar4 Bar5");
	for (i=0;i<wTotalBoards;i++)
	{
		wReturnCode=Ixud_GetCardInfo(i,&A,&B,szModelName);
		if (wReturnCode!=0)
			printf("Get Card %d Info has Error!!!\n",i);
		else
			printf("%0.15s 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",szModelName,B.dwModelNo ,A.wVendorID,A.wDeviceID,A.wSubVendorID ,A.wSubDeviceID ,A.Aux  );
		
	}
	wBoardNo = 0;
	wSelect = 0;
	printf("\nPlease Select R/W Memory (0)Read (1)Write");
	scanf("%d",wSelect);

	if(wSelect)
	{
		wRtn = Ixud_WriteMemory(0,0,0,0x12345678);
		printf("\nWrite Memory value 0x12345678");
	
	}else{
		wRtn = Ixud_ReadMemory(0,0,0,&dwValue);	
		printf("\nRead Memory Value = %x",dwValue);
	}
	//printf("Please selection board (Board 0 ~ %d)):\n",wTotalBoards-1);
	//scanf("%d",&wBoardNo);
    //system("cls");

	wReturnCode=Ixud_DriverClose();
	//printf("%d",5%2);
	system("PAUSE");
}