SCO OpenServer
pci_read(D3oddi)
pci_read: pci_readbyte, pci_readword, pci_readdword --
read data from PCI configuration space
Synopsis
#include <sys/pci.h>
int pci_readbyte(struct pci_devinfo infptr, unsigned short reg,
unsigned char dataptr);
int pci_readword(struct pci_devinfo infptr, unsigned short reg,
unsigned short dataptr);
int pci_readdword(struct pci_devinfo infptr, unsigned short reg,
unsigned long dataptr);
Description
The three functions
pci_readbyte( ),
pci_readword( ),
and
pci_readdword( )
functions read a byte, word, or 32-bit word (double word),
respectively, from a configuration space register.
Arguments
infptr-
Pointer to a
pci_businfo(D4oddi)
structure.
reg-
Register to be read.
dataptr-
Pointer to a
pci_devinfo(D4oddi)
structure into which the data will be returned.
Return values
A return value of 1 indicates success;
the contents of reg is written
to the dataptr structure.
A return value of 0 indicates failure.
A failure can occur if the device is not found
or if the register offset is invalid or misaligned.
Usage
The register offset must be aligned
to correspond with the size of the data field being returned.
In other words, the register offset for
pci_readword( )
must be 2-byte aligned,
and the register offset for
pci_readdword( )
must be 4-byte aligned.
Incorrect alignment will result in a failure.
Context and synchronization
Initialization
context
Hardware applicability
PCI bus
Version applicability
oddi:
3, 3mp, 4, 4mp, 5, 5mp, 6, 6mp
SVR5 DDI compatibility
DDI drivers access PCI configuration information
through the resource manager database.
Use the
cm_getval(D3)
function to access information
supported by the parameters documented on the
cm_params(D5)
manual page and function such as
cm_read_devconfig(D3)
and
cm_write_devconfig(D3)
to access other configuration information.
Note that DDI drivers cannot access
all the PCI configuration information
that SCO OpenServer 5 drivers can access.
References
pci(D4oddi),
pci(HW)
pci_buspresent(D3oddi),
pci_search(D3oddi),
pci_specialcycle(D3oddi),
pci_write(D3oddi)
``PCI'' in HDK Technical Reference
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 5 HDK - June 2005