Leaked source code of windows server 2003
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.

321 lines
12 KiB

  1. /************************************************************************/
  2. /* */
  3. /* CVTVDIF.H */
  4. /* */
  5. /* July 12 1995 (c) 1993, 1995 ATI Technologies Incorporated. */
  6. /************************************************************************/
  7. /********************** PolyTron RCS Utilities
  8. $Revision: 1.3 $
  9. $Date: 11 Jan 1996 19:40:34 $
  10. $Author: RWolff $
  11. $Log: S:/source/wnt/ms11/miniport/archive/cvtvdif.h_v $
  12. *
  13. * Rev 1.3 11 Jan 1996 19:40:34 RWolff
  14. * Added field for maximum supported pixel clock frequency to VDIFInputs
  15. * structure.
  16. *
  17. * Rev 1.2 30 Oct 1995 12:11:56 MGrubac
  18. * Fixed bug in calculating CRTC parameters based on read in data from VDIF files.
  19. *
  20. * Rev 1.1 26 Jul 1995 12:54:54 mgrubac
  21. * Changed members of stVDIFCallbackData structure.
  22. *
  23. * Rev 1.0 20 Jul 1995 18:23:32 mgrubac
  24. * Initial revision.
  25. End of PolyTron RCS section *****************/
  26. /*
  27. * Prototypes for functions supplied by CVTVDIF.C
  28. */
  29. extern void SetOtherModeParameters( WORD PixelDepth,
  30. WORD Pitch,
  31. WORD Multiplier,
  32. struct st_mode_table *pmode);
  33. #define CARRETURN '\x0D' /* Carriage return */
  34. #define TIMINGSECTION "PREADJUSTED_TIMING"
  35. #define HORPIXEL "HORPIXEL"
  36. #define VERPIXEL "VERPIXEL"
  37. #define VERFREQUENCY "VERFREQUENCY"
  38. #define HORFREQUENCY "HORFREQUENCY"
  39. #define SCANTYPE "SCANTYPE"
  40. #define PIXELCLOCK "PIXELCLOCK"
  41. #define HORSYNCTIME "HORSYNCTIME"
  42. #define HORADDRTIME "HORADDRTIME"
  43. #define HORBLANKTIME "HORBLANKTIME"
  44. #define HORBLANKSTART "HORBLANKSTART"
  45. #define VERSYNCTIME "VERSYNCTIME"
  46. #define VERADDRTIME "VERADDRTIME"
  47. #define VERBLANKTIME "VERBLANKTIME"
  48. #define VERBLANKSTART "VERBLANKSTART"
  49. #define HORSYNCSTART "HORSYNCSTART"
  50. #define VERSYNCSTART "VERSYNCSTART"
  51. #define HORSYNCPOLARITY "HORSYNCPOLARITY"
  52. #define VERSYNCPOLARITY "VERSYNCPOLARITY"
  53. /*
  54. * Structure for passing arguments and returned values between
  55. * SetFixedModes() and VDIFCallback()
  56. */
  57. struct stVDIFCallbackData
  58. {
  59. /*
  60. * Input and Outputs are from perspective of VDIFCallback()
  61. */
  62. /*
  63. * FreeTables; Input : number of free tables
  64. * Output: number of free tables after VDIFCallback routine
  65. */
  66. short FreeTables;
  67. /*
  68. * NumModes; Input and output: Number of mode tables added to list.
  69. * Incremented every time a new mode table is added to the list, in
  70. * SetFixedModes() and in VDIFCallback()
  71. */
  72. WORD NumModes;
  73. WORD Index; /* Input: First entry from "book" tables to use */
  74. WORD EndIndex; /* Input: Last entry from "book" tables to use */
  75. WORD LowBound; /* Input and output: The lowest frame rate */
  76. WORD Multiplier; /* Input Argument from SetFixedModes */
  77. WORD HorRes; /* Input Argument from SetFixedModes */
  78. WORD VerRes; /* Input Argument from SetFixedModes */
  79. WORD PixelDepth; /* Input Argument from SetFixedModes */
  80. WORD Pitch; /* Input Argument from SetFixedModes */
  81. ULONG MaxDotClock; /* Maximum supported pixel clock frequency */
  82. /*
  83. * ppFreeTables; Input and output: Pointer to pointer to the next free mode
  84. * table. Incremented every time a new mode table is added to the list, in
  85. * SetFixedModes() and in VDIFCallback()
  86. */
  87. struct st_mode_table **ppFreeTables;
  88. };
  89. /*
  90. * Structure for AlterTables[] to contain information we need to extract
  91. * from VDIF file for each mode table
  92. */
  93. struct VDIFInputs
  94. {
  95. short MinFrameRate;
  96. BOOL Interlaced;
  97. ULONG PixelClock;
  98. ULONG HorFrequency;
  99. ULONG VerFrequency;
  100. ULONG HorSyncStart;
  101. ULONG VerSyncStart;
  102. ULONG HorBlankStart;
  103. ULONG VerBlankStart;
  104. ULONG HorAddrTime;
  105. ULONG VerAddrTime;
  106. ULONG HorBlankTime;
  107. ULONG VerBlankTime;
  108. ULONG HorSyncTime;
  109. ULONG VerSyncTime;
  110. ULONG HorPolarity;
  111. ULONG VerPolarity;
  112. };
  113. /*
  114. * Pointer for passing parameters to callback functions by pointing
  115. * (after casting) to a structure containing input (and possibly output)
  116. * variables for a callback function. Originally intended for use with
  117. * SetFixedModes() and VDIFCallback().
  118. */
  119. extern void *pCallbackArgs;
  120. /*
  121. * VDIF Macros
  122. */
  123. #define OPER_LIMITS(vdif) \
  124. ((VDIFLimitsRec *)((char *)(vdif) + (vdif)->OffsetOperationalLimits))
  125. #define NEXT_OPER_LIMITS(limits) \
  126. ((VDIFLimitsRec *)((char *)(limits) + (limits)->OffsetNextLimits))
  127. #define PREADJ_TIMING(limits) \
  128. ((VDIFTimingRec *)((char *)(limits) + (limits)->Header.ScnLength))
  129. #define NEXT_PREADJ_TIMING(timing) \
  130. ((VDIFTimingRec *)((char *)(timing) + (timing)->Header.ScnLength))
  131. /*
  132. * Binary VDIF file defines
  133. */
  134. #define VDIF_MONITOR_MONOCHROME 0
  135. #define VDIF_MONITOR_COLOR 1
  136. #define VDIF_VIDEO_TTL 0
  137. #define VDIF_VIDEO_ANALOG 1
  138. #define VDIF_VIDEO_ECL 2
  139. #define VDIF_VIDEO_DECL 3
  140. #define VDIF_VIDEO_OTHER 4
  141. #define VDIF_SYNC_SEPARATE 0
  142. #define VDIF_SYNC_C 1
  143. #define VDIF_SYNC_CP 2
  144. #define VDIF_SYNC_G 3
  145. #define VDIF_SYNC_GP 4
  146. #define VDIF_SYNC_OTHER 5
  147. #define VDIF_EXT_XTAL 6
  148. #define VDIF_SCAN_NONINTERLACED 0
  149. #define VDIF_SCAN_INTERLACED 1
  150. #define VDIF_SCAN_OTHER 2
  151. #define VDIF_POLARITY_NEGATIVE 0
  152. #define VDIF_POLARITY_POSITIVE 1
  153. /*
  154. * We must force byte alignment of structures used in binary VDIF files,
  155. * since structures contained in binary files are already byte aligned
  156. */
  157. #pragma pack(1)
  158. struct _VDIF /* Monitor Description: */
  159. {
  160. UCHAR VDIFId[4]; /* Always "VDIF" */
  161. ULONG FileLength; /* Lenght of the whole file */
  162. ULONG Checksum; /* Sum of all bytes in the file after */
  163. /* This feeld */
  164. USHORT VDIFVersion; /* Structure version number */
  165. USHORT VDIFRevision; /* Structure revision number */
  166. USHORT Date[3]; /* File date Year/Month/Day */
  167. USHORT DateManufactured[3]; /* Date Year/Month/Day */
  168. ULONG FileRevision; /* File revision string */
  169. ULONG Manufacturer; /* ASCII ID of the manufacturer */
  170. ULONG ModelNumber; /* ASCII ID of the model */
  171. ULONG MinVDIFIndex; /* ASCII ID of Minimum VDIF index */
  172. ULONG Version; /* ASCII ID of the model version */
  173. ULONG SerialNumber; /* ASCII ID of the serial number */
  174. UCHAR MonitorType; /* Monochrome or Color */
  175. UCHAR CRTSize; /* Inches */
  176. UCHAR BorderRed; /* Percent */
  177. UCHAR BorderGreen; /* Percent */
  178. UCHAR BorderBlue; /* Percent */
  179. UCHAR Reserved1; /* Padding */
  180. USHORT Reserved2; /* Padding */
  181. ULONG RedPhosphorDecay; /* Microseconds */
  182. ULONG GreenPhosphorDecay; /* Microseconds */
  183. ULONG BluePhosphorDecay; /* Microseconds */
  184. USHORT WhitePoint_x; /* WhitePoint in CIExyY (scale 1000) */
  185. USHORT WhitePoint_y;
  186. USHORT WhitePoint_Y;
  187. USHORT RedChromaticity_x; /* Red chromaticity in x,y */
  188. USHORT RedChromaticity_y;
  189. USHORT GreenChromaticity_x; /* Green chromaticity in x,y */
  190. USHORT GreenChromaticity_y;
  191. USHORT BlueChromaticity_x; /* Blue chromaticity in x,y */
  192. USHORT BlueChromaticity_y;
  193. USHORT RedGamma; /* Gamme curve exponent (scale 1000) */
  194. USHORT GreenGamma;
  195. USHORT BlueGamma;
  196. ULONG NumberOperationalLimits;
  197. ULONG OffsetOperationalLimits;
  198. ULONG NumberOptions; /* Optional sections (gamma table) */
  199. ULONG OffsetOptions;
  200. ULONG OffsetStringTable;
  201. };
  202. #pragma pack()
  203. typedef struct _VDIF VDIFRec;
  204. #pragma pack(1)
  205. struct _VDIFScnHdr /* Generic Section Header: */
  206. {
  207. ULONG ScnLength; /* Lenght of section */
  208. ULONG ScnTag; /* Tag for section identification */
  209. };
  210. #pragma pack()
  211. typedef struct _VDIFScnHdr VDIFScnHdrRec;
  212. #pragma pack(1)
  213. struct _VDIFLimits /* Operational Limits: */
  214. {
  215. VDIFScnHdrRec Header; /* Common section info */
  216. USHORT MaxHorPixel; /* Pixels */
  217. USHORT MaxVerPixel; /* Lines */
  218. USHORT MaxHorAddrLength; /* Millimeters */
  219. USHORT MaxVerAddrHeight; /* Millimeters */
  220. UCHAR VideoType; /* TTL / Analog / ECL / DECL */
  221. UCHAR SyncType; /* TTL / Analog / ECL / DECL */
  222. UCHAR SyncConfiguration; /* Separate / C / CP / G / GP */
  223. UCHAR Reserved1; /* Padding */
  224. USHORT Reserved2; /* Padding */
  225. USHORT TerminationResistance;
  226. USHORT WhiteLevel; /* Millivolts */
  227. USHORT BlackLevel; /* Millivolts */
  228. USHORT BlankLevel; /* Millivolts */
  229. USHORT SyncLevel; /* Millivolts */
  230. ULONG MaxPixelClock; /* KiloHertz */
  231. ULONG MinHorFrequency; /* Hertz */
  232. ULONG MaxHorFrequency; /* Hertz */
  233. ULONG MinVerFrequency; /* MilliHertz */
  234. ULONG MaxVerFrequency; /* MilliHertz */
  235. USHORT MinHorRetrace; /* Nanoseconds */
  236. USHORT MinVerRetrace; /* Microseconds */
  237. ULONG NumberPreadjustedTimings;
  238. ULONG OffsetNextLimits;
  239. };
  240. #pragma pack()
  241. typedef struct _VDIFLimits VDIFLimitsRec;
  242. #pragma pack(1)
  243. struct _VDIFTiming /* Preadjusted Timing: */
  244. {
  245. VDIFScnHdrRec Header; /* Common section info */
  246. ULONG PreadjustedTimingName; /* SVGA/SVPMI mode number */
  247. USHORT HorPixel; /* Pixels */
  248. USHORT VerPixel; /* Lines */
  249. USHORT HorAddrLength; /* Millimeters */
  250. USHORT VerAddrHeight; /* Millimeters */
  251. UCHAR PixelWidthRatio; /* Gives H:V */
  252. UCHAR PixelHeightRatio;
  253. UCHAR Reserved1; /* Padding */
  254. UCHAR ScanType; /* Noninterlaced / interlaced */
  255. UCHAR HorSyncPolarity; /* Negative / positive */
  256. UCHAR VerSyncPolarity; /* Negative / positive */
  257. USHORT CharacterWidth; /* Pixels */
  258. ULONG PixelClock; /* KiloHertz */
  259. ULONG HorFrequency; /* Hertz */
  260. ULONG VerFrequency; /* MilliHertz */
  261. ULONG HorTotalTime; /* Nanoseconds */
  262. ULONG VerTotalTime; /* Microseconds */
  263. USHORT HorAddrTime; /* Nanoseconds */
  264. USHORT HorBlankStart; /* Nanoseconds */
  265. USHORT HorBlankTime; /* Nanoseconds */
  266. USHORT HorSyncStart; /* Nanoseconds */
  267. USHORT HorSyncTime; /* Nanoseconds */
  268. USHORT VerAddrTime; /* Microseconds */
  269. USHORT VerBlankStart; /* Microseconds */
  270. USHORT VerBlankTime; /* Microseconds */
  271. USHORT VerSyncStart; /* Microseconds */
  272. USHORT VerSyncTime; /* Microseconds */
  273. };
  274. #pragma pack()
  275. typedef struct _VDIFTiming VDIFTimingRec;
  276. #pragma pack(1)
  277. struct _VDIFGamma /* Gamma Table: */
  278. {
  279. VDIFScnHdrRec Header; /* Common sectio info */
  280. USHORT GammaTableEntries; /* Count of grays or RGB 3-tuples */
  281. USHORT Unused1;
  282. };
  283. #pragma pack()
  284. typedef struct _VDIFGamma VDIFGammaRec;
  285. typedef enum /* Tags for section identification */
  286. {
  287. VDIF_OPERATIONAL_LIMITS_TAG = 1,
  288. VDIF_PREADJUSTED_TIMING_TAG,
  289. VDIF_GAMMA_TABLE_TAG
  290. } VDIFScnTag;