- Fix broken VideoPortSignalDmaComplete definition

- Cleanup and reformat dma.c and add missing functions (not yet exported)

svn path=/trunk/; revision=35009
This commit is contained in:
Stefan Ginsberg 2008-08-01 14:54:19 +00:00
parent 6a23266635
commit 0ebeef15a1
2 changed files with 235 additions and 104 deletions

View file

@ -1,143 +1,274 @@
/*
* VideoPort driver
*
* Copyright (C) 2002, 2003, 2004 ReactOS Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; see the file COPYING.LIB.
* If not, write to the Free Software Foundation,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* PROJECT: ReactOS Videoport
* LICENSE: GPL - See COPYING in the top level directory
* FILE: drivers/video/videoprt/dma.c
* PURPOSE: Videoport Direct Memory Access Support
* PROGRAMMERS: ...
*/
#include "videoprt.h"
/* INCLUDES ******************************************************************/
#include <videoprt.h>
#define NDEBUG
#include <debug.h>
/* PUBLIC FUNCTIONS ***********************************************************/
/*
* @implemented
*/
PVOID NTAPI
VideoPortAllocateCommonBuffer(
IN PVOID HwDeviceExtension,
IN PVP_DMA_ADAPTER VpDmaAdapter,
IN ULONG DesiredLength,
OUT PPHYSICAL_ADDRESS LogicalAddress,
IN BOOLEAN CacheEnabled,
PVOID Reserved)
PVOID
NTAPI
VideoPortAllocateCommonBuffer(IN PVOID HwDeviceExtension,
IN PVP_DMA_ADAPTER VpDmaAdapter,
IN ULONG DesiredLength,
OUT PPHYSICAL_ADDRESS LogicalAddress,
IN BOOLEAN CacheEnabled,
PVOID Reserved)
{
return HalAllocateCommonBuffer(
(PADAPTER_OBJECT)VpDmaAdapter,
DesiredLength,
LogicalAddress,
CacheEnabled);
/* Forward to HAL */
return HalAllocateCommonBuffer((PADAPTER_OBJECT)VpDmaAdapter,
DesiredLength,
LogicalAddress,
CacheEnabled);
}
/*
* @implemented
*/
VOID NTAPI
VideoPortReleaseCommonBuffer(
IN PVOID HwDeviceExtension,
IN PVP_DMA_ADAPTER VpDmaAdapter,
IN ULONG Length,
IN PHYSICAL_ADDRESS LogicalAddress,
IN PVOID VirtualAddress,
IN BOOLEAN CacheEnabled)
VOID
NTAPI
VideoPortReleaseCommonBuffer(IN PVOID HwDeviceExtension,
IN PVP_DMA_ADAPTER VpDmaAdapter,
IN ULONG Length,
IN PHYSICAL_ADDRESS LogicalAddress,
IN PVOID VirtualAddress,
IN BOOLEAN CacheEnabled)
{
HalFreeCommonBuffer(
(PADAPTER_OBJECT)VpDmaAdapter,
Length,
LogicalAddress,
VirtualAddress,
CacheEnabled);
/* Forward to HAL */
HalFreeCommonBuffer((PADAPTER_OBJECT)VpDmaAdapter,
Length,
LogicalAddress,
VirtualAddress,
CacheEnabled);
}
/*
* @unimplemented
*/
VOID NTAPI
VideoPortPutDmaAdapter(
IN PVOID HwDeviceExtension,
IN PVP_DMA_ADAPTER VpDmaAdapter)
VOID
NTAPI
VideoPortPutDmaAdapter(IN PVOID HwDeviceExtension,
IN PVP_DMA_ADAPTER VpDmaAdapter)
{
UNIMPLEMENTED;
}
/*
* @unimplemented
* @implemented
*/
PVP_DMA_ADAPTER NTAPI
VideoPortGetDmaAdapter(
IN PVOID HwDeviceExtension,
IN PVP_DEVICE_DESCRIPTION VpDeviceExtension)
PVP_DMA_ADAPTER
NTAPI
VideoPortGetDmaAdapter(IN PVOID HwDeviceExtension,
IN PVP_DEVICE_DESCRIPTION VpDeviceExtension)
{
DEVICE_DESCRIPTION DeviceDescription;
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension;
ULONG NumberOfMapRegisters;
PVP_DMA_ADAPTER Adapter;
DEVICE_DESCRIPTION DeviceDescription;
PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
ULONG NumberOfMapRegisters;
DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
/* Zero the structure */
RtlZeroMemory(&DeviceDescription,
sizeof(DEVICE_DESCRIPTION));
TRACE_(VIDEOPRT, "VideoPortGetDmaAdapter\n");
/* Initialize the structure */
DeviceDescription.Version = DEVICE_DESCRIPTION_VERSION;
DeviceDescription.Master = TRUE /* ?? */;
DeviceDescription.DmaWidth = Width8Bits;
DeviceDescription.DmaSpeed = Compatible;
DeviceDescription.Version = DEVICE_DESCRIPTION_VERSION;
DeviceDescription.Master = TRUE /* ?? */;
DeviceDescription.ScatterGather = VpDeviceExtension->ScatterGather;
DeviceDescription.DemandMode = FALSE /* ?? */;
DeviceDescription.AutoInitialize = FALSE /* ?? */;
DeviceDescription.Dma32BitAddresses = VpDeviceExtension->Dma32BitAddresses;
DeviceDescription.IgnoreCount = FALSE /* ?? */;
DeviceDescription.Reserved1 = FALSE;
DeviceDescription.BusNumber = DeviceExtension->SystemIoBusNumber;
DeviceDescription.DmaChannel = 0 /* ?? */;
DeviceDescription.InterfaceType = DeviceExtension->AdapterInterfaceType;
DeviceDescription.DmaWidth = Width8Bits;
DeviceDescription.DmaSpeed = Compatible;
DeviceDescription.MaximumLength = VpDeviceExtension->MaximumLength;
DeviceDescription.DmaPort = 0;
/* Copy data from caller's device extension */
DeviceDescription.ScatterGather = VpDeviceExtension->ScatterGather;
DeviceDescription.Dma32BitAddresses = VpDeviceExtension->Dma32BitAddresses;
DeviceDescription.Dma64BitAddresses = VpDeviceExtension->Dma64BitAddresses;
DeviceDescription.MaximumLength = VpDeviceExtension->MaximumLength;
Adapter =
(PVP_DMA_ADAPTER)HalGetAdapter(&DeviceDescription, &NumberOfMapRegisters);
INFO_(VIDEOPRT, "Adapter %p\n", Adapter);
return(Adapter);
/* Copy data from the internal device extension */
DeviceDescription.BusNumber = DeviceExtension->SystemIoBusNumber;
DeviceDescription.InterfaceType = DeviceExtension->AdapterInterfaceType;
return (PVP_DMA_ADAPTER)HalGetAdapter(&DeviceDescription,
&NumberOfMapRegisters);
}
/*
* @implemented
*/
VOID NTAPI
VideoPortFreeCommonBuffer( IN PVOID HwDeviceExtension,
IN ULONG Length,
IN PVOID VirtualAddress,
IN PHYSICAL_ADDRESS LogicalAddress,
IN BOOLEAN CacheEnabled)
VOID
NTAPI
VideoPortFreeCommonBuffer(IN PVOID HwDeviceExtension,
IN ULONG Length,
IN PVOID VirtualAddress,
IN PHYSICAL_ADDRESS LogicalAddress,
IN BOOLEAN CacheEnabled)
{
DEVICE_DESCRIPTION DeviceDescription;
PVP_DMA_ADAPTER VpDmaAdapter;
DEVICE_DESCRIPTION DeviceDescription;
PVP_DMA_ADAPTER VpDmaAdapter;
VpDmaAdapter = VideoPortGetDmaAdapter(
HwDeviceExtension,
(PVP_DEVICE_DESCRIPTION)&DeviceDescription);
HalFreeCommonBuffer(
(PADAPTER_OBJECT)VpDmaAdapter,
Length,
LogicalAddress,
VirtualAddress,
CacheEnabled);
/* FIXME: Broken code*/
VpDmaAdapter = VideoPortGetDmaAdapter(HwDeviceExtension,
(PVP_DEVICE_DESCRIPTION)&DeviceDescription);
HalFreeCommonBuffer((PADAPTER_OBJECT)VpDmaAdapter,
Length,
LogicalAddress,
VirtualAddress,
CacheEnabled);
}
/*
* @unimplemented
*/
PVOID
NTAPI
VideoPortGetCommonBuffer(IN PVOID HwDeviceExtension,
IN ULONG DesiredLength,
IN ULONG Alignment,
OUT PPHYSICAL_ADDRESS LogicalAddress,
OUT PULONG pActualLength,
IN BOOLEAN CacheEnabled)
{
UNIMPLEMENTED;
return NULL;
}
/*
* @implemented
*/
BOOLEAN
NTAPI
VideoPortUnmapDmaMemory(
PVOID HwDeviceExtension,
PVOID VirtualAddress,
HANDLE ProcessHandle,
PDMA BoardMemoryHandle)
{
/* Deprecated */
return FALSE;
}
/*
* @implemented
*/
PDMA
NTAPI
VideoPortMapDmaMemory(IN PVOID HwDeviceExtension,
IN PVIDEO_REQUEST_PACKET pVrp,
IN PHYSICAL_ADDRESS BoardAddress,
IN PULONG Length,
IN PULONG InIoSpace,
IN PVOID MappedUserEvent,
IN PVOID DisplayDriverEvent,
IN OUT PVOID *VirtualAddress)
{
/* Deprecated */
return NULL;
}
/*
* @implemented
*/
VOID
NTAPI
VideoPortSetDmaContext(IN PVOID HwDeviceExtension,
OUT PDMA pDma,
IN PVOID InstanceContext)
{
/* Deprecated */
return;
}
/*
* @implemented
*/
BOOLEAN
NTAPI
VideoPortSignalDmaComplete(IN PVOID HwDeviceExtension,
IN PDMA pDmaHandle)
{
/* Deprecated */
return FALSE;
}
/*
* @unimplemented
*/
VP_STATUS
NTAPI
VideoPortStartDma(IN PVOID HwDeviceExtension,
IN PVP_DMA_ADAPTER VpDmaAdapter,
IN PVOID Mdl,
IN ULONG Offset,
IN OUT PULONG pLength,
IN PEXECUTE_DMA ExecuteDmaRoutine,
IN PVOID Context,
IN BOOLEAN WriteToDevice)
{
UNIMPLEMENTED;
/* Lie and return success */
return NO_ERROR;
}
/*
* @implemented
*/
PVOID
NTAPI
VideoPortGetDmaContext(IN PVOID HwDeviceExtension,
IN PDMA pDma)
{
/* Deprecated */
return NULL;
}
/*
* @implemented
*/
PDMA
NTAPI
VideoPortDoDma(IN PVOID HwDeviceExtension,
IN PDMA pDma,
IN DMA_FLAGS DmaFlags)
{
/* Deprecated */
return NULL;
}
/*
* @unimplemented
*/
PDMA
NTAPI
VideoPortAssociateEventsWithDmaHandle(IN PVOID HwDeviceExtension,
IN OUT PVIDEO_REQUEST_PACKET pVrp,
IN PVOID MappedUserEvent,
IN PVOID DisplayDriverEvent)
{
UNIMPLEMENTED;
return NULL;
}
/*
* @unimplemented
*/
VP_STATUS
NTAPI
VideoPortCompleteDma(IN PVOID HwDeviceExtension,
IN PVP_DMA_ADAPTER VpDmaAdapter,
IN PVP_SCATTER_GATHER_LIST VpScatterGather,
IN BOOLEAN WriteToDevice)
{
UNIMPLEMENTED;
/* Lie and return success */
return NO_ERROR;
}

View file

@ -1348,7 +1348,7 @@ BOOLEAN
DDKAPI
VideoPortSignalDmaComplete(
IN PVOID HwDeviceExtension,
IN PVOID pDmaHandle);
IN PDMA pDmaHandle);
VPAPI
VOID