www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/09/19/16:32:53

From: "A. Sinan Unur" <asu1 AT cornell DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: PCI Query
Date: 19 Sep 2001 20:29:02 GMT
Organization: Cornell University
Lines: 74
Sender: asu1 AT cornell DOT invalid (on slip-32-102-40-116.ny.us.prserv.net)
Message-ID: <Xns9121A7AC31F2AASINANUNUR@132.236.56.8>
References: <3BA8E560 DOT 3040907 AT us DOT ibm DOT com>
NNTP-Posting-Host: slip-32-102-40-116.ny.us.prserv.net
X-Trace: news01.cit.cornell.edu 1000931342 1331 32.102.40.116 (19 Sep 2001 20:29:02 GMT)
X-Complaints-To: usenet AT news01 DOT cit DOT cornell DOT edu
NNTP-Posting-Date: 19 Sep 2001 20:29:02 GMT
User-Agent: Xnews/4.06.22
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Gregory Treantos <gtreanto AT us DOT ibm DOT com> wrote in 
news:3BA8E560 DOT 3040907 AT us DOT ibm DOT com:

>   Is it possible to write a C program with djgpp that can poke the PCI 
> bus of an intel box, look for a network adapter and retrieve the 
> manufactures id + mac address. If so what libraries should I be looking 
> at. Thanks

i do not know of any libraries.

ralph brown's interrupt list is a good starting point.

here is a quick and dirty installation check routine. use it at your own 
risk.

#include <dpmi.h>
#include <stdio.h>
#include <string.h>

int pci_chkins(void)
{
	__dpmi_regs r;

	memset(&r, 0, sizeof(r));

	r.x.ax = 0xb101;
	r.d.edi = 0x0;

	printf("PCI BIOS v2.0c+ Installation Check\n");

	if( __dpmi_int(0x1a, &r) != 0 )
	{
		printf("Error executing interrupt via DPMI.\n");
		return -1;
	}
	
	printf("AH: %2.2x. PCI BIOS 2.0c+ %s.\n", r.h.ah,
			r.h.ah == 0 ? "installed" : "not installed");
	printf("Magic EDX: %8.8lx\n", r.d.edx);
	printf("Protected mode entry point EDI: %8.8lx\n", r.d.edi);
	printf("Hardware characteristics AL: %2.2x\n", r.h.al);
	printf("Interface major version BH: %2.2x\n", r.h.bh);
	printf("Interface minor version BL: %2.2x\n", r.h.bl);
	printf("Last PCI bus on system CL: %2.2x\n", r.h.cl);

	return 0;
}

int main(void)
{
	return pci_chkins();
}
	



C:\var>gcc pcichkins.c -o pcichkins.exe -Wall

C:\var>pcichkins
PCI BIOS v2.0c+ Installation Check
AH: 00. PCI BIOS 2.0c+ installed.
Magic EDX: 20494350
Protected mode entry point EDI: 00000000
Hardware characteristics AL: 01
Interface major version BH: 02
Interface minor version BL: 10
Last PCI bus on system CL: 00



-- 
--------------------------------
A. Sinan Unur
http://www.unur.com/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019