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.

477 lines
21 KiB

  1. /******************************Module*Header*******************************\
  2. *
  3. * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  4. * !! !!
  5. * !! WARNING: NOT DDK SAMPLE CODE !!
  6. * !! !!
  7. * !! This source code is provided for completeness only and should not be !!
  8. * !! used as sample code for display driver development. Only those sources !!
  9. * !! marked as sample code for a given driver component should be used for !!
  10. * !! development purposes. !!
  11. * !! !!
  12. * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  13. *
  14. * Module Name: tvp4020.h
  15. *
  16. * Content: This module contains the definitions for the P2 internal RAMDAC.
  17. *
  18. * Copyright (c) 1994-1999 3Dlabs Inc. Ltd. All rights reserved.
  19. * Copyright (c) 1995-2003 Microsoft Corporation. All rights reserved.
  20. \*****************************************************************************/
  21. #define ADbgpf VideoDebugPrint
  22. //
  23. // TI TVP4020 RAMDAC definitions
  24. // This set of registers resides at &(pCtrlRegs->ExternalVideo)
  25. //
  26. typedef struct _tvp4020_regs {
  27. RAMDAC_REG pciAddrWr; // 0x00 - palette/cursor RAM write address, Index Register
  28. RAMDAC_REG palData; // 0x01 - palette RAM data
  29. RAMDAC_REG pixelMask; // 0x02 - pixel read mask
  30. RAMDAC_REG pciAddrRd; // 0x03 - palette/cursor RAM read address
  31. RAMDAC_REG curColAddr; // 0x04 - cursor color address
  32. RAMDAC_REG curColData; // 0x05 - cursor color data
  33. RAMDAC_REG Reserved1; // 0x06 - reserved
  34. RAMDAC_REG Reserved2; // 0x07 - reserved
  35. RAMDAC_REG Reserved3; // 0x08 - reserved
  36. RAMDAC_REG Reserved4; // 0x09 - reserved
  37. RAMDAC_REG indexData; // 0x0A - indexed data
  38. RAMDAC_REG curRAMData; // 0x0B - cursor RAM data
  39. RAMDAC_REG cursorXLow; // 0x0C - cursor position X low byte
  40. RAMDAC_REG cursorXHigh; // 0x0D - cursor position X high byte
  41. RAMDAC_REG cursorYLow; // 0x0E - cursor position Y low byte
  42. RAMDAC_REG cursorYHigh; // 0x0F - cursor position Y high byte
  43. } TVP4020RAMDAC, *pTVP4020RAMDAC;
  44. // macro declared by any function wishing to use the P2 internal RAMDAC . MUST be declared
  45. // after GLINT_DECL.
  46. //
  47. #if MINIVDD
  48. #define TVP4020_DECL \
  49. pTVP4020RAMDAC pTVP4020Regs = (pTVP4020RAMDAC)&(pDev->pRegisters->Glint.ExtVCReg)
  50. #else
  51. #define TVP4020_DECL \
  52. pTVP4020RAMDAC pTVP4020Regs = (pTVP4020RAMDAC)&(pRegisters->Glint.ExtVCReg)
  53. #endif
  54. // use the following macros as the address to pass to the
  55. // VideoPortWriteRegisterUlong function
  56. //
  57. // Palette Access
  58. #define __TVP4020_PAL_WR_ADDR ((PULONG)&(pTVP4020Regs->pciAddrWr.reg))
  59. #define __TVP4020_PAL_RD_ADDR ((PULONG)&(pTVP4020Regs->pciAddrRd.reg))
  60. #define __TVP4020_PAL_DATA ((PULONG)&(pTVP4020Regs->palData.reg))
  61. // Pixel mask
  62. #define __TVP4020_PIXEL_MASK ((PULONG)&(pTVP4020Regs->pixelMask.reg))
  63. // Access to the indexed registers
  64. #define __TVP4020_INDEX_ADDR ((PULONG)&(pTVP4020Regs->pciAddrWr.reg))
  65. #define __TVP4020_INDEX_DATA ((PULONG)&(pTVP4020Regs->indexData.reg))
  66. // Access to the Cursor
  67. #define __TVP4020_CUR_RAM_WR_ADDR ((PULONG)&(pTVP4020Regs->pciAddrWr.reg))
  68. #define __TVP4020_CUR_RAM_RD_ADDR ((PULONG)&(pTVP4020Regs->palAddrRd.reg))
  69. #define __TVP4020_CUR_RAM_DATA ((PULONG)&(pTVP4020Regs->curRAMData.reg))
  70. #define __TVP4020_CUR_COL_ADDR ((PULONG)&(pTVP4020Regs->curColAddr.reg))
  71. #define __TVP4020_CUR_COL_DATA ((PULONG)&(pTVP4020Regs->curColData.reg))
  72. // Cursor position control
  73. #define __TVP4020_CUR_X_LSB ((PULONG)&(pTVP4020Regs->cursorXLow.reg))
  74. #define __TVP4020_CUR_X_MSB ((PULONG)&(pTVP4020Regs->cursorXHigh.reg))
  75. #define __TVP4020_CUR_Y_LSB ((PULONG)&(pTVP4020Regs->cursorYLow.reg))
  76. #define __TVP4020_CUR_Y_MSB ((PULONG)&(pTVP4020Regs->cursorYHigh.reg))
  77. // ----------------------Values for some direct registers-----------------------
  78. /********************************************************************************/
  79. /* DIRECT REGISTER - CURSOR POSITION CONTROL */
  80. /********************************************************************************/
  81. // ** TVP4020_CUR_X_LSB
  82. // ** TVP4020_CUR_X_MSB
  83. // ** TVP4020_CUR_Y_LSB
  84. // ** TVP4020_CUR_Y_MSB
  85. // Default - undefined
  86. // Values written into those registers represent the BOTTOM-RIGHT corner
  87. // of the cursor. If 0 is in X or Y position - the cursor is off the screen
  88. // Only 12 bits are used, giving the range from 0 to 4095 ( 0x0000 - 0x0FFF)
  89. // The size of the cursor is (64,64) (0x40, 0x40)
  90. #define TVP4020_CURSOR_OFFSCREEN 0x00 // Cursor offscreen
  91. /********************************************************************************/
  92. /* DIRECT REGISTER - CURSOR COLORS */
  93. /********************************************************************************/
  94. #define TVP4020_CURSOR_COLOR0 0x01
  95. #define TVP4020_CURSOR_COLOR1 0x02
  96. #define TVP4020_CURSOR_COLOR2 0x03
  97. // ------------------------Indirect indexed registers map--------------------------
  98. /********************************************************************************/
  99. /* INDIRECT REGISTER - CURSOR CONTROL */
  100. /********************************************************************************/
  101. #define __TVP4020_CURSOR_CONTROL 0x06 // Indirect cursor control -
  102. // Default - 0x00
  103. #define TVP4020_CURSOR_SIZE_32 (0 << 6)// 32x32 cursor
  104. #define TVP4020_CURSOR_SIZE_64 (1 << 6)// 32x32 cursor
  105. #define TVP4020_CURSOR_32_SEL(i) ((i) << 4)// one of 4 32x32 cursors DABO: changed to << 4
  106. #define TVP4020_CURSOR_RAM_ADDRESS(x) (((x) & 0x03) << 2)// High bits of cursor RAM address
  107. #define TVP4020_CURSOR_RAM_MASK ((0x03) << 2) // Mask for high bits of cursor RAM address
  108. // DABO: Added constants for cursor mode
  109. #define TVP4020_CURSOR_OFF 0x00 // Cursor off
  110. #define TVP4020_CURSOR_COLOR 0x01 // 2-bits select color
  111. #define TVP4020_CURSOR_XGA 0x02 // 2-bits select XOR
  112. #define TVP4020_CURSOR_XWIN 0x03 // 2-bits select transparency/color
  113. /********************************************************************************/
  114. /* INDIRECT REGISTER - COLOR MODE REGISTER */
  115. /********************************************************************************/
  116. #define __TVP4020_COLOR_MODE 0x18 // Color Mode Register
  117. // Default - 0x00
  118. #define TVP4020_TRUE_COLOR_ENABLE (1 << 7)// True Color data accesses LUT
  119. #define TVP4020_TRUE_COLOR_DISABLE (0 << 7)// Non true color accesses LUT
  120. #define TVP4020_RGB_MODE (1 << 5)// RGB mode DABO: Swapped 0/1 (0=BGR, 1=RGB)
  121. #define TVP4020_BGR_MODE (0 << 5)// BGR mode
  122. #define TVP4020_VGA_SELECT (0 << 4)// select VGA mode
  123. #define TVP4020_GRAPHICS_SELECT (1 << 4)// select graphics modes
  124. #define TVP4020_PIXEL_MODE_CI8 (0 << 0)// pseudo color or VGA mode
  125. #define TVP4020_PIXEL_MODE_332 (1 << 0)// 332 true color
  126. #define TVP4020_PIXEL_MODE_2320 (2 << 0)// 232 off
  127. #define TVP4020_PIXEL_MODE_2321 (3 << 0)//
  128. #define TVP4020_PIXEL_MODE_5551 (4 << 0)//
  129. #define TVP4020_PIXEL_MODE_4444 (5 << 0)//
  130. #define TVP4020_PIXEL_MODE_565 (6 << 0)//
  131. #define TVP4020_PIXEL_MODE_8888 (8 << 0)//
  132. #define TVP4020_PIXEL_MODE_PACKED (9 << 0)// 24 bit packed
  133. /********************************************************************************/
  134. /* INDIRECT REGISTER - MODE CONTROL REGISTER */
  135. /********************************************************************************/
  136. #define __TVP4020_MODE_CONTROL 0x19 // Mode control
  137. // Default - 0x00
  138. #define TVP4020_PRIMARY_INPUT (0 << 4)// Primary input throuh palette
  139. #define TVP4020_SECONDARY_INPUT (1 << 4)// Secondary input throuh palette
  140. #define TVP4020_5551_DBL_BUFFER (1 << 2)// Enable 5551 dbl buffer
  141. #define TVP4020_5551_PACKED (0 << 2)// Packed 555 mode
  142. #define TVP4020_ENABLE_STATIC_DBL_BUFFER (1 << 1)// Static dbl buffer enabled
  143. #define TVP4020_DISABLE_STATIC_DBL_BUFFER (1 << 1)// Static dbl buffer disabled
  144. #define TVP4020_SELECT_FRONT_MODE (0 << 0)// Front mode
  145. #define TVP4020_SELECT_BACK_MODE (1 << 0)// Back mode
  146. /********************************************************************************/
  147. /* INDIRECT REGISTER - PALETTE PAGE */
  148. /********************************************************************************/
  149. #define __TVP4020_PALETTE_PAGE 0x1C //
  150. // Default - 0x00
  151. /********************************************************************************/
  152. /* INDIRECT REGISTER - MISC CONTROL */
  153. /********************************************************************************/
  154. #define __TVP4020_MISC_CONTROL 0x1E //
  155. // Default - 0x00
  156. #define TVP4020_SYNC_ENABLE (1 << 5)// Output SYNC info onto IOG
  157. #define TVP4020_SYNC_DISABLE (0 << 5)// No SYNC IOG output
  158. #define TVP4020_PEDESTAL_0 (0 << 4)// 0 IRE blanking pedestal
  159. #define TVP4020_PEDESTAL_75 (1 << 4)// 7.5 IRE blanking pedestal
  160. #define TVP4020_VSYNC_INVERT (1 << 3)// invert VSYNC output polarity
  161. #define TVP4020_VSYNC_NORMAL (0 << 3)// normal VSYNC output polarity
  162. #define TVP4020_HSYNC_INVERT (1 << 2)// invert HSYNC output polarity
  163. #define TVP4020_HSYNC_NORMAL (0 << 3)// normal HSYNC output polarity
  164. #define TVP4020_DAC_8BIT (1 << 1)// DAC is in 8-bit mode
  165. #define TVP4020_DAC_6BIT (0 << 1)// DAC is in 6-bit mode
  166. #define TVP4020_DAC_POWER_ON (0 << 0)// Turn DAC Power on
  167. #define TVP4020_DAC_POWER_OFF (1 << 0)// Turn DAC Power off
  168. /********************************************************************************/
  169. /* INDIRECT REGISTER - COLOR KEY CONTROL */
  170. /********************************************************************************/
  171. #define __TVP4020_CK_CONTROL 0x40 //
  172. // Default - 0x00
  173. /********************************************************************************/
  174. /* INDIRECT REGISTER - COLOR KEY OVERLAY */
  175. /********************************************************************************/
  176. #define __TVP4020_CK_OVR_REG 0x41 //
  177. // Default - 0x00
  178. /********************************************************************************/
  179. /* INDIRECT REGISTER - COLOR KEY RED */
  180. /********************************************************************************/
  181. #define __TVP4020_CK_RED_REG 0x42 //
  182. // Default - 0x00
  183. /********************************************************************************/
  184. /* INDIRECT REGISTER - COLOR KEY GREEN */
  185. /********************************************************************************/
  186. #define __TVP4020_CK_GREEN_REG 0x43 //
  187. // Default - 0x00
  188. /********************************************************************************/
  189. /* INDIRECT REGISTER - COLOR KEY BLUE */
  190. /********************************************************************************/
  191. #define __TVP4020_CK_BLUE_REG 0x44 //
  192. // Default - 0x00
  193. /********************************************************************************/
  194. /* INDIRECT REGISTER - PIXEL CLOCK PLL */
  195. /********************************************************************************/
  196. #define __TVP4020_PIXCLK_REG_A1 0x20
  197. #define __TVP4020_PIXCLK_REG_A2 0x21
  198. #define __TVP4020_PIXCLK_REG_A3 0x22
  199. #define __TVP4020_PIXCLK_REG_B1 0x23
  200. #define __TVP4020_PIXCLK_REG_B2 0x24
  201. #define __TVP4020_PIXCLK_REG_B3 0x25
  202. #define __TVP4020_PIXCLK_REG_C1 0x26
  203. #define __TVP4020_PIXCLK_REG_C2 0x27
  204. #define __TVP4020_PIXCLK_REG_C3 0x28
  205. #define __TVP4020_PIXCLK_STATUS 0x29
  206. /********************************************************************************/
  207. /* INDIRECT REGISTER - MEMORU CLOCK PLL */
  208. /********************************************************************************/
  209. #define __TVP4020_MEMCLK_REG_1 0x30
  210. #define __TVP4020_MEMCLK_REG_2 0x31
  211. #define __TVP4020_MEMCLK_REG_3 0x32
  212. #define __TVP4020_MEMCLK_STATUS 0x33
  213. #if 0
  214. // need a delay between each write to the 4020. The only way to guarantee
  215. // that the write has completed is to read from a GLINT control register.
  216. // Reading forces any posted writes to be flushed out. PPC needs 2 reads
  217. // to give us enough time.
  218. #define TVP4020_DELAY \
  219. { \
  220. volatile LONG __junk; \
  221. __junk = VideoPortReadRegisterUlong (FB_MODE_SEL); \
  222. __junk = VideoPortReadRegisterUlong (FB_MODE_SEL); \
  223. }
  224. #else
  225. #define TVP4020_DELAY
  226. #endif
  227. // macro to load a given data value into an internal TVP4020 register.
  228. //
  229. #define TVP4020_WRITE_CURRENT_INDEX TVP4020_SET_INDEX_REG
  230. #define TVP4020_SET_INDEX_REG(index) \
  231. { \
  232. VideoPortWriteRegisterUlong(__TVP4020_INDEX_ADDR, (ULONG)((index) & 0xff)); \
  233. TVP4020_DELAY; \
  234. }
  235. #define TVP4020_READ_CURRENT_INDEX(data) \
  236. { \
  237. data = VideoPortReadRegisterUlong(__TVP4020_INDEX_ADDR) & 0xff; \
  238. TVP4020_DELAY; \
  239. }
  240. #define TVP4020_WRITE_INDEX_REG(index, data) \
  241. { \
  242. TVP4020_SET_INDEX_REG(index); \
  243. ADbgpf(("*(0x%X) <-- 0x%X\n", __TVP4020_INDEX_DATA, (data) & 0xff)); \
  244. VideoPortWriteRegisterUlong(__TVP4020_INDEX_DATA, (ULONG)((data) & 0xff)); \
  245. TVP4020_DELAY; \
  246. }
  247. #define TVP4020_READ_INDEX_REG(index, data) \
  248. { \
  249. TVP4020_SET_INDEX_REG(index); \
  250. data = VideoPortReadRegisterUlong(__TVP4020_INDEX_DATA) & 0xff; \
  251. TVP4020_DELAY; \
  252. ADbgpf(("0x%X <-- *(0x%X)\n", data, __TVP4020_INDEX_DATA)); \
  253. }
  254. // DABO: For compatibility with TVP3026
  255. #define TVP4020_LOAD_CURSOR_CTRL(data) \
  256. { \
  257. volatile LONG __temp; \
  258. TVP4020_READ_INDEX_REG(__TVP4020_CURSOR_CONTROL, __temp); \
  259. __temp &= ~(0x03) ; \
  260. __temp |= ((data) & 0x03) ; \
  261. TVP4020_WRITE_INDEX_REG(__TVP4020_CURSOR_CONTROL, __temp); \
  262. }
  263. // macros to write a given RGB triplet into cursors 0, 1 and 2
  264. #define TVP4020_SET_CURSOR_COLOR0(red, green, blue) \
  265. { \
  266. VideoPortWriteRegisterUlong(__TVP4020_CUR_COL_ADDR, (ULONG)(TVP4020_CURSOR_COLOR0)); \
  267. TVP4020_DELAY; \
  268. VideoPortWriteRegisterUlong(__TVP4020_CUR_COL_DATA, (ULONG)(red)); \
  269. TVP4020_DELAY; \
  270. VideoPortWriteRegisterUlong(__TVP4020_CUR_COL_DATA, (ULONG)(green)); \
  271. TVP4020_DELAY; \
  272. VideoPortWriteRegisterUlong(__TVP4020_CUR_COL_DATA, (ULONG)(blue)); \
  273. TVP4020_DELAY; \
  274. }
  275. #define TVP4020_SET_CURSOR_COLOR1(red, green, blue) \
  276. { \
  277. VideoPortWriteRegisterUlong(__TVP4020_CUR_COL_ADDR, (ULONG)(TVP4020_CURSOR_COLOR1)); \
  278. TVP4020_DELAY; \
  279. VideoPortWriteRegisterUlong(__TVP4020_CUR_COL_DATA, (ULONG)(red)); \
  280. TVP4020_DELAY; \
  281. VideoPortWriteRegisterUlong(__TVP4020_CUR_COL_DATA, (ULONG)(green)); \
  282. TVP4020_DELAY; \
  283. VideoPortWriteRegisterUlong(__TVP4020_CUR_COL_DATA, (ULONG)(blue)); \
  284. TVP4020_DELAY; \
  285. }
  286. #define TVP4020_SET_CURSOR_COLOR2(red, green, blue) \
  287. { \
  288. VideoPortWriteRegisterUlong(__TVP4020_CUR_COL_ADDR, (ULONG)(TVP4020_CURSOR_COLOR2)); \
  289. TVP4020_DELAY; \
  290. VideoPortWriteRegisterUlong(__TVP4020_CUR_COL_DATA, (ULONG)(red)); \
  291. TVP4020_DELAY; \
  292. VideoPortWriteRegisterUlong(__TVP4020_CUR_COL_DATA, (ULONG)(green)); \
  293. TVP4020_DELAY; \
  294. VideoPortWriteRegisterUlong(__TVP4020_CUR_COL_DATA, (ULONG)(blue)); \
  295. TVP4020_DELAY; \
  296. }
  297. // macros to load a given RGB triple into the TVP4020 palette. Send the starting
  298. // index and then send RGB triples. Auto-increment is turned on.
  299. // Use TVP4020_PALETTE_START and multiple TVP4020_LOAD_PALETTE calls to load
  300. // a contiguous set of entries. Use TVP4020_LOAD_PALETTE_INDEX to load a set
  301. // of sparse entries.
  302. //
  303. #define TVP4020_PALETTE_START_WR(index) \
  304. { \
  305. VideoPortWriteRegisterUlong(__TVP4020_PAL_WR_ADDR, (ULONG)(index)); \
  306. TVP4020_DELAY; \
  307. }
  308. #define TVP4020_PALETTE_START_RD(index) \
  309. { \
  310. VideoPortWriteRegisterUlong(__TVP4020_PAL_RD_ADDR, (ULONG)(index)); \
  311. TVP4020_DELAY; \
  312. }
  313. #define TVP4020_LOAD_PALETTE(red, green, blue) \
  314. { \
  315. VideoPortWriteRegisterUlong(__TVP4020_PAL_DATA, (ULONG)(red)); \
  316. TVP4020_DELAY; \
  317. VideoPortWriteRegisterUlong(__TVP4020_PAL_DATA, (ULONG)(green)); \
  318. TVP4020_DELAY; \
  319. VideoPortWriteRegisterUlong(__TVP4020_PAL_DATA, (ULONG)(blue)); \
  320. TVP4020_DELAY; \
  321. }
  322. #define TVP4020_LOAD_PALETTE_INDEX(index, red, green, blue) \
  323. { \
  324. VideoPortWriteRegisterUlong(__TVP4020_PAL_WR_ADDR, (ULONG)(index)); \
  325. TVP4020_DELAY; \
  326. VideoPortWriteRegisterUlong(__TVP4020_PAL_DATA, (ULONG)(red)); \
  327. TVP4020_DELAY; \
  328. VideoPortWriteRegisterUlong(__TVP4020_PAL_DATA, (ULONG)(green)); \
  329. TVP4020_DELAY; \
  330. VideoPortWriteRegisterUlong(__TVP4020_PAL_DATA, (ULONG)(blue)); \
  331. TVP4020_DELAY; \
  332. }
  333. // macro to read back a given RGB triple from the TVP4020 palette. Use after
  334. // a call to TVP4020_PALETTE_START_RD
  335. //
  336. #define TVP4020_READ_PALETTE(red, green, blue) \
  337. { \
  338. red = (UCHAR)(VideoPortReadRegisterUlong(__TVP4020_PAL_DATA) & 0xff); \
  339. TVP4020_DELAY; \
  340. green = (UCHAR)(VideoPortReadRegisterUlong(__TVP4020_PAL_DATA) & 0xff); \
  341. TVP4020_DELAY; \
  342. blue = (UCHAR)(VideoPortReadRegisterUlong(__TVP4020_PAL_DATA) & 0xff); \
  343. TVP4020_DELAY; \
  344. }
  345. // macros to set/get the pixel read mask. The mask is 8 bits wide and gets
  346. // replicated across all bytes that make up a pixel.
  347. //
  348. #define TVP4020_SET_PIXEL_READMASK(mask) \
  349. { \
  350. VideoPortWriteRegisterUlong(__TVP4020_PIXEL_MASK, (ULONG)(mask)); \
  351. TVP4020_DELAY; \
  352. }
  353. #define TVP4020_READ_PIXEL_READMASK(mask) \
  354. { \
  355. mask = VideoPortReadRegisterUlong(__TVP4020_PIXEL_MASK) & 0xff; \
  356. }
  357. // macros to load values into the cursor array
  358. //
  359. #define TVP4020_CURSOR_ARRAY_START(offset) \
  360. { \
  361. volatile LONG __temp; \
  362. TVP4020_READ_INDEX_REG(__TVP4020_CURSOR_CONTROL, __temp); \
  363. __temp &= ~TVP4020_CURSOR_RAM_MASK ; \
  364. __temp |= TVP4020_CURSOR_RAM_ADDRESS((offset)>> 8) ; \
  365. TVP4020_WRITE_INDEX_REG(__TVP4020_CURSOR_CONTROL, __temp); \
  366. VideoPortWriteRegisterUlong(__TVP4020_CUR_RAM_WR_ADDR, (ULONG)((offset)& 0xff)); \
  367. TVP4020_DELAY; \
  368. }
  369. // DABO: Need a similar macro to set the read address for cursor RAM?
  370. #define TVP4020_LOAD_CURSOR_ARRAY(data) \
  371. { \
  372. VideoPortWriteRegisterUlong(__TVP4020_CUR_RAM_DATA, (ULONG)(data)); \
  373. TVP4020_DELAY; \
  374. }
  375. #define TVP4020_READ_CURSOR_ARRAY(data) \
  376. { \
  377. data = VideoPortReadRegisterUlong(__TVP4020_CUR_RAM_DATA) & 0xff; \
  378. TVP4020_DELAY; \
  379. }
  380. // macro to move the cursor
  381. //
  382. #define TVP4020_MOVE_CURSOR(x, y) \
  383. { \
  384. VideoPortWriteRegisterUlong(__TVP4020_CUR_X_LSB, (ULONG)((x) & 0xff)); \
  385. TVP4020_DELAY; \
  386. VideoPortWriteRegisterUlong(__TVP4020_CUR_X_MSB, (ULONG)((x) >> 8)); \
  387. TVP4020_DELAY; \
  388. VideoPortWriteRegisterUlong(__TVP4020_CUR_Y_LSB, (ULONG)((y) & 0xff)); \
  389. TVP4020_DELAY; \
  390. VideoPortWriteRegisterUlong(__TVP4020_CUR_Y_MSB, (ULONG)((y) >> 8)); \
  391. TVP4020_DELAY; \
  392. }
  393. // macro to change the cursor hotspot
  394. //
  395. #define TVP4020_CURSOR_HOTSPOT(x, y) \
  396. { \
  397. TVP4020_DELAY; \
  398. }