Mail Archives: djgpp/2001/09/21/13:30:50
On a PC, you can also use I/O to get at PCI config space
location 0xCF8 is the PCI config space address
and location 0xCFC is the data.
The address is layed out as follows:
Bit(s) Purpose
31 enable
30-24 reserved
23-16 bus number
15-11 device number
10-8 function number
7-2 register number
Get the pci spec for further details.
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.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/
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
- Raw text -