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.

381 lines
12 KiB

  1. /*++
  2. Copyright (c) 1993 Weitek Corporation
  3. Module Name:
  4. ibm485.h
  5. Abstract:
  6. This module contains the IBMRGB525 specific DAC definitions for the
  7. Weitek P9100 miniport device driver.
  8. Environment:
  9. Kernel mode
  10. Revision History may be found at the end of this file.
  11. --*/
  12. //
  13. // Define the relative offset of each of the Bt485 registers in the
  14. // DACRegisters array found in the Device Extension.
  15. //
  16. typedef enum
  17. {
  18. RS_0,
  19. RS_1,
  20. RS_2,
  21. RS_3,
  22. RS_4,
  23. RS_5,
  24. RS_6,
  25. RS_7,
  26. RS_8,
  27. RS_9,
  28. RS_A,
  29. RS_B,
  30. RS_C,
  31. RS_D,
  32. RS_E,
  33. RS_F,
  34. NUM_DAC_REGS
  35. } DAC_REG_INDEX;
  36. //
  37. // IBMRGB525 Indexed registers. Those index registers marked // Referenced
  38. // indicate that they are reference.
  39. //
  40. #define RGB525_REVISION_LEVEL (0x00)
  41. #define RGB525_ID (0x01)
  42. #define RGB525_MISC_CLOCK_CTL (0x02) // Referenced
  43. #define RGB525_SYNC_CTL (0x03)
  44. #define RGB525_HSYNC_POS (0x04)
  45. #define RGB525_POWER_MGNT (0x05)
  46. #define RGB525_DAC_OPER (0x06) // Referenced
  47. #define RGB525_PAL_CTRL (0x07)
  48. //
  49. // 08h through 09h are reserved by IBM
  50. //
  51. #define RGB525_PIXEL_FORMAT (0x0A) // Referenced
  52. #define RGB525_8BPP_CTL (0x0B) // Referenced
  53. #define RGB525_16BPP_CTL (0x0C) // Referenced
  54. #define RGB525_24BPP_CTL (0x0D) // Referenced
  55. #define RGB525_32BPP_CTL (0x0E) // Referenced
  56. //
  57. // 0Fh is reserved by IBM
  58. //
  59. #define RGB525_PLL_CTL1 (0x10) // Referenced
  60. #define RGB525_PLL_CTL2 (0x11) // Referenced
  61. //
  62. // 12h through 13h are reserved by IBM
  63. //
  64. #define RGB525_FIXED_PLL_REF_DIV (0x14) // Referenced
  65. //
  66. // 15h through 1fh are reserved by IBM
  67. //
  68. #define RGB525_F0 (0x20) // Referenced
  69. #define RGB525_F1 (0x21)
  70. #define RGB525_F2 (0x22)
  71. #define RGB525_F3 (0x23)
  72. #define RGB525_F4 (0x24)
  73. #define RGB525_F5 (0x25)
  74. #define RGB525_F6 (0x26)
  75. #define RGB525_F7 (0x27)
  76. #define RGB525_F8 (0x28)
  77. #define RGB525_F9 (0x29)
  78. #define RGB525_F10 (0x2A)
  79. #define RGB525_F11 (0x2B)
  80. #define RGB525_F12 (0x2C)
  81. #define RGB525_F13 (0x2D)
  82. #define RGB525_F14 (0x2E)
  83. #define RGB525_F15 (0x2F)
  84. #define RGB525_CURSOR_CTL (0x30) // Referenced
  85. #define RGB525_CURSOR_X_LOW (0x31) // Referenced
  86. #define RGB525_CURSOR_X_HIGH (0x32) // Referenced
  87. #define RGB525_CURSOR_Y_LOW (0x33) // Referenced
  88. #define RGB525_CURSOR_Y_HIGH (0x34) // Referenced
  89. #define RGB525_CURSOR_HOT_X (0x35) // Referenced
  90. #define RGB525_CURSOR_HOT_Y (0x36) // Referenced
  91. //
  92. // 37h through 3fh are reserved by IBM
  93. //
  94. #define RGB525_CURSOR_1_RED (0x40) // Referenced
  95. #define RGB525_CURSOR_1_GREEN (0x41) // Referenced
  96. #define RGB525_CURSOR_1_BLUE (0x42) // Referenced
  97. #define RGB525_CURSOR_2_RED (0x43) // Referenced
  98. #define RGB525_CURSOR_2_GREEN (0x44) // Referenced
  99. #define RGB525_CURSOR_2_BLUE (0x45) // Referenced
  100. #define RGB525_CURSOR_3_RED (0x46)
  101. #define RGB525_CURSOR_3_GREEN (0x47)
  102. #define RGB525_CURSOR_3_BLUE (0x48)
  103. //
  104. // 49h through 5fh are reserved by IBM
  105. //
  106. #define RGB525_BORDER_RED (0x60)
  107. #define RGB525_BORDER_GREEN (0x61)
  108. #define RGB525_BORDER_BLUE (0x62)
  109. //
  110. // 63h through 6fh are reserved by IBM
  111. //
  112. #define RGB525_MISC_CTL1 (0x70) // Referenced
  113. #define RGB525_MISC_CTL2 (0x71) // Referenced
  114. #define RGB525_MISC_CTL3 (0x72)
  115. //
  116. // 73h through 81h are reserved by IBM
  117. //
  118. #define RGB525_DAC_SENSE (0x82)
  119. //
  120. // 83h is reserved by IBM
  121. //
  122. #define RGB525_MISR_RED (0x84)
  123. //
  124. // 85h is reserved by IBM
  125. //
  126. #define RGB525_MISR_GREEN (0x86)
  127. //
  128. // 87h is reserved by IBM
  129. //
  130. #define RGB525_MISR_BLUE (0x88)
  131. //
  132. // 89h - 8dh are reserved by IBM
  133. //
  134. #define RGB525_PLL_VCO_DIV (0x8E)
  135. #define RGB525_PLL_REF_DIV_IN (0x8F)
  136. #define RGB525_VRAM_MASK_LOW (0x90)
  137. #define RGB525_VRAM_MASK_HIGH (0x91)
  138. //
  139. // 92h through 0ffh are reserved by IBM
  140. //
  141. #define RGB525_CURSOR_ARRAY (0x100) // Referenced
  142. //
  143. // Miscellaneous definitions...
  144. //
  145. //
  146. // Max clock frequency supported w/o clock doubling.
  147. //
  148. //
  149. #define CLK_MAX_FREQ_IBM525 (17000L)
  150. #define ON (0xff)
  151. #define OFF (0x0)
  152. #define CURS_ACTIVE_IBM525 (0x02)
  153. #define ENB_CURS_IBM525 (0x02)
  154. #define DIS_CURS_IBM525 ~CURS_ACTIVE_IBM525
  155. //
  156. // PLL Control 1 Register Bit Definitions. (Section 13.2.3.1)
  157. //
  158. #define IBM525_PLL1_REF_SRC_MSK 0x10
  159. #define IBM525_PLL1_REFCLK_INPUT 0x00
  160. #define IBM525_PLL1_EXTOSC_INPUT 0x10
  161. #define IBM525_PLL1_EXT_INT_MSK 0x07
  162. #define IBM525_PLL1_EXT_FS 0x00
  163. #define IBM525_PLL1_INT_FS 0x02
  164. //
  165. // PLL Control 2 Register Bit Definitions. (Section 13.2.3.2)
  166. //
  167. #define IBM525_PLL2_INT_FS_MSK 0x0F
  168. #define IBM525_PLL2_F0_REG 0x00
  169. #define IBM525_PLL2_F1_REG 0x01
  170. #define IBM525_PLL2_F2_REG 0x02
  171. #define IBM525_PLL2_F3_REG 0x03
  172. #define IBM525_PLL2_F4_REG 0x04
  173. #define IBM525_PLL2_F5_REG 0x05
  174. #define IBM525_PLL2_F6_REG 0x06
  175. #define IBM525_PLL2_F7_REG 0x07
  176. #define IBM525_PLL2_F8_REG 0x08
  177. #define IBM525_PLL2_F9_REG 0x09
  178. #define IBM525_PLL2_F10_REG 0x0A
  179. #define IBM525_PLL2_F11_REG 0x0B
  180. #define IBM525_PLL2_F12_REG 0x0C
  181. #define IBM525_PLL2_F13_REG 0x0D
  182. #define IBM525_PLL2_F14_REG 0x0E
  183. #define IBM525_PLL2_F15_REG 0x0F
  184. //
  185. // PLL Reference Divider Register Bit Definitions. (Section 13.2.3.3)
  186. //
  187. #define IBM525_PLLD_4MHZ 0x02
  188. #define IBM525_PLLD_6MHZ 0x03
  189. #define IBM525_PLLD_8MHZ 0x04
  190. #define IBM525_PLLD_10MHZ 0x05
  191. #define IBM525_PLLD_12MHZ 0x06
  192. #define IBM525_PLLD_14MHZ 0x07
  193. #define IBM525_PLLD_16MHZ 0x08
  194. #define IBM525_PLLD_18MHZ 0x09
  195. #define IBM525_PLLD_20MHZ 0x0A
  196. #define IBM525_PLLD_22MHZ 0x0B
  197. #define IBM525_PLLD_24MHZ 0x0C
  198. #define IBM525_PLLD_26MHZ 0x0D
  199. #define IBM525_PLLD_28MHZ 0x0E
  200. #define IBM525_PLLD_30MHZ 0x0F
  201. #define IBM525_PLLD_32MHZ 0x10
  202. #define IBM525_PLLD_34MHZ 0x11
  203. #define IBM525_PLLD_36MHZ 0x12
  204. #define IBM525_PLLD_38MHZ 0x13
  205. #define IBM525_PLLD_40MHZ 0x14
  206. #define IBM525_PLLD_42MHZ 0x15
  207. #define IBM525_PLLD_44MHZ 0x16
  208. #define IBM525_PLLD_46MHZ 0x17
  209. #define IBM525_PLLD_48MHZ 0x18
  210. #define IBM525_PLLD_50MHZ 0x19
  211. #define IBM525_PLLD_52MHZ 0x1A
  212. #define IBM525_PLLD_54MHZ 0x1B
  213. #define IBM525_PLLD_56MHZ 0x1C
  214. #define IBM525_PLLD_58MHZ 0x1D
  215. #define IBM525_PLLD_60MHZ 0x1E
  216. #define IBM525_PLLD_62MHZ 0x1F
  217. //
  218. // DAC Operation Register Bit Definitions. (Section 13.2.1.8)
  219. //
  220. #define IBM525_DO_SOG_MSK 0x08
  221. #define IBM525_DO_SOG_DISABLE 0x00
  222. #define IBM525_DO_SOG_ENABLE 0x08
  223. #define IBM525_DO_BRB_MSK 0x04
  224. #define IBM525_DO_BRB_NORMAL 0x00
  225. #define IBM525_DO_BRB_BLANKED 0x04
  226. #define IBM525_DO_DSR_MSK 0x02
  227. #define IBM525_DO_DSR_SLOW 0x00
  228. #define IBM525_DO_DSR_FAST 0x02
  229. #define IBM525_DO_DPE_MSK 0x01
  230. #define IBM525_DO_DPE_DISABLE 0x00
  231. #define IBM525_DO_DPE_ENABLE 0x01
  232. //
  233. // Bit definitions for the indexed registers.
  234. //
  235. //
  236. // Miscellaneous Control 1 Register Bit Definitions. (Section 13.2.1.1)
  237. //
  238. #define IBM525_MC1_MISR_CTL_MSK 0x80
  239. #define IBM525_MC1_MISR_CTL_OFF 0x00
  240. #define IBM525_MC1_MISR_CTL_ON 0x80
  241. #define IBM525_MC1_VMSK_CTL_MSK 0x40
  242. #define IBM525_MC1_VMASK_DISABLE 0x00
  243. #define IBM525_MC1_VMASK_ENABLE 0x40
  244. #define IBM525_MC1_PADR_RFMT_MSK 0x20
  245. #define IBM525_MC1_GET_PAL_ADDR 0x00
  246. #define IBM525_MC1_GET_ACC_STATE 0x20
  247. #define IBM525_MC1_SENS_DSAB_MSK 0x10
  248. #define IBM525_MC1_SENSE_ENABLE 0x00
  249. #define IBM525_MC1_SENSE_DISABLE 0x10
  250. #define IBM525_MC1_SENS_SEL_MSK 0x08
  251. #define IBM525_MC1_SENS_SEL_BIT3 0x00
  252. #define IBM525_MC1_SENS_SEL_BIT7 0x08
  253. #define IBM525_MC1_VRAM_SIZE_MSK 0x01
  254. #define IBM525_MC1_VRAM_32_BITS 0x00
  255. #define IBM525_MC1_VRAM_64_BITS 0x01
  256. //
  257. // Miscellaneous Control 2 Register Bit Definitions. (Section 13.2.1.2)
  258. //
  259. #define IBM525_MC2_PCLK_SEL_MSK 0xC0
  260. #define IBM525_MC2_LCLK_INPUT 0x00
  261. #define IBM525_MC2_INT_PLL_OUT 0x40
  262. #define IBM525_MC2_EXT_OSC_INPUT 0x80
  263. #define IBM525_MC2_INTL_MODE_MSK 0x20
  264. #define IBM525_MC2_NON_INTERLACE 0x00
  265. #define IBM525_MC2_INTERLACE 0x20
  266. #define IBM525_MC2_BLANK_CTL_MSK 0x10
  267. #define IBM525_MC2_NORMAL_BLNKS 0x00
  268. #define IBM525_MC2_DAC_BLNKS 0x10
  269. #define IBM525_MC2_CLR_RES_MSK 0x04
  270. #define IBM525_MC2_CLR_RES_6_BIT 0x00
  271. #define IBM525_MC2_CLR_RES_8_BIT 0x04
  272. #define IBM525_MC2_PORT_SEL_MSK 0x01
  273. #define IBM525_MC2_VGA_PEL_INPUT 0x00
  274. #define IBM525_MC2_SD_PEL_INPUT 0x01
  275. //
  276. // Define the Desired Frequency Ranges.
  277. //
  278. #define IBM525_DF0_LOW 1625
  279. #define IBM525_DF0_HIGH 3200
  280. #define IBM525_DF0_STEP 25
  281. #define IBM525_DF1_LOW 3250
  282. #define IBM525_DF1_HIGH 6400
  283. #define IBM525_DF1_STEP 50
  284. #define IBM525_DF2_LOW 6500
  285. #define IBM525_DF2_HIGH 12800
  286. #define IBM525_DF2_STEP 100
  287. #define IBM525_DF3_LOW 13000
  288. #define IBM525_DF3_HIGH 25000
  289. #define IBM525_DF3_STEP 200
  290. //
  291. // Frequency 0 thru Frequency 15 Register Bit Definitions. (Section 13.2.3.4)
  292. //
  293. #define IBM525_FREQ_DF_MSK 0xC0
  294. #define IBM525_FREQ_DF_0 0x00
  295. #define IBM525_FREQ_DF_1 0x40
  296. #define IBM525_FREQ_DF_2 0x80
  297. #define IBM525_FREQ_DF_3 0xC0
  298. //
  299. // Miscellaneous Clock Control Register Bit Definitions. (Section 13.2.1.4)
  300. //
  301. #define IBM525_MCC_DDOT_DSAB_MSK 0x80
  302. #define IBM525_MCC_DDOT_ENABLE 0x00
  303. #define IBM525_MCC_DDOT_DISABLE 0x80
  304. #define IBM525_MCC_SCLK_DSAB_MSK 0x40
  305. #define IBM525_MCC_SCLK_ENABLE 0x00
  306. #define IBM525_MCC_SCLK_DISABLE 0x40
  307. #define IBM525_MCC_B24P_DDOT_MSK 0x20
  308. #define IBM525_MCC_B24P_PLL 0x00
  309. #define IBM525_MCC_B24P_SCLK 0x20
  310. #define IBM525_MCC_DDOT_DIV_MSK 0x0E
  311. #define IBM525_MCC_PLL_DIV_1 0x00
  312. #define IBM525_MCC_PLL_DIV_2 0x02
  313. #define IBM525_MCC_PLL_DIV_4 0x04
  314. #define IBM525_MCC_PLL_DIV_8 0x06
  315. #define IBM525_MCC_PLL_DIV_16 0x08
  316. #define IBM525_MCC_PLL_ENAB_MSK 0x01
  317. #define IBM525_MCC_PLL_DISABLE 0x00
  318. #define IBM525_MCC_PLL_ENABLE 0x01
  319. //
  320. // Pixel Format Register Bit Definitions. (Section 13.2.2.1)
  321. //
  322. #define IBM525_PF_FORMAT_MSK 0x07
  323. #define IBM525_PF_4_BPP 0x02
  324. #define IBM525_PF_8_BPP 0x03
  325. #define IBM525_PF_15_OR_16_BPP 0x04
  326. #define IBM525_PF_24_BPP 0x05
  327. #define IBM525_PF_32_BPP 0x06
  328. //
  329. // 8 Bpp Control Register Bit Definitions. (Section 13.2.2.2)
  330. //
  331. #define IBM525_8BC_DCOL_MSK 0x01
  332. #define IBM525_8BC_INDIRECT 0x00
  333. #define IBM525_8BC_DIRECT 0x01
  334. //
  335. // Macros for accessing the IBMRGB525's hardware cursor registers.
  336. //
  337. #define WR_CURS_POS_X_IBM525(pos) \
  338. WriteIBM525(HwDeviceExtension, RGB525_CURSOR_X_LOW, (UCHAR) pos); \
  339. WriteIBM525(HwDeviceExtension, RGB525_CURSOR_X_HIGH, (UCHAR) (pos >> 8))
  340. #define WR_CURS_POS_Y_IBM525(pos) \
  341. WriteIBM525(HwDeviceExtension, RGB525_CURSOR_Y_LOW, (UCHAR) pos); \
  342. WriteIBM525(HwDeviceExtension, RGB525_CURSOR_Y_HIGH, (UCHAR) (pos >> 8))
  343. #define CURS_IS_ON_IBM525() \
  344. (ReadIBM525(HwDeviceExtension, RGB525_CURSOR_CTL) & CURS_ACTIVE_IBM525)
  345. #define CURS_ON_IBM525() \
  346. WriteIBM525(HwDeviceExtension, RGB525_CURSOR_CTL, (UCHAR) (ReadIBM525(HwDeviceExtension, RGB525_CURSOR_CTL) | ENB_CURS_IBM525))
  347. #define CURS_OFF_IBM525() \
  348. WriteIBM525(HwDeviceExtension, RGB525_CURSOR_CTL, (UCHAR) (ReadIBM525(HwDeviceExtension, RGB525_CURSOR_CTL) & DIS_CURS_IBM525))