home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / win3 / patches / symantec / rtlinc.exe / EMM.H < prev    next >
C/C++ Source or Header  |  1993-05-18  |  5KB  |  181 lines

  1. /*_ emm.h   Thu Dec  6 1990 */
  2. /* Expanded (LIM EMS) Memory Interface    */
  3.  
  4. /* References:
  5.  *    Lotus/Intel/Microsoft
  6.  *    Expanded Memory Specification
  7.  *    Version 4.0
  8.  *    Available from Intel at 800-538-3373
  9.  */
  10.  
  11. #ifndef __EMM_H
  12. #define __EMM_H    1
  13.  
  14. #if __cplusplus
  15. extern "C" {
  16. #endif
  17.  
  18. #define EMM_PAGESIZE    0x4000    /* 16K page size            */
  19.  
  20. extern int __cdecl emm_inited;    /* != 0 if emm handler is initialized    */
  21.  
  22. /********************************
  23.  * Initialize EMM handler.
  24.  * Returns:
  25.  *    0    EMS installed and operating
  26.  *    !=0    No EMS detected, or it isn't functioning properly
  27.  */
  28.  
  29. int __cdecl emm_init(void);
  30.  
  31. /************************************
  32.  * Get number of unallocated pages.
  33.  * Use this function to determine how many pages available before
  34.  * you attempt to allocate them with emm_allocpages().
  35.  */
  36.  
  37. unsigned __cdecl emm_getunalloc(void);
  38.  
  39. /************************************
  40.  * Get total number of pages in EMM system.
  41.  */
  42.  
  43. unsigned __cdecl emm_gettotal(void);
  44.  
  45. /**********************************
  46.  * Allocate pages.
  47.  * It is a fatal error if there are no emm handles available.
  48.  * Input:
  49.  *    n    number of pages to allocate, 0 < n <= emm_getunalloc()
  50.  * Returns:
  51.  *    handle that refers to these pages
  52.  */
  53.  
  54. int __cdecl emm_allocpages(unsigned);
  55.  
  56. /****************************
  57.  * Map page from logical page to physical page.
  58.  */
  59.  
  60. void __cdecl emm_maphandle(int handle,unsigned logical,unsigned physical);
  61.  
  62. /*****************************
  63.  * Save the state of the page mapping registers associated with
  64.  * the handle. The state is restored by emm_restorepagemap().
  65.  * You cannot nest emm_savepagemap()/emm_restorepagemap() calls for
  66.  * a single handle.
  67.  * There is a limited number of handles that can be saved with this
  68.  * function, fixed by the particular EMM handler. The application should
  69.  * strive to never require more than 1. This function will abort the
  70.  * program if there is no more handle space.
  71.  */
  72.  
  73. void __cdecl emm_savepagemap(int handle);
  74.  
  75. void __cdecl emm_restorepagemap(int handle);
  76.  
  77. /********************************
  78.  * Get physical page address of EMM frame page.
  79.  * Input:
  80.  *    pagenum        EMM page number (0..3)
  81.  * Returns:
  82.  *    pointer to base of that page
  83.  *    NULL if error
  84.  */
  85.  
  86. void far * __cdecl emm_physpage(int);
  87.  
  88. /********************************
  89.  * Terminate use of EMM handler.
  90.  */
  91.  
  92. void __cdecl emm_term(void);
  93.  
  94. /*******************************
  95.  * Get all handles pages.
  96.  * Input:
  97.  *    *p    points to array to be filled in. The number of entries
  98.  *        needed is returned by emm_gethandlecount();
  99.  * Output:
  100.  *    *p    data filled in
  101.  * Returns:
  102.  *    0    success
  103.  *    !=0    error code
  104.  */
  105. #pragma pack(__DEFALIGN)
  106. struct emm_handle_s
  107. {   int handle;        /* active handle                */
  108.     int pages;        /* number of pages alloc'd to that handle    */
  109. };
  110. #pragma pack()
  111.  
  112. int __cdecl emm_gethandlespages(struct emm_handle_s *p);
  113.  
  114. /*******************************
  115.  * Get number of active emm handles.
  116.  * Returns:
  117.  *    number of active handles
  118.  */
  119.  
  120. int __cdecl emm_gethandlecount(void);
  121.  
  122. /****************************
  123.  * Deallocate pages allocated for a handle by emm_allocpages().
  124.  * The program needs to deallocate its handles before exiting the program,
  125.  * else the pages will remain allocated and unavailable for use
  126.  * by other programs.
  127.  */
  128.  
  129. void __cdecl emm_deallocpages(int handle);
  130.  
  131. /****************************
  132.  * Return version number of EMM.
  133.  * Returns 0 if not initialized.
  134.  * The number is in the form of 2 hex digits, the most significant
  135.  * being the major version and the least the minor.
  136.  * For example, 0x32 means version 3.2.
  137.  */
  138.  
  139. int __cdecl emm_getversion(void);
  140.  
  141. /************************************
  142.  * The following four functions allow a program to save and restore
  143.  * the state of the EMM mapping registers. These are used in place
  144.  * of emm_savepagemap() and emm_restorepagemap() when you don't
  145.  * want to use a handle.
  146.  */
  147.  
  148. /************************************
  149.  * Get and return size in bytes of buffer needed by the functions
  150.  * emm_getpagemap(), emm_setpagemap() and emm_getsetpagemap().
  151.  */
  152.  
  153. unsigned __cdecl emm_getpagemapsize(void);
  154.  
  155. /*******************************
  156.  * Write state of mapping registers into *dst.
  157.  */
  158.  
  159. void __cdecl emm_getpagemap(void *dst);
  160.  
  161. /*******************************
  162.  * Set state of mapping registers from values previously saved by
  163.  * emm_getpagemap() into *src.
  164.  */
  165.  
  166. void __cdecl emm_setpagemap(void *src);
  167.  
  168. /**********************************
  169.  * Equivalent to:
  170.  *    emm_getpagemap(dst);
  171.  *    emm_setpagemap(src);
  172.  */
  173.  
  174. void __cdecl emm_getsetpagemap(void *dst,void *src);
  175.  
  176. #if __cplusplus
  177. }
  178. #endif
  179.  
  180. #endif /* __EMM_H    */
  181.