阅读:1250回复:0
VxWorks下关于PCI驱动部分的一些程序
VxWorks下关于PCI驱动部分的一些程序,有几个地方我不是很明白。请指点!
其实也不算是驱动部分了,请看看吧 UINT32 address; //---------------------------------------------------------- // check for PCI device //---------------------------------------------------------- if (pciFindDevice (fVendorId, fDeviceId, getIndex(), &busNumber, &deviceNumber, &functionNumber) != OK) { fDiscoveryOk = false; return; } //------------------------------------------------------ // determine device interrupt //------------------------------------------------------ unsigned int intLine; pciConfigInLong( busNumber, deviceNumber, functionNumber, PCI_INT_LINE_OFFSET, &intLine); // Set the IRQ number for interrupts from the PCI device. intLine &= 0x000000ff; fIrq = (unsigned long)intLine; //------------------------------------------------------ // determine device I/O and memory base addresses // NOTE: some devices define offset 0 to be memory base, // while others define it as the I/O base. //------------------------------------------------------ pciConfigInLong( busNumber, deviceNumber, functionNumber, PCI_BAR_0_OFFSET, &address); cout << \"pciConfigInLong method returned address \" << address << endl; //------------------------------------------------------ // actual start address //------------------------------------------------------ address &= 0xfffffff0; // Clear out the status bits in the lower nibble address |= 0x20000000; // Endianness // Set BAR0 for the 3212 chip so we can access configuration registers. fBar[0] = address; //---------------------------------------------------------------------- // Get base address for MAC address space (PCI base address for local // space 0 //---------------------------------------------------------------------- pciConfigInLong( busNumber, deviceNumber, functionNumber, PCI_BAR_1_OFFSET, &address); address &= 0xfffffff0; // Clear out the status bits in the lower nibble address |= 0x20000000; // Endianness // Set BAR1 for the 3212 chip so we can access configuration registers. fBar[1] = address; 我觉得奇怪,为什么BAR0同时是memory和I/O地址呢? address |= 0x20000000; // Endianness还有这一句是指置状态位吗? |
|