// UNIVIF Library Include #include #include #include "pcifunc.h" typedef unsigned char byte; typedef unsigned short word; typedef unsigned long dword; const int UNIV_IF_Vendor=0x136c; // APIC21 const int UNIV_IF_Device=0xa026; // アドテックより割り当て const int UNIV_IF_MaxID=32; // ID の最大数+1 // 情報格納 struct UNIV_IF_BaseAddress { unsigned short ctladdr; unsigned short ioaddr; unsigned short busdevfn; unsigned short device; unsigned int version; }; extern UNIV_IF_BaseAddress baseAddress[UNIV_IF_MaxID]; // 関数 extern void DumpDeviceList(void); extern int ConfigureUNIVIF(int bsn,const char *ttfile); extern int DisableUNIVIF(int bsn); extern int GetUNIVIFBaseAddress(int bsn); extern int GetUNIVIFVersion(int bsn); extern int UnivIFReadEEPROM(int bsn, word addr); extern void UnivIFWriteEEPROM(int bsn, word addr,word val); // デバッグ extern int uiflib_debug; inline int IsValidBSN(int bsn) { return (bsn>=0)&&(bsn<0x20); } // giveio があるか extern int GIVEIO; inline void outb(byte data,word port) { if(GIVEIO) _outp(port,data); else _IoWriteChar(port,data); } inline void outw(word data,word port) { if(GIVEIO) _outpw(port,data); else _IoWriteShort(port,data); } inline void outl(dword data,word port) { if(GIVEIO) _outpd(port,data); else _IoWriteLong(port,data); } inline byte inb(word port) { if(GIVEIO) return (byte)_inp(port); else return _IoReadChar(port); } inline word inw(word port) { if(GIVEIO) return (word)_inpw(port); else return _IoReadShort(port); } inline dword inl(word port) { if(GIVEIO) return (dword)_inpd(port); else return _IoReadLong(port); } inline void usleep(unsigned long u) { Sleep((u+500)/1000); }