Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 41 → Rev 46

/wiener_pcivme/pcivme Package/Win8.1Release/pcivme Package.log
1,4 → 1,4
Build started 15.4.2014 9:30:24.
Build started 9.5.2014 10:19:28.
1>Project "C:\home\rok\wiener_pcivme_new\pcivme Package\pcivme Package.vcxproj" on node 2 (Build target(s)).
1>Inf2Cat:
C:\Program Files\Windows Kits\8.1\bin\x86\inf2cat.exe /os:6_3_x86 /driver:"C:\home\rok\wiener_pcivme_new\Win8.1Release\pcivme Package\\"
17,4 → 17,4
 
Build succeeded.
 
Time Elapsed 00:00:00.76
Time Elapsed 00:00:01.86
/wiener_pcivme/pcivme Package/pcivme Package.vcxproj.user
6,4 → 6,7
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win8.1 Release|Win32'">
<TestCertificate>CN="WDKTestCert f9daq,130420202756907596" | 0151AB799219824083D69252DB1123D19497D981</TestCertificate>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|x64'">
<TestCertificate>CN="WDKTestCert f9daq,130456734665934551" | 07A72C2F56048EA2BFE412C6E93F08D55191ABC8</TestCertificate>
</PropertyGroup>
</Project>
/wiener_pcivme/pcivme/SOURCE/pcivme_drv.c
31,7 → 31,8
//-------------------------------------------------------------------------
// INCLUDES
//
#include <initguid.h>
#include <wdmguid.h>
#include <ntddk.h>
#include <devioctl.h>
#include <pcivme_drv.h>
41,7 → 42,6
#include <pcivme.h>
#include <pciif.h>
#include <pcivme_fifo.h>
 
//------------------------------------------------------------------------
// DEFINES
//
143,8 → 143,7
 
KdPrint(("PCIVMEUnload() InitState %d \n", ext->nInitState ));
 
//if (ext->LowerDeviceObject) IoDetachDevice(ext->LowerDeviceObject);
//IoDeleteDevice(driverObj->DeviceObject);
 
if (ext->nInitState!=100) return;
 
switch (ext->nInitState)
202,6 → 201,7
IoDeleteSymbolicLink( &symbol_name);
 
// delete the deviceObject
 
if (ext->LowerDeviceObject) IoDetachDevice(ext->LowerDeviceObject);
IoDeleteDevice(driverObj->DeviceObject);
}
580,18 → 580,90
}
#endif
 
 
// http://read.pudn.com/downloads148/sourcecode/windows/vxd/640413/agp/agplib/init.c__.htm
NTSTATUS
QueryBusInterface(
IN PDEVICE_OBJECT DeviceObject,
OUT PBUS_INTERFACE_STANDARD BusInterface
)
/*++
Routine Description:
Sends a query-interface IRP to the specified device object
to obtain the BUS_INTERFACE_STANDARD interface.
Arguments:
DeviceObject - Supplies the device object to send the BUS_INTERFACE_STANDARD to
BusInterface - Returns the bus interface
Return Value:
STATUS_SUCCESS if successful
NTSTATUS if unsuccessful
--*/
{
PIRP Irp;
KEVENT Event;
PIO_STACK_LOCATION IrpSp;
IO_STATUS_BLOCK IoStatusBlock;
NTSTATUS Status;
// ULONG ReturnLength;
KeInitializeEvent( &Event, NotificationEvent, FALSE );
Irp = IoBuildSynchronousFsdRequest( IRP_MJ_PNP,
DeviceObject,
NULL,
0,
NULL,
&Event,
&IoStatusBlock );
if (Irp == NULL) {
return(STATUS_INSUFFICIENT_RESOURCES);
}
IrpSp = IoGetNextIrpStackLocation( Irp );
ASSERT(IrpSp != NULL);
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED ;
IrpSp->MajorFunction = IRP_MJ_PNP;
IrpSp->MinorFunction = IRP_MN_QUERY_INTERFACE;
IrpSp->Parameters.QueryInterface.InterfaceType = (LPGUID)&GUID_BUS_INTERFACE_STANDARD;
IrpSp->Parameters.QueryInterface.Size = sizeof(BUS_INTERFACE_STANDARD);
IrpSp->Parameters.QueryInterface.Version = 1;
IrpSp->Parameters.QueryInterface.Interface = (PINTERFACE) BusInterface;
IrpSp->Parameters.QueryInterface.InterfaceSpecificData = NULL;
Status = IoCallDriver(DeviceObject, Irp);
if (Status == STATUS_PENDING) {
KeWaitForSingleObject( &Event, Executive, KernelMode, FALSE, NULL );
Status = Irp->IoStatus.Status;
}
return(Status);
}
//------------------------------------------------------------------------
// search for pciada's
//
 
