The library for getting PCI resource for MS-DOS Introduction The library is in the OBJ form and is being used to get the resource (I/O base address, interrupt level and memory base address) of PCI bus board in MS-DOS. You can get the resources by specifying the Vender ID, Device ID and Board ID of PCI bus boards manufactured by CONTEC as parameters. For the Verdor ID, Device ID and Board ID of the PCI bus boards manufactured by CONTEC, please refer to the technical reference and User's Guide of each board. Furthermore, the library is supplied with source program. Support computer IBM PC/AT compatible computer OS MS-DOS Ver 5.0 or later PC-DOS2000 Language MC-C Ver 6.0 or later Borland C/C++ Ver 4.0 or later Turbo C/C++ Ver 4.0 or later List of Files README.TXT This file GETPCI_S.OBJ Object file for small model GETPCI_M.OBJ Object file for medium model GETPCI_C.OBJ Object file for compact model GETPCI_L.OBJ Object file for large model GETPCI.H Heder file for object file GETPCI.C Source file of functions for getting PCI resource GETRES.C Source program of the sample for displaying resource of specified board GETRES.EXE Excutable code of program above GETCONF.C Source program of the sample for displaying "PCI configuration register"of all PCI bus boards GETCONF.EXE Excutable code of program above MSC_SMP.BAT BAT file used on MS-C (used to compile function/sample) TC_SMP.BAT BAT file used on Turbo-c (used to compile function/sample) Sample Program Summary GETRES.EXE Summary: It is the sample which used the GetPciResource function. Usage: Execute the program by typing the command line below to get/display the resource. GETRES.EXE GETCONF.EXE Summary: It is the sample to get/display the hardware information that can be recognised by the PCI-BIOS installed on your PC. The display directly displays the contents of [PCI Configuration Register]. Please refer to [Reference] below for detailed data. Usage: GETCONF.EXE Notes -This library is built in MSC. Before using the library, please compile it in your development environment by using BAT file. -When assembling programs, please include the GETPCI.H in source program and link with the library. Function Specifications Function Gets the resource of PCI bus board that is specified by Vender ID, Device ID and Board ID (revision). Format int GetPciResource(unsigned short VenderID, unsigned short DeviceID, unsigned short BoardID, unsigned short *IoAddr, unsigned short *IoNum, unsigned short *Irq, unsigned long *MemAddr, unsigned short *MemNum); Parameters VenderID: Assign the Vender ID. The Vender ID of CONTEC is CONTEC_VENDER_ID (0x1221). DeviceID: Assign the Device ID. The Device ID varies with the board name. BoardID: Assign the Board ID (Revision). The Board ID is the value which is set by the rotary switch etc. on the board. Make sure that the Board ID is unique for the boards with same model in one system. IoAddr: Specify the starting address of the array AoAddr[6] that stores the I/O base address. IoNum: Specify the address of the variable that stores the number of I/O base addresses. Irq: Specify the address of the variable that stores the interrupt level. 0xff is returned when have no interrupt level. MemAddr: Specify the starting address of the array MemAddr[6] that stores the memory base address. MemNum: Specify the address of the variable that stores the number of memory base address. Return Values 0: Normal completion -1: The specified board does not exist. -2: The Board ID is duplicated. Explanation Get I/O base address, interrupt level and memory base address of the PCI bus board. The PCI bus board has its characteristic identifier of Vender ID and Device ID. This function gets the board resource using these IDs. The Board ID is characteristic identifier of CONTEC PCI bus board, it is used when plural boards with same model are being used, and it is set by the rotary switch on the board. The Board ID is stored in revision item of PCI bus configuration register. The total number of registers for I/O base address and memory base address is restricted to 6. Example Gets the resource of PIO-32/32L(PCI) with the Board ID of 0. #include "getpci.h" unsigned short IoAddr[6]; unsigned short IoNum; unsigned short Irq; unsigned long MemAddr[6]; unsigned short MemNum; int ret; ret = GetPciResource(CONTEC_VENDER_ID, PIO_32_32L_PCI, 0, &IoAddr[0], &IoNum, &Irq, &MemAddr[0], &MemNum); if (ret != 0) { printf("The board is not found.\n"); // Error handling exit(0); } Reference: PCI configuration Register Contecnts(Type 00h) 31 16 15 0 +---------------------------------+---------------------------------+ | Device ID | Vender ID | 00h +---------------------------------+---------------------------------+ | Status | Command | 04h +---------------------------------+----------------+----------------+ | Class code | Revision ID | 08h +----------------+----------------+----------------+----------------+ | BIST | Header Type | Latency Timer | Cache Line Size| 0ch +----------------+----------------+----------------+----------------+ | Base Address Registers | 10h | | 14h | | 18h | | 1ch | | 20h | | 24h +-------------------------------------------------------------------+ | Cardbus CIS Pointer | 28h +---------------------------------+---------------------------------+ | Subsystem ID | Subsystem Vender ID | 2ch +---------------------------------+---------------------------------+ | Expansion ROM Base Address | 30h +-------------------------------------------------------------------+ | Reserved | 34h +-------------------------------------------------------------------+ | Reserved | 38h +----------------+----------------+----------------+----------------+ | Max_Lat | Min_Gnt | Intrrupt Pin | Intrrupt Line | 3ch +----------------+----------------+----------------+----------------+ | Own additional information for PCI device | 40h | | 44h | | 48h | | 4ch | : | | : | | | fch +-------------------------------------------------------------------+