Functions – Comtrol eCos User Manual
Page 447

Chapter 30. The eCos PCI Library
Functions
void cyg_pci_init(void);
Initialize the PCI library and establish contact with the hardware. This function is idempotent and can be called
either by all drivers in the system, or just from an application initialization function.
cyg_bool cyg_pci_find_device( cyg_uint16 vendor,
cyg_uint16 device,
cyg_pci_device_id *devid );
Searches the PCI bus configuration space for a device with the given
vendor
and
device
ids. The search starts at
the device pointed to by
devid
, or at the first slot if it contains
CYG_PCI_NULL_DEVID
.
*devid
will be updated
with the ID of the next device found. Returns
true
if one is found and
false
if not.
cyg_bool cyg_pci_find_class( cyg_uint32 dev_class,
cyg_pci_device_id *devid );
Searches the PCI bus configuration space for a device with the given
dev_class
class code. The search starts at
the device pointed to by
devid
, or at the first slot if it contains
CYG_PCI_NULL_DEVID
.
*devid
will be updated with the ID of the next device found. Returns
true
if one is found and
false
if not.
cyg_bool cyg_pci_find_next( cyg_pci_device_id cur_devid,
cyg_pci_device_id *next_devid );
Searches the PCI configuration space for the next valid device after
cur_devid
. If
cur_devid
is given the
value
CYG_PCI_NULL_DEVID
, then the search starts at the first slot. It is permitted for
next_devid
to point to
cur_devid
. Returns
true
if another device is found and
false
if not.
cyg_bool cyg_pci_find_matching( cyg_pci_match_func *matchp,
void * match_callback_data,
cyg_pci_device_id *devid );
Searches the PCI bus configuration space for a device whose properties match those required by the caller supplied
cyg_pci_match_func
. The search starts at the device pointed to by
devid
, or at the first slot if it contains
CYG_PCI_NULL_DEVID
. The
devid
will be updated with the ID of the next device found. This function returns
true
if a matching device is found and
false
if not.
The match_func has a type declared as:
typedef cyg_bool (cyg_pci_match_func)( cyg_uint16 vendor,
cyg_uint16 device,
cyg_uint32 class,
void *
user_data);
The
vendor
,
device
, and
class
are from the device configuration space. The
user_data
is the callback
data passed to
cyg_pci_find_matching
.
void cyg_pci_get_device_info ( cyg_pci_device_id devid,
cyg_pci_device *dev_info );
This function gets the PCI configuration information for the device indicated in
devid
. The common fields of
the cyg_pci_device structure, and the appropriate fields of the relevant header union member are filled in from the
343