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.

521 lines
13 KiB

  1. /***************************************************************************
  2. * ADC.H *
  3. ****************************************************************************
  4. *
  5. * Last change: 18 janvier 1994
  6. *
  7. * By: Patrice Gagnon
  8. *
  9. * Changes:
  10. *
  11. * Description: All definitions used for the ENCODER's test program.
  12. *
  13. ****************************************************************************/
  14. /********************** DEFINES: IDENTIFICATION ************************/
  15. #define DENC_REG 0
  16. #define PSG_REG 1
  17. #define DAC_REG 2
  18. #define ADC_REG 3
  19. #define CTRL_REG 4
  20. #define MGA_DAC_LUT 0
  21. #define ENC_DENC_CLUT 1
  22. #define ENC_DAC_COL_LUT 2
  23. #define ENC_COL_LUT 3
  24. #define ALL_COL_LUT 4
  25. #define ENC_DAC_CUR_LUT 5
  26. #define ENC_ID_REV0 0x50
  27. #define PSG_ID 0x02
  28. #define BASE_VER 0x02
  29. #define DELUXE_VER 0x03
  30. #define PAL_STD 1
  31. #define NTSC_STD 2
  32. #define VAFC 0x10
  33. #define BLANC 0x00ffffff
  34. #define NOIR 0x00000000
  35. #define ROUGE 0x00ff0000
  36. #define VERT 0x0000ff00
  37. #define BLEU 0x000000ff
  38. #define RED_PATH 0
  39. #define GREEN_PATH 1
  40. #define BLUE_PATH 2
  41. #define WHITE_PATH 3
  42. #define ALPHA_PATH 4
  43. #define DEFAULT_REG 0
  44. #define PATH_REG 1
  45. #define VISU_ALPHA 2
  46. #define KEYING 3
  47. #define ONE_CHANGE 4
  48. #define ALL_REG 0xff
  49. #define BOTH_SENSE 3
  50. #define ONLY_DENC 2
  51. #define ONLY_DAC 1
  52. #define NONE 0
  53. #define MGA_SENSE 1
  54. #define MAX_LEVEL 0xfc
  55. #define MIN_LEVEL 0x00
  56. #define BLANCK_LEVEL 0x64
  57. #define WHITE_LEVEL 0xff
  58. #define RED_LEVEL 0xa4
  59. #define GREEN_LEVEL 0xd4
  60. #define BLUE_LEVEL 0x84
  61. #define SECUR_FACTOR 0x0c /* 57 mV of security */
  62. /******************** DEFINES: NUMBER OF REGISTER **********************/
  63. #define DENC_NBRE_REG 16
  64. #define PSG_NBRE_REG 23
  65. #define PSG_NBRE_FULL_REG 17
  66. #define PSG_NBRE_REG_A_CHAMP 3
  67. #define DAC_NBRE_REG 16+1 /* COMMAND3 addition */
  68. #define DAC_NBRE_REG_A_CHAMP 4+1 /* " " */
  69. #define DAC_NBRE_FULL_REG 12
  70. #define ADC_NBRE_REG 8-4 /* IOUT4-6 unused */
  71. #define ADC_NBRE_REG_A_CHAMP 1
  72. #define ADC_NBRE_FULL_REG 6-3 /* " " */
  73. /******************** DEFINES: CALCUL OF ADDRESSES *********************/
  74. #define BASE_ADDR1 0x240
  75. #define BASE_ADDR2 0x300
  76. #define BASE_ADDR3 0x340
  77. #define ENC_CTRL_OFFSET 0x00
  78. #define ENC_ID_OFFSET 0x02
  79. #define DENC_OFFSET 0x04
  80. #define PSG_OFFSET 0x08
  81. #define ADC_OFFSET 0x0c
  82. #define DAC_OFFSET 0x10
  83. #define DENC_CLUT_CTRL_RD ( DENC_OFFSET + 0x0 )
  84. #define DENC_CLUT_CTRL_WR ( DENC_OFFSET + 0x0 )
  85. #define DENC_CLUT_DATA ( DENC_OFFSET + 0x1 )
  86. #define DAC_LUT_CTRL_RD ( DAC_OFFSET + 0x3 )
  87. #define DAC_LUT_CTRL_WR ( DAC_OFFSET + 0x0 )
  88. #define DAC_LUT_DATA ( DAC_OFFSET + 0x1 )
  89. #define DAC_CUR_CTRL_RD ( DAC_OFFSET + 0x7 )
  90. #define DAC_CUR_CTRL_WR ( DAC_OFFSET + 0x4 )
  91. #define DAC_CUR_DATA ( DAC_OFFSET + 0x5 )
  92. #define DENC_ADDR_CTRL ( DENC_OFFSET + 0x2 )
  93. #define DENC_DATA_CTRL ( DENC_OFFSET + 0x3 )
  94. #define PSG_ADDR_CTRL ( PSG_OFFSET + 0x0 )
  95. #define PSG_DATA_CTRL ( PSG_OFFSET + 0x2 )
  96. /****************************** MACROS ***********************************/
  97. #define AUTO_INC (inw (dataPort) >> 9) & 0x1
  98. #define VERSION enc.board.id_reg.f.ver
  99. #define NOT_ENCODER (enc.board.id_reg.all & 0xf7) != ENC_ID_REV0
  100. #define VAFC_INPUT enc.board.ctrl_reg.f.vafc_input == IN_VAFC
  101. #define KEYING_EN enc.denc.index08.f.keye == ENABLE
  102. #define IN_NTSC enc.board.ctrl_reg.f.ntsc_en == NTSC_STD
  103. #define CLEAR_LUT(lutSel) initEveryLut (lutSel,1,0x00,0xff,0,0,0)
  104. /******************** DEFINES: FIELD *********************/
  105. #define ENC_FILTER ( (word)0x0004 )
  106. /************************* DENC'S STRUCTURE ******************************/
  107. /***** CONTROL TABLE *****/
  108. typedef struct
  109. {
  110. union /* INDEX 00 */
  111. {
  112. struct
  113. {
  114. byte mod : 2;
  115. byte ccir : 1;
  116. byte scbw : 1;
  117. byte fmt : 3;
  118. byte vtby : 1;
  119. } f;
  120. byte all;
  121. } index00;
  122. byte trer; /* INDEX 01 */
  123. byte treg; /* INDEX 02 */
  124. byte treb; /* INDEX 03 */
  125. union /* INDEX 04 */
  126. {
  127. struct
  128. {
  129. byte oef : 1;
  130. byte hlck : 1;
  131. byte hpll : 1;
  132. byte nint : 1;
  133. byte vtrc : 1;
  134. byte scen : 1;
  135. byte sysel : 2;
  136. } f;
  137. byte all;
  138. } index04;
  139. union /* INDEX 05 */
  140. {
  141. struct
  142. {
  143. byte gdc : 6;
  144. byte unused : 2;
  145. } f;
  146. byte all;
  147. } index05;
  148. byte idel; /* INDEX 06 */
  149. union /* INDEX 07 */
  150. {
  151. struct
  152. {
  153. byte pso : 6;
  154. byte unused : 2;
  155. } f;
  156. byte all;
  157. } index07;
  158. union /* INDEX 08 */
  159. {
  160. struct
  161. {
  162. byte srsn : 1;
  163. byte gpsw : 1;
  164. byte im : 1;
  165. byte coki : 1;
  166. byte cpr : 1;
  167. byte src : 1;
  168. byte keye : 1;
  169. byte dd : 1;
  170. } f;
  171. byte all;
  172. } index08;
  173. union /* INDEX 09 */
  174. {
  175. struct
  176. {
  177. byte rtce : 1;
  178. byte rtin : 1;
  179. byte rtsc : 1;
  180. byte iepi : 1;
  181. byte mpkc : 2;
  182. byte bame : 1;
  183. byte unused : 1;
  184. } f;
  185. byte all;
  186. } index09;
  187. byte chps; /* INDEX 0C */
  188. byte fsco; /* INDEX 0D */
  189. union /* INDEX 0E */
  190. {
  191. struct
  192. {
  193. byte std : 4;
  194. byte clck : 1;
  195. byte unused : 3;
  196. } f;
  197. byte all;
  198. } index0E;
  199. } DENC;
  200. /************************** PSG'S STRUCTURE ******************************/
  201. #define PSG_DPYCTL_IDX 0x0
  202. #define PSG_POLCTL_IDX 0x1
  203. #define PSG_EXTCTL_IDX 0x2
  204. #define PSG_V_TOTAL_IDX 0x3
  205. #define PSG_H_TOTAL_IDX 0x7
  206. #define PSG_HS_BURST_IDX 0x10 /* Horiz. start */
  207. #define PSG_HE_BURST_IDX 0x11 /* Horiz. end */
  208. #define PSG_VS_BURST_IDX 0x12 /* Vert. start */
  209. #define PSG_VE_BURST_IDX 0x13 /* Vert. end */
  210. #define PSG_VCOUNT_IDX 0x14
  211. #define PSG_HCOUNT_IDX 0x15
  212. #define PSG_SCOUNT_IDX 0x16
  213. typedef struct
  214. {
  215. union /* INDEX */
  216. {
  217. struct
  218. {
  219. word index_reg : 5;
  220. word chip_ver : 2;
  221. word chip_id : 5;
  222. word unused : 4;
  223. } f;
  224. word all;
  225. } index;
  226. union /* DPYCTL */
  227. {
  228. struct
  229. {
  230. word non_interlaced : 1;
  231. word run : 1;
  232. word divise_select : 2;
  233. word serrated_sync : 1;
  234. word equalization_pulses : 1;
  235. word video : 1;
  236. word video_read : 1; /* read back bit */
  237. word clamp_pulse : 1;
  238. word autoinc : 1;
  239. word unused : 6;
  240. } f;
  241. word all;
  242. } dpyctl;
  243. union /* POLCTL */
  244. {
  245. struct
  246. {
  247. word hori_sync : 1;
  248. word vert_sync : 1;
  249. word composite_sync : 1;
  250. word composite_blank : 1;
  251. word burst_pulse : 1;
  252. word clamp_pulse : 1;
  253. word internal_pclk : 1;
  254. word pclk : 1;
  255. word unused : 8;
  256. } f;
  257. word all;
  258. } polctl;
  259. union /* EXTCTL */
  260. {
  261. struct
  262. {
  263. word external_sync : 1;
  264. word hori_reset : 1;
  265. word scan_mode : 2;
  266. word hori_reset_input_pol : 1;
  267. word vert_reset_input_pol : 1;
  268. word field_scan_mode : 1;
  269. word unused : 9;
  270. } f;
  271. word all;
  272. } extctl;
  273. word vtotal;
  274. word vsblnk;
  275. word veblnk;
  276. word vesync;
  277. word htotal;
  278. word hsblnk;
  279. word heblnk;
  280. word hesync;
  281. word vssyncs;
  282. word sethcnt;
  283. word setvcnt;
  284. word hsclmp;
  285. word heclmp;
  286. word hsbrst;
  287. word hebrst;
  288. word vsbrst;
  289. word vebrst;
  290. word vcount;
  291. word hcount;
  292. word scount;
  293. } PSG;
  294. /*************************** DAC'S STRUCTURE *****************************/
  295. typedef struct
  296. {
  297. byte col_addr_wr;
  298. byte col_data;
  299. byte rd_msk;
  300. byte col_addr_rd;
  301. byte cur_addr_wr;
  302. byte cur_data;
  303. union /* COMMAND REGISTER 0 */
  304. {
  305. struct
  306. {
  307. byte power_down_en : 1;
  308. byte dac_resolution : 1;
  309. byte red_sync_en : 1;
  310. byte green_sync_en : 1;
  311. byte blue_sync_en : 1;
  312. byte setup_en : 1;
  313. byte clk_disable : 1;
  314. byte reserved : 1;
  315. } f;
  316. byte all;
  317. } command0;
  318. byte cur_addr_rd;
  319. union /* COMMAND REGISTER 1 */
  320. {
  321. struct
  322. {
  323. byte switch_ctrl : 1;
  324. byte switch_en : 1;
  325. byte multiplexing_rate : 1;
  326. byte color_format : 1;
  327. byte tc_bypass : 1;
  328. byte bit_par_pixel_sel : 2;
  329. byte reserved : 1;
  330. } f;
  331. byte all;
  332. } command1;
  333. union /* COMMAND REGISTER 2 */
  334. {
  335. struct
  336. {
  337. byte cursor_mode_sel : 2;
  338. byte palette_index_sel : 1;
  339. byte disp_mode_sel : 1;
  340. byte clksel_en : 1;
  341. byte portsel_mask : 1;
  342. byte test_path_en : 1;
  343. byte sclk_disable : 1;
  344. } f;
  345. byte all;
  346. } command2;
  347. union /* COMMAND REGISTER 3 */
  348. {
  349. struct
  350. {
  351. byte msb_add_cntr : 2;
  352. byte curs_sel : 1;
  353. byte clk_muliplier : 1;
  354. byte reserved : 4;
  355. } f;
  356. byte all;
  357. } command3;
  358. union /* STATUS */
  359. {
  360. struct
  361. {
  362. byte color_comp_add : 2;
  363. byte rw_access_status : 1;
  364. byte sense : 1;
  365. byte rev : 2;
  366. byte id : 2;
  367. } f;
  368. byte all;
  369. } status;
  370. byte ram_data;
  371. byte cur_x_low;
  372. byte cur_x_hi;
  373. byte cur_y_low;
  374. byte cur_y_hi;
  375. } DAC;
  376. /*************************** ADC'S STRUCTURE *****************************/
  377. typedef struct
  378. {
  379. union /* COMMAND REGISTER */
  380. {
  381. struct
  382. {
  383. byte sync_detect_lev : 1;
  384. byte reserved : 1;
  385. byte color_out_sel : 2;
  386. byte sync_detect_sel : 3;
  387. byte digitize_sel : 1;
  388. } f;
  389. byte all;
  390. } cmd_reg;
  391. byte iout0;
  392. byte iout1;
  393. byte iout2;
  394. /* byte iout3;
  395. byte iout4;
  396. byte iout5;
  397. byte reserved; */
  398. } ADC;
  399. /*********************** ENC CONFIG'S STRUCTURE **************************/
  400. typedef struct
  401. {
  402. union /* CTRL REGISTER */
  403. {
  404. struct
  405. {
  406. word vafc_input : 1;
  407. word ntsc_en : 1;
  408. word filter_en : 1;
  409. word genclock_en : 1;
  410. word genclock_pol : 1;
  411. word vidrst_pol : 1;
  412. word vidrst_en : 1;
  413. word hi_reg_bt254 : 1;
  414. word denc_mode : 1;
  415. word alpha_sync_en : 1;
  416. word clr_sense : 1;
  417. word reserved : 3;
  418. word dac_sense : 1;
  419. word denc_sense : 1;
  420. } f;
  421. word all;
  422. } ctrl_reg;
  423. union /* ID REGISTER */
  424. {
  425. struct
  426. {
  427. word rev : 3;
  428. word ver : 2;
  429. word id : 3;
  430. word dum : 8;
  431. } f;
  432. word all;
  433. } id_reg;
  434. } BOARD;
  435. /*************************** GENERAL STRUCTURE ***************************/
  436. typedef struct
  437. {
  438. DENC denc;
  439. PSG psg;
  440. DAC dac;
  441. ADC adc;
  442. BOARD board;
  443. } ENC_CONFIG;