vxworks 中读写pci寄存器

在开发vxworks中,经常要读写pci的寄存器,实现下述函数:


void pciRead(    int        bus,           /* bus */
   int        device,        /* device */
   int        function,      /* function */
   int        offset        /* offset of capability */)
{
VXB_DEVICE_ID pDev;

UINT32 data;

pDev = vxbInstByNameFind("QorIQPciEx",0);

vxbPciConfigInLong(pDev,bus,device,function,offset,&data);

printf("data = 0x%x\n",data);
return;

}


void pciWrite(
int        bus,           /* bus */
   int        device,        /* device */
   int        function,      /* function */
   int        offset,        /* offset of capability */
   int data)
{
VXB_DEVICE_ID pDev;

pDev = vxbInstByNameFind("QorIQPciEx",0);

vxbPciConfigOutLong(pDev,bus,device,function,offset,data);
return;

}

你可能感兴趣的:(vxworks)