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.

555 lines
16 KiB

  1. //
  2. // INTEL CORPORATION PROPRIETARY INFORMATION
  3. // This software is supplied under the terms of a license agreement or
  4. // nondisclosure agreement with Intel Corporation and may not be copied
  5. // or disclosed except in accordance with the terms of that agreement.
  6. // Copyright (c) 1996 Intel Corporation. All Rights Reserved.
  7. //
  8. // Workfile: BERT.H
  9. //
  10. // Purpose:
  11. // This header contains the defines for the Bert Gate Array Asic
  12. // registers and functions
  13. //
  14. // Contents:
  15. //
  16. #ifndef _BERT_H_
  17. #define _BERT_H_
  18. // Bert register offsets
  19. #define BERT_CAPSTAT_REG 0x00
  20. #define BERT_VINSTAT_REG 0x04
  21. #define BERT_INTSTAT_REG 0x08
  22. #define BERT_INTRST_REG 0x0c
  23. #define BERT_IIC_REG 0x10
  24. #define BERT_FIFOCFG_REG 0x14
  25. #define BERT_RPSADR_REG 0x18
  26. #define BERT_UALIMIT_REG 0x20
  27. #define BERT_LALIMIT_REG 0x24
  28. #define BERT_RPSPAGE_REG 0x28
  29. #define BERT_YPTR_REG 0x30
  30. #define BERT_UPTR_REG 0x34
  31. #define BERT_VPTR_REG 0x38
  32. #define BERT_YSTRIDE_REG 0x40
  33. #define BERT_USTRIDE_REG 0x44
  34. #define BERT_VSTRIDE_REG 0x48
  35. #define BERT_DALI_REG 0x50
  36. #define BERT_EEPROM_REG 0x60
  37. #define BERT_DMASTAT_REG 0x70
  38. #define BERT_TEST_REG 0x74
  39. // for Pistachio's Register 97-03-21(Fri)
  40. #define BERT_P_SKIP_REG 0x80
  41. #define BERT_P_ISIZ_REG 0x84
  42. #define BERT_P_OSIZ_REG 0x88
  43. #define BERT_P_LUMI_REG 0x8c
  44. #define BERT_P_COL_REG 0x90
  45. #define BERT_P_FILT_REG 0x94
  46. #define BERT_P_SUP1_REG 0x98
  47. #define BERT_P_SUP2_REG 0x9c
  48. #define BERT_P_SUP3_REG 0xa0
  49. #define BERT_BURST_LEN 0x9c // Insert 97-03-17(Mon)
  50. #define BERT_FER_REG 0xf0
  51. #define BERT_FEMR_REG 0xf4
  52. #define BERT_FPSR_REG 0xf8
  53. #define BERT_FECREG 0xfc
  54. // I2C status byte bits
  55. #define I2C_OFFSET 0x40
  56. #define I2CSTATUS_ALTD 0x02
  57. #define I2CSTATUS_FIDT 0x20
  58. #define I2CSTATUS_HLCK 0x40
  59. // INTSTAT Interrupt status register bit defines
  60. #define FIELD_INT 0x00000001
  61. #define RPS_INT 0x00000002
  62. #define SYNC_LOCK_INT 0x00000004
  63. #define SPARE_INT 0x00000008
  64. #define FIFO_OVERFLOW_INT 0x00000010
  65. #define LINE_TIMEOUT_INT 0x00000020
  66. #define RPS_OOB_INT 0x00000040
  67. #define REG_UNDEF_INT 0x00000080
  68. #define CODEC_INT 0x00000100
  69. #define SLOW_CLOCK_INT 0x00000200
  70. #define OVER_RUN_INT 0x00000400
  71. #define REG_LOAD_INT 0x00000800
  72. #define LINE_SYNC_INT 0x00001000
  73. #define IIC_ERROR_INT 0x00002000
  74. #define PCI_PARITY_ERROR_INT 0x00004000
  75. #define PCI_ACCESS_ERROR_INT 0x00008000
  76. // INSTAT Interrupt enable OR mask bits
  77. #define FIELD_INT_MASK 0x00010000
  78. #define RPS_INT_MASK 0x00020000
  79. #define SYNC_LOCK_INT_MASK 0x00040000
  80. #define SPARE_INT_MASK 0x00080000
  81. #define FIFO_OVERFLOW_INT_MASK 0x00100000
  82. #define LINE_TIMEOUT_INT_MASK 0x00200000
  83. #define RPS_OOB_INT_MASK 0x00400000
  84. #define REG_UNDEF_INT_MASK 0x00800000
  85. #define CODEC_INT_MASK 0x01000000
  86. #define SLOW_CLOCK_INT_MASK 0x02000000
  87. #define OVER_RUN_INT_MASK 0x04000000
  88. #define REG_LOAD_INT_MASK 0x08000000
  89. #define LINE_SYNC_INT_MASK 0x10000000
  90. #define IIC_ERROR_INT_MASK 0x20000000
  91. #define PCI_PARITY_ERROR_INT_MASK 0x40000000
  92. #define PCI_ACCESS_ERROR_INT_MASK 0x80000000
  93. // INTRST Interrupt ReSeT Register bits
  94. // reset bits
  95. #define FIELD_INT_RESET 0x00000001
  96. #define RPS_INT_RESET 0x00000002
  97. #define SYNC_LOCK_INT_RESET 0x00000004
  98. #define SPARE_INT_RESET 0x00000008
  99. #define FIFO_OVERFLOW_INT_RESET 0x00000010
  100. #define LINE_TIMEOUT_INT_RESET 0x00000020
  101. #define RPS_OOB_INT_RESET 0x00000040
  102. #define REG_UNDEF_INT_RESET 0x00000080
  103. #define SLOW_CLOCK_INT_RESET 0x00000200
  104. #define OVER_RUN_INT_RESET 0x00000400
  105. #define REG_LOAD_INT_RESET 0x00000800
  106. #define LINE_SYNC_INT_RESET 0x00001000
  107. #define IIC_ERROR_INT_RESET 0x00002000
  108. #define PCI_PARITY_ERROR_INT_RESET 0x00004000
  109. #define PCI_ACCESS_ERROR_INT_RESET 0x00008000
  110. // set bits
  111. #define FIELD_INT_SET 0x00010000
  112. #define RPS_INT_SET 0x00020000
  113. #define SYNC_LOCK_INT_SET 0x00040000
  114. #define SPARE_INT_SET 0x00080000
  115. #define FIFO_OVERFLOW_INT_SET 0x00100000
  116. #define LINE_TIMEOUT_INT_SET 0x00200000
  117. #define RPS_OOB_INT_SET 0x00400000
  118. #define REG_UNDEF_INT_SET 0x00800000
  119. #define SLOW_CLOCK_INT_SET 0x02000000
  120. #define OVER_RUN_INT_SET 0x04000000
  121. #define REG_LOAD_INT_SET 0x08000000
  122. #define LINE_SYNC_INT_SET 0x10000000
  123. #define IIC_ERROR_INT_SET 0x20000000
  124. #define PCI_PARITY_ERROR_INT_SET 0x40000000
  125. #define PCI_ACCESS_ERROR_INT_SET 0x80000000
  126. #define TEST_MAKE_VORLON1 0x10000000
  127. //
  128. // The following values for the FIFO trip points and giving unlimited
  129. // PCI bus master access is reasonable for all platforms.
  130. //
  131. #define BERT_DEF_TRIP_POINTS 16
  132. #define BERT_DEF_PCI_BURST_LEN 3
  133. typedef struct _RPS_COMMAND
  134. {
  135. union
  136. {
  137. struct
  138. {
  139. ULONG RegisterOffset:8;
  140. ULONG Reserved:19;
  141. ULONG FWait:1;
  142. ULONG Edge:1;
  143. ULONG Int:1;
  144. ULONG ReadWrite:1;
  145. ULONG Continue:1;
  146. } bits;
  147. ULONG AsULONG;
  148. } u;
  149. ULONG Argument;
  150. } RPS_COMMAND, *PRPS_COMMAND;
  151. #define RPS_COMMAND_CONT 0x80000000
  152. #define RPS_COMMAND_STOP 0x00000000
  153. #define RPS_COMMAND_READ 0x40000000
  154. #define RPS_COMMAND_WRITE 0x00000000
  155. #define RPS_COMMAND_INT 0x20000000
  156. #define RPS_COMMAND_NOINT 0x00000000
  157. #define RPS_COMMAND_RISE_EDGE 0x10000000
  158. #define RPS_COMMAND_FALL_EDGE 0x00000000
  159. #define RPS_COMMAND_FWAIT 0x00000000
  160. #define RPS_COMMAND_DEFAULT (RPS_COMMAND_STOP | RPS_COMMAND_WRITE | \
  161. RPS_COMMAND_RISE_EDGE | RPS_COMMAND_FWAIT | \
  162. RPS_COMMAND_NOINT)
  163. // RPS COMMAND
  164. #define RPS_CONTINUE_CMD 0x80000000
  165. #define RPS_READ_CMD 0x40000000
  166. #define RPS_INT_CMD 0x20000000
  167. // Enable bits for the CAPSTAT register
  168. #define RST 0x80000000 // Reset front end.
  169. #define EBMV 0x10000000 // Enable Bus Master Video (i.e. DMA)
  170. #define EREO 0x04000000 // Enable RPS Even
  171. #define EROO 0x02000000 // Enable RPS Odd
  172. #define LOCK 0x00002000 // Sync Lock
  173. #define RPSS 0x00001000 // RPS Status
  174. #define GO0 0x00000010 // Power to camara
  175. #define CKRE 0x00000008 // Clock Run Enable // Add 97-05-08
  176. #define CKMD 0x00000004 // Clock Request Mode // Add 97-05-08
  177. #define ERPS 0x08000000 // Enable RPS
  178. #define FEMR_ENABLE 0x00008000
  179. #define CAMARA_OFF RST
  180. //#define PASSIVE_ENABLE (ERPS | GO0)
  181. //#define CAPTURE_EVEN (ERPS | EREO | GO0 | EBMV)
  182. //#define CAPTURE_ODD (ERPS | EROO | GO0 | EBMV)
  183. //#define SKIP_EVEN (ERPS | EREO | GO0)
  184. //#define SKIP_ODD (ERPS | EROO | GO0)
  185. #define PASSIVE_ENABLE ERPS // DEL GO0 97-04-07(Mon) BUN
  186. #define CAPTURE_EVEN (ERPS | EBMV) // DEL EREO ZGO0 97-04-07(Mon) BUN
  187. #define CAPTURE_ODD (ERPS | EBMV) // mode 97-03-29(Sat) BUN
  188. #define SKIP_EVEN ERPS // DEL EREO ZGO0 97-04-07(Mon) BUN
  189. #define SKIP_ODD ERPS // DEL EROO ZGO0 97-04-07(Mon) BUN
  190. // Bit positions for the INTSTAT register's ENABLE flags.
  191. #define FIE 0x10000 // Field Interrupt Enable
  192. #define RIE 0x20000 // RPS Interrupt Enable
  193. #define SLIE 0x40000 // Sync Lock Interrupt Enable
  194. #define EXIE 0x80000 // External interrupt Enable(Dilbert)
  195. #define SPIE 0x80000 // Spare Interrupt Enable(Bert).
  196. #define FOIE 0x100000 // FIFO Overflow Interrupt Enable.
  197. #define LTIE 0x200000 // LINE Timeout Interrupt Enable.
  198. #define ROIE 0x400000 // RPS Out of Bounds Interrupt Enable.
  199. #define RUIE 0x800000 // Register Undefined Interrupt Enable.
  200. #define SCIE 0x2000000 // Slock Clock Interrupt Enable.
  201. #define ORIE 0x4000000 // Over Run Interrupt Enable.
  202. #define RLIE 0x8000000 // Register Load Interrupt Enable.
  203. #define DEIE 0x10000000 // DCI Error Interrupt Enable(Dilbert).
  204. #define LSIE 0x10000000 // Line Sync Interrupt Enable(Bert).
  205. #define IEIE 0x20000000 // IIC Error Interrupt Enable.
  206. #define PPIE 0x40000000 // PCI Parity Error Interrupt Enable.
  207. #define PEIE 0x80000000 // PCI Access Error Interrupt Enable.
  208. // The active video capture interrupts mask
  209. //#define ACTIVE_CAPTURE_IRQS (RIE | SLIE | FOIE | ROIE | RUIE |\
  210. // ORIE | RLIE | IEIE | PPIE | PEIE)
  211. // delete PPIE & IEIE & ORIE 97-03-15(Sat)
  212. // Pistachi not support to PPIE and ORIE. Santaclara does not use I2c bus.
  213. #define ACTIVE_CAPTURE_IRQS (RIE | SLIE | FOIE | LTIE | ROIE | RUIE | RLIE | PEIE)
  214. // for Pistachio's flags 97-03-21(Fri)
  215. #define CHGCOL 0x00010000 // P_LUMI Change Color
  216. #define VFL 0x00010000 // P_FIL Vertical Filter
  217. #define EI_H 0x00000001 // P_SUP1 EI Level H
  218. #define EI_L 0x00000000 // P_SUP1 EI Level L
  219. #define EICH_2 0x00000000 // P_SUP1 EICH 2ms
  220. #define EICH_10 0x00000010 // P_SUP1 EICH 10ms
  221. #define EICH_50 0x00000020 // P_SUP1 EICH 50ms
  222. #define EICH_NONE 0x00000030 // P_SUP1 EICH None
  223. #define MSTOPI 0x00000002 // P_SUP3 IIC Stop Not Auto
  224. #define HSIIC 0x00000001 // P_SUP3 IIC HighSpeed Mode
  225. #define VSNC 0x00000008 // VINSTAT VSNC
  226. //
  227. // define the video standard constants
  228. //
  229. #define NTSC_MAX_PIXELS_PER_LINE 640
  230. #define NTSC_MAX_LINES_PER_FIELD 240
  231. #define PAL_MAX_PIXELS_PER_LINE 768
  232. #define PAL_MAX_LINES_PER_FIELD 288
  233. #define NTSC_HORIZONTAL_START 3
  234. #define NTSC_VERTICAL_START 14
  235. #define PAL_HORIZONTAL_START NTSC_HORIZONTAL_START // Same as NTSC
  236. #define PAL_VERTICAL_START 19
  237. #define MAX_CAPTURE_BUFFER_SIZE ((640*480*12)/8)
  238. #define DEFAULT_CAPTURE_BUFFER_SIZE ((320*240*12)/8)
  239. //
  240. // frame timing, time between vsync interrupts
  241. //
  242. #define PAL_MICROSPERFRAME (1000L/25)
  243. #define NTSC_MICROSPERFRAME (1000L/30)
  244. //#define EBMV_TIMEOUT 200000 // 20 millisec
  245. #define EBMV_TIMEOUT 500000 // 20 millisec
  246. #define DEF_RPS_FRAMES 30 // 30 default fps
  247. #define CAMERA_OFF_TIME 5000 // StreamFini -> CameraOFF Add 97-05-03(Sat)
  248. #define CAMERA_FLAG_ON 0x01 // Add 97-05-10(Sat)
  249. #define CAMERA_FLAG_OFF 0x00 // Add 97-05-10(Sat)
  250. #define CAVCE_ON 0x01 // Add 97-05-10(Sat)
  251. #define CAVCE_OFF 0x00 // Add 97-05-10(Sat)
  252. #define ZV_ENABLE 0x01l // Add 97-05-10(Sat)
  253. #define ZV_DISABLE 0x00l // Add 97-05-10(Sat)
  254. #define ZV_GETSTATUS 0xffl // Add 97-05-10(Sat)
  255. #define ZV_ERROR 0xffl // Add 97-05-10(Sat)
  256. #define MODE_VFW 0x01 // Add 97-05-10(Sat)
  257. #define MODE_ZV 0x02 // Add 97-05-10(Sat)
  258. #define MAX_HUE 0xff
  259. #define DEFAULT_HUE 0x80
  260. #define MAX_HUE 0xff
  261. #define MAX_BRIGHTNESS 0xff
  262. #define MAX_CONTRAST 0xff
  263. #define MAX_SATURATION 0xff
  264. #define IGNORE100msec 0x200000l
  265. #define PCI_CFGCCR 0x08 /* offset of Pistachio Configration/Revision */
  266. #define PCI_Wake_Up 0x40 /* offset of Pistachio Wake up */
  267. #define PCI_CFGWAK 0x40 /* offset of Pistachio Wake up */
  268. #define PCI_DATA_PATH 0x44 /* offset of Pistachio Data path */
  269. #define PCI_CFGPAT 0x44 /* offset of Pistachio Data path */
  270. #define SELIZV_CFGPAT 0x2l
  271. #define ZVEN_CFGPAT 0x1l
  272. #define CAVCE_CFGPAT 0x10l
  273. #define CADTE_CFGPAT 0x20l
  274. #define PXCCE_CFGPAT 0x100l
  275. #define PXCSE_CFGPAT 0x200l
  276. #define PCIFE_CFGPAT 0x400l
  277. #define PCIME_CFGPAT 0x800l
  278. #define PCIDS_CFGPAT 0x1000l
  279. #define GPB_CFGPAT 0x30000l
  280. #define CASL_CFGWAK 0x00010000l
  281. VOID HW_ApmResume(PHW_DEVICE_EXTENSION);
  282. VOID HW_ApmSuspend(PHW_DEVICE_EXTENSION);
  283. VOID HW_SetFilter(PHW_DEVICE_EXTENSION, BOOL);
  284. ULONG HW_ReadFilter(PHW_DEVICE_EXTENSION, BOOL);
  285. BOOL
  286. SetupPCILT(PHW_DEVICE_EXTENSION pHwDevExt);
  287. VOID
  288. InitializeConfigDefaults(PHW_DEVICE_EXTENSION pHwDevExt);
  289. BOOL
  290. CameraChkandON(PHW_DEVICE_EXTENSION pHwDevExt, ULONG ulMode);
  291. BOOL
  292. CameraChkandOFF(PHW_DEVICE_EXTENSION pHwDevExt, ULONG ulMode);
  293. BOOL
  294. CheckCameraStatus(PHW_DEVICE_EXTENSION pHwDevExt); // Add 97-05-05(Mon)
  295. BOOL
  296. SetZVControl(PHW_DEVICE_EXTENSION pHwDevExt, ULONG ulZVStatus); // Add 97-05-02(Fri)
  297. VOID
  298. WriteRegUlong(PHW_DEVICE_EXTENSION pHwDevExt,
  299. ULONG,
  300. ULONG);
  301. VOID
  302. ReadModifyWriteRegUlong(PHW_DEVICE_EXTENSION pHwDevExt,
  303. ULONG,
  304. ULONG,
  305. ULONG);
  306. ULONG
  307. ReadRegUlong(PHW_DEVICE_EXTENSION pHwDevExt, ULONG);
  308. BOOL
  309. HWInit(
  310. IN PHW_DEVICE_EXTENSION pHwDevExt
  311. );
  312. VOID
  313. BertInterruptEnable(
  314. IN PHW_DEVICE_EXTENSION pHwDevExt,
  315. IN BOOL bStatus
  316. );
  317. VOID
  318. BertDMAEnable(
  319. IN PHW_DEVICE_EXTENSION pHwDevExt,
  320. IN BOOL bStatus
  321. );
  322. BOOL
  323. BertIsLocked(
  324. IN PHW_DEVICE_EXTENSION pHwDevExt
  325. );
  326. BOOL
  327. BertFifoConfig(
  328. IN PHW_DEVICE_EXTENSION pHwDevExt,
  329. IN ULONG dwFormat
  330. );
  331. BOOL
  332. BertInitializeHardware(
  333. IN PHW_DEVICE_EXTENSION pHwDevExt
  334. );
  335. VOID
  336. BertEnableRps(
  337. IN PHW_DEVICE_EXTENSION pHwDevExt
  338. );
  339. VOID
  340. BertDisableRps(
  341. IN PHW_DEVICE_EXTENSION pHwDevExt
  342. );
  343. BOOL
  344. BertIsCAPSTATReady(
  345. IN PHW_DEVICE_EXTENSION pHwDevExt
  346. );
  347. VOID
  348. BertVsncSignalWait(
  349. IN PHW_DEVICE_EXTENSION pHwDevExt
  350. );
  351. VOID
  352. BertDMARestart(
  353. IN PHW_DEVICE_EXTENSION pHwDevExt
  354. );
  355. BOOL
  356. BertBuildNodes(
  357. IN PHW_DEVICE_EXTENSION pHwDevExt
  358. );
  359. BOOL
  360. BertTriBuildNodes(
  361. IN PHW_DEVICE_EXTENSION pHwDevExt
  362. );
  363. BOOL
  364. BertIsCardIn(
  365. IN PHW_DEVICE_EXTENSION pHwDevExt
  366. );
  367. VOID
  368. BertSetDMCHE(
  369. IN PHW_DEVICE_EXTENSION pHwDevExt
  370. );
  371. BOOL
  372. ImageSetInputImageSize(
  373. IN PHW_DEVICE_EXTENSION pHwDevExt,
  374. IN PRECT pRect
  375. );
  376. BOOL
  377. ImageSetOutputImageSize(
  378. IN PHW_DEVICE_EXTENSION pHwDevExt,
  379. IN ULONG ulWidth,
  380. IN ULONG ulHeight
  381. );
  382. BOOL
  383. ImageSetChangeColorAvail(
  384. IN PHW_DEVICE_EXTENSION pHwDevExt,
  385. IN ULONG ulChgCol
  386. );
  387. BOOL
  388. ImageSetHueBrightnessContrastSat(
  389. IN PHW_DEVICE_EXTENSION pHwDevExt
  390. );
  391. BOOL
  392. ImageSetFilterInfo(
  393. IN PHW_DEVICE_EXTENSION pHwDevExt,
  394. IN ULONG ulVFL,
  395. IN ULONG ulFL1,
  396. IN ULONG ulFL2,
  397. IN ULONG ulFL3,
  398. IN ULONG ulFL4
  399. );
  400. BOOL
  401. ImageFilterON(
  402. IN PHW_DEVICE_EXTENSION pHwDevExt
  403. );
  404. BOOL
  405. ImageFilterOFF(
  406. IN PHW_DEVICE_EXTENSION pHwDevExt
  407. );
  408. BOOL
  409. ImageGetFilterInfo(
  410. IN PHW_DEVICE_EXTENSION pHwDevExt
  411. );
  412. BOOL
  413. ImageGetFilteringAvailable(
  414. IN PHW_DEVICE_EXTENSION pHwDevExt
  415. );
  416. BOOL
  417. Alloc_TriBuffer(
  418. IN PHW_DEVICE_EXTENSION pHwDevExt
  419. );
  420. BOOL
  421. Free_TriBuffer(
  422. IN PHW_DEVICE_EXTENSION pHwDevExt
  423. );
  424. BOOL
  425. SetASICRev(
  426. IN PHW_DEVICE_EXTENSION pHwDevExt
  427. );
  428. BOOL
  429. VC_GetPCIRegister(
  430. PHW_DEVICE_EXTENSION pHwDevExt,
  431. ULONG ulOffset,
  432. PVOID pData,
  433. ULONG ulLength);
  434. BOOL
  435. VC_SetPCIRegister(
  436. PHW_DEVICE_EXTENSION pHwDevExt,
  437. ULONG ulOffset,
  438. PVOID pData,
  439. ULONG ulLength);
  440. VOID VC_Delay(int nMillisecs);
  441. #if DBG
  442. void DbgDumpPciRegister( PHW_DEVICE_EXTENSION pHwDevExt );
  443. void DbgDumpCaptureRegister( PHW_DEVICE_EXTENSION pHwDevExt );
  444. #endif
  445. #endif // _BERT_H_
  446.