Hi all,
I am developing a stream class mini-driver with PCI interface. I use following example codes to implement:
WINDDK\3790.1830\src\wdm\videocap\testcap
WINDDK\3790.1830\src\general\pcidrv\sys
I add pcidrv’s code into testcap, and now I can install testcap.sys and can get PCI BusInterface.
However, I encounter a problem as following:
I do “MapHWResources” in “HwInitialize” of testcap, and map IO space as below:
…
for (i = 0; i < partialResourceListTranslated->Count; i++, resourceTrans++)
{
switch (resourceTrans->Type) {
case CmResourceTypeMemory:
if(numberOfBARs == 1) {
pHwDevExt->MemPhysAddress_bar0 = resourceTrans->u.Memory.Start;
resourceTrans->u.Memory.Length = 0x10000000 ; /* 28 bit : 256mb */
pHwDevExt->CSRAddress =(ULONG)( MmMapIoSpace(
resourceTrans->u.Memory.Start,
resourceTrans->u.Memory.Length, /*28 bit :256mb*/
MmNonCached));
…
When I perform memory read/write such as “READ_REGISTER_ULONG/WRITE_REGISTER_ULONG” or “RtlCopyMemory” in CSRAddress region, it doesn’t work. That is , it can’t read/write memory in “CSRAddress” region. I have tried to use SoftICE to modify the value in CSRAddress region, the value also can’t be modified.
Since I can change bar 3 base address of PCI using following method, I am sure the mini-driver is connectted to my PCI device:
pHwDevExt->BusInterface.SetBusData(
pHwDevExt->BusInterface.Context,
PCI_WHICHSPACE_CONFIG,
buffer,
FIELD_OFFSET(PCI_COMMON_CONFIG, VendorID),
PCI_PAC_HDR_LENGTH);
How could I read/write the memory in CSRAddress?
Could anyone help me to solve this problem? Or is there any example code for stream class mini-driver with PCI interface?
Thanks for your help!