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.

486 lines
17 KiB

  1. /*****************************************************************************
  2. *
  3. * file name: bind.h
  4. *
  5. ******************************************************************************/
  6. #ifndef BIND_H /* useful for header inclusion check, used by DDK */
  7. #define BIND_H
  8. #if 0 /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
  9. /* BDL should be enabled by __HC303__ only & not by High C 1.73 ???
  10. * __HIGHC__ is not automatically enabled by HIGH C3.03
  11. * Verify if this is correct.
  12. */
  13. #ifdef __HIGHC__
  14. pragma Off(Args_in_regs_for_locals);
  15. #endif
  16. #else
  17. #ifdef __HC303__
  18. #ifdef __ANSI_C__
  19. #define _REGS REGS
  20. /*** Configuration for compatibility with ASM ***/
  21. #pragma Off(Args_in_regs_for_locals);
  22. #else
  23. /*** Configuration for compatibility with ASM ***/
  24. pragma Off(Args_in_regs_for_locals);
  25. #endif /* __ANSI_C__ */
  26. #endif /* __HC303__ */
  27. #endif /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
  28. #ifdef WINDOWS_NT
  29. #include "video.h"
  30. #define _itoa itoa
  31. #define _strnicmp strnicmp
  32. #define _inp(a) VideoPortReadPortUchar((PUCHAR)(a))
  33. #define _outp(a, d) VideoPortWritePortUchar((PUCHAR)(a), (d))
  34. #define _stat stat
  35. #define inpw(a) VideoPortReadPortUshort((PUSHORT)(a))
  36. #define outpw(a, d) VideoPortWritePortUshort((PUSHORT)(a), (d))
  37. #define indw(a) VideoPortReadPortUlong((PULONG)(a))
  38. #define outdw(a, d) VideoPortWritePortUlong((PULONG)(a), (d))
  39. #define HANDLE word
  40. #define WORD word
  41. #endif /* #ifdef WINDOWS_NT */
  42. #ifndef XGXENV_H /*
  43. * Avoids multiple redefinitions, bind.h should always
  44. * be placed above xgxenv.h
  45. */
  46. /* data type */
  47. typedef int bool; /* boolean */
  48. typedef unsigned char byte; /* 8-bit datum */
  49. typedef unsigned short word; /* 16-bit datum */
  50. typedef short sword; /* 16-bit datum */
  51. typedef unsigned long dword; /* 32-bit datum */
  52. typedef long sdword; /* 32-bit datum */
  53. #endif /* XGXENV_H */
  54. /*** RGB color ***/
  55. typedef dword mtxRGB; /* red 0-7, green 8-15, blue 16-23 */
  56. /*** RGB color mask ***/
  57. typedef dword mtxRGBMASK; /* red 0-7, green 8-15, blue 16-23 */
  58. #define PUBLIC
  59. #define PRIVATE static
  60. #define FALSE 0
  61. #define TRUE 1
  62. #define DONT_CARE 0
  63. #define ZOOMx1 0x00010001 /* no zoom */
  64. #define SIZDW_BUFFER 8100 /* size of posting buffer */
  65. #define mtxVGA 0
  66. #define mtxADV_MODE 1
  67. #define mtxRES_NTSC 2
  68. #define mtxRES_PAL 3
  69. #define mtxFAIL 0
  70. #define mtxOK 1
  71. #define MAXCLIPRECT 10
  72. /*** MGA PRODUCT TYPE ***/
  73. #define MGA_ULTIMA 1
  74. #define MGA_ULTIMA_VAFC 2
  75. #define MGA_ULTIMA_PLUS 3
  76. #define MGA_ULTIMA_PLUS_200 4
  77. #define MGA_IMPRESSION_PLUS 5
  78. #define MGA_IMPRESSION_PLUS_200 6
  79. #define MGA_IMPRESSION 7
  80. #define MGA_IMPRESSION_PRO 8
  81. #define MGA_IMPRESSION_LTE 9
  82. typedef dword mtxCL; /* CL I.D. */
  83. typedef dword mtxRC; /* RC I.D. */
  84. typedef dword mtxLSDB; /* LSDB I.D. */
  85. /*
  86. * Cursor definition
  87. */
  88. typedef struct {
  89. word Width;
  90. word Height;
  91. word Pitch;
  92. word Format;
  93. dword *Data;
  94. } PixMap;
  95. /*
  96. * CursorInfo
  97. */
  98. typedef struct {
  99. word MaxWidth;
  100. word MaxHeight;
  101. word MaxDepth;
  102. word MaxColors;
  103. word CurWidth;
  104. word CurHeight;
  105. sword cHotSX;
  106. sword cHotSY;
  107. sword HotSX;
  108. sword HotSY;
  109. } CursorInfo;
  110. /*
  111. * Offscreen memory
  112. */
  113. typedef struct {
  114. word Type; /* bit 0 : 0 = normal off screen memory */
  115. /* 1 = z-buffer memory */
  116. /* bit 1 : 0 = vram */
  117. /* 1 = dram */
  118. /* bit 2 : 0 = supports block mode */
  119. /* 1 = no block mode */
  120. /* bit 3 - 15 : reserved */
  121. word XStart; /* x origin of off screen memory area in pixels */
  122. word YStart; /* y origin of off screen memory area in pixels */
  123. word Width; /* off screen width in pixels */
  124. word Height; /* off screen height in pixels */
  125. dword SafePlanes; /* off screen safe memory planes */
  126. word ZXStart; /* precise z-buffer start offset in pixels on YStart. */
  127. /* Valid only for z-buffer memory type offscreens ... */
  128. /* useful for direct z-buffer access manipulations. */
  129. } OffScrData;
  130. /*
  131. * HwModeData
  132. */
  133. typedef struct {
  134. word DispWidth; /* maximum display width in pixels */
  135. word DispHeight; /* maximum display height in pixels */
  136. byte DispType; /* bit 0 : 0 = non interlaced, 1 = interlaced */
  137. /* bit 1 : 0 = normal operation, 1 = TV_MODE */
  138. /* bit 2 : 0 = normal operation, 1 = LUT mode */
  139. /* bit 3 : 0 = normal operation, 1 = 565 mode */
  140. /* bit 4 : 0 = normal operation, 1 = DB mode */
  141. /* bit 5 : 0 = normal operation, 1 = monitor limited */
  142. /* bit 6 : 0 = normal operation, 1 = hw limited */
  143. /* bit 7 : 0 = normal operation, 1 = not displayable */
  144. byte ZBuffer; /* z-buffer available in this mode */
  145. word PixWidth; /* pixel width */
  146. dword NumColors; /* number of simultaneously displayable colors */
  147. word FbPitch; /* frame buffer pitch in pixels */
  148. byte NumOffScr; /* number of off screen areas */
  149. OffScrData *pOffScr; /* pointer to off screen area information */
  150. } HwModeData;
  151. /*
  152. * HwData
  153. */
  154. typedef struct {
  155. dword MapAddress; /* Memory map address */
  156. dword ProductType;
  157. /* 0 - 15 : Product platform */
  158. /* 11xx: ISA bus */
  159. /* 101x: VL bus */
  160. /* 100x: MCA bus */
  161. /* 011x: PCI bus */
  162. /* 16 - 31: Product ID */
  163. /* 0001: MGA_ULTIMA */
  164. /* 0010: MGA_ULTIMA_VAFC */
  165. /* 0011: MGA_ULTIMA_PLUS */
  166. /* 0100: MGA_ULTIMA_PLUS_200 */
  167. /* 0101: MGA_IMPRESSION_PLUS */
  168. /* 0110: MGA_IMPRESSION_PLUS_200 */
  169. /* 0111: MGA_IMPRESSION */
  170. /* 1000: MGA_IMPRESSION_PRO */
  171. /* 1001: MGA_IMPRESSION_LTE */
  172. dword ProductRev; /* 4 bit revision codes as follows */
  173. /* 0 - 3 : pcb revision */
  174. /* 4 - 7 : Titan revision */
  175. /* (0=TITAN, 1=ATLAS, 2=ATHENA) */
  176. /* 8 - 11 : Dubic revision */
  177. /* 12 : VideoPro board 0=absent 1=present */
  178. /* 13 - 31 : all 1's indicating no other device
  179. present */
  180. dword ShellRev; /* Shell revision */
  181. dword BindingRev; /* Binding revision */
  182. byte VGAEnable; /* 0 = vga disabled, 1 = vga enabled */
  183. byte Sync; /* relects the hardware straps */
  184. byte Device8_16; /* relects the hardware straps */
  185. byte PortCfg; /* 0-Disabled, 1-Mouse Port, 2-Laser Port */
  186. byte PortIRQ; /* IRQ level number, -1 = interrupts disabled */
  187. word MouseMap; /* Mouse I/O map base if PortCfg = Mouse Port */
  188. /* else don't care */
  189. byte MouseIRate; /* Mouse interrupt rate in Hz */
  190. byte DacType; /* 0 = BT482 */
  191. /* 1 = VIEWPOINT */
  192. /* 2 = BT485 */
  193. /* 7 = PX2085 */
  194. /* 9 = TVP3026 */
  195. /* 92 = SIERRA */
  196. /* 93 = CHAMELEON */
  197. HwModeData *pCurrentHwMode; /* Pointer to HwMode */
  198. HwModeData *pCurrentDisplayMode; /* Pointer to display mode */
  199. CursorInfo cursorInfo;
  200. dword VramAvail; /* VRAM memory available on board in bytes */
  201. dword DramAvail; /* DRAM memory available on board in bytes */
  202. word CurrentOverScanX; /* Left overscan in pixels */
  203. word CurrentOverScanY; /* Top overscan in pixels */
  204. dword YDstOrg; /* Offset physique de la memoire */
  205. dword CurrentZoomFactor;
  206. dword CurrentXStart;
  207. dword CurrentYStart;
  208. #ifdef WINDOWS_NT
  209. HwModeData *pHwMode; /* Pointer to HwMode */
  210. UCHAR *BaseAddress; /* Board base address */
  211. word ConfigSpace; /* Board config space */
  212. UCHAR *ConfigSpaceAddress;
  213. #endif
  214. } HwData;
  215. /*** Prototypes ***/
  216. #ifndef _WATCOM_DLL32
  217. HwData *mtxCheckHwAll(void);
  218. bool mtxSelectHw(HwData *pHardware);
  219. HwModeData *mtxGetHwModes(void);
  220. word mtxGetRefreshRates(HwModeData *pHwModeSelect);
  221. word ConvBitToFreq (word BitFreq);
  222. bool mtxSelectHwMode(HwModeData *pHwMode);
  223. bool mtxSetDisplayMode(HwModeData *pHwMode, dword Zoom);
  224. void mtxSetDisplayStart(dword x, dword y);
  225. dword mtxGetMgaSel(void);
  226. void mtxGetInfo(HwModeData **_pCurHwMode, HwModeData **_pCurDispMode,
  227. byte **_InitBuffer, byte **_VideoBuffer);
  228. bool mtxSetLUT(word index, mtxRGB color);
  229. void mtxClose(void);
  230. #endif
  231. /*----------------------------------------------------*/
  232. /* XG3 products : support declarations for sxciio.h */
  233. /*----------------------------------------------------*/
  234. #define mtxPBWAIT 1 /* Wait flag */
  235. typedef struct {
  236. dword Left;
  237. dword Top;
  238. dword Right;
  239. dword Bottom;
  240. } mtxRect;
  241. #define MAXCLIPRECT 10
  242. typedef struct {
  243. dword Count; /* number of clipping rectangles */
  244. dword Reserved; /* reserved field, set to 0x0 */
  245. dword Reserved1; /* origin of clip list, set to 0x0 */
  246. dword Reserved2; /* origin of clip list, set to 0x0 */
  247. mtxRect Rects[MAXCLIPRECT]; /* max. clip rects */
  248. mtxRect Bounds; /* bounding rectangle */
  249. } mtxClipList;
  250. /*** Prototypes ***/
  251. #ifndef _WATCOM_DLL32
  252. dword mtxAllocCL (word Nb_Rect);
  253. dword mtxAllocLSDB (word Nb_Light);
  254. dword mtxAllocRC (dword *Reserved);
  255. dword *mtxAllocBuffer (dword Nb_dword);
  256. bool mtxFreeBuffer (dword *ptr);
  257. bool mtxFreeCL (dword ptr);
  258. bool mtxFreeLSDB (dword ptr);
  259. bool mtxFreeRC (dword ptr);
  260. dword mtxGetBlockSize (void);
  261. bool mtxPostBuffer (dword *ptr, dword length, dword flags);
  262. bool mtxSyncBuffer (dword *ptr);
  263. bool mtxSetCL(dword RCid, dword CLid, mtxClipList *CL);
  264. void mtxSetRC (dword RCid);
  265. bool mtxCursorSetShape(PixMap *);
  266. void mtxCursorSetColors(mtxRGB, mtxRGB, mtxRGB, mtxRGB);
  267. void mtxCursorEnable(word);
  268. void mtxCursorSetHotSpot(word, word);
  269. void mtxCursorMove(word, word);
  270. CursorInfo *mtxCursorGetInfo();
  271. #endif
  272. /*----------------------------------------------------*/
  273. /* XG3 products : support declarations for graphics.h */
  274. /*----------------------------------------------------*/
  275. #define mtxRES_1280 0 /* 1280 x 1024 Resolution */
  276. #define mtxRES_1024 1 /* 1024 x 768 Resolution */
  277. #define mtxRES_VIDEO 2 /* 640 x 480 Interlaced Resolution */
  278. #define mtxRES_MAX -1 /* Find largest resolution */
  279. #define NTSC_UNDER 1 /* screen type */
  280. #define PAL_UNDER 2
  281. #define NTSC_OVER 3
  282. #define PAL_OVER 4
  283. #define mtxPASSTHRU 0 /* Passthru mode ; mtxPASSTHRU = mtxVGA */
  284. #define mtxADV_MODE 1 /* Advanced mode */
  285. /*** Raster operation ***/
  286. typedef dword mtxROP;
  287. #define mtxCLEAR ((mtxROP)0x00000000) /* 0 */
  288. #define mtxNOR ((mtxROP)0x11111111) /* NOT src AND NOT dst */
  289. #define mtxANDINVERTED ((mtxROP)0x22222222) /* NOT src AND dst */
  290. #define mtxREPLACEINVERTED ((mtxROP)0x33333333) /* NOT src */
  291. #define mtxANDREVERSE ((mtxROP)0x44444444) /* src AND NOT dst */
  292. #define mtxINVERT ((mtxROP)0x55555555) /* NOT dst */
  293. #define mtxXOR ((mtxROP)0x66666666) /* src XOR dst */
  294. #define mtxNAND ((mtxROP)0x77777777) /* NOT src OR NOT dst */
  295. #define mtxAND ((mtxROP)0x88888888) /* src AND dst */
  296. #define mtxEQUIV ((mtxROP)0x99999999) /* NOT src XOR dst */
  297. #define mtxNOOP ((mtxROP)0xAAAAAAAA) /* dst */
  298. #define mtxORINVERTED ((mtxROP)0xBBBBBBBB) /* NOT src OR dst */
  299. #define mtxREPLACE ((mtxROP)0xCCCCCCCC) /* src */
  300. #define mtxORREVERSE ((mtxROP)0xDDDDDDDD) /* src OR NOT dst */
  301. #define mtxOR ((mtxROP)0xEEEEEEEE) /* src OR dst */
  302. #define mtxSET ((mtxROP)0xFFFFFFFF) /* 1 */
  303. typedef struct { /* Configuration structure */
  304. word Width; /* screen width */
  305. word Height; /* screen height */
  306. dword Colors; /* # of colors */
  307. word PhysPixelSize; /* number of bits needed per pixel */
  308. byte DacSize; /* dac size */
  309. byte Luts; /* # of lut on board */
  310. word FbWidth; /* frame buffer width */
  311. word FbHeight; /* frame buffer height */
  312. word FbPitch; /* size of scan line */
  313. word OffScreenX; /* offscreen x location */
  314. word OffScreenY; /* offscreen y location */
  315. word OffScreenWidth; /* offscreen width */
  316. word OffScreenHeight; /* offscreen height */
  317. dword OffScreenPlanes; /* safe planes to write to mask */
  318. byte Name[32]; /* Board name */
  319. byte BindingId[32]; /* binding id */
  320. byte ShellId[32]; /* shell id */
  321. } mtxCONFIG;
  322. /*** prototypes ***/
  323. #ifndef _WATCOM_DLL32
  324. #ifndef __DDK_SRC__ /* - - - - - - - - - - - - - - - - - - - - - - - - - - */
  325. word mtxGetVideoMode (void);
  326. void mtxSetFgColor (mtxRGB color);
  327. mtxRGB mtxGetFgColor (void);
  328. void mtxSetOp (dword Op);
  329. dword mtxGetOp (void);
  330. void mtxScLine (sword x1, sword y1, sword x2, sword y2);
  331. void mtxScPixel (sword s, sword y);
  332. bool mtxScClip (word left, word top, word right, word bottom);
  333. void mtxScFilledRect (sword left, sword top, sword right, sword bottom);
  334. bool mtxCheckHw (void);
  335. bool mtxInit(bool dualscreen,short resolution_id,bool clear_flag, mtxCONFIG *config);
  336. bool mtxReset (void);
  337. void mtxSetVideoMode (word mode);
  338. extern void mtxMemScBitBlt(word dstx, word dsty, word width, word height,
  339. word plane, dword *src);
  340. extern void mtxScMemBitBlt(word srcx, word srcy, word width, word height,
  341. word plane, dword *dst);
  342. extern void mtxScScBitBlt (sword srcx, sword srcy, sword dstx, sword dsty,
  343. word width, word height, sword plane);
  344. #else /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  345. /* this will be cleaned up, quick and dirty solution for now */
  346. void mtxSetVideoMode (word mode);
  347. word mtxGetVideoMode (void);
  348. #ifndef GRPROTO_H
  349. void mtxSetFgColor (mtxRGB color);
  350. mtxRGB mtxGetFgColor (void);
  351. void mtxSetOp (dword Op);
  352. dword mtxGetOp (void);
  353. void mtxScLine (sword x1, sword y1, sword x2, sword y2);
  354. void mtxScPixel (sword s, sword y);
  355. /*** bool mtxScClip (word left, word top, word right, word bottom); ***/
  356. /*** for DDK compatibility ***/
  357. void mtxSetClipRect (
  358. word xLeft, word yTop,
  359. word xRight, word yBottom
  360. );
  361. /*** macro for mtxScClip calls to mtxSetClipRect and evaluates to mtxOK ***/
  362. #define mtxScClip( x, t, y, b ) ( \
  363. mtxSetClipRect( (x), (t), (y), (b) ), \
  364. mtxOK \
  365. )
  366. /*** NOTE: underscores will be removed in final DDK version from common
  367. *** SDK and DDK function names
  368. ***/
  369. #define _mtxScClip( x, t, y, b ) ( \
  370. mtxSetClipRect( (x), (t), (y), (b) ), \
  371. mtxOK \
  372. )
  373. void mtxScFilledRect (sword left, sword top, sword right, sword bottom);
  374. #endif /* GRPROTO_H */
  375. bool mtxCheckHw (void);
  376. bool mtxInit(bool dualscreen,short resolution_id,bool clear_flag, mtxCONFIG *config);
  377. bool mtxReset (void);
  378. #ifndef BLTPROTO_H
  379. extern void mtxMemScBitBlt(word dstx, word dsty, word width, word height,
  380. word plane, dword *src);
  381. extern void mtxScMemBitBlt(word srcx, word srcy, word width, word height,
  382. word plane, dword *dst);
  383. extern void mtxScScBitBlt (sword srcx, sword srcy, sword dstx, sword dsty,
  384. word width, word height, sword plane);
  385. #endif /* BLTPROTO_H */
  386. #endif /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  387. #endif
  388. #endif /* BIND_H */
  389.