Mail Archives: djgpp/2001/09/19/16:32:53
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 -