Use free Windows DDK and compile with latest MinGW releases.
[reactos.git] / reactos / hal / halx86 / dma.c
1 /* $Id: dma.c,v 1.2 2002/09/07 15:12:10 chorns Exp $
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/hal/x86/dma.c
6 * PURPOSE: DMA functions
7 * PROGRAMMER: David Welch (welch@mcmail.com)
8 * UPDATE HISTORY:
9 * Created 22/05/98
10 */
11
12 /* INCLUDES *****************************************************************/
13
14 #include <hal.h>
15
16 #define NDEBUG
17 #include <internal/debug.h>
18
19
20 ADAPTER_OBJECT AdapterObjects[] = {
21 { 0, (PVOID)0x87, (PVOID)0x1, (PVOID)0x0, 0, NULL },
22 { 1, (PVOID)0x83, (PVOID)0x3, (PVOID)0x2, 0, NULL },
23 { 2, (PVOID)0x81, (PVOID)0x5, (PVOID)0x4, 0, NULL },
24 { 3, (PVOID)0x82, (PVOID)0x7, (PVOID)0x6, 0, NULL } };
25
26
27 /* FUNCTIONS *****************************************************************/
28
29 PVOID STDCALL
30 HalAllocateCommonBuffer (PADAPTER_OBJECT AdapterObject,
31 ULONG Length,
32 PPHYSICAL_ADDRESS LogicalAddress,
33 BOOLEAN CacheEnabled)
34 /*
35 * FUNCTION: Allocates memory that is visible to both the processor(s) and
36 * a dma device
37 * ARGUMENTS:
38 * AdapterObject = Adapter object representing the bus master or
39 * system dma controller
40 * Length = Number of bytes to allocate
41 * LogicalAddress = Logical address the driver can use to access the
42 * buffer
43 * CacheEnabled = Specifies if the memory can be cached
44 * RETURNS: The base virtual address of the memory allocated
45 * NULL on failure
46 */
47 {
48 UNIMPLEMENTED;
49 }
50
51 BOOLEAN STDCALL
52 HalFlushCommonBuffer (ULONG Unknown1,
53 ULONG Unknown2,
54 ULONG Unknown3,
55 ULONG Unknown4,
56 ULONG Unknown5,
57 ULONG Unknown6,
58 ULONG Unknown7,
59 ULONG Unknown8)
60 {
61 return TRUE;
62 }
63
64 VOID STDCALL
65 HalFreeCommonBuffer (PADAPTER_OBJECT AdapterObject,
66 ULONG Length,
67 PHYSICAL_ADDRESS LogicalAddress,
68 PVOID VirtualAddress,
69 BOOLEAN CacheEnabled)
70 {
71 MmFreeContiguousMemory(VirtualAddress);
72 }
73
74 PADAPTER_OBJECT STDCALL
75 HalGetAdapter (PDEVICE_DESCRIPTION DeviceDescription,
76 PULONG NumberOfMapRegisters)
77 /*
78 * FUNCTION: Returns a pointer to an adapter object for the DMA device
79 * defined in the device description structure
80 * ARGUMENTS:
81 * DeviceDescription = Structure describing the attributes of the device
82 * NumberOfMapRegisters (OUT) = Returns the maximum number of map
83 * registers the device driver can
84 * allocate for DMA transfer operations
85 * RETURNS: The allocated adapter object on success
86 * NULL on failure
87 */
88 {
89 /* Validate parameters in device description, and return a pointer to
90 the adapter object for the requested dma channel */
91 if( DeviceDescription->Version != DEVICE_DESCRIPTION_VERSION )
92 return NULL;
93 if( DeviceDescription->Master )
94 return NULL;
95 if( DeviceDescription->ScatterGather )
96 return NULL;
97 if( DeviceDescription->AutoInitialize )
98 return NULL;
99 if( DeviceDescription->Dma32BitAddresses )
100 return NULL;
101 if( DeviceDescription->InterfaceType != Isa )
102 return NULL;
103 /* if( DeviceDescription->DmaWidth != Width8Bits )
104 return NULL;*/
105 *NumberOfMapRegisters = 0x10;
106 AdapterObjects[DeviceDescription->DmaChannel].Buffer = 0;
107 return &AdapterObjects[DeviceDescription->DmaChannel];
108 }
109
110 ULONG STDCALL
111 HalReadDmaCounter (PADAPTER_OBJECT AdapterObject)
112 {
113 UNIMPLEMENTED;
114 }
115
116 /* EOF */