NTSTATUS SearchDevices(PDEVICE_OBJECT device_Obj)
{
PCI_SLOT_NUMBER SlotNumber;
PCI_COMMON_CONFIG pci_config;
PBUS_INTERFACE_STANDARD busInterface;
PCIADA *pciada;
ULONG length;
ULONG propertyAddress, length;
USHORT FunctionNumber, DeviceNumber;
int *found;
int i,j,k;
 
int i;
NTSTATUS status;
int BytesRead;
KdPrint(("SearchDevices()\n"));
 
// prepare structures ----------------------------------------
607,21 → 679,26
 
// search for pciada's ---------------------------------------
SlotNumber.u.bits.Reserved = 0;
for (j = 0; j < PCI_MAX_BUSES; j++)
busInterface = (PBUS_INTERFACE_STANDARD)ExAllocatePool(NonPagedPool,
sizeof(BUS_INTERFACE_STANDARD));
if (busInterface == NULL)
{
for (i = 0; i < PCI_MAX_DEVICES; i++)
{
SlotNumber.u.bits.DeviceNumber = i;
for (k = 0; k < PCI_MAX_FUNCTION; k++)
{
SlotNumber.u.bits.FunctionNumber = k;
length = HalGetBusData( PCIConfiguration, // Bustype
j, // PCI-Busnumber
SlotNumber.u.AsULONG, // Slotnumber
(PVOID) &(pci_config), // Pointer for the PCI-Information
sizeof(PCI_COMMON_CONFIG) );
return STATUS_INSUFFICIENT_RESOURCES;
}
((DEVICE_EXT*)(device_Obj->DeviceExtension))->busInterface = busInterface;
status = QueryBusInterface(device_Obj, busInterface);
BytesRead = busInterface->GetBusData(busInterface->Context, PCI_WHICHSPACE_CONFIG, &pci_config, 0, PCI_COMMON_HDR_LENGTH);
 
pciada = &((DEVICE_EXT*)(device_Obj->DeviceExtension))->pciada[0];
 
//http://www.hollistech.com/Resources/Misc%20articles/getbusdata.htm
//IoGetDeviceProperty
//There are other differnt methods to send a request to lower layer. One method is
//by sending IRP_MN_READ_CONFIG to lower driver. You will recieve
//PCI_COMMON_CONFIG structure.
// http://msdn.microsoft.com/en-us/library/windows/hardware/ff536890(v=vs.85).aspx
// http://www.rdos.net/svn/tags/V9.2.5/watcom/bld/src/win32/miniwdm/dev/wdmdev.c
if ((pci_config.VendorID == PCIVME_VENDOR_ID) &&
(pci_config.DeviceID == PCIVME_DEVICE_ID) &&
(pci_config.u.type0.SubSystemID == PCIVME_SUBSYS_ID) &&
631,17 → 708,31
pciada = &((DEVICE_EXT*)(device_Obj->DeviceExtension))->pciada[*found];
 
memcpy(&pciada->PCIDevice, &pci_config, sizeof(pci_config));
pciada->Slot = SlotNumber;
pciada->Bus = j;
IoGetDeviceProperty(device_Obj,
DevicePropertyBusNumber,
sizeof(ULONG),
(PVOID)&(pciada->Bus),
&length);
 
IoGetDeviceProperty(device_Obj,
DevicePropertyAddress,
sizeof(ULONG),
(PVOID)&propertyAddress,
&length);
//
// For PCI, the DevicePropertyAddress has device number
// in the high word and the function number in the low word.
//
FunctionNumber = (USHORT)((propertyAddress)& 0x0000FFFF);
DeviceNumber = (USHORT)(((propertyAddress) >> 16) & 0x0000FFFF);
pciada->Slot.u.AsULONG = DeviceNumber;
KdPrint(("PCIADA found @ Bus/Slot %d/%d.\n", pciada->Bus, pciada->Slot.u.AsULONG));
 
(*found)++;
if (*found >= PCIVME_MAX_PCIADA) return STATUS_SUCCESS;
}
}
}
}
}
KdPrint(("SearchDevices() found %d devices\n", (*found)));
return STATUS_SUCCESS;
}
656,9 → 747,10
int i;
ULONG dwData;
PCIADA *pciada;
PBUS_INTERFACE_STANDARD busInterface;
 
KdPrint(("PLX9050BugFix()\n"));
 
