Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

191 lines
5.9 KiB

  1. /************************************************************************/
  2. /* */
  3. /* SERVICES.H */
  4. /* */
  5. /* Aug 26 1993 (c) 1993, ATI Technologies Incorporated. */
  6. /************************************************************************/
  7. /********************** PolyTron RCS Utilities
  8. $Revision: 1.9 $
  9. $Date: 02 Feb 1996 17:22:20 $
  10. $Author: RWolff $
  11. $Log: S:/source/wnt/ms11/miniport/archive/services.h_v $
  12. *
  13. * Rev 1.9 02 Feb 1996 17:22:20 RWolff
  14. * Added prototype for new routine GetVgaBuffer().
  15. *
  16. * Rev 1.8 11 Jan 1996 19:45:02 RWolff
  17. * SetFixedModes() now restricts modes based on pixel clock frequency.
  18. *
  19. * Rev 1.7 20 Jul 1995 18:01:16 mgrubac
  20. * Added support for VDIF files.
  21. *
  22. * Rev 1.6 02 Jun 1995 14:34:06 RWOLFF
  23. * Added prototype for UpperCase().
  24. *
  25. * Rev 1.5 23 Dec 1994 10:48:14 ASHANMUG
  26. * ALPHA/Chrontel-DAC
  27. *
  28. * Rev 1.4 19 Aug 1994 17:14:34 RWOLFF
  29. * Added support for non-standard pixel clock generators.
  30. *
  31. * Rev 1.3 20 Jul 1994 13:01:36 RWOLFF
  32. * Added prototype for new routine FillInRegistry().
  33. *
  34. * Rev 1.2 12 May 1994 11:05:06 RWOLFF
  35. * Prototype and definitions for new function SetFixedModes()
  36. *
  37. * Rev 1.1 26 Apr 1994 12:35:44 RWOLFF
  38. * Added prototype for ISAPitchAdjust()
  39. *
  40. * Rev 1.0 31 Jan 1994 11:49:22 RWOLFF
  41. * Initial revision.
  42. *
  43. * Rev 1.3 24 Jan 1994 18:10:24 RWOLFF
  44. * Added prototype for new routine TripleClock().
  45. *
  46. * Rev 1.2 15 Dec 1993 15:32:16 RWOLFF
  47. * Added prototype for new clock multiplier routine.
  48. *
  49. * Rev 1.1 05 Nov 1993 13:27:50 RWOLFF
  50. * Headers for new routines in SERVICES.C, added array of pixel clock
  51. * frequencies (initialized for 18811-1 clock chip, may be changed by other
  52. * routines for other clock chips).
  53. *
  54. * Rev 1.0 03 Sep 1993 14:29:06 RWOLFF
  55. * Initial revision.
  56. End of PolyTron RCS section *****************/
  57. #ifdef DOC
  58. SERVICES.H - Header file for SERVICES.C
  59. #endif
  60. /*
  61. * Global definitions used in detecting card capabilities.
  62. */
  63. #define VIDEO_ROM_ID 0x0AA55 /* Found at start of any BIOS block */
  64. /*
  65. * Permitted values for clock multiplication at high pixel depths.
  66. */
  67. enum {
  68. CLOCK_SINGLE = 1,
  69. CLOCK_THREE_HALVES,
  70. CLOCK_DOUBLE,
  71. CLOCK_TRIPLE
  72. };
  73. /*
  74. * Prototypes for functions supplied by SERVICES.C
  75. */
  76. extern void short_delay (void);
  77. extern void delay(int);
  78. extern BOOL IsBufferBacked(PUCHAR StartAddress, ULONG Size);
  79. extern UCHAR DoubleClock(UCHAR ClockSelector);
  80. extern UCHAR ThreeHalvesClock(UCHAR ClockSelector);
  81. extern UCHAR TripleClock(UCHAR ClockSelector);
  82. extern ULONG GetFrequency(UCHAR ClockSelector);
  83. extern UCHAR GetSelector(ULONG *Frequency);
  84. extern UCHAR GetShiftedSelector(ULONG Frequency);
  85. extern void ISAPitchAdjust(struct query_structure *QueryPtr);
  86. extern WORD SetFixedModes(WORD StartIndex,
  87. WORD EndIndex,
  88. WORD Multiplier,
  89. WORD PixelDepth,
  90. WORD Pitch,
  91. short FreeTables,
  92. ULONG MaxDotClock,
  93. struct st_mode_table **ppmode);
  94. extern void FillInRegistry(struct query_structure *QueryPtr);
  95. extern PVOID MapFramebuffer(ULONG StartAddress, long Size);
  96. extern unsigned short *Get_BIOS_Seg(void);
  97. extern void UpperCase(PUCHAR TxtString);
  98. extern PUCHAR GetVgaBuffer(ULONG Size, ULONG Offset, PULONG Segment, PUCHAR SaveBuffer);
  99. extern UCHAR LioInp(int Port, int Offset);
  100. extern USHORT LioInpw(int Port, int Offset);
  101. extern ULONG LioInpd(int Port);
  102. extern VOID LioOutp(int Port, UCHAR Data, int Offset);
  103. extern VOID LioOutpw(int Port, USHORT Data, int Offset);
  104. extern VOID LioOutpd(int Port, ULONG Data);
  105. #ifdef INCLUDE_SERVICES
  106. /*
  107. * Definitions and variables used in SERVICES.C
  108. */
  109. /*
  110. * The following definitions are used in finding the video BIOS segment.
  111. */
  112. #define ISA_ROM_BASE 0xC0000 /* Lowest address where BIOS can be found */
  113. #define ROM_LOOK_SIZE 0x40000 /* Size of block where BIOS can be found */
  114. #define ROM_GRANULARITY 0x00800 /* BIOS starts on a 2k boundary */
  115. /*
  116. * Offset from ISA_ROM_BASE of highest possible start of video BIOS segment
  117. */
  118. #define MAX_BIOS_START ROM_LOOK_SIZE - ROM_GRANULARITY
  119. /*
  120. * The ATI signature string will start at an offset into the video BIOS
  121. * segment no less than SIG_AREA_START and no greater than SIG_AREA_END.
  122. */
  123. #define SIG_AREA_START 0x30
  124. #define SIG_AREA_END 0x80
  125. /*
  126. * ROM block containing ATI Graphics product signature,
  127. * extended base address, and ASIC chip revision
  128. */
  129. VIDEO_ACCESS_RANGE RawRomBaseRange = {
  130. ISA_ROM_BASE, 0, ROM_LOOK_SIZE, FALSE, FALSE, FALSE
  131. };
  132. /*
  133. * Clock selector and divisor as used by DoubleClock(). These do not
  134. * match the divisor ans selector masks in the CLOCK_SEL register.
  135. */
  136. #define SELECTOR_MASK 0x0F
  137. #define DIVISOR_MASK 0x10
  138. #define DIVISOR_SHIFT 4 /* Bits to shift divisor before ORing with selector */
  139. /*
  140. * Frequencies (in hertz) produced by the clock generator for
  141. * each select value. External clock values should be set to 0
  142. * (won't match anything).
  143. */
  144. ULONG ClockGenerator[16] =
  145. {
  146. 100000000L,
  147. 126000000L,
  148. 92400000L,
  149. 36000000L,
  150. 50350000L,
  151. 56640000L,
  152. 0L,
  153. 44900000L,
  154. 135000000L,
  155. 32000000L,
  156. 110000000L,
  157. 80000000L,
  158. 39910000L,
  159. 44900000L,
  160. 75000000L,
  161. 65000000L
  162. };
  163. /*
  164. * Frequency tolerance (in hertz) used by GetSelector().
  165. * Any selector/divisor pair which produces a frequency
  166. * within FREQ_TOLERANCE of the input is considered a match.
  167. */
  168. #define FREQ_TOLERANCE 100000L
  169. #else /* Not defined INCLUDE_SERVICES */
  170. extern ULONG ClockGenerator[16];
  171. #endif /* defined INCLUDE_SERVICES */