Author: janderwald
Date: Fri Mar 5 11:11:54 2010
New Revision: 45862
URL:
http://svn.reactos.org/svn/reactos?rev=45862&view=rev
Log:
[PORTCLS]
- Implement a function to retrieve the current acquired mapping tag range of the miniport
driver
- Call RevokeMappings when audio pin is stopped
Modified:
trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.hpp
trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.cpp
trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp
trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavepci.cpp
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.hpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.hpp [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/interfaces.hpp [iso-8859-1] Fri Mar 5
11:11:54 2010
@@ -351,6 +351,11 @@
STDMETHOD_(BOOLEAN, HasLastMappingFailed)(THIS) PURE;
STDMETHOD_(ULONG, GetCurrentIrpOffset)(THIS) PURE;
+
+ STDMETHOD_(BOOLEAN, GetAcquiredTagRange)(THIS_
+ IN PVOID * FirstTag,
+ IN PVOID * LastTag);
+
};
@@ -387,7 +392,11 @@
IN PVOID Tag); \
\
STDMETHODIMP_(BOOLEAN) HasLastMappingFailed(THIS); \
- STDMETHODIMP_(ULONG) GetCurrentIrpOffset(THIS);
+ STDMETHODIMP_(ULONG) GetCurrentIrpOffset(THIS); \
+ STDMETHODIMP_(BOOLEAN) GetAcquiredTagRange(THIS_ \
+ IN PVOID * FirstTag, \
+ IN PVOID * LastTag);
+
/*****************************************************************************
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/irpstream.cpp [iso-8859-1] Fri Mar 5
11:11:54 2010
@@ -539,6 +539,53 @@
return m_CurrentOffset;
}
+BOOLEAN
+NTAPI
+CIrpQueue::GetAcquiredTagRange(
+ IN PVOID * FirstTag,
+ IN PVOID * LastTag)
+{
+ KIRQL OldLevel;
+ BOOLEAN Ret = FALSE;
+ PIRP Irp;
+ PLIST_ENTRY CurEntry;
+
+ KeAcquireSpinLock(&m_IrpListLock, &OldLevel);
+
+ if (!IsListEmpty(&m_FreeIrpList))
+ {
+ // get first entry
+ CurEntry = RemoveHeadList(&m_FreeIrpList);
+ // get irp from list entry
+ Irp = (PIRP)CONTAINING_RECORD(CurEntry, IRP, Tail.Overlay.ListEntry);
+
+ // get tag of first acquired buffer
+ *FirstTag = Irp->Tail.Overlay.DriverContext[3];
+
+ // put back irp
+ InsertHeadList(&m_FreeIrpList, &Irp->Tail.Overlay.ListEntry);
+
+ // get last entry
+ CurEntry = RemoveTailList(&m_FreeIrpList);
+ // get irp from list entry
+ Irp = (PIRP)CONTAINING_RECORD(CurEntry, IRP, Tail.Overlay.ListEntry);
+
+ // get tag of first acquired buffer
+ *LastTag = Irp->Tail.Overlay.DriverContext[3];
+
+ // put back irp
+ InsertTailList(&m_FreeIrpList, &Irp->Tail.Overlay.ListEntry);
+
+ // indicate success
+ Ret = TRUE;
+ }
+
+ // release lock
+ KeReleaseSpinLock(&m_IrpListLock, OldLevel);
+ // done
+ return Ret;
+}
+
NTSTATUS
NTAPI
NewIrpQueue(
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavecyclic.cpp [iso-8859-1] Fri
Mar 5 11:11:54 2010
@@ -346,7 +346,6 @@
Position->WriteOffset =
(ULONGLONG)Pin->m_IrpQueue->GetCurrentIrpOffset();
DPRINT("Play %lu Write %lu\n", Position->PlayOffset,
Position->WriteOffset);
}
-
Irp->IoStatus.Information = sizeof(KSAUDIO_POSITION);
return STATUS_SUCCESS;
Modified: trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavepci.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/backpln/…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavepci.cpp [iso-8859-1]
(original)
+++ trunk/reactos/drivers/wdm/audio/backpln/portcls/pin_wavepci.cpp [iso-8859-1] Fri Mar
5 11:11:54 2010
@@ -195,6 +195,8 @@
NTSTATUS Status = STATUS_UNSUCCESSFUL;
CPortPinWavePci *Pin;
PSUBDEVICE_DESCRIPTOR Descriptor;
+ PVOID FirstTag, LastTag;
+ ULONG MappingsRevoked;
PKSSTATE State = (PKSSTATE)Data;
// get sub device descriptor
@@ -221,6 +223,35 @@
{
// store new state
Pin->m_State = *State;
+ if (Pin->m_ConnectDetails->Interface.Id ==
KSINTERFACE_STANDARD_LOOPED_STREAMING && Pin->m_State == KSSTATE_STOP)
+ {
+ // FIXME
+ // complete with successful state
+ Pin->m_IrpQueue->CancelBuffers();
+ while(Pin->m_IrpQueue->GetAcquiredTagRange(&FirstTag,
&LastTag))
+ {
+ Status = Pin->m_Stream->RevokeMappings(FirstTag, LastTag,
&MappingsRevoked);
+ DPRINT("RevokeMappings Status %lx MappingsRevoked: %lu\n",
Status, MappingsRevoked);
+ KeStallExecutionProcessor(10);
+ }
+ Pin->m_Position.PlayOffset = 0;
+ Pin->m_Position.WriteOffset = 0;
+ }
+ else if (Pin->m_State == KSSTATE_STOP)
+ {
+ Pin->m_IrpQueue->CancelBuffers();
+ while(Pin->m_IrpQueue->GetAcquiredTagRange(&FirstTag,
&LastTag))
+ {
+ Status = Pin->m_Stream->RevokeMappings(FirstTag, LastTag,
&MappingsRevoked);
+ DPRINT("RevokeMappings Status %lx MappingsRevoked: %lu\n",
Status, MappingsRevoked);
+ KeStallExecutionProcessor(10);
+ }
+ Pin->m_Position.PlayOffset = 0;
+ Pin->m_Position.WriteOffset = 0;
+ }
+ // store result
+ Irp->IoStatus.Information = sizeof(KSSTATE);
+
}
// store result
Irp->IoStatus.Information = sizeof(KSSTATE);