busInterface = DeviceExtension->busInterface;
for (i = 0; i < DeviceExtension->nPCIADAs; i++)
{
pciada = &DeviceExtension->pciada[i];
673,17 → 765,12
pciada->PCIDevice.u.type0.BaseAddresses[4];
pciada->PCIDevice.u.type0.BaseAddresses[4] = dwData;
 
if (HalSetBusDataByOffset(PCIConfiguration, pciada->Bus,
pciada->Slot.u.AsULONG,
(PVOID)&pciada->PCIDevice.u.type0.BaseAddresses[0],
0x10, 4) != 4)
return STATUS_UNSUCCESSFUL;
 
if (HalSetBusDataByOffset(PCIConfiguration, pciada->Bus,
pciada->Slot.u.AsULONG,
(PVOID)&pciada->PCIDevice.u.type0.BaseAddresses[4],
0x20, 4) != 4)
return STATUS_UNSUCCESSFUL;
if (busInterface->SetBusData(busInterface->Context, PCI_WHICHSPACE_CONFIG, (PVOID)&pciada->PCIDevice.u.type0.BaseAddresses[0], 0x10, 4) != 4)
return STATUS_UNSUCCESSFUL;
if (busInterface->SetBusData(busInterface->Context, PCI_WHICHSPACE_CONFIG, (PVOID)&pciada->PCIDevice.u.type0.BaseAddresses[4], 0x20, 4) != 4)
return STATUS_UNSUCCESSFUL;
}
if ((dwData = pciada->PCIDevice.u.type0.BaseAddresses[1]) & 0x80)
696,17 → 783,12
pciada->PCIDevice.u.type0.BaseAddresses[5];
pciada->PCIDevice.u.type0.BaseAddresses[5] = dwData;
 
if (HalSetBusDataByOffset(PCIConfiguration, pciada->Bus,
pciada->Slot.u.AsULONG,
(PVOID)&pciada->PCIDevice.u.type0.BaseAddresses[1],
0x14, 4) != 4)
return STATUS_UNSUCCESSFUL;
 
if (HalSetBusDataByOffset(PCIConfiguration, pciada->Bus,
pciada->Slot.u.AsULONG,
(PVOID)&pciada->PCIDevice.u.type0.BaseAddresses[5],
0x24, 4) != 4)
return STATUS_UNSUCCESSFUL;
if (busInterface->SetBusData(busInterface->Context, PCI_WHICHSPACE_CONFIG, (PVOID)&pciada->PCIDevice.u.type0.BaseAddresses[1], 0x14, 4) != 4)
return STATUS_UNSUCCESSFUL;
if (busInterface->SetBusData(busInterface->Context, PCI_WHICHSPACE_CONFIG, (PVOID)&pciada->PCIDevice.u.type0.BaseAddresses[5], 0x24, 4) != 4)
return STATUS_UNSUCCESSFUL;
}
}
 
969,28 → 1051,6
 
 
//------------------------------------------------------------------------
// free resources from PCIADAs
//
NTSTATUS PCIVMEFreeResources(PDEVICE_OBJECT device_Obj)
{
CM_RESOURCE_LIST ResList;
BOOLEAN bConflict;
UNICODE_STRING DriverClassName;
 
KdPrint(("PCIVMEFreeResources()\n"));
 
RtlInitUnicodeString(&DriverClassName, L"PCIVME");
 
ResList.Count = 0;
 
IoReportResourceUsage(&DriverClassName, device_Obj->DriverObject,
&ResList, sizeof(ResList), device_Obj,
NULL, 0, FALSE, &bConflict);
return STATUS_SUCCESS;
};
 
 
//------------------------------------------------------------------------
// translate memory resources to neutral for PCIADAs
//
NTSTATUS PCIVMETranslateBusAddresses(PDEVICE_OBJECT device_Obj, PIRP irp)
1198,7 → 1258,11
// delete the symbolicLink in the registry
IoDeleteSymbolicLink(&symbol_name);
DEVICE_EXT *ext = (DEVICE_EXT*)(fdo->DeviceExtension);
// delete the deviceObject
// delete the busInterface and deviceObject
if (ext->busInterface) {
(*ext->busInterface->InterfaceDereference)(ext->busInterface->Context);
ext->busInterface = NULL;
}
if (ext->LowerDeviceObject) IoDetachDevice(ext->LowerDeviceObject);
IoDeleteDevice(fdo);
KdPrint(("HandleStopDevice (OK)\n"));
1244,8 → 1308,9
KdPrint(( "PCIVMEDispatchPnp - IRP_MJ_PNP (%2.2X)\n", fcn));
 
static NTSTATUS(*fcntab[])(PDEVICE_OBJECT, PIRP) = {
HandleStartDevice, // IRP_MN_START_DEVICE
HandleStopDevice // IRP_MN_QUERY_REMOVE_DEVICE
HandleStartDevice, // IRP_MN_START_DEVICE
// DefaultPnpHandler, // IRP_MN_QUERY_REMOVE_DEVICE
HandleStopDevice // IRP_MN_REMOVE_DEVICE
};
 
