User guide
148 Enhanced OS-9 for X86 PCAT
1
Installing and Configuring Enhanced OS-9
pci_read_configuration_dword() - read PCI configuration
dword
Syntax
#include <pcicnfg.h>
u_int32 pci_read_configuration_dword(u_int32 bus,
u_int32 dev, u_int32 func, u_int32 index);
State
System
Description
pci_read_configuration_dword() function will return the PCI
configuration dword value for the PCI device at ’bus’ bus number, ’dev’
device number, ’func’ function number, ’index’ offset into the
configuration space.
Header File
MWOS/SRC/DEFS/HW/pcicnfg.h
Example
#include <const.h>
#include <pcicnfg.h>
#include <systype.h>
#include <stdio.h>
#include <stdlib.h>
main()
{
u_int8 bus, dev, func;
u_int32 hdware;
bus = 0; /* device on bus zero */
device = 11; /* device ID = 11 */
func = 0; /* function number = 0 */
/* Get PCI I/O Port Address */
hdware = pci_read_configuration_dword(bus, dev, 0,
offsetof(pci_config_reg,base_addrs[0]));
/* mask address and add PCI Area Offset */
hdware = (hdware & ~1) + PCI_IO_BASE;
printf("PCI device at 0x%08x\n", hdware);
return EXIT_SUCCESS;
}