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.

487 lines
13 KiB

  1. //
  2. // MODULE : STi3520A.H
  3. // PURPOSE : STi3520A related unctions
  4. // AUTHOR : JBS Yadawa
  5. // CREATED : 7/20/96
  6. //
  7. //
  8. // Copyright (C) 1996 SGS-THOMSON Microelectronics
  9. //
  10. //
  11. // REVISION HISTORY :
  12. //
  13. // DATE :
  14. //
  15. // COMMENTS :
  16. //
  17. #ifndef __STi3520A_H__
  18. #define __STi3520A_H__
  19. #define QUANT_TAB_SIZE 64
  20. //---- Definition of the STi35xxx memory partitioning
  21. #define NB_ROW_OF_MB 22 // Number of Rows of Macro blocks for B
  22. // pictures when optimmization is used
  23. #define BUF_FULL 0x480// bit buffer occupies 0x480 * 256 bytes (1.75 Mbits)
  24. //---- PAL
  25. #define PSZ_PAL 0x0980 // Picture size = 720*576*1.5 / 256 = 0x97E
  26. #define BUFF_A_PAL BUF_FULL+1 //
  27. #define BUFF_B_PAL (BUFF_A_PAL+PSZ_PAL)
  28. #define BUFF_C_PAL (BUFF_B_PAL+PSZ_PAL)
  29. //---- NTSC
  30. #define PSZ_NTSC 0x07F0
  31. #define BUFF_A_NTSC BUF_FULL+1
  32. #define BUFF_B_NTSC (BUFF_A_NTSC+PSZ_NTSC)
  33. #define BUFF_C_NTSC (BUFF_B_NTSC+PSZ_NTSC)
  34. //---- OSD
  35. #define OSD_START (BUFF_C + ((NB_ROW_OF_MB*3)/2))*32L
  36. #define FORWARD_PRED 0
  37. #define BACKWARD_PRED 1
  38. #define PICT 0x0000
  39. #define USER 0xB200
  40. #define SEQ 0xB300
  41. #define SEQ_ERR 0xB400
  42. #define EXT 0xB500
  43. #define SEQ_END 0xB700
  44. #define GOP 0xB800
  45. #define SEQ_EXT 0x10
  46. #define SEQ_DISP 0x20
  47. #define QUANT_EXT 0x30
  48. #define SEQ_SCAL 0x50
  49. #define PICT_PSV 0x70
  50. #define PICT_COD 0x80
  51. #define PICT_SCAL 0x90
  52. /***********************************************/
  53. /* definition of states of FistVsyncAfterVbv */
  54. /***********************************************/
  55. // FistVsyncAfterVbv is a 3 state variable
  56. // before vbv FistVsyncAfterVbv = NOT_YET_VBV
  57. // between vbv and following vsync FistVsyncAfterVbv = NOT_YET_VST
  58. // after vsync following vbv FistVsyncAfterVbv = PAST_VBV_AND_VST
  59. #define NOT_YET_VBV 0
  60. #define NOT_YET_VST 1
  61. #define PAST_VBV_AND_VST 2
  62. #define CFG_MCF 0x00
  63. #define CFG_CCF 0x01
  64. #define VID_CTL 0x02
  65. #define VID_TIS 0x03
  66. #define VID_PFH 0x04
  67. #define VID_PFV 0x05
  68. #define VID_PPR1 0x06
  69. #define VID_PPR2 0x07
  70. #define CFG_MRF 0x08
  71. #define CFG_MWF 0x08
  72. #define CFG_BMS 0x09
  73. #define CFG_MRP 0x0A
  74. #define CFG_MWP 0x0B
  75. #define VID_DFP 0x0C
  76. #define VID_RFP 0x0E
  77. #define VID_FFP 0x10
  78. #define VID_BFP 0x12
  79. #define VID_VBG 0x14
  80. #define VID_VBL 0x16
  81. #define VID_VBS 0x18
  82. #define VID_VBT 0x1A
  83. #define AUD_ABG 0X1C
  84. #define AUD_ABL 0X1E
  85. #define AUD_ABS 0X20
  86. #define AUD_ABT 0X22
  87. #define VID_DFS 0x24
  88. #define VID_DFW 0x25
  89. #define VID_DFA 0x26
  90. #define VID_XFS 0x27
  91. #define VID_XFW 0x28
  92. #define VID_XFA 0x29
  93. #define VID_OTP 0x2A
  94. #define VID_OBP 0x2B
  95. #define VID_PAN 0x2C
  96. #define VID_SCN 0x2E
  97. #define VID_REV 0x78
  98. #define CKG_PLL 0x30
  99. #define CKG_CFG 0x31
  100. #define CKG_AUD 0x32
  101. #define CKG_VID 0x33
  102. #define CKG_PIX 0x34
  103. #define CKG_PCM 0x35
  104. #define CKG_MCK 0x36
  105. #define CKG_AUX 0x37
  106. #define CKG_DRC 0x38
  107. #define CFG_BFS 0x39
  108. #define PES_AUD 0x40
  109. #define PES_VID 0x41
  110. #define PES_SPF 0x42
  111. #define PES_STA 0x43
  112. #define PES_SC1 0x44
  113. #define PES_SC2 0x45
  114. #define PES_SC3 0x46
  115. #define PES_SC4 0x47
  116. #define PES_SC5 0x48
  117. #define PES_TS1 0x49
  118. #define PES_TS2 0x4A
  119. #define PES_TS3 0x4B
  120. #define PES_TS4 0x4C
  121. #define PES_TS5 0x4D
  122. #define PES_PTS_FIFO 0x68
  123. #define VID_ITM 0x60
  124. #define VID_ITM1 0x3C
  125. #define VID_ITS 0x62
  126. #define VID_ITS1 0x3D
  127. #define VID_STA 0x64
  128. #define VID_STA1 0x3B
  129. #define VID_HDF 0x66
  130. #define CDcount 0x67
  131. #define SCDcount 0x68
  132. #define VID_HDS 0x69
  133. #define VID_LSO 0x6A
  134. #define VID_LSR 0x6B
  135. #define VID_CSO 0x6C
  136. #define VID_LSRh 0x6D
  137. #define VID_YDO 0x6E
  138. #define VID_YDS 0x6F
  139. #define VID_XDO 0x70
  140. #define VID_XDS 0x72
  141. #define VID_DCF 0x74
  142. #define VID_QMW 0x76
  143. #define VID_TST 0x77
  144. /************************************************************/
  145. /* Definition of STi3520A registers with STi3520 names */
  146. /************************************************************/
  147. #define HDF VID_HDF
  148. #define CTL VID_CTL
  149. #define STA VID_STA
  150. #define ITM VID_ITM
  151. #define ITM1 VID_ITM1
  152. #define ITS VID_ITS
  153. #define ITS1 VID_ITS1
  154. #define MRF CFG_MRF
  155. #define MWF CFG_MWF
  156. #define BMS CFG_BMS
  157. #define MRP CFG_MRP
  158. #define MWP CFG_MWP
  159. #define DFP VID_DFP
  160. #define RFP VID_RFP
  161. #define FFP VID_FFP
  162. #define BFP VID_BFP
  163. #define FBP VID_FBP // shares the same address as BFP
  164. #define BBL VID_VBL
  165. #define BBS VID_VBS
  166. #define BBG VID_VBG
  167. #define BBT VID_VBT
  168. #define DFW VID_DFW
  169. #define DFS VID_DFS
  170. #define YDO VID_YDO
  171. #define XDO VID_XDO
  172. #define YDS VID_YDS
  173. #define XDS VID_XDS
  174. #define OEP VID_OBP
  175. #define OOP VID_OTP
  176. #define LSO VID_LSO
  177. #define LSR VID_LSR
  178. #define CSO VID_CSO
  179. #define DCF VID_DCF
  180. #define QMW VID_QMW
  181. /*********************************************/
  182. /* Definition of the STi3520A Bit Position*/
  183. /*********************************************/
  184. // CFG_CCF Register bits
  185. #define M32 0x80
  186. #define M16 0x40
  187. #define PBO 0x20
  188. #define EC3 0x10
  189. #define EC2 0x08
  190. #define ECK 0x04
  191. #define EDI 0x02
  192. #define EVI 0x01
  193. // CFG_DRC Register bits
  194. #define NPD 0x40
  195. #define MRS 0x20
  196. #define SGR 0x08
  197. #define CLK 0x04
  198. #define HPD 0x02
  199. #define SDR 0x01
  200. // CFG_MCF Register bits
  201. #define M20 0x80
  202. #define RFI 0x7F
  203. // CTL Register bits
  204. #define ERU 0x80
  205. #define ERS 0x40
  206. #define CBC 0x20
  207. #define DEC 0x10
  208. #define EPR 0x08
  209. #define PRS 0x04
  210. #define SRS 0x02
  211. #define EDC 0x01
  212. #define A35 0x8000 // for STi3500A code compatibility
  213. // DCF Register bits
  214. #define OAD1 0x8000
  215. #define OAD0 0x4000
  216. #define OAM 0x2000
  217. #define XYE 0x1000
  218. #define DAM2 0x0800
  219. #define DAM1 0x0400
  220. #define DAM0 0x0200
  221. #define FLD 0x0100
  222. #define USR 0x0080
  223. #define PXD 0x0040
  224. #define EVD 0x0020
  225. #define EOS 0x0010
  226. #define DSR 0x0008
  227. #define VFC2 0x0004
  228. #define VFC1 0x0002
  229. #define VFC0 0x0001
  230. // ITM/ITS/STA Status Register bits
  231. #define PDE 0x8000
  232. #define SER 0x4000
  233. #define BMI 0x2000
  234. #define HFF 0x1000
  235. #define RFF 0x0800
  236. #define WFE 0x0400
  237. #define PID 0x0200
  238. #define PER 0x0100
  239. #define PSD 0x0080
  240. #define TOP 0x0040
  241. #define BOT 0x0020
  242. #define BBE 0x0010
  243. #define BBF 0x0008
  244. #define HFE 0x0004
  245. #define BFF 0x0002
  246. #define HIT 0x0001
  247. // VID_TIS Register bits
  248. #define MP2 0x40
  249. #define SKP1 0x20
  250. #define SKP0 0x10
  251. #define OVW 0x08
  252. #define FIS 0x04
  253. #define RPT 0x02
  254. #define EXE 0x01
  255. #define SOS 0x08
  256. #define QMN 0x04
  257. #define QMI 0x02
  258. #define HDS 0x01
  259. //ckw start
  260. // AUD Registers
  261. #define AUD_ANC0 0x86
  262. #define AUD_ANC8 0x87
  263. #define AUD_ANC16 0x88
  264. #define AUD_ANC24 0x89
  265. #define AUD_ESC0 0x8A
  266. #define AUD_ESC8 0x8B
  267. #define AUD_ESC16 0x8C
  268. #define AUD_ESC24 0x8D
  269. #define AUD_ESC32 0x8E
  270. #define AUD_ESCX0 0x8F
  271. #define AUD_LRP 0x91
  272. #define AUD_FFL0 0x94
  273. #define AUD_FFL8 0x95
  274. #define AUD_P18 0x96
  275. #define AUD_CDI0 0x98
  276. #define AUD_FOR 0x99
  277. #define AUD_ITR0 0x9A
  278. #define AUD_ITR8 0x9B
  279. #define AUD_ITM0 0x9C
  280. #define AUD_ITM8 0x9D
  281. #define AUD_LCA 0x9E
  282. #define AUD_EXT 0x9F
  283. #define AUD_RCA 0xA0
  284. #define AUD_SID 0xA2
  285. #define AUD_SYN 0xA3
  286. #define AUD_IDE 0xA4
  287. #define AUD_SCM 0xA5
  288. #define AUD_SYS 0xA6
  289. #define AUD_SYE 0xA7
  290. #define AUD_LCK 0xA8
  291. #define AUD_CRC 0xAA
  292. #define AUD_SEM 0xAC
  293. #define AUD_PLY 0xAE
  294. #define AUD_MUT 0xB0
  295. #define AUD_SKP 0xB2
  296. #define AUD_ISS 0xB6
  297. #define AUD_ORD 0xB8
  298. #define AUD_LAT 0xBC
  299. #define AUD_RES 0xC0
  300. #define AUD_RST 0xC2
  301. #define AUD_SFR 0xC4
  302. #define AUD_DEM 0xC6
  303. #define AUD_IFT 0xD2
  304. #define AUD_SCP 0xD3
  305. #define AUD_ITS 0xDB
  306. #define AUD_IMS 0xDC
  307. #define AUD_HDR0 0xDE
  308. #define AUD_HDR8 0xDF
  309. #define AUD_HDR16 0xE0
  310. #define AUD_HDR24 0xE1
  311. #define AUD_PTS0 0xE2
  312. #define AUD_PTS8 0xE3
  313. #define AUD_PTS16 0xE4
  314. #define AUD_PTS24 0xE5
  315. #define AUD_PTS32 0xE6
  316. #define AUD_ADA 0xEC
  317. #define AUD_REV 0xED
  318. #define AUD_DIV 0xEE
  319. #define AUD_DIF 0xEF
  320. #define AUD_BBE 0xF0
  321. //ckw end
  322. //*************************************************
  323. // STi4500 register definitions
  324. //*************************************************
  325. #define ANC 0x06
  326. #define ANC_AV 0x6C
  327. #define ATTEN_L 0x1E
  328. #define ATTEN_R 0x20
  329. #define AUDIO_ID 0x22
  330. #define AUDIO_ID_EN 0x24
  331. #define BALE_LIM_H 0x69
  332. #define BALF_LIM_H 0x6B
  333. #define CRC_ECM 0x2A
  334. #define DIF 0x6F
  335. #define DMPH 0x46
  336. #define DRAM_EXT 0x3E
  337. #define DUAL_REG 0x1F
  338. #define FIFO_IN_TRESHOLD 0x52
  339. #define FORMAT 0x19
  340. #define FRAME_NUMBER 0x13
  341. #define FRAME_OFFSET 0x12
  342. #define FREE_FORM_H 0x15
  343. #define FREE_FORM_L 0x14
  344. #define HEADER 0x5E
  345. #define INTR 0x1A
  346. #define INTR_EN 0x1C
  347. #define INVERT_LRCLK 0x11
  348. #define INVERT_SCLK 0x53
  349. #define LATENCY 0x3C
  350. #define MUTE 0x30
  351. #define PACKET_SYNC_CHOICE 0x23
  352. #define PCM_DIV 0x6E
  353. #define PCM_FS 0x44
  354. #define PCM_ORD 0x38
  355. #define PCM_18 0x16
  356. #define PLAY 0x2E
  357. #define PTS_0 0x62
  358. #define PTS_1 0x63
  359. #define PTS_2 0x64
  360. #define PTS_3 0x65
  361. #define PTS_4 0x66
  362. #define REPEAT 0x34
  363. #define RESET 0x40
  364. #define RESTART 0x42
  365. #define SIN_EN 0x70
  366. #define SKIP 0x32
  367. #define STC_INC 0x10
  368. #define STC_DIVH 0x49
  369. #define STC_DIVL 0x48
  370. #define STC_CTL 0x21
  371. #define STC_0 0x4A
  372. #define STC_1 0x4B
  373. #define STC_2 0x4C
  374. #define STC_3 0x4D
  375. #define STC_4 0x4E
  376. #define STR_SEL 0x36
  377. #define SYNCHRO_CONFIRM 0x25
  378. #define SYNC_ECM 0x2C
  379. #define SYNC_LCK 0x28
  380. #define SYNC_REG 0x27
  381. #define SYNC_ST 0x26
  382. #define VERSION 0x6D
  383. /* Define Interrupt Masks of the STi4500*/
  384. #define SYNC 0x0001 // Set upon change in synchro status
  385. #define HEAD 0x0002 // Set when a valid header has been registered
  386. #define PTS 0x0004 // Set when PTS detected
  387. #define BALE 0x0008 // Set when under BALE treshold
  388. #define BALF 0x0010 // Set when over BALF treshold
  389. #define CRC 0x0020 // Set when CRC error is detected
  390. #define ANCI 0x0080 // Set when Ancillary buffer is full
  391. #define PCMU 0x0100 // Set on PCM buffer underflow
  392. #define SAMP 0x0200 // Set when sampling frequency has changed
  393. #define DEMP 0x0400 // Set when de-emphasis changed
  394. #define DFUL 0x0800 // Set when DRAM is full
  395. #define FIFT 0x1000 // Set when fifo_in_treshold reached
  396. #define FIFF 0x2000 // Set when fifo is full
  397. #define BOF 0x4000 // Set when Begining of frame
  398. #define NSYNC 0xFFFE // Set upon change in synchro status
  399. #define NHEAD 0xFFFD // Set when a valid header has been registered
  400. #define NPTS 0xFFFB // Set when PTS detected
  401. #define NBALE 0xFFF7 // Set when under BALE treshold
  402. #define NBALF 0xFFEF // Set when over BALF treshold
  403. #define NCRC 0xFFDF // Set when CRC error is detected
  404. #define NANC 0xFF7F // Set when Ancillary buffer is full
  405. #define NPCMU 0xFEFF // Set on PCM buffer underflow
  406. #define NSAMP 0xFDFF // Set when sampling frequency has changed
  407. #define NDEMP 0xFBFF // Set when de-emphasis changed
  408. #define NDFUL 0xF7FF // Set when DRAM is full
  409. #define NFIFT 0xEFFF // Set when fifo_in_treshold reached
  410. #define NFIFF 0xDFFF // Set when fifo is full
  411. #define NBOF 0xBFFF // Set when Begining of frame
  412. BOOL FARAPI VideoOpen(void);
  413. void FARAPI VideoClose(void);
  414. void FARAPI VideoInitDecoder(STREAMTYPE StreamType);
  415. void FARAPI VideoSetMode(WORD Mode, WORD param);
  416. void FARAPI VideoDecode(void);
  417. void FARAPI VideoStep(void);
  418. void FARAPI VideoBack(void);
  419. void FARAPI VideoStop(void);
  420. void FARAPI VideoPause(void);
  421. BOOL FARAPI AudioIsEnoughPlace(WORD size);
  422. BOOL FARAPI VideoIsEnoughPlace(WORD size);
  423. DWORD FARAPI VideoGetFirstDTS(void);
  424. WORD FARAPI VideoGetErrorMsg(void);
  425. void FARAPI VideoSkip(void);
  426. void FARAPI VideoRepeat(void);
  427. WORD FARAPI VideoGetState(void);
  428. DWORD FARAPI VideoGetPTS(void);
  429. BOOL FARAPI VideoIsFirstDTS(void);
  430. BOOL FARAPI VideoIsFirstField(void);
  431. BOOL FARAPI VideoForceBKC(BOOL bEnable);
  432. void FARAPI VideoMaskInt (void);
  433. void FARAPI VideoRestoreInt (void);
  434. BOOL FARAPI VideoVideoInt(void);
  435. WORD FARAPI SendAudioIfPossible(LPBYTE pBuffer, WORD Size);
  436. WORD FARAPI SendAudioToVideoIfPossible(LPBYTE Buffer, WORD Size);
  437. void FARAPI VideoInitPesParser(STREAMTYPE StreamType );
  438. BOOL FARAPI VideoIsValidPTS(void);
  439. DWORD FARAPI BoardReadVideoPTS(void);
  440. WORD FARAPI VideoTestReg(void);
  441. WORD FARAPI VideoTestMemPat(WORD pattern, WORD pattern1);
  442. WORD FARAPI VideoTestMem(void);
  443. void FARAPI VideoSetVideoWindow (WORD a, WORD b, WORD c, WORD d );
  444. void FARAPI VideoInitXY(void);
  445. void FARAPI SetXY(WORD xds, WORD yds);
  446. void FARAPI VideoSetPictureSize(void);
  447. void FARAPI VideoSwitchSRC (void);
  448. void FARAPI VideoSeekDecoder(STREAMTYPE StreamType);
  449. WORD FARAPI VideoGetABL(void) ;
  450. #endif // #ifndef __STi3520A_H