[NTVDM]
[reactos.git] / reactos / subsystems / mvdm / ntvdm / dos / dos32krnl / emsdrv.h
1 /*
2 * COPYRIGHT: GPLv2+ - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
4 * FILE: emsdrv.h
5 * PURPOSE: DOS EMS Driver
6 * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7 */
8
9 #ifndef _EMSDRV_H_
10 #define _EMSDRV_H_
11
12 /* DEFINITIONS ****************************************************************/
13
14 #define EMS_VERSION_NUM 0x40
15 #define EMS_INTERRUPT_NUM 0x67
16 #define EMS_SEGMENT 0xD000
17 #define EMS_MAX_HANDLES 16
18 #define EMS_PAGE_BITS 14
19 #define EMS_PAGE_SIZE (1 << EMS_PAGE_BITS)
20 #define EMS_PHYSICAL_PAGES 4
21
22 /* 16 MB of EMS memory */
23 #define EMS_TOTAL_PAGES 1024
24
25 #define EMS_STATUS_OK 0x00
26 #define EMS_STATUS_INTERNAL_ERROR 0x80
27 #define EMS_STATUS_INVALID_HANDLE 0x83
28 #define EMS_STATUS_NO_MORE_HANDLES 0x85
29 #define EMS_STATUS_INSUFFICIENT_PAGES 0x88
30 #define EMS_STATUS_ZERO_PAGES 0x89
31 #define EMS_STATUS_INV_LOGICAL_PAGE 0x8A
32 #define EMS_STATUS_INV_PHYSICAL_PAGE 0x8B
33 #define EMS_STATUS_UNKNOWN_FUNCTION 0x8F
34
35 typedef struct _EMS_HANDLE
36 {
37 BOOLEAN Allocated;
38 USHORT PageCount;
39 LIST_ENTRY PageList;
40 UCHAR Name[8];
41 } EMS_HANDLE, *PEMS_HANDLE;
42
43 typedef struct _EMS_PAGE
44 {
45 LIST_ENTRY Entry;
46 USHORT Handle;
47 } EMS_PAGE, *PEMS_PAGE;
48
49 #pragma pack(push, 1)
50
51 typedef struct _EMS_COPY_DATA
52 {
53 ULONG RegionLength;
54 UCHAR SourceType;
55 USHORT SourceHandle;
56 USHORT SourceOffset;
57 USHORT SourceSegment;
58 UCHAR DestType;
59 USHORT DestHandle;
60 USHORT DestOffset;
61 USHORT DestSegment;
62 } EMS_COPY_DATA, *PEMS_COPY_DATA;
63
64 typedef struct _EMS_HARDWARE_INFO
65 {
66 WORD RawPageSize;
67 WORD AlternateRegSets;
68 WORD ContextAreaSize;
69 WORD DmaRegisterSets;
70 WORD DmaChannelOperation;
71 } EMS_HARDWARE_INFO, *PEMS_HARDWARE_INFO;
72
73 #pragma pack(pop)
74
75 #endif
76
77 /* FUNCTIONS ******************************************************************/
78
79 BOOLEAN EmsDrvInitialize(ULONG TotalPages);
80 VOID EmsDrvCleanup(VOID);