一个关于PCI操作的问题

各位大虾,小弟在编写PCI设备驱动时需要用到PCI的配置函数,结果发现在调用pci_write_config16时出现错误,代码流程如下:

unsigned int busNo, devFunc;
unsigned int lcrBase, baseAddr, as3_ba;

ThreadCtl(_NTO_TCTL_IO, 0);

phd1 = pci_attach(0);
if(phd1==-1){
printf(“Can’t initial PCI service!\n”);
exit(ERR_PCIBiosNotExist);
}
if(pci_find_device(DEVICE_ID,VENDOR_ID,cardNo,&busNo,&devFunc)!=PCI_SUCCESS) {
pci_detach(phd1);
exit(ERR_PCICardNotExist);
}

pci_read_config16( busNo, devFunc, PCI_CS_BASE_ADDRESS_1, 1, &lcrBase );

/* if the lcrBase meet the bug of PLX 9050 then modify lcrBase*/
/* to avoid PLX 9050 bug */
if( lcrBase &0x0080 )
{
if (as3_ba & 0x0001)
lcrBase = (as3_ba & 0xfffc);
else
lcrBase = (baseAddr + 0x100)&0xFF00;
pci_write_config16( busNo, devFunc, PCI_CS_BASE_ADDRESS_1, 1, lcrBase );
} else {
lcrBase = (lcrBase & 0xfffc) ;
}

错误为:
passing unsigned int' to argument 6 of pci_write_config_bus(unsig
ned int, unsigned int, unsigned int, unsigned int, unsigned int, const void *)’
lacks a cast

请各位大虾给予指导。

  1. lcrBase应定义为unsigned short型.
  2. pci_write_config16( busNo, devFunc, PCI_CS_BASE_ADDRESS_1, 1, lcrBase );
    应为 pci_write_config16( busNo, devFunc, PCI_CS_BASE_ADDRESS_1, 1, &lcrBase );