[ros-diffs] [sginsberg] 35009: - Fix broken VideoPortSignalDmaComplete definition - Cleanup and reformat dma.c and add missing functions (not yet exported)

sginsberg at svn.reactos.org sginsberg at svn.reactos.org
Fri Aug 1 16:54:19 CEST 2008


Author: sginsberg
Date: Fri Aug  1 09:54:19 2008
New Revision: 35009

URL: http://svn.reactos.org/svn/reactos?rev=35009&view=rev
Log:
- Fix broken VideoPortSignalDmaComplete definition
- Cleanup and reformat dma.c and add missing functions (not yet exported)

Modified:
    trunk/reactos/drivers/video/videoprt/dma.c
    trunk/reactos/include/ddk/video.h

Modified: trunk/reactos/drivers/video/videoprt/dma.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/video/videoprt/dma.c?rev=35009&r1=35008&r2=35009&view=diff
==============================================================================
--- trunk/reactos/drivers/video/videoprt/dma.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/video/videoprt/dma.c [iso-8859-1] Fri Aug  1 09:54:19 2008
@@ -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.
- *
- */
-
-#include "videoprt.h"
+ * 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:     ...
+ */
+
+/* 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)
-{
-   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)
-{
-   HalFreeCommonBuffer(
-      (PADAPTER_OBJECT)VpDmaAdapter,
-      Length,
-      LogicalAddress,
-      VirtualAddress,
-      CacheEnabled);
-}
-
-/*
- * @unimplemented
- */
-
-VOID NTAPI
-VideoPortPutDmaAdapter(
-   IN PVOID HwDeviceExtension,
-   IN PVP_DMA_ADAPTER VpDmaAdapter)
-{
-    UNIMPLEMENTED;
-}
-
-/*
- * @unimplemented
- */
-
-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;
-
-   DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
-
-   TRACE_(VIDEOPRT, "VideoPortGetDmaAdapter\n");
-
-   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;
-
-   Adapter =
-      (PVP_DMA_ADAPTER)HalGetAdapter(&DeviceDescription, &NumberOfMapRegisters);
-   INFO_(VIDEOPRT, "Adapter %p\n", Adapter);
-   return(Adapter);
-}
-
-/*
- * @implemented
- */
-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;
-
-   VpDmaAdapter = VideoPortGetDmaAdapter(
-                    HwDeviceExtension,
-                    (PVP_DEVICE_DESCRIPTION)&DeviceDescription);
-
-   HalFreeCommonBuffer(
-      (PADAPTER_OBJECT)VpDmaAdapter,
-      Length,
-      LogicalAddress,
-      VirtualAddress,
-      CacheEnabled);
-}
+PVOID
+NTAPI
+VideoPortAllocateCommonBuffer(IN PVOID HwDeviceExtension,
+                              IN PVP_DMA_ADAPTER VpDmaAdapter,
+                              IN ULONG DesiredLength,
+                              OUT PPHYSICAL_ADDRESS LogicalAddress,
+                              IN BOOLEAN CacheEnabled,
+                              PVOID Reserved)
+{
+    /* 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)
+{
+    /* Forward to HAL */
+    HalFreeCommonBuffer((PADAPTER_OBJECT)VpDmaAdapter,
+                       Length,
+                       LogicalAddress,
+                       VirtualAddress,
+                       CacheEnabled);
+}
+
+/*
+ * @unimplemented
+ */
+VOID
+NTAPI
+VideoPortPutDmaAdapter(IN PVOID HwDeviceExtension,
+                       IN PVP_DMA_ADAPTER VpDmaAdapter)
+{
+    UNIMPLEMENTED;
+}
+
+/*
+ * @implemented
+ */
+PVP_DMA_ADAPTER
+NTAPI
+VideoPortGetDmaAdapter(IN PVOID HwDeviceExtension,
+                       IN PVP_DEVICE_DESCRIPTION VpDeviceExtension)
+{
+    DEVICE_DESCRIPTION DeviceDescription;
+    PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension = VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension);
+    ULONG NumberOfMapRegisters;
+
+	/* Zero the structure */
+    RtlZeroMemory(&DeviceDescription,
+	              sizeof(DEVICE_DESCRIPTION));
+
+    /* Initialize the structure */
+    DeviceDescription.Version = DEVICE_DESCRIPTION_VERSION;
+    DeviceDescription.Master = TRUE /* ?? */;
+	DeviceDescription.DmaWidth = Width8Bits;
+    DeviceDescription.DmaSpeed = Compatible;
+
+	/* Copy data from caller's device extension */
+    DeviceDescription.ScatterGather = VpDeviceExtension->ScatterGather;
+	DeviceDescription.Dma32BitAddresses = VpDeviceExtension->Dma32BitAddresses;
+	DeviceDescription.Dma64BitAddresses = VpDeviceExtension->Dma64BitAddresses;
+	DeviceDescription.MaximumLength = VpDeviceExtension->MaximumLength;
+
+    /* 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)
+{
+    DEVICE_DESCRIPTION DeviceDescription;
+    PVP_DMA_ADAPTER VpDmaAdapter;
+
+    /* 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;
+}

Modified: trunk/reactos/include/ddk/video.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/video.h?rev=35009&r1=35008&r2=35009&view=diff
==============================================================================
--- trunk/reactos/include/ddk/video.h [iso-8859-1] (original)
+++ trunk/reactos/include/ddk/video.h [iso-8859-1] Fri Aug  1 09:54:19 2008
@@ -1348,7 +1348,7 @@
 DDKAPI
 VideoPortSignalDmaComplete(
   IN PVOID  HwDeviceExtension,
-  IN PVOID  pDmaHandle);
+  IN PDMA  pDmaHandle);
 
 VPAPI
 VOID



More information about the Ros-diffs mailing list