08cf9ba73286752eb5082e714740cbd080a9e8b7
[reactos.git] / reactos / include / internal / hal / ddk.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: include/internal/hal/ddk.h
5 * PURPOSE: HAL provided defintions for device drivers
6 * PROGRAMMER: David Welch (welch@mcmail.com)
7 * REVISION HISTORY:
8 * 23/06/98: Taken from linux system.h
9 */
10
11
12 #ifndef __INCLUDE_INTERNAL_HAL_DDK_H
13 #define __INCLUDE_INTERNAL_HAL_DDK_H
14
15 #include <internal/ntoskrnl.h>
16
17 /* HalReturnToFirmware */
18 #define FIRMWARE_HALT 1
19 #define FIRMWARE_REBOOT 3
20
21
22 enum
23 {
24 DEVICE_DESCRIPTION_VERSION,
25 DEVICE_DESCRIPTION_VERSION1,
26 };
27
28 typedef ULONG DMA_WIDTH;
29 typedef ULONG DMA_SPEED;
30 typedef ULONG BUS_DATA_TYPE;
31
32 /*
33 * PURPOSE: Types for HalGetBusData
34 */
35 enum
36 {
37 Cmos,
38 EisaConfiguration,
39 Pos,
40 PCIConfiguration,
41 MaximumBusDataType,
42 };
43
44 typedef struct _DEVICE_DESCRIPTION
45 {
46 ULONG Version;
47 BOOLEAN Master;
48 BOOLEAN ScatterGather;
49 BOOLEAN DemandMode;
50 BOOLEAN AutoInitialize;
51 BOOLEAN Dma32BitAddress;
52 BOOLEAN IgnoreCount;
53 BOOLEAN Reserved1;
54 BOOLEAN Reserved2;
55 ULONG BusNumber;
56 ULONG DmaChannel;
57 INTERFACE_TYPE InterfaceType;
58 DMA_WIDTH DmaWidth;
59 DMA_SPEED DmaSpeed;
60 ULONG MaximumLength;
61 ULONG DmaPort;
62 } DEVICE_DESCRIPTION, *PDEVICE_DESCRIPTION;
63
64 typedef BOOLEAN (*PHAL_RESET_DISPLAY_PARAMETERS)(ULONG Columns, ULONG Rows);
65
66
67 VOID HalAcquireDisplayOwnership (
68 PHAL_RESET_DISPLAY_PARAMETERS ResetDisplayParameters);
69
70 PVOID HalAllocateCommonBuffer(PADAPTER_OBJECT AdapterObject,
71 ULONG Length,
72 PPHYSICAL_ADDRESS LogicalAddress,
73 BOOLEAN CacheEnabled);
74
75 NTSTATUS HalAssignSlotResources(PUNICODE_STRING RegistryPath,
76 PUNICODE_STRING DriverClassName,
77 PDRIVER_OBJECT DriverObject,
78 PDEVICE_OBJECT DeviceObject,
79 INTERFACE_TYPE BusType,
80 ULONG BusNumber,
81 ULONG SlotNumber,
82 PCM_RESOURCE_LIST* AllocatedResources);
83
84 VOID HalDisplayString (PCH String);
85
86 VOID HalExamineMBR(PDEVICE_OBJECT DeviceObject,
87 ULONG SectorSize,
88 ULONG MBRTypeIdentifier,
89 PVOID Buffer);
90
91 VOID HalFreeCommonBuffer(PADAPTER_OBJECT AdapterObject,
92 ULONG Length,
93 PHYSICAL_ADDRESS LogicalAddress,
94 PVOID VirtualAddress,
95 BOOLEAN CacheEnabled);
96
97 PADAPTER_OBJECT HalGetAdapter(PDEVICE_DESCRIPTION DeviceDescription,
98 PULONG NumberOfMapRegisters);
99
100 ULONG HalGetBusData(BUS_DATA_TYPE BusDataType,
101 ULONG BusNumber,
102 ULONG SlotNumber,
103 PVOID Buffer,
104 ULONG Length);
105
106 ULONG HalGetBusDataByOffset(BUS_DATA_TYPE BusDataType,
107 ULONG BusNumber,
108 ULONG SlotNumber,
109 PVOID Buffer,
110 ULONG Offset,
111 ULONG Length);
112
113 ULONG HalGetDmaAlignmentRequirement(VOID);
114
115 ULONG HalGetInterruptVector(INTERFACE_TYPE InterfaceType,
116 ULONG BusNumber,
117 ULONG BusInterruptLevel,
118 ULONG BusInterruptVector,
119 PKIRQL Irql,
120 PKAFFINITY Affinity);
121
122 BOOLEAN HalInitSystem (ULONG Phase,
123 boot_param *bp);
124
125 BOOLEAN HalMakeBeep (ULONG Frequency);
126
127 VOID HalQueryDisplayParameters(PULONG DispSizeX,
128 PULONG DispSizeY,
129 PULONG CursorPosX,
130 PULONG CursorPosY);
131
132 VOID HalQueryRealTimeClock(PTIME_FIELDS pTime);
133 VOID HalSetRealTimeClock(PTIME_FIELDS Time);
134
135 VOID HalQuerySystemInformation(VOID);
136
137 ULONG HalReadDmaCounter(PADAPTER_OBJECT AdapterObject);
138
139 VOID HalReturnToFirmware(ULONG Action);
140
141 ULONG HalSetBusData(BUS_DATA_TYPE BusDataType,
142 ULONG BusNumber,
143 ULONG SlotNumber,
144 PVOID Buffer,
145 ULONG Length);
146
147 ULONG HalSetBusDataByOffset(BUS_DATA_TYPE BusDataType,
148 ULONG BusNumber,
149 ULONG SlotNumber,
150 PVOID Buffer,
151 ULONG Offset,
152 ULONG Length);
153
154 VOID HalSetDisplayParameters(ULONG CursorPosX,
155 ULONG CursorPosY);
156
157 BOOLEAN HalTranslateBusAddress(INTERFACE_TYPE InterfaceType,
158 ULONG BusNumber,
159 PHYSICAL_ADDRESS BusAddress,
160 PULONG AddressSpace,
161 PPHYSICAL_ADDRESS TranslatedAddress);
162
163 /*
164 * Kernel debugger section
165 */
166
167 typedef struct _KD_PORT_INFORMATION
168 {
169 ULONG ComPort;
170 ULONG BaudRate;
171 ULONG BaseAddress;
172 } KD_PORT_INFORMATION, *PKD_PORT_INFORMATION;
173
174
175 extern ULONG KdComPortInUse;
176
177
178 BOOLEAN
179 STDCALL
180 KdPortInitialize (PKD_PORT_INFORMATION PortInformation,
181 DWORD Unknown1,
182 DWORD Unknown2);
183
184 VOID
185 STDCALL
186 KdPortPutByte (UCHAR ByteToSend);
187
188
189 /*
190 * Port I/O functions
191 */
192
193 VOID
194 READ_PORT_BUFFER_UCHAR (PUCHAR Port, PUCHAR Value, ULONG Count);
195
196 VOID
197 READ_PORT_BUFFER_ULONG (PULONG Port, PULONG Value, ULONG Count);
198
199 VOID
200 READ_PORT_BUFFER_USHORT (PUSHORT Port, PUSHORT Value, ULONG Count);
201
202 UCHAR
203 READ_PORT_UCHAR (PUCHAR Port);
204
205 ULONG
206 READ_PORT_ULONG (PULONG Port);
207
208 USHORT
209 READ_PORT_USHORT (PUSHORT Port);
210
211 VOID
212 WRITE_PORT_BUFFER_UCHAR (PUCHAR Port, PUCHAR Value, ULONG Count);
213
214 VOID
215 WRITE_PORT_BUFFER_ULONG (PULONG Port, PULONG Value, ULONG Count);
216
217 VOID
218 WRITE_PORT_BUFFER_USHORT (PUSHORT Port, PUSHORT Value, ULONG Count);
219
220 VOID
221 WRITE_PORT_UCHAR (PUCHAR Port, UCHAR Value);
222
223 VOID
224 WRITE_PORT_ULONG (PULONG Port, ULONG Value);
225
226 VOID
227 WRITE_PORT_USHORT (PUSHORT Port, USHORT Value);
228
229
230 #endif /* __INCLUDE_INTERNAL_HAL_DDK_H */