- Use InterlockedIncrement, InterlockedDecrement over intrinsics
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Mon, 26 Jan 2009 17:38:22 +0000 (17:38 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Mon, 26 Jan 2009 17:38:22 +0000 (17:38 +0000)
- Fix ordering of IDmaChannelSlaveVtbl which led to an infinite loop
- Add a few guids
- Fix parameter for KeWaitForSingleObject (spotted by Christoph)
- Also check for IID_IPort in IPortTopology
- Fix priority boost IServiceGroup

svn path=/trunk/; revision=39115

reactos/drivers/wdm/audio/backpln/portcls/dma_slave.c
reactos/drivers/wdm/audio/backpln/portcls/guids.c
reactos/drivers/wdm/audio/backpln/portcls/irp.c
reactos/drivers/wdm/audio/backpln/portcls/port_topology.c
reactos/drivers/wdm/audio/backpln/portcls/portcls.rbuild
reactos/drivers/wdm/audio/backpln/portcls/private.h
reactos/drivers/wdm/audio/backpln/portcls/service_group.c

index 7b63c40..ef24ce0 100644 (file)
@@ -68,7 +68,7 @@ IDmaChannelSlave_fnAddRef(
 
     DPRINT("IDmaChannelSlave_AddRef: This %p\n", This);
 
-    return _InterlockedIncrement(&This->ref);
+    return InterlockedIncrement(&This->ref);
 }
 
 ULONG
@@ -78,7 +78,7 @@ IDmaChannelSlave_fnRelease(
 {
     IDmaChannelSlaveImpl * This = (IDmaChannelSlaveImpl*)iface;
 
-    _InterlockedDecrement(&This->ref);
+    InterlockedDecrement(&This->ref);
 
     DPRINT("IDmaChannelSlave_Release: This %p new ref %u\n", This, This->ref);
 
@@ -102,7 +102,7 @@ NTAPI
 IDmaChannelSlave_fnAllocateBuffer(
     IN IDmaChannelSlave * iface,
     IN ULONG BufferSize,
-    IN PPHYSICAL_ADDRESS  PhysicalAddressConstraint  OPTIONAL)
+    IN PPHYSICAL_ADDRESS  PhysicalAddressConstraint OPTIONAL)
 {
     IDmaChannelSlaveImpl * This = (IDmaChannelSlaveImpl*)iface;
 
@@ -125,6 +125,8 @@ IDmaChannelSlave_fnAllocateBuffer(
 
     This->BufferSize = BufferSize;
     This->AllocatedBufferSize = BufferSize;
+    DPRINT1("IDmaChannelSlave_fnAllocateBuffer Success Buffer %u Address %ull\n", BufferSize, This->Address);
+
     return STATUS_SUCCESS;
 }
 
@@ -185,7 +187,7 @@ IDmaChannelSlave_fnFreeBuffer(
         return;
     }
 
-    This->pAdapter->DmaOperations->FreeCommonBuffer(This->pAdapter, This->AllocatedBufferSize, This->Address, This->Buffer, TRUE);
+    This->pAdapter->DmaOperations->FreeCommonBuffer(This->pAdapter, This->AllocatedBufferSize, This->Address, This->Buffer, FALSE);
     This->Buffer = NULL;
     This->AllocatedBufferSize = 0;
     This->Address.QuadPart = 0LL;
@@ -458,8 +460,8 @@ IDmaChannelSlaveVtbl vt_IDmaChannelSlaveVtbl =
     IDmaChannelSlave_fnSystemAddress,
     IDmaChannelSlave_fnPhysicalAdress,
     IDmaChannelSlave_fnGetAdapterObject,
-    IDmaChannelSlave_fnCopyFrom,
     IDmaChannelSlave_fnCopyTo,
+    IDmaChannelSlave_fnCopyFrom,
     /* IDmaChannelSlave methods */
     IDmaChannelSlave_fnStart,
     IDmaChannelSlave_fnStop,
index bf44743..769e487 100644 (file)
@@ -19,6 +19,7 @@ const GUID CLSID_MiniportDriverDMusUARTCapture;
 const GUID CLSID_MiniportDriverFmSynth;
 const GUID CLSID_MiniportDriverFmSynthWithVol;
 
+const GUID IID_IPort =    {0xb4c90a25L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44}};
 const GUID IID_IDrmPort = {0x286D3DF8L, 0xCA22, 0x4E2E, {0xB9, 0xBC, 0x20, 0xB4, 0xF0, 0xE2, 0x01, 0xCE}};
 const GUID IID_IDrmPort2 = {0x1ACCE59CL, 0x7311, 0x4B6B, {0x9F, 0xBA, 0xCC, 0x3B, 0xA5, 0x9A, 0xCD, 0xCE}};
 const GUID IID_IInterruptSync = {0x22C6AC63L, 0x851B, 0x11D0, {0x9A, 0x7F, 0x00, 0xAA, 0x00, 0x38, 0xAC, 0xFE}};
@@ -26,7 +27,6 @@ const GUID IID_IPortWavePci = {0xb4c90a50L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0
 const GUID IID_IMiniportWavePci = {0xb4c90a52L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44}};
 const GUID IID_IAdapterPowerManagement = {0x793417D0L, 0x35FE, 0x11D1, {0xAD, 0x08, 0x00, 0xA0, 0xC9, 0x0A, 0xB1, 0xB0}};
 
-
 const GUID IID_IMiniportWaveCyclic = {0xb4c90a27L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44}};
 const GUID IID_IPortWaveCyclic = {0xb4c90a26L, 0x5791, 0x11d0, {0x86, 0xf9, 0x00, 0xa0, 0xc9, 0x11, 0xb5, 0x44}};
 const GUID IID_IResourceList = {0x22C6AC60L, 0x851B, 0x11D0, {0x9A, 0x7F, 0x00, 0xAA, 0x00, 0x38, 0xAC, 0xFE}};
@@ -41,6 +41,18 @@ const GUID IID_IPortClsVersion = {0x7D89A7BBL, 0x869B, 0x4567, {0x8D, 0xBE, 0x1E
 const GUID IID_IUnknown = {0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x46}};
 const GUID IID_IPortEvents = {0xA80F29C4L, 0x5498, 0x11D2, {0x95, 0xD9, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
 
+//FIXME
+//
+const GUID KS_CATEGORY_AUDIO    = {0x6994AD04, 0x93EF, 0x11D0, {0xA3, 0xCC, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
+const GUID KS_CATEGORY_RENDER   = {0x65E8773E, 0x8F56, 0x11D0, {0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
+const GUID KS_CATEGORY_CAPTURE  = {0x65E8773D, 0x8F56, 0x11D0, {0xA3, 0xB9, 0x00, 0xA0, 0xC9, 0x22, 0x31, 0x96}};
+const GUID KS_CATEGORY_TOPOLOGY = {0xDDA54A40, 0x1E4C, 0x11D1, {0xA0, 0x50, 0x40, 0x57, 0x05, 0xC1, 0x00, 0x00}};
+
+
+const GUID KSDATAFORMAT_TYPE_AUDIO =             {0x73647561L, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
+const GUID KSDATAFORMAT_SUBTYPE_PCM =            {0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
+const GUID KSDATAFORMAT_SPECIFIER_WAVEFORMATEX = {0x05589f81L, 0xc356, 0x11ce, {0xbf, 0x01, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}};
+
 
 ///
 /// undocumented guids
index 712e557..abb462a 100644 (file)
@@ -322,7 +322,7 @@ return STATUS_SUCCESS;
     if (Status == STATUS_PENDING)
     {
         /* not yet, lets wait a bit */
-        KeWaitForSingleObject(&Event, Executive, FALSE, FALSE, NULL);
+        KeWaitForSingleObject(&Event, Executive, KernelMode, FALSE, NULL);
         Status = STATUS_SUCCESS;
     }
     DPRINT1("Returning status %x\n", Status);
index 150ab27..1fb9e3b 100644 (file)
@@ -70,6 +70,7 @@ IPortTopology_fnQueryInterface(
     DPRINT1("IPortTopology_fnQueryInterface\n");
 
     if (IsEqualGUIDAligned(refiid, &IID_IPortTopology) ||
+        IsEqualGUIDAligned(refiid, &IID_IPort) ||
         IsEqualGUIDAligned(refiid, &IID_IUnknown))
     {
         *Output = &This->lpVtbl;
index 18dc45d..3cacfe0 100644 (file)
@@ -10,6 +10,7 @@
        <library>drmk</library>
        <library>rtl</library>
        <library>hal</library>
+       <library>libcntpr</library>
        <file>api.c</file>
        <file>connection.c</file>
        <file>dll.c</file>
index 6f7cc78..9de5b85 100644 (file)
 
 #include "interfaces.h"
 #include <ks.h>
+#include <ksmedia.h>
 #include <stdio.h>
+#include <math.h>
+#include <intrin.h>
 
 #define TAG(A, B, C, D) (ULONG)(((A)<<0) + ((B)<<8) + ((C)<<16) + ((D)<<24))
 #define TAG_PORTCLASS TAG('P', 'C', 'L', 'S')
index d9c9bd6..881c3ab 100644 (file)
@@ -177,7 +177,7 @@ IServiceGroupDpc(
 {
     IServiceGroupImpl * This = (IServiceGroupImpl*)DeferredContext;
     IServiceGroup_fnRequestService((IServiceGroup*)DeferredContext);
-    KeSetEvent(&This->DpcEvent, 0, FALSE);
+    KeSetEvent(&This->DpcEvent, IO_SOUND_INCREMENT, FALSE);
 }
 
 
@@ -243,7 +243,7 @@ static IServiceGroupVtbl vt_IServiceGroup =
 };
 
 /*
- * @unimplemented
+ * @implemented
  */
 NTSTATUS NTAPI
 PcNewServiceGroup(