1 /* 2 * COPYRIGHT: GPLv2+ - See COPYING in the top level directory 3 * PROJECT: ReactOS Virtual DOS Machine 4 * FILE: subsystems/mvdm/ntvdm/dos/dos32krnl/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 // Default segment 17 // Specification: Operating system handle 0x0000; user handles from 0x0001 to 0x00FE 18 #define EMS_MAX_HANDLES 255 19 #define EMS_PAGE_BITS 14 20 #define EMS_PAGE_SIZE (1 << EMS_PAGE_BITS) 21 #define EMS_PHYSICAL_PAGES 4 22 23 /* 16 MB of EMS memory */ 24 #define EMS_TOTAL_PAGES 1024 25 26 #define EMS_STATUS_SUCCESS 0x00 27 #define EMS_STATUS_INTERNAL_ERROR 0x80 28 #define EMS_STATUS_INVALID_HANDLE 0x83 29 #define EMS_STATUS_UNKNOWN_FUNCTION 0x84 30 #define EMS_STATUS_NO_MORE_HANDLES 0x85 31 #define EMS_STATUS_INSUFFICIENT_PAGES 0x88 32 #define EMS_STATUS_ZERO_PAGES 0x89 33 #define EMS_STATUS_INV_LOGICAL_PAGE 0x8A 34 #define EMS_STATUS_INV_PHYSICAL_PAGE 0x8B 35 #define EMS_STATUS_INVALID_SUBFUNCTION 0x8F 36 #define EMS_STATUS_HANDLE_NOT_FOUND 0xA0 37 #define EMS_STATUS_UNNAMED_HANDLE 0xA1 38 #define EMS_STATUS_HANDLE_ALREADY_EXISTS 0xA1 39 40 typedef struct _EMS_HANDLE 41 { 42 BOOLEAN Allocated; 43 USHORT PageCount; 44 LIST_ENTRY PageList; 45 UCHAR Name[8]; 46 } EMS_HANDLE, *PEMS_HANDLE; 47 48 typedef struct _EMS_PAGE 49 { 50 LIST_ENTRY Entry; 51 USHORT Handle; 52 } EMS_PAGE, *PEMS_PAGE; 53 54 #pragma pack(push, 1) 55 56 typedef struct _EMS_HANDLE_PAGE_INFO 57 { 58 USHORT Handle; 59 USHORT PageCount; 60 } EMS_HANDLE_PAGE_INFO, *PEMS_HANDLE_PAGE_INFO; 61 62 typedef struct _EMS_HANDLE_DIR_ENTRY 63 { 64 USHORT Handle; 65 UCHAR Name[8]; 66 } EMS_HANDLE_DIR_ENTRY, *PEMS_HANDLE_DIR_ENTRY; 67 68 typedef struct _EMS_COPY_DATA 69 { 70 ULONG RegionLength; 71 UCHAR SourceType; 72 USHORT SourceHandle; 73 USHORT SourceOffset; 74 USHORT SourceSegment; 75 UCHAR DestType; 76 USHORT DestHandle; 77 USHORT DestOffset; 78 USHORT DestSegment; 79 } EMS_COPY_DATA, *PEMS_COPY_DATA; 80 81 typedef struct _EMS_MAPPABLE_PHYS_PAGE 82 { 83 USHORT PageSegment; 84 USHORT PageNumber; 85 } EMS_MAPPABLE_PHYS_PAGE, *PEMS_MAPPABLE_PHYS_PAGE; 86 87 typedef struct _EMS_HARDWARE_INFO 88 { 89 WORD RawPageSize; 90 WORD AlternateRegSets; 91 WORD ContextAreaSize; 92 WORD DmaRegisterSets; 93 WORD DmaChannelOperation; 94 } EMS_HARDWARE_INFO, *PEMS_HARDWARE_INFO; 95 96 #pragma pack(pop) 97 98 /* FUNCTIONS ******************************************************************/ 99 100 BOOLEAN EmsDrvInitialize(USHORT Segment, ULONG TotalPages); 101 VOID EmsDrvCleanup(VOID); 102 103 #endif /* _EMSDRV_H_ */ 104