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.

141 lines
4.0 KiB

  1. /************************************************************************/
  2. /* */
  3. /* VDPTOCRT.C */
  4. /* */
  5. /* Copyright (c) 1993, ATI Technologies Incorporated. */
  6. /************************************************************************/
  7. /********************** PolyTron RCS Utilities
  8. $Revision: 1.8 $
  9. $Date: 20 Jul 1995 18:03:48 $
  10. $Author: mgrubac $
  11. $Log: S:/source/wnt/ms11/miniport/vcs/vdptocrt.c $
  12. *
  13. * Rev 1.8 20 Jul 1995 18:03:48 mgrubac
  14. * Added support for VDIF files.
  15. *
  16. * Rev 1.7 02 Jun 1995 14:34:28 RWOLFF
  17. * Switched from toupper() to UpperCase(), since toupper() led to unresolved
  18. * externals on some platforms.
  19. *
  20. * Rev 1.6 08 Mar 1995 11:35:52 ASHANMUG
  21. * Cleaned-up Warnings
  22. *
  23. * Rev 1.5 31 Aug 1994 16:33:38 RWOLFF
  24. * Now gets resolution definitions from ATIMP.H.
  25. *
  26. * Rev 1.4 19 Aug 1994 17:15:14 RWOLFF
  27. * Added support for non-standard pixel clock generators.
  28. *
  29. * Rev 1.3 22 Mar 1994 15:39:12 RWOLFF
  30. * Workaround for abs() not working properly.
  31. *
  32. * Rev 1.2 03 Mar 1994 12:38:46 ASHANMUG
  33. *
  34. * Rev 1.0 31 Jan 1994 11:24:14 RWOLFF
  35. * Initial revision.
  36. Rev 1.1 05 Nov 1993 13:34:12 RWOLFF
  37. Fixed "Hang on read from file" bug.
  38. Rev 1.0 16 Aug 1993 13:21:32 Robert_Wolff
  39. Initial revision.
  40. Rev 1.2 24 Jun 1993 14:30:12 RWOLFF
  41. Microsoft-originated change: added #include statements for additional
  42. NT-supplied headers which are needed in build 47x of NT
  43. Rev 1.1 04 May 1993 16:52:14 RWOLFF
  44. Switched from floating point calculations to long integer calculations due
  45. to lack of floating point support in Windows NT kernel-mode code.
  46. Rev 1.0 30 Apr 1993 16:45:18 RWOLFF
  47. Initial revision.
  48. End of PolyTron RCS section *****************/
  49. #ifdef DOC
  50. VDPTOCRT.C - Source file for Windows NT function to return a table of
  51. register values for setting a requested mode. The values
  52. are calculated from a raw ASCII list of timing values
  53. following the .VDP standard. The entry point to this module
  54. is the function "VdpToCrt" found at the end of the file.
  55. Written by Bill Hopkins
  56. #endif
  57. // COMPILER INCLUDES
  58. #include <stdio.h>
  59. #include <stdlib.h>
  60. #include <string.h>
  61. #include <errno.h>
  62. #include <math.h>
  63. // NT INCLUDES
  64. #include "dderror.h"
  65. #include "devioctl.h"
  66. #include "miniport.h"
  67. #include "ntddvdeo.h"
  68. #include "video.h"
  69. // APPLICATION INCLUDES
  70. #define INCLUDE_VDPDATA
  71. #define INCLUDE_VDPTOCRT
  72. #include "stdtyp.h"
  73. #include "amach1.h"
  74. #include "atimp.h"
  75. #include "cvtvga.h"
  76. #include "services.h"
  77. #include "vdptocrt.h"
  78. #include "vdpdata.h"
  79. /*
  80. * STATIC VARIABLES
  81. */
  82. static long MaxHorz,MaxVert; // used to record maximum resolution
  83. static unsigned long MaxRate; // used to record maximum vert scan rate
  84. /*
  85. * FUNCTION PROTYPES
  86. */
  87. /*
  88. * Allow miniport to be swapped out when not needed.
  89. */
  90. #if defined (ALLOC_PRAGMA)
  91. #pragma alloc_text(PAGE_COM, normal_to_skip2)
  92. #endif
  93. /*
  94. *****************************************************************************
  95. */
  96. /*
  97. * long normal_to_skip2(normal_number);
  98. *
  99. * long normal_number; Number to be converted
  100. *
  101. * Convert a number into either skip_1_2 or skip_2 representation.
  102. * Representation chosen depends on global skip1, which is nonzero
  103. * if skip_1_2 is desired and zero if skip_2 is desired.
  104. *
  105. * Returns
  106. * Number converted into desired representation
  107. */
  108. long normal_to_skip2(long normal_number)
  109. {
  110. if (skip1)
  111. return (((normal_number << 2) & 0xFFF8) | (normal_number & 0x1));
  112. else
  113. return (((normal_number << 1) & 0xFFF8) | (normal_number & 0x3));
  114. } /* end normal_to_skip2() */