4 * Copyright (C) 2002, 2003, 2004 ReactOS Team
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; see the file COPYING.LIB.
18 * If not, write to the Free Software Foundation,
19 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 /* PUBLIC FUNCTIONS ***********************************************************/
32 VideoPortAllocateCommonBuffer(
33 IN PVOID HwDeviceExtension
,
34 IN PVP_DMA_ADAPTER VpDmaAdapter
,
35 IN ULONG DesiredLength
,
36 OUT PPHYSICAL_ADDRESS LogicalAddress
,
37 IN BOOLEAN CacheEnabled
,
40 return HalAllocateCommonBuffer(
41 (PADAPTER_OBJECT
)VpDmaAdapter
,
52 VideoPortReleaseCommonBuffer(
53 IN PVOID HwDeviceExtension
,
54 IN PVP_DMA_ADAPTER VpDmaAdapter
,
56 IN PHYSICAL_ADDRESS LogicalAddress
,
57 IN PVOID VirtualAddress
,
58 IN BOOLEAN CacheEnabled
)
61 (PADAPTER_OBJECT
)VpDmaAdapter
,
73 VideoPortPutDmaAdapter(
74 IN PVOID HwDeviceExtension
,
75 IN PVP_DMA_ADAPTER VpDmaAdapter
)
85 VideoPortGetDmaAdapter(
86 IN PVOID HwDeviceExtension
,
87 IN PVP_DEVICE_DESCRIPTION VpDeviceExtension
)
89 DEVICE_DESCRIPTION DeviceDescription
;
90 PVIDEO_PORT_DEVICE_EXTENSION DeviceExtension
;
91 ULONG NumberOfMapRegisters
;
92 PVP_DMA_ADAPTER Adapter
;
94 DeviceExtension
= VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension
);
96 TRACE_(VIDEOPRT
, "VideoPortGetDmaAdapter\n");
98 DeviceDescription
.Version
= DEVICE_DESCRIPTION_VERSION
;
99 DeviceDescription
.Master
= TRUE
/* ?? */;
100 DeviceDescription
.ScatterGather
= VpDeviceExtension
->ScatterGather
;
101 DeviceDescription
.DemandMode
= FALSE
/* ?? */;
102 DeviceDescription
.AutoInitialize
= FALSE
/* ?? */;
103 DeviceDescription
.Dma32BitAddresses
= VpDeviceExtension
->Dma32BitAddresses
;
104 DeviceDescription
.IgnoreCount
= FALSE
/* ?? */;
105 DeviceDescription
.Reserved1
= FALSE
;
106 DeviceDescription
.BusNumber
= DeviceExtension
->SystemIoBusNumber
;
107 DeviceDescription
.DmaChannel
= 0 /* ?? */;
108 DeviceDescription
.InterfaceType
= DeviceExtension
->AdapterInterfaceType
;
109 DeviceDescription
.DmaWidth
= Width8Bits
;
110 DeviceDescription
.DmaSpeed
= Compatible
;
111 DeviceDescription
.MaximumLength
= VpDeviceExtension
->MaximumLength
;
112 DeviceDescription
.DmaPort
= 0;
115 (PVP_DMA_ADAPTER
)HalGetAdapter(&DeviceDescription
, &NumberOfMapRegisters
);
116 INFO_(VIDEOPRT
, "Adapter %p\n", Adapter
);
124 VideoPortFreeCommonBuffer( IN PVOID HwDeviceExtension
,
126 IN PVOID VirtualAddress
,
127 IN PHYSICAL_ADDRESS LogicalAddress
,
128 IN BOOLEAN CacheEnabled
)
130 DEVICE_DESCRIPTION DeviceDescription
;
131 PVP_DMA_ADAPTER VpDmaAdapter
;
133 VpDmaAdapter
= VideoPortGetDmaAdapter(
135 (PVP_DEVICE_DESCRIPTION
)&DeviceDescription
);
138 (PADAPTER_OBJECT
)VpDmaAdapter
,