CODES.CPP
资源名称:pciexp.zip [点击查看]
上传用户:zhuqijet
上传日期:2007-01-04
资源大小:138k
文件大小:2k
源码类别:
驱动编程
开发平台:
Visual C++
- #include "stdafx.h"
- #include "pciCode.h" // vendor codes
- #define DIM(x) (sizeof(x) / sizeof((x)[0]))
- /****************************************************************************
- * findVendor
- * Inputs:
- * USHORT VendorID: PCI Vendor ID
- * CString & ShortVendor: place to put short vendor name
- * CString & LongVendor: place to put long vendor name
- * Result: BOOL
- * TRUE if successful; ShortVendor and LongVendor defined
- * FALSE if not found; ShortVendor and LongVendor unchanged
- ****************************************************************************/
- BOOL findVendor(USHORT VendorID, CString & ShortVendor, CString & LongVendor)
- {
- for(int i = 0; i < DIM(PciVenTable); i++)
- { /* scan vendor table */
- if(PciVenTable[i].VenId == VendorID)
- { /* found it */
- ShortVendor = PciVenTable[i].VenShort;
- LongVendor = PciVenTable[i].VenFull;
- return TRUE;
- } /* found it */
- } /* scan vendor table */
- return FALSE;
- }
- /****************************************************************************
- * findDevice
- * Inputs:
- * USHORT VendorID: vendor ID
- * USHORT DeviceID: device ID
- * CString & chip: Chip name
- * CString & desc: Chip description
- * Result: BOOL
- * TRUE if found, chip and desc modified
- * FALSE if not found, chip and desc unchanged
- ****************************************************************************/
- BOOL findDevice(USHORT VendorID, USHORT DeviceID, CString & chip, CString & desc)
- {
- for(int i = 0; i < DIM(PciDevTable); i++)
- { /* scan device table */
- if(PciDevTable[i].VenId == VendorID &&
- PciDevTable[i].DevId == DeviceID)
- { /* found it */
- chip = PciDevTable[i].Chip;
- desc = PciDevTable[i].ChipDesc;
- return TRUE;
- } /* found it */
- } /* scan device table */
- return FALSE;
- }