if (fcn >= arraysize(fcntab))
/wiener_pcivme/pcivme/SOURCE/pcivme_drv.h
169,6 → 169,7
PCIADA *vmemm[PCIVME_MAX_VMEMM]; // points to PCIADA to which it belongs
 
int nInitState; // tracks the state of initialisation
PBUS_INTERFACE_STANDARD busInterface;
} DEVICE_EXT, *PDEVICE_EXT;
 
typedef struct
189,6 → 190,7
NTSTATUS PCIVMEOpen(PDEVICE_OBJECT deviceObj, PIRP irp);
NTSTATUS PCIVMEClose(PDEVICE_OBJECT deviceObj, PIRP irp);
VOID PCIVMEUnload(PDRIVER_OBJECT driverObj);
NTSTATUS QueryBusInterface(IN PDEVICE_OBJECT DeviceObject, OUT PBUS_INTERFACE_STANDARD BusInterface);
NTSTATUS SearchDevices(PDEVICE_OBJECT device_Obj);
NTSTATUS PLX9050BugFix(PDEVICE_OBJECT device_Obj);
NTSTATUS PCIVMEExtractResources(PCIADA *pciada, PIRP irp);
206,6 → 208,7
#pragma alloc_text (init, DriverEntry)
#pragma alloc_text (page, PCIVMEStartDevice)
#pragma alloc_text (page, PCIVMEAddDevice)
#pragma alloc_text (page, QueryBusInterface)
#pragma alloc_text (page, SearchDevices)
#pragma alloc_text (page, PLX9050BugFix)
#pragma alloc_text (page, PCIVMEExtractResources)
/wiener_pcivme/pcivme/SOURCE/pcivme_i.c
195,6 → 195,7
//------------------------------------------------------------------------
// translate interrupt resources for PCIADAs to neutral ones
//
/*
NTSTATUS PCIVMETranslateInterrupts(PDEVICE_OBJECT device_Obj)
{
int i;
227,6 → 228,7
 
return result;
}
*/
 
//------------------------------------------------------------------------
// connect service routines to all PCIADA interrupts
/wiener_pcivme/pcivme/pcivme.vcxproj.filters
22,5 → 22,54
<Inf Include="pcivme.inf">
<Filter>Driver Files</Filter>
</Inf>
</ItemGroup>
</ItemGroup>
<ItemGroup>
<ClCompile Include="SOURCE\pcivme_drv.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="SOURCE\pcivme_fifo.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="SOURCE\pcivme_i.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="SOURCE\pcivme_io.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="SOURCE\pcivme_v.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="SOURCE\guid.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SOURCE\pciif.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SOURCE\pcivme.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SOURCE\pcivme_drv.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SOURCE\pcivme_fifo.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SOURCE\pcivme_i.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SOURCE\pcivme_io.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SOURCE\pcivme_v.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SOURCE\Vic.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="SOURCE\Vme.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>
/wiener_pcivme/pcivme/pcivme.vcxproj.user
3,4 → 3,8
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win8.1 Debug|Win32'">
<SignMode>Off</SignMode>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|x64'">
<TestCertificate>CN="WDKTestCert f9daq,130456733316664517" | 8644AA4DA938EFB0FDDA92D462A26EAF43663C98</TestCertificate>
<SignMode>TestSign</SignMode>
</PropertyGroup>
</Project>
/wiener_pcivme/pcivme/pcivme.vcxproj
190,9 → 190,11
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|x64'">
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
<IncludePath>$(ProjectDir);$(IncludePath);$(ProjectDir)\SOURCE</IncludePath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Release|x64'">
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
<IncludePath>$(ProjectDir);$(IncludePath);$(ProjectDir)\SOURCE</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win8.1 Debug|Win32'">
<ClCompile>
266,7 → 268,7
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Debug|x64'">
<ClCompile>
<WppEnabled>true</WppEnabled>
<WppEnabled>false</WppEnabled>
<WppScanConfigurationData Condition="'%(ClCompile. ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
<WppKernelMode>true</WppKernelMode>
</ClCompile>
273,7 → 275,7
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Win7 Release|x64'">
<ClCompile>
<WppEnabled>true</WppEnabled>
<WppEnabled>false</WppEnabled>
<WppScanConfigurationData Condition="'%(ClCompile. ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
<WppKernelMode>true</WppKernelMode>
</ClCompile>
/wiener_pcivme/Win8.1Release/pcivme Package/pcivme.cat
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream