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.

2118 lines
52 KiB

  1. //***************************************************************************
  2. //
  3. // FileName:
  4. // $Workfile: brdprop.cpp $
  5. //
  6. // Author:
  7. // TOSHIBA [PCS](PSY) Seiichi Nakamura
  8. // Copyright (c) 1997 TOSHIBA CORPORATION
  9. //
  10. // Description:
  11. //
  12. //***************************************************************************
  13. // $Header: /DVD Drivers/ZiVA.WDM/brdprop.cpp 58 98/12/03 6:08p Yagi $
  14. // $Modtime: 98/12/03 4:53p $
  15. // $Nokeywords:$
  16. //***************************************************************************
  17. // Date | Author | Description
  18. // -----------+--------------+--------------------------------------------
  19. // 1998.03.27 | Hideki Yagi | Buugfix about Digital Palette setting.
  20. // 1998.05.01 | Hideki Yagi | Add SubpicProperty_FlushBuff.
  21. //
  22. #include "includes.h"
  23. #include "timeout.h"
  24. #include "ioif.h"
  25. #include "adv.h"
  26. #include "zivachip.h"
  27. #include "mixhal.h"
  28. // by oka
  29. #include "userdata.h"
  30. #include "zivabrd.h"
  31. //***************************************************************************
  32. // ZiVA Board Class
  33. //***************************************************************************
  34. //---------------------------------------------------------------------------
  35. // IClassLibHAL SetVideoProperty
  36. //---------------------------------------------------------------------------
  37. HALRESULT CMPEGBoardHAL::SetVideoProperty( VIDEOPROPTYPE PropertyType, VOID *pData )
  38. {
  39. BOOL rc = FALSE;
  40. switch( PropertyType )
  41. {
  42. case VideoProperty_TVSystem:
  43. rc = SetVideoProperty_TVSystem( pData );
  44. break;
  45. case VideoProperty_AspectRatio:
  46. rc = SetVideoProperty_AspectRatio( pData );
  47. break;
  48. case VideoProperty_DisplayMode:
  49. rc = SetVideoProperty_DisplayMode( pData );
  50. break;
  51. case VideoProperty_Resolution:
  52. rc = SetVideoProperty_Resolution( pData );
  53. break;
  54. case VideoProperty_DigitalOut:
  55. rc = SetVideoProperty_DigitalOut( pData );
  56. break;
  57. case VideoProperty_DigitalPalette:
  58. rc = SetVideoProperty_DigitalPalette( pData );
  59. break;
  60. case VideoProperty_APS:
  61. rc = SetVideoProperty_APS( pData );
  62. break;
  63. case VideoProperty_ClosedCaption:
  64. rc = SetVideoProperty_ClosedCaption( pData );
  65. break;
  66. case VideoProperty_OutputSource:
  67. rc = SetVideoProperty_OutputSource( pData );
  68. break;
  69. case VideoProperty_CompositeOut:
  70. rc = SetVideoProperty_CompositeOut( pData );
  71. break;
  72. case VideoProperty_SVideoOut:
  73. rc = SetVideoProperty_SVideoOut( pData );
  74. break;
  75. case VideoProperty_SkipFieldControl:
  76. rc = SetVideoProperty_SkipFieldControl( pData );
  77. break;
  78. case VideoProperty_FilmCamera:
  79. rc = SetVideoProperty_FilmCamera( pData );
  80. break;
  81. // by oka
  82. case VideoProperty_Digest:
  83. rc = SetVideoProperty_Digest( pData );
  84. break;
  85. case VideoProperty_OSDData:
  86. rc = SetVideoProperty_OSDData( pData );
  87. break;
  88. case VideoProperty_OSDSwitch:
  89. rc = SetVideoProperty_OSDSwitch( pData );
  90. break;
  91. case VideoProperty_Magnify:
  92. rc = SetVideoProperty_Magnify( pData );
  93. break;
  94. case VideoProperty_ClosedCaptionData:
  95. rc = SetVideoProperty_ClosedCaptionData( pData );
  96. break;
  97. // end
  98. default:
  99. return HAL_INVALID_PARAM;
  100. };
  101. if( rc == TRUE )
  102. return HAL_SUCCESS;
  103. DBG_BREAK();
  104. return HAL_ERROR;
  105. };
  106. //---------------------------------------------------------------------------
  107. // IClassLibHAL GetVideoProperty
  108. //---------------------------------------------------------------------------
  109. HALRESULT CMPEGBoardHAL::GetVideoProperty( VIDEOPROPTYPE PropertyType, VOID *pData )
  110. {
  111. BOOL rc = FALSE;
  112. switch( PropertyType )
  113. {
  114. case VideoProperty_TVSystem:
  115. rc = GetVideoProperty_TVSystem( pData );
  116. break;
  117. case VideoProperty_AspectRatio:
  118. rc = GetVideoProperty_AspectRatio( pData );
  119. break;
  120. case VideoProperty_DisplayMode:
  121. rc = GetVideoProperty_DisplayMode( pData );
  122. break;
  123. case VideoProperty_Resolution:
  124. rc = GetVideoProperty_Resolution( pData );
  125. break;
  126. case VideoProperty_DigitalOut:
  127. rc = GetVideoProperty_DigitalOut( pData );
  128. break;
  129. case VideoProperty_DigitalPalette:
  130. rc = GetVideoProperty_DigitalPalette( pData );
  131. break;
  132. case VideoProperty_APS:
  133. rc = GetVideoProperty_APS( pData );
  134. break;
  135. case VideoProperty_ClosedCaption:
  136. rc = GetVideoProperty_ClosedCaption( pData );
  137. break;
  138. case VideoProperty_OutputSource:
  139. rc = GetVideoProperty_OutputSource( pData );
  140. break;
  141. case VideoProperty_CompositeOut:
  142. rc = GetVideoProperty_CompositeOut( pData );
  143. break;
  144. case VideoProperty_SVideoOut:
  145. rc = GetVideoProperty_SVideoOut( pData );
  146. break;
  147. case VideoProperty_SkipFieldControl:
  148. rc = GetVideoProperty_SkipFieldControl( pData );
  149. break;
  150. case VideoProperty_FilmCamera:
  151. rc = GetVideoProperty_FilmCamera( pData );
  152. break;
  153. // by oka
  154. case VideoProperty_Digest:
  155. rc = GetVideoProperty_Digest( pData );
  156. break;
  157. case VideoProperty_OSDData:
  158. rc = GetVideoProperty_OSDData( pData );
  159. break;
  160. case VideoProperty_OSDSwitch:
  161. rc = GetVideoProperty_OSDSwitch( pData );
  162. break;
  163. case VideoProperty_Magnify:
  164. rc = GetVideoProperty_Magnify( pData );
  165. break;
  166. case VideoProperty_ClosedCaptionData:
  167. rc = GetVideoProperty_ClosedCaptionData( pData );
  168. break;
  169. // end
  170. default:
  171. return HAL_INVALID_PARAM;
  172. };
  173. if( rc == TRUE )
  174. return HAL_SUCCESS;
  175. DBG_BREAK();
  176. return HAL_ERROR;
  177. };
  178. //---------------------------------------------------------------------------
  179. // IClassLibHAL SetAudioProperty
  180. //---------------------------------------------------------------------------
  181. HALRESULT CMPEGBoardHAL::SetAudioProperty( AUDIOPROPTYPE PropertyType, VOID *pData )
  182. {
  183. BOOL rc = FALSE;
  184. switch( PropertyType )
  185. {
  186. case AudioProperty_Type:
  187. rc = SetAudioProperty_Type( pData );
  188. break;
  189. case AudioProperty_Number:
  190. rc = SetAudioProperty_Number( pData );
  191. break;
  192. case AudioProperty_Volume:
  193. rc = SetAudioProperty_Volume( pData );
  194. break;
  195. case AudioProperty_Sampling:
  196. rc = SetAudioProperty_Sampling( pData );
  197. break;
  198. case AudioProperty_Channel:
  199. rc = SetAudioProperty_Channel( pData );
  200. break;
  201. case AudioProperty_Quant:
  202. rc = SetAudioProperty_Quant( pData );
  203. break;
  204. case AudioProperty_AudioOut:
  205. rc = SetAudioProperty_AudioOut( pData );
  206. break;
  207. case AudioProperty_Cgms:
  208. rc = SetAudioProperty_Cgms( pData );
  209. break;
  210. case AudioProperty_AnalogOut:
  211. rc = SetAudioProperty_AnalogOut( pData );
  212. break;
  213. case AudioProperty_DigitalOut:
  214. rc = SetAudioProperty_DigitalOut( pData );
  215. break;
  216. case AudioProperty_AC3DRangeLowBoost:
  217. rc = SetAudioProperty_AC3DRangeLowBoost( pData );
  218. break;
  219. case AudioProperty_AC3DRangeHighCut:
  220. rc = SetAudioProperty_AC3DRangeHighCut( pData );
  221. break;
  222. case AudioProperty_AC3OperateMode:
  223. rc = SetAudioProperty_AC3OperateMode( pData );
  224. break;
  225. case AudioProperty_AC3OutputMode:
  226. rc = SetAudioProperty_AC3OutputMode( pData );
  227. break;
  228. default:
  229. return HAL_INVALID_PARAM;
  230. };
  231. if( rc == TRUE )
  232. return HAL_SUCCESS;
  233. DBG_BREAK();
  234. return HAL_ERROR;
  235. };
  236. //---------------------------------------------------------------------------
  237. // IClassLibHAL GetAudioProperty
  238. //---------------------------------------------------------------------------
  239. HALRESULT CMPEGBoardHAL::GetAudioProperty( AUDIOPROPTYPE PropertyType, VOID *pData )
  240. {
  241. BOOL rc = FALSE;
  242. switch( PropertyType )
  243. {
  244. case AudioProperty_Type:
  245. rc = GetAudioProperty_Type( pData );
  246. break;
  247. case AudioProperty_Number:
  248. rc = GetAudioProperty_Number( pData );
  249. break;
  250. case AudioProperty_Volume:
  251. rc = GetAudioProperty_Volume( pData );
  252. break;
  253. case AudioProperty_Sampling:
  254. rc = GetAudioProperty_Sampling( pData );
  255. break;
  256. case AudioProperty_Channel:
  257. rc = GetAudioProperty_Channel( pData );
  258. break;
  259. case AudioProperty_Quant:
  260. rc = GetAudioProperty_Quant( pData );
  261. break;
  262. case AudioProperty_AudioOut:
  263. rc = GetAudioProperty_AudioOut( pData );
  264. break;
  265. case AudioProperty_Cgms:
  266. rc = GetAudioProperty_Cgms( pData );
  267. break;
  268. case AudioProperty_AnalogOut:
  269. rc = GetAudioProperty_AnalogOut( pData );
  270. break;
  271. case AudioProperty_DigitalOut:
  272. rc = GetAudioProperty_DigitalOut( pData );
  273. break;
  274. case AudioProperty_AC3DRangeLowBoost:
  275. rc = GetAudioProperty_AC3DRangeLowBoost( pData );
  276. break;
  277. case AudioProperty_AC3DRangeHighCut:
  278. rc = GetAudioProperty_AC3DRangeHighCut( pData );
  279. break;
  280. case AudioProperty_AC3OperateMode:
  281. rc = GetAudioProperty_AC3OperateMode( pData );
  282. break;
  283. case AudioProperty_AC3OutputMode:
  284. rc = GetAudioProperty_AC3OutputMode( pData );
  285. break;
  286. default:
  287. return HAL_INVALID_PARAM;
  288. };
  289. if( rc == TRUE )
  290. return HAL_SUCCESS;
  291. DBG_BREAK();
  292. return HAL_ERROR;
  293. };
  294. //---------------------------------------------------------------------------
  295. // IClassLibHAL SetSubpicProperty
  296. //---------------------------------------------------------------------------
  297. HALRESULT CMPEGBoardHAL::SetSubpicProperty( SUBPICPROPTYPE PropertyType, VOID *pData )
  298. {
  299. BOOL rc = FALSE;
  300. switch( PropertyType )
  301. {
  302. case SubpicProperty_Number:
  303. rc = SetSubpicProperty_Number( pData );
  304. break;
  305. case SubpicProperty_Palette:
  306. rc = SetSubpicProperty_Palette( pData );
  307. break;
  308. case SubpicProperty_Hilight:
  309. rc = SetSubpicProperty_Hilight( pData );
  310. break;
  311. case SubpicProperty_State:
  312. rc = SetSubpicProperty_State( pData );
  313. break;
  314. // by oka
  315. case SubpicProperty_HilightButton:
  316. rc = SetSubpicProperty_HilightButton( pData );
  317. break;
  318. case SubpicProperty_FlushBuff:
  319. rc = SetSubpicProperty_FlushBuff( pData );
  320. break;
  321. default:
  322. return HAL_INVALID_PARAM;
  323. };
  324. if( rc == TRUE )
  325. return HAL_SUCCESS;
  326. DBG_BREAK();
  327. return HAL_ERROR;
  328. };
  329. //---------------------------------------------------------------------------
  330. // IClassLibHAL GetSubpicProperty
  331. //---------------------------------------------------------------------------
  332. HALRESULT CMPEGBoardHAL::GetSubpicProperty( SUBPICPROPTYPE PropertyType, VOID *pData )
  333. {
  334. BOOL rc = FALSE;
  335. switch( PropertyType )
  336. {
  337. case SubpicProperty_Number:
  338. rc = GetSubpicProperty_Number( pData );
  339. break;
  340. case SubpicProperty_Palette:
  341. rc = GetSubpicProperty_Palette( pData );
  342. break;
  343. case SubpicProperty_Hilight:
  344. rc = GetSubpicProperty_Hilight( pData );
  345. break;
  346. case SubpicProperty_State:
  347. rc = GetSubpicProperty_State( pData );
  348. break;
  349. // by oka
  350. case SubpicProperty_HilightButton:
  351. rc = GetSubpicProperty_HilightButton( pData );
  352. break;
  353. case SubpicProperty_FlushBuff:
  354. rc = GetSubpicProperty_FlushBuff( pData );
  355. break;
  356. default:
  357. return HAL_INVALID_PARAM;
  358. };
  359. if( rc == TRUE )
  360. return HAL_SUCCESS;
  361. DBG_BREAK();
  362. return HAL_ERROR;
  363. };
  364. //***************************************************************************
  365. // Video Property Functions( Set Series )
  366. //***************************************************************************
  367. BOOL CMPEGBoardHAL::SetVideoProperty_TVSystem( PVOID pData )
  368. {
  369. VideoProperty_TVSystem_Value *pValue = (VideoProperty_TVSystem_Value *)pData;
  370. POWERSTATE PowerState;
  371. GetPowerState( &PowerState );
  372. if( PowerState == POWERSTATE_ON )
  373. {
  374. if( *pValue != m_VideoProp.m_TVSystem )
  375. {
  376. // 98.12.03 H.Yagi start
  377. // Abort Command send to ZiVA
  378. m_pKernelObj->DisableHwInt();
  379. ziva.INT_MASK = ZIVA_INT_ENDC;
  380. ClearENDCEvent();
  381. m_pKernelObj->EnableHwInt();
  382. ziva.Abort( 1 );
  383. // WaitENDC interrupt
  384. if( WaitENDC() == FALSE ){
  385. DBG_PRINTF( ("brdprop: Abort Error\n\r") );
  386. DBG_BREAK();
  387. return( FALSE );
  388. }
  389. // 98.12.03 H.Yagi end
  390. switch( *pValue )
  391. {
  392. case TV_NTSC:
  393. ziva.VIDEO_ENV_CHANGE = 0x01; // 98.10.29 H.Yagi
  394. m_VideoProp.m_TVSystem = *pValue; // 98.10.29 H.Yagi
  395. break;
  396. case TV_PALB: case TV_PALD: case TV_PALG:
  397. case TV_PALH: case TV_PALI: case TV_PALM:
  398. DBG_PRINTF( ( "DVDPROP: Change TVSystem from %d to %d\n", m_VideoProp.m_TVSystem, *pValue ));
  399. ziva.VIDEO_ENV_CHANGE = 0x02; // 98.10.29 H.Yagi
  400. m_VideoProp.m_TVSystem = *pValue; // 98.10.29 H.Yagi
  401. // SetPowerState( POWERSTATE_OFF );
  402. // SetPowerState( POWERSTATE_ON );
  403. break;
  404. case TV_PALN: // NON SUPPORT!
  405. DBG_BREAK();
  406. return FALSE;
  407. default:
  408. DBG_BREAK();
  409. return FALSE;
  410. };
  411. ziva.NewPlayMode(); // 98.10.29 H.Yagi
  412. };
  413. switch( *pValue )
  414. {
  415. case TV_NTSC:
  416. if( adv==NULL )
  417. {
  418. DBG_PRINTF(("DVDPROP:adv object is NULL! LINE=%d\n", __LINE__ ));
  419. DBG_BREAK();
  420. return( FALSE );
  421. }
  422. adv->SetNTSC();
  423. break;
  424. case TV_PALB: case TV_PALD: case TV_PALG:
  425. case TV_PALH: case TV_PALI:
  426. if( adv==NULL )
  427. {
  428. DBG_PRINTF(("DVDPROP:adv object is NULL! LINE=%d\n", __LINE__ ));
  429. DBG_BREAK();
  430. return( FALSE );
  431. }
  432. adv->SetPAL( 0 ); // PAL B,D,G,H,I
  433. break;
  434. case TV_PALM:
  435. if( adv==NULL )
  436. {
  437. DBG_PRINTF(("DVDPROP:adv object is NULL! LINE=%d\n", __LINE__ ));
  438. DBG_BREAK();
  439. return( FALSE );
  440. }
  441. adv->SetPAL( 1 ); // PAL M
  442. break;
  443. case TV_PALN: // NON SUPPORT!
  444. DBG_BREAK();
  445. return FALSE;
  446. default:
  447. DBG_BREAK();
  448. return FALSE;
  449. };
  450. };
  451. m_VideoProp.m_TVSystem = *pValue;
  452. return TRUE;
  453. };
  454. BOOL CMPEGBoardHAL::SetVideoProperty_AspectRatio( PVOID pData )
  455. {
  456. VideoProperty_AspectRatio_Value *pValue = (VideoProperty_AspectRatio_Value *)pData;
  457. POWERSTATE PowerState;
  458. GetPowerState( &PowerState );
  459. if( PowerState == POWERSTATE_ON )
  460. {
  461. switch( *pValue )
  462. {
  463. case Aspect_04_03:
  464. DBG_PRINTF( ( "DVDPROP: Aspect_04_03\n"));
  465. ziva.FORCE_CODED_ASPECT_RATIO = 2;
  466. break;
  467. case Aspect_16_09:
  468. DBG_PRINTF( ( "DVDPROP: Aspect_16_09\n"));
  469. ziva.FORCE_CODED_ASPECT_RATIO = 3;
  470. break;
  471. default:
  472. DBG_BREAK();
  473. return FALSE;
  474. };
  475. };
  476. m_VideoProp.m_AspectRatio = *pValue;
  477. return SetVideoProperty_DisplayMode( (PVOID)&(m_VideoProp.m_DisplayMode) );
  478. };
  479. BOOL CMPEGBoardHAL::SetVideoProperty_DisplayMode( PVOID pData )
  480. {
  481. VideoProperty_DisplayMode_Value *pValue = (VideoProperty_DisplayMode_Value *)pData;
  482. POWERSTATE PowerState;
  483. GetPowerState( &PowerState );
  484. // �p�����[�^�`�F�b�N
  485. if( *pValue != Display_Original && *pValue != Display_PanScan && *pValue != Display_LetterBox )
  486. {
  487. DBG_BREAK();
  488. return FALSE;
  489. };
  490. // 1998.8.18 seichan
  491. // PICV�̊��荞�݂����������Ƃ��ɐݒ肷���悤�ɕύX
  492. /******/
  493. if( PowerState == POWERSTATE_ON )
  494. {
  495. switch( *pValue )
  496. {
  497. case Display_Original:
  498. DBG_PRINTF( ( "DVDPROP: Display Original\n"));
  499. if( m_VideoProp.m_AspectRatio == Aspect_04_03 )
  500. {
  501. ziva.DISPLAY_ASPECT_RATIO = 0x00;
  502. ziva.ASPECT_RATIO_MODE = 0x01;
  503. ioif.luke2.AVCONT = (WORD)((ioif.luke2.AVCONT & 0xfcff) | 0x0300); // S2 = H, S1 = H
  504. }
  505. else
  506. {
  507. ziva.DISPLAY_ASPECT_RATIO = 0x02;
  508. ziva.ASPECT_RATIO_MODE = 0x01;
  509. ioif.luke2.AVCONT = (WORD)((ioif.luke2.AVCONT & 0xfcff) | 0x0200); // S2 = H, S1 = L
  510. };
  511. break;
  512. case Display_PanScan:
  513. DBG_PRINTF( ( "DVDPROP: Display Panscan\n"));
  514. if( m_VideoProp.m_AspectRatio == Aspect_04_03 )
  515. {
  516. ziva.DISPLAY_ASPECT_RATIO = 0x00;
  517. ziva.ASPECT_RATIO_MODE = 0x01;
  518. ziva.PAN_SCAN_SOURCE = 0x00;
  519. ioif.luke2.AVCONT = (WORD)((ioif.luke2.AVCONT & 0xfcff) | 0x0300); // S2 = H, S1 = H
  520. }
  521. else
  522. {
  523. ziva.DISPLAY_ASPECT_RATIO = 0x00;
  524. ziva.ASPECT_RATIO_MODE = 0x01;
  525. ziva.PAN_SCAN_SOURCE = 0x00;
  526. ioif.luke2.AVCONT = (WORD)((ioif.luke2.AVCONT & 0xfcff) | 0x0300); // S2 = H, S1 = H
  527. };
  528. break;
  529. case Display_LetterBox:
  530. DBG_PRINTF( ( "DVDPROP: Display LetterBox\n"));
  531. if( m_VideoProp.m_AspectRatio == Aspect_04_03 )
  532. {
  533. ziva.DISPLAY_ASPECT_RATIO = 0x00;
  534. ziva.ASPECT_RATIO_MODE = 0x01;
  535. ioif.luke2.AVCONT = (WORD)((ioif.luke2.AVCONT & 0xfcff) | 0x0300); // S2 = H, S1 = H
  536. }
  537. else
  538. {
  539. ziva.DISPLAY_ASPECT_RATIO = 0x00;
  540. ziva.ASPECT_RATIO_MODE = 0x02;
  541. ioif.luke2.AVCONT = (WORD)((ioif.luke2.AVCONT & 0xfcff) | 0x0100); // S2 = L, S1 = H
  542. };
  543. break;
  544. default:
  545. DBG_BREAK();
  546. return FALSE;
  547. };
  548. };
  549. /*******/
  550. m_VideoProp.m_DisplayMode = *pValue;
  551. // 1998.8.18 seichan
  552. // ZiVA��PICV�Őݒ����s�����߂̃t���O���Z�b�g
  553. // m_SetVideoProperty_DisplayMode_Event = TRUE;
  554. return TRUE;
  555. };
  556. BOOL CMPEGBoardHAL::SetVideoProperty_Resolution( PVOID pData )
  557. {
  558. VideoSizeStruc *pValue = (VideoSizeStruc *)pData;
  559. m_VideoProp.m_Size = *pValue;
  560. return TRUE;
  561. };
  562. BOOL CMPEGBoardHAL::SetVideoProperty_DigitalOut( PVOID pData )
  563. {
  564. VideoProperty_DigitalOut_Value *pValue = (VideoProperty_DigitalOut_Value *)pData;
  565. BYTE Data;
  566. // if( m_VideoProp.m_DigitalOut != DigitalOut_Off && *pValue != DigitalOut_Off )
  567. // {
  568. // return FALSE;
  569. // };
  570. POWERSTATE PowerState;
  571. GetPowerState( &PowerState );
  572. if( PowerState == POWERSTATE_ON )
  573. {
  574. switch( *pValue )
  575. {
  576. case DigitalOut_Off:
  577. // ZV off
  578. if( m_VideoProp.m_DigitalOut == DigitalOut_ZV )
  579. {
  580. m_pKernelObj->GetPCIConfigData( 0x44, &Data );
  581. Data = (BYTE)( Data & 0xfe );
  582. m_pKernelObj->SetPCIConfigData( 0x44, Data );
  583. };
  584. ioif.luke2.IO_VMODE = 0x00;
  585. ioif.luke2.IO_HSCNT = 0x00;
  586. ioif.luke2.IO_VPCNT = 0x00;
  587. break;
  588. case DigitalOut_ZV:
  589. ioif.luke2.IO_VMODE = 0x00;
  590. ioif.luke2.IO_HSCNT = 0x00;
  591. ioif.luke2.IO_VPCNT = 0x00;
  592. m_pKernelObj->GetPCIConfigData( 0x44, &Data );
  593. Data = (BYTE)( Data | 0x01 );
  594. m_pKernelObj->SetPCIConfigData( 0x44, Data );
  595. break;
  596. case DigitalOut_LPB08:
  597. ioif.luke2.IO_VMODE = 0x04;
  598. ioif.luke2.IO_HSCNT = 0x70;
  599. ioif.luke2.IO_VPCNT = 0x02;
  600. break;
  601. case DigitalOut_LPB16:
  602. ioif.luke2.IO_VMODE = 0x08;
  603. ioif.luke2.IO_HSCNT = 0x00;
  604. ioif.luke2.IO_VPCNT = 0x00;
  605. break;
  606. case DigitalOut_VMI:
  607. ioif.luke2.IO_VMODE = 0x06;
  608. ioif.luke2.IO_HSCNT = 0x00;
  609. ioif.luke2.IO_VPCNT = 0x00;
  610. break;
  611. case DigitalOut_AMCbt:
  612. ioif.luke2.IO_VMODE = 0x07;
  613. ioif.luke2.IO_HSCNT = 0x00;
  614. ioif.luke2.IO_VPCNT = 0x00;
  615. break;
  616. case DigitalOut_AMC656:
  617. ioif.luke2.IO_VMODE = 0x09;
  618. ioif.luke2.IO_HSCNT = 0x00;
  619. ioif.luke2.IO_VPCNT = 0x00;
  620. break;
  621. case DigitalOut_DAV2:
  622. ioif.luke2.IO_VMODE = 0x01;
  623. ioif.luke2.IO_HSCNT = 0x00;
  624. ioif.luke2.IO_VPCNT = 0x00;
  625. break;
  626. case DigitalOut_CIRRUS:
  627. ioif.luke2.IO_VMODE = 0x05;
  628. ioif.luke2.IO_HSCNT = 0x00;
  629. ioif.luke2.IO_VPCNT = 0x00;
  630. break;
  631. default:
  632. DBG_BREAK();
  633. return FALSE;
  634. };
  635. };
  636. m_VideoProp.m_DigitalOut = *pValue;
  637. return TRUE;
  638. };
  639. BOOL CMPEGBoardHAL::SetVideoProperty_DigitalPalette( PVOID pData )
  640. {
  641. Digital_Palette *pValue = (Digital_Palette *)pData;
  642. BYTE CpCtl;
  643. CpCtl = 0x04; // 98.03.27 H.Yagi
  644. ioif.luke2.IO_CPCNT = CpCtl;
  645. switch( pValue->Select )
  646. {
  647. case Palette_Y: CpCtl = 0x01; break;
  648. case Palette_Cb: CpCtl = 0x02; break;
  649. case Palette_Cr: CpCtl = 0x03; break;
  650. default:
  651. DBG_BREAK();
  652. return FALSE;
  653. };
  654. POWERSTATE PowerState;
  655. GetPowerState( &PowerState );
  656. if( PowerState == POWERSTATE_ON )
  657. {
  658. // Select Palette and Clear Counter.
  659. ioif.luke2.IO_CPCNT = CpCtl;
  660. // Set Palette value
  661. for ( int i = 0 ; i < 256; i ++ )
  662. ioif.luke2.IO_CPLT = pValue->pPalette[i];
  663. };
  664. for ( int i = 0 ; i < 256; i ++ )
  665. m_VideoProp.m_DigitalPalette[ pValue->Select ][i] = pValue->pPalette[i];
  666. return TRUE;
  667. };
  668. BOOL CMPEGBoardHAL::SetVideoProperty_APS( PVOID pData )
  669. {
  670. VideoAPSStruc *pValue = (VideoAPSStruc *)pData;
  671. POWERSTATE PowerState;
  672. GetPowerState( &PowerState );
  673. if( PowerState == POWERSTATE_ON )
  674. {
  675. if( adv==NULL )
  676. {
  677. DBG_PRINTF(("DVDPROP:adv object is NULL! LINE=%d\n", __LINE__ ));
  678. DBG_BREAK();
  679. return( FALSE );
  680. }
  681. BOOL rc;
  682. rc = adv->SetMacroVision( pValue->APSType );
  683. if( rc == FALSE )
  684. return FALSE;
  685. rc = adv->SetCgmsType( pValue->CgmsType, m_VideoProp );
  686. if( rc == FALSE )
  687. return FALSE;
  688. };
  689. m_VideoProp.m_APS = *pValue;
  690. return TRUE;
  691. };
  692. BOOL CMPEGBoardHAL::SetVideoProperty_ClosedCaption( PVOID pData )
  693. {
  694. VideoProperty_ClosedCaption_Value *pValue = (VideoProperty_ClosedCaption_Value *)pData;
  695. switch( *pValue )
  696. {
  697. case ClosedCaption_On:
  698. // by oka
  699. m_CCRingBufferStart = 0xFFFFFFFF;
  700. m_CCDataPoint = m_CCDataNumber = m_CCRingBufferNumber = 0;
  701. m_CCsend_point = m_CCpending = m_CCnumber = 0;
  702. adv->SetClosedCaptionOn( TRUE );
  703. // by oka
  704. if (!SetEventIntMask( ZIVA_INT_USR | ZIVA_INT_VSYNC ))
  705. {
  706. DBG_BREAK();
  707. return HAL_ERROR;
  708. }
  709. // ziva.INT_MASK = GetEventIntMask(); // No need
  710. break;
  711. case ClosedCaption_Off:
  712. // by oka
  713. if (!UnsetEventIntMask( ZIVA_INT_USR | ZIVA_INT_VSYNC ))
  714. {
  715. DBG_BREAK();
  716. return HAL_ERROR;
  717. }
  718. // ziva.INT_MASK = GetEventIntMask(); // No need.
  719. m_CCRingBufferStart = 0xFFFFFFFF;
  720. m_CCDataPoint = m_CCDataNumber = m_CCRingBufferNumber = 0;
  721. m_CCsend_point = m_CCpending = m_CCnumber = 0;
  722. adv->SetClosedCaptionData( 0x0000942C );
  723. adv->SetClosedCaptionData( 0x0000942C );
  724. adv->SetClosedCaptionOn( FALSE );
  725. break;
  726. default:
  727. DBG_BREAK();
  728. return FALSE;
  729. };
  730. m_VideoProp.m_ClosedCaption = *pValue;
  731. return TRUE;
  732. };
  733. BOOL CMPEGBoardHAL::SetVideoProperty_OutputSource( PVOID pData )
  734. {
  735. VideoProperty_OutputSource_Value *pValue = (VideoProperty_OutputSource_Value *)pData;
  736. BYTE Data;
  737. switch( *pValue )
  738. {
  739. case OutputSource_VGA:
  740. m_pKernelObj->GetPCIConfigData( 0x44, &Data );
  741. Data = (BYTE)( Data & 0xfd );
  742. m_pKernelObj->SetPCIConfigData( 0x44, Data );
  743. break;
  744. case OutputSource_DVD:
  745. m_pKernelObj->GetPCIConfigData( 0x44, &Data );
  746. Data = (BYTE)( Data | 0x02 );
  747. m_pKernelObj->SetPCIConfigData( 0x44, Data );
  748. break;
  749. default:
  750. DBG_BREAK();
  751. return FALSE;
  752. };
  753. m_VideoProp.m_OutputSource = *pValue;
  754. return TRUE;
  755. };
  756. BOOL CMPEGBoardHAL::SetVideoProperty_CompositeOut( PVOID pData )
  757. {
  758. VideoProperty_CompositeOut_Value *pValue = (VideoProperty_CompositeOut_Value *)pData;
  759. POWERSTATE PowerState;
  760. GetPowerState( &PowerState );
  761. if( PowerState == POWERSTATE_ON )
  762. {
  763. switch( *pValue )
  764. {
  765. case CompositeOut_On:
  766. if( adv==NULL )
  767. {
  768. DBG_PRINTF(("DVDPROP:adv object is NULL! LINE=%d\n", __LINE__ ));
  769. DBG_BREAK();
  770. return( FALSE );
  771. }
  772. adv->SetCompPowerOn( TRUE );
  773. break;
  774. case CompositeOut_Off:
  775. if( adv==NULL )
  776. {
  777. DBG_PRINTF(("DVDPROP:adv object is NULL! LINE=%d\n", __LINE__ ));
  778. DBG_BREAK();
  779. return( FALSE );
  780. }
  781. adv->SetCompPowerOn( FALSE );
  782. break;
  783. default:
  784. DBG_BREAK();
  785. return FALSE;
  786. };
  787. };
  788. m_VideoProp.m_CompositeOut = *pValue;
  789. return TRUE;
  790. };
  791. BOOL CMPEGBoardHAL::SetVideoProperty_SVideoOut( PVOID pData )
  792. {
  793. VideoProperty_SVideoOut_Value *pValue = (VideoProperty_SVideoOut_Value *)pData;
  794. POWERSTATE PowerState;
  795. GetPowerState( &PowerState );
  796. if( PowerState == POWERSTATE_ON )
  797. {
  798. switch( *pValue )
  799. {
  800. case SVideoOut_On:
  801. if( adv==NULL )
  802. {
  803. DBG_PRINTF(("DVDPROP:adv object is NULL! LINE=%d\n", __LINE__ ));
  804. DBG_BREAK();
  805. return( FALSE );
  806. }
  807. adv->SetSVideoPowerOn( TRUE );
  808. break;
  809. case SVideoOut_Off:
  810. if( adv==NULL )
  811. {
  812. DBG_PRINTF(("DVDPROP:adv object is NULL! LINE=%d\n", __LINE__ ));
  813. DBG_BREAK();
  814. return( FALSE );
  815. }
  816. adv->SetSVideoPowerOn( FALSE );
  817. break;
  818. default:
  819. DBG_BREAK();
  820. return FALSE;
  821. };
  822. };
  823. m_VideoProp.m_SVideoOut = *pValue;
  824. return TRUE;
  825. };
  826. BOOL CMPEGBoardHAL::SetVideoProperty_SkipFieldControl( PVOID pData )
  827. {
  828. VideoProperty_SkipFieldControl_Value *pValue = (VideoProperty_SkipFieldControl_Value *)pData;
  829. POWERSTATE PowerState;
  830. GetPowerState( &PowerState );
  831. if( PowerState == POWERSTATE_ON )
  832. {
  833. switch( *pValue )
  834. {
  835. case SkipFieldControl_On:
  836. ioif.luke2.AVCONT |= 0x04;
  837. break;
  838. case SkipFieldControl_Off:
  839. ioif.luke2.AVCONT &= 0xfffd;
  840. break;
  841. default:
  842. DBG_BREAK();
  843. return FALSE;
  844. };
  845. };
  846. m_VideoProp.m_SkipFieldControl = *pValue;
  847. return TRUE;
  848. };
  849. BOOL CMPEGBoardHAL::SetVideoProperty_FilmCamera( PVOID pData )
  850. {
  851. VideoProperty_FilmCamera_Value *pValue = (VideoProperty_FilmCamera_Value *)pData;
  852. POWERSTATE PowerState;
  853. GetPowerState( &PowerState );
  854. if( PowerState == POWERSTATE_ON )
  855. {
  856. switch( *pValue )
  857. {
  858. case Source_Camera:
  859. break;
  860. case Source_Film:
  861. break;
  862. default:
  863. DBG_BREAK();
  864. return FALSE;
  865. };
  866. };
  867. m_VideoProp.m_FilmCamera = *pValue;
  868. return TRUE;
  869. };
  870. // by oka
  871. BOOL CMPEGBoardHAL::SetVideoProperty_Digest( PVOID pData )
  872. {
  873. DWORD ret = ZIVARESULT_NOERROR;;
  874. VideoDigestStruc *pValue = (VideoDigestStruc *)pData;
  875. POWERSTATE PowerState;
  876. GetPowerState( &PowerState );
  877. if( PowerState == POWERSTATE_ON )
  878. {
  879. ret = ziva.Digest( pValue->dmX,
  880. pValue->dmY,
  881. pValue->dmSkip,
  882. pValue->dmDecimation,
  883. pValue->dmThreshold
  884. // pValue->dmStart
  885. );
  886. };
  887. // m_SubpicProp.m_HlightButton = *pValue;
  888. if (ret == ZIVARESULT_NOERROR)
  889. return TRUE;
  890. else
  891. return FALSE;
  892. };
  893. // by oka
  894. BOOL CMPEGBoardHAL::SetVideoProperty_OSDData( PVOID pData )
  895. {
  896. DWORD OSDSize;
  897. BYTE * OSDData;
  898. DWORD ret = ZIVARESULT_NOERROR;
  899. OsdDataStruc *pValue = (OsdDataStruc *)pData;
  900. POWERSTATE PowerState;
  901. GetPowerState( &PowerState );
  902. if( PowerState == POWERSTATE_ON )
  903. {
  904. if (m_VideoProp.m_OSDSwitch == Video_OSD_On)
  905. {
  906. ziva.OSD_EVEN_FIELD.Set( 0 );
  907. ziva.OSD_ODD_FIELD.Set( 0 );
  908. }
  909. ASSERT((m_OSDStartAddr % 4) == 0);
  910. if ((m_OSDStartAddr % 4) != 0)
  911. {
  912. DBG_BREAK();
  913. //RETAILMSG(ZONE_ERROR,(TEXT("OSD_BUFFER_START address Error!!\r\n")));
  914. return FALSE;
  915. }
  916. DWORD OSDStartAddrPointer, NextDataHeader;
  917. OSDStartAddrPointer = m_OSDStartAddr;
  918. NextDataHeader = 0;
  919. // loop to Next=NULL;
  920. while (pValue != NULL)
  921. {
  922. OSDSize = pValue->dwOsdSize;
  923. OSDData = (BYTE *)pValue->pData;
  924. // check data size
  925. if((m_OSDEndAddr - OSDStartAddrPointer) < OSDSize)
  926. {
  927. DBG_BREAK();
  928. //RETAILMSG(ZONE_ERROR,(TEXT("OSDSize too big!!\r\n")));
  929. return FALSE;
  930. }
  931. // Next Header Address
  932. if (pValue->pNextData != NULL)
  933. {
  934. NextDataHeader = OSDStartAddrPointer + OSDSize;
  935. // for 32bit boundary
  936. NextDataHeader += (NextDataHeader % 4);
  937. // Even
  938. OSDData[1] = (BYTE)((NextDataHeader >> 16) & 0xff);
  939. OSDData[2] = (BYTE)((NextDataHeader >> 8) & 0xff);
  940. OSDData[3] = (BYTE)((NextDataHeader) & 0xff);
  941. // Odd
  942. OSDData[1+32] = (BYTE)(((NextDataHeader+32) >> 16) & 0xff);
  943. OSDData[2+32] = (BYTE)(((NextDataHeader+32) >> 8) & 0xff);
  944. OSDData[3+32] = (BYTE)((NextDataHeader+32) & 0xff);
  945. } else {
  946. NextDataHeader = 0;
  947. // Even
  948. OSDData[1] = 0;
  949. OSDData[2] = 0;
  950. OSDData[3] = 0;
  951. // Odd
  952. OSDData[1+32] = 0;
  953. OSDData[2+32] = 0;
  954. OSDData[3+32] = 0;
  955. }
  956. // change address
  957. DWORD EvenBmpAddr,OddBmpAddr;
  958. DWORD EvenPltAddr,OddPltAddr;
  959. DWORD PelType;
  960. PelType = (((DWORD)OSDData[18]<<1) & 0x2)
  961. + (((DWORD)OSDData[19]>>8) & 0x80);
  962. EvenBmpAddr = (((DWORD)OSDData[13] << 16) & 0xff0000)
  963. + (((DWORD)OSDData[14] << 8 ) & 0xff00)
  964. + ((DWORD)OSDData[15] & 0xff);
  965. OddBmpAddr = (((DWORD)OSDData[13+32] << 16) & 0xff0000)
  966. + (((DWORD)OSDData[14+32] << 8 ) & 0xff00)
  967. + ((DWORD)OSDData[15+32] & 0xff);
  968. EvenPltAddr = (((DWORD)OSDData[29] << 16) & 0xff0000)
  969. + (((DWORD)OSDData[30] << 8 ) & 0xff00)
  970. + ((DWORD)OSDData[31] & 0xff);
  971. OddPltAddr = (((DWORD)OSDData[29+32] << 16) & 0xff0000)
  972. + (((DWORD)OSDData[30+32] << 8 ) & 0xff00)
  973. + ((DWORD)OSDData[31+32] & 0xff);
  974. // �ȉ��̌v�Z����PltAddr��OSDData[64]�����n�܂��Ƃ����O���ō������Ă���
  975. DWORD PltSize;
  976. if (PelType == 3)
  977. PltSize = 16;
  978. else
  979. PltSize = 64;
  980. EvenBmpAddr = EvenBmpAddr - EvenPltAddr + OSDStartAddrPointer + PltSize;
  981. OddBmpAddr = OddBmpAddr - OddPltAddr + OSDStartAddrPointer + PltSize;
  982. EvenPltAddr = OSDStartAddrPointer + PltSize;
  983. OddPltAddr = OSDStartAddrPointer + PltSize;
  984. // EvenBmpAddr
  985. OSDData[13]=(BYTE)((EvenBmpAddr & 0x00ff0000)>>16);
  986. OSDData[14]=(BYTE)((EvenBmpAddr & 0x0000ff00)>>8);
  987. OSDData[15]=(BYTE)(EvenBmpAddr & 0x000000fc);
  988. // OddBmpAddr
  989. OSDData[13+32]=(BYTE)((OddBmpAddr & 0x00ff0000)>>16);
  990. OSDData[14+32]=(BYTE)((OddBmpAddr & 0x0000ff00)>>8);
  991. OSDData[15+32]=(BYTE)(OddBmpAddr & 0x000000fc);
  992. // EvenPltAddr
  993. OSDData[29]=(BYTE)((EvenPltAddr & 0x00ff0000)>>16);
  994. OSDData[30]=(BYTE)((EvenPltAddr & 0x0000ff00)>>8);
  995. OSDData[31]=(BYTE)(EvenPltAddr & 0x000000fc);
  996. // OddPltAddr
  997. OSDData[29+32]=(BYTE)((OddPltAddr & 0x00ff0000)>>16);
  998. OSDData[30+32]=(BYTE)((OddPltAddr & 0x0000ff00)>>8);
  999. OSDData[31+32]=(BYTE)(OddPltAddr & 0x000000fc);
  1000. // transfer data
  1001. for( DWORD i = 0 ; i < OSDSize ; i += 4 )
  1002. {
  1003. ret = ziva.ZiVAWriteMemory( OSDStartAddrPointer + i, (DWORD)OSDData[i+0] << 24
  1004. | (DWORD)OSDData[i+1] << 16
  1005. | (DWORD)OSDData[i+2] << 8
  1006. | (DWORD)OSDData[i+3] );
  1007. };
  1008. // Next OSD Data
  1009. pValue = (OsdDataStruc *)pValue->pNextData;
  1010. OSDStartAddrPointer = NextDataHeader;
  1011. }
  1012. if (m_VideoProp.m_OSDSwitch == Video_OSD_On)
  1013. {
  1014. ziva.OSD_EVEN_FIELD.Set( m_OSDStartAddr );
  1015. ziva.OSD_ODD_FIELD.Set( m_OSDStartAddr + 32 );
  1016. }
  1017. };
  1018. if (ret == ZIVARESULT_NOERROR)
  1019. return TRUE;
  1020. else
  1021. return FALSE;
  1022. };
  1023. // by oka
  1024. BOOL CMPEGBoardHAL::SetVideoProperty_OSDSwitch( PVOID pData )
  1025. {
  1026. VideoProperty_OSD_Switch_Value *pValue = (VideoProperty_OSD_Switch_Value *)pData;
  1027. POWERSTATE PowerState;
  1028. GetPowerState( &PowerState );
  1029. if( PowerState == POWERSTATE_ON )
  1030. {
  1031. if (*pValue == Video_OSD_On && m_VideoProp.m_OSDSwitch == Video_OSD_Off)
  1032. {
  1033. ziva.OSD_EVEN_FIELD.Set( m_OSDStartAddr );
  1034. ziva.OSD_ODD_FIELD.Set( m_OSDStartAddr + 32 );
  1035. m_VideoProp.m_OSDSwitch = Video_OSD_On;
  1036. }
  1037. if (*pValue == Video_OSD_Off && m_VideoProp.m_OSDSwitch == Video_OSD_On)
  1038. {
  1039. ziva.OSD_EVEN_FIELD.Set( 0 );
  1040. ziva.OSD_ODD_FIELD.Set( 0 );
  1041. m_VideoProp.m_OSDSwitch = Video_OSD_Off;
  1042. }
  1043. };
  1044. return TRUE;
  1045. };
  1046. // by oka
  1047. BOOL CMPEGBoardHAL::SetVideoProperty_Magnify( PVOID pData )
  1048. {
  1049. VideoMagnifyStruc *pValue = (VideoMagnifyStruc *)pData;
  1050. POWERSTATE PowerState;
  1051. GetPowerState( &PowerState );
  1052. if( PowerState == POWERSTATE_ON )
  1053. {
  1054. ziva.Magnify(pValue->dwX, pValue->dwY, pValue->dwFactor);
  1055. };
  1056. return TRUE;
  1057. };
  1058. // by oka
  1059. BOOL CMPEGBoardHAL::SetVideoProperty_ClosedCaptionData( PVOID pData )
  1060. {
  1061. return FALSE;
  1062. }
  1063. //***************************************************************************
  1064. // Video Property Functions( Get Series )
  1065. //***************************************************************************
  1066. BOOL CMPEGBoardHAL::GetVideoProperty_TVSystem( PVOID pData )
  1067. {
  1068. VideoProperty_TVSystem_Value *pValue = (VideoProperty_TVSystem_Value *)pData;
  1069. *pValue = m_VideoProp.m_TVSystem;
  1070. return TRUE;
  1071. };
  1072. BOOL CMPEGBoardHAL::GetVideoProperty_AspectRatio( PVOID pData )
  1073. {
  1074. VideoProperty_AspectRatio_Value *pValue = (VideoProperty_AspectRatio_Value *)pData;
  1075. POWERSTATE PowerState;
  1076. GetPowerState( &PowerState );
  1077. if( PowerState == POWERSTATE_ON )
  1078. {
  1079. switch( (DWORD)ziva.DISPLAY_ASPECT_RATIO )
  1080. {
  1081. case 0x00:
  1082. *pValue = Aspect_04_03;
  1083. break;
  1084. case 0x01:
  1085. *pValue = Aspect_16_09;
  1086. break;
  1087. default:
  1088. DBG_BREAK();
  1089. return FALSE;
  1090. };
  1091. m_VideoProp.m_AspectRatio = *pValue;
  1092. return TRUE;
  1093. };
  1094. *pValue = m_VideoProp.m_AspectRatio;
  1095. return TRUE;
  1096. };
  1097. BOOL CMPEGBoardHAL::GetVideoProperty_DisplayMode( PVOID pData )
  1098. {
  1099. VideoProperty_DisplayMode_Value *pValue = (VideoProperty_DisplayMode_Value *)pData;
  1100. POWERSTATE PowerState;
  1101. GetPowerState( &PowerState );
  1102. if( PowerState == POWERSTATE_ON )
  1103. {
  1104. switch( (DWORD)ziva.ASPECT_RATIO_MODE )
  1105. {
  1106. case 0x00: *pValue = Display_Original; break;
  1107. case 0x01: *pValue = Display_PanScan; break;
  1108. case 0x02: *pValue = Display_LetterBox; break;
  1109. default:
  1110. DBG_BREAK();
  1111. return FALSE;
  1112. };
  1113. m_VideoProp.m_DisplayMode = *pValue;
  1114. return TRUE;
  1115. };
  1116. *pValue = m_VideoProp.m_DisplayMode;
  1117. return TRUE;
  1118. };
  1119. BOOL CMPEGBoardHAL::GetVideoProperty_Resolution( PVOID pData )
  1120. {
  1121. VideoSizeStruc *pValue = (VideoSizeStruc *)pData;
  1122. m_VideoProp.m_Size = *pValue;
  1123. return TRUE;
  1124. };
  1125. BOOL CMPEGBoardHAL::GetVideoProperty_DigitalOut( PVOID pData )
  1126. {
  1127. VideoProperty_DigitalOut_Value *pValue = (VideoProperty_DigitalOut_Value *)pData;
  1128. *pValue = m_VideoProp.m_DigitalOut;
  1129. return TRUE;
  1130. };
  1131. BOOL CMPEGBoardHAL::GetVideoProperty_DigitalPalette( PVOID pData )
  1132. {
  1133. Digital_Palette *pValue = (Digital_Palette *)pData;
  1134. BYTE CpCtl;
  1135. switch( pValue->Select )
  1136. {
  1137. case Video_Palette_Y: CpCtl = 0x05; break;
  1138. case Video_Palette_Cb: CpCtl = 0x06; break;
  1139. case Video_Palette_Cr: CpCtl = 0x07; break;
  1140. default:
  1141. DBG_BREAK();
  1142. return FALSE;
  1143. };
  1144. POWERSTATE PowerState;
  1145. GetPowerState( &PowerState );
  1146. if( PowerState == POWERSTATE_ON )
  1147. {
  1148. // Select Palette and Clear Counter.
  1149. ioif.luke2.IO_CPCNT = CpCtl;
  1150. for ( int i = 0 ; i < 256; i ++ )
  1151. {
  1152. // Get Palette value
  1153. pValue->pPalette[i] = ioif.luke2.IO_CPLT;
  1154. m_VideoProp.m_DigitalPalette[ pValue->Select ][i] = pValue->pPalette[i];
  1155. };
  1156. return TRUE;
  1157. };
  1158. for ( int i = 0 ; i < 256; i ++ )
  1159. pValue->pPalette[i] = m_VideoProp.m_DigitalPalette[ pValue->Select ][i];
  1160. return TRUE;
  1161. };
  1162. BOOL CMPEGBoardHAL::GetVideoProperty_APS( PVOID pData )
  1163. {
  1164. VideoAPSStruc *pValue = (VideoAPSStruc *)pData;
  1165. *pValue = m_VideoProp.m_APS;
  1166. return TRUE;
  1167. };
  1168. BOOL CMPEGBoardHAL::GetVideoProperty_ClosedCaption( PVOID pData )
  1169. {
  1170. VideoProperty_ClosedCaption_Value *pValue = (VideoProperty_ClosedCaption_Value *)pData;
  1171. *pValue = m_VideoProp.m_ClosedCaption;
  1172. return TRUE;
  1173. };
  1174. BOOL CMPEGBoardHAL::GetVideoProperty_OutputSource( PVOID pData )
  1175. {
  1176. VideoProperty_OutputSource_Value *pValue = (VideoProperty_OutputSource_Value *)pData;
  1177. *pValue = m_VideoProp.m_OutputSource;
  1178. return TRUE;
  1179. };
  1180. BOOL CMPEGBoardHAL::GetVideoProperty_CompositeOut( PVOID pData )
  1181. {
  1182. VideoProperty_CompositeOut_Value *pValue = (VideoProperty_CompositeOut_Value *)pData;
  1183. *pValue = m_VideoProp.m_CompositeOut;
  1184. return TRUE;
  1185. };
  1186. BOOL CMPEGBoardHAL::GetVideoProperty_SVideoOut( PVOID pData )
  1187. {
  1188. VideoProperty_SVideoOut_Value *pValue = (VideoProperty_SVideoOut_Value *)pData;
  1189. *pValue = m_VideoProp.m_SVideoOut;
  1190. return TRUE;
  1191. };
  1192. BOOL CMPEGBoardHAL::GetVideoProperty_SkipFieldControl( PVOID pData )
  1193. {
  1194. VideoProperty_SkipFieldControl_Value *pValue = (VideoProperty_SkipFieldControl_Value *)pData;
  1195. *pValue = m_VideoProp.m_SkipFieldControl;
  1196. return TRUE;
  1197. };
  1198. BOOL CMPEGBoardHAL::GetVideoProperty_FilmCamera( PVOID pData )
  1199. {
  1200. VideoProperty_FilmCamera_Value *pValue = (VideoProperty_FilmCamera_Value *)pData;
  1201. *pValue = m_VideoProp.m_FilmCamera;
  1202. return TRUE;
  1203. };
  1204. // by oka
  1205. BOOL CMPEGBoardHAL::GetVideoProperty_Digest( PVOID pData )
  1206. {
  1207. return FALSE;
  1208. }
  1209. // by oka
  1210. BOOL CMPEGBoardHAL::GetVideoProperty_OSDData( PVOID pData )
  1211. {
  1212. return FALSE;
  1213. }
  1214. // by oka
  1215. BOOL CMPEGBoardHAL::GetVideoProperty_OSDSwitch( PVOID pData )
  1216. {
  1217. VideoProperty_OSD_Switch_Value *pValue = (VideoProperty_OSD_Switch_Value *)pData;
  1218. *pValue = m_VideoProp.m_OSDSwitch;
  1219. return TRUE;
  1220. }
  1221. // by oka
  1222. BOOL CMPEGBoardHAL::GetVideoProperty_Magnify( PVOID pData )
  1223. {
  1224. return FALSE;
  1225. }
  1226. // by oka
  1227. BOOL CMPEGBoardHAL::GetVideoProperty_ClosedCaptionData( PVOID pData )
  1228. {
  1229. return FALSE;
  1230. }
  1231. //***************************************************************************
  1232. // Audio property private functions( Set series )
  1233. //***************************************************************************
  1234. BOOL CMPEGBoardHAL::SetAudioProperty_Type( PVOID pData )
  1235. {
  1236. AudioProperty_Type_Value *pValue = (AudioProperty_Type_Value *)pData;
  1237. POWERSTATE PowerState;
  1238. GetPowerState( &PowerState );
  1239. if( PowerState == POWERSTATE_ON )
  1240. {
  1241. switch( *pValue )
  1242. {
  1243. case AudioType_AC3:
  1244. ziva.SelectStream( 2, m_AudioProp.m_StreamNo );
  1245. break;
  1246. case AudioType_PCM:
  1247. ziva.SelectStream( 4, m_AudioProp.m_StreamNo );
  1248. break;
  1249. case AudioType_MPEG1:
  1250. ziva.SelectStream( 3, m_AudioProp.m_StreamNo );
  1251. break;
  1252. case AudioType_MPEG2:
  1253. ziva.SelectStream( 3, m_AudioProp.m_StreamNo );
  1254. break;
  1255. default:
  1256. DBG_BREAK();
  1257. return FALSE;
  1258. };
  1259. DWORD Quant;
  1260. GetAudioProperty_Quant( (PVOID)&Quant );
  1261. SetAudioProperty_Quant( (PVOID)&Quant );
  1262. };
  1263. m_AudioProp.m_Type = *pValue;
  1264. return TRUE;
  1265. };
  1266. BOOL CMPEGBoardHAL::SetAudioProperty_Number( PVOID pData )
  1267. {
  1268. DWORD *pValue = (DWORD *)pData;
  1269. ASSERT( *pValue <= 7 );
  1270. POWERSTATE PowerState;
  1271. GetPowerState( &PowerState );
  1272. if( PowerState == POWERSTATE_ON )
  1273. {
  1274. switch( m_AudioProp.m_Type )
  1275. {
  1276. case AudioType_AC3:
  1277. ziva.SelectStream( 2, *pValue );
  1278. break;
  1279. case AudioType_PCM:
  1280. ziva.SelectStream( 4, *pValue );
  1281. break;
  1282. case AudioType_MPEG1:
  1283. ziva.SelectStream( 3, *pValue );
  1284. break;
  1285. case AudioType_MPEG2:
  1286. ziva.SelectStream( 3, *pValue );
  1287. break;
  1288. default:
  1289. DBG_BREAK();
  1290. return FALSE;
  1291. };
  1292. };
  1293. m_AudioProp.m_StreamNo = *pValue;
  1294. return TRUE;
  1295. };
  1296. BOOL CMPEGBoardHAL::SetAudioProperty_Volume( PVOID pData )
  1297. {
  1298. DWORD *pValue = (DWORD *)pData;
  1299. ASSERT( *pValue <= 100 );
  1300. POWERSTATE PowerState;
  1301. GetPowerState( &PowerState );
  1302. if( PowerState == POWERSTATE_ON )
  1303. ziva.AUDIO_ATTENUATION = (9600 - (*pValue) * 96) /100;
  1304. m_AudioProp.m_Volume = *pValue;
  1305. return TRUE;
  1306. };
  1307. BOOL CMPEGBoardHAL::SetAudioProperty_Sampling( PVOID pData )
  1308. {
  1309. DWORD *pValue = (DWORD *)pData;
  1310. POWERSTATE PowerState;
  1311. GetPowerState( &PowerState );
  1312. if( PowerState == POWERSTATE_ON )
  1313. {
  1314. switch( *pValue )
  1315. {
  1316. case 32000: /* ziva.NEW_AUDIO_MODE = 0x7;*/ break; // 32 kHz
  1317. case 96000: /* ziva.NEW_AUDIO_MODE = 0x3;*/ break; // 96 kHz
  1318. case 48000: /* ziva.NEW_AUDIO_MODE = 0x2;*/ break; // 48 kHz
  1319. case 44100: /* ziva.NEW_AUDIO_MODE = 0x1;*/ break; // 44.1 kHz
  1320. default:
  1321. DBG_BREAK();
  1322. return FALSE;
  1323. };
  1324. };
  1325. m_AudioProp.m_Sampling = *pValue;
  1326. return TRUE;
  1327. };
  1328. BOOL CMPEGBoardHAL::SetAudioProperty_Channel( PVOID pData )
  1329. {
  1330. DWORD *pValue = (DWORD *)pData;
  1331. ASSERT( 1 <= *pValue && *pValue <= 8 );
  1332. // ZiVA -DS chip has 2 chanel.
  1333. if( *pValue != 2 )
  1334. {
  1335. DBG_BREAK();
  1336. return FALSE;
  1337. };
  1338. m_AudioProp.m_ChannelNo = *pValue;
  1339. return TRUE;
  1340. };
  1341. BOOL CMPEGBoardHAL::SetAudioProperty_Quant( PVOID pData )
  1342. {
  1343. DWORD *pValue = (DWORD *)pData;
  1344. POWERSTATE PowerState;
  1345. GetPowerState( &PowerState );
  1346. if( PowerState == POWERSTATE_ON )
  1347. {
  1348. ioif.luke2.IO_CONT = (ioif.luke2.IO_CONT & 0xfffff8) | 0x72000000;
  1349. };
  1350. m_AudioProp.m_Quant = *pValue;
  1351. return TRUE;
  1352. };
  1353. BOOL CMPEGBoardHAL::SetAudioProperty_AudioOut( PVOID pData )
  1354. {
  1355. AudioProperty_AudioOut_Value *pValue = (AudioProperty_AudioOut_Value *)pData;
  1356. POWERSTATE PowerState;
  1357. GetPowerState( &PowerState );
  1358. if( *pValue != AudioOut_Encoded && *pValue != AudioOut_Decoded )
  1359. {
  1360. DBG_BREAK();
  1361. return FALSE;
  1362. };
  1363. if( PowerState == POWERSTATE_ON )
  1364. {
  1365. if( ( ziva.AUDIO_CONFIG & 0x02 ) != 0 )
  1366. {
  1367. switch( *pValue )
  1368. {
  1369. case AudioOut_Encoded:
  1370. ziva.AUDIO_CONFIG &= 0xfffffffe;
  1371. break;
  1372. case AudioOut_Decoded:
  1373. ziva.AUDIO_CONFIG |= 0x01;
  1374. break;
  1375. default:
  1376. DBG_BREAK();
  1377. return FALSE;
  1378. };
  1379. CTimeOut TimeOut( 1000, 1, m_pKernelObj ); // wait 1s, sleep 1ms
  1380. ziva.NEW_AUDIO_CONFIG = 0x01;
  1381. while( TRUE )
  1382. {
  1383. if( 0 == ziva.NEW_AUDIO_CONFIG )
  1384. break;
  1385. TimeOut.Sleep();
  1386. if( TimeOut.CheckTimeOut()==TRUE )
  1387. {
  1388. DBG_BREAK();
  1389. return FALSE;
  1390. };
  1391. }
  1392. }
  1393. else // ziva micro code bug.
  1394. {
  1395. if( *pValue == AudioOut_Encoded )
  1396. {
  1397. ziva.AUDIO_CONFIG = (ziva.AUDIO_CONFIG & 0xfffffffc) | 0x02;
  1398. CTimeOut TimeOut( 1000, 1, m_pKernelObj ); // wait 1s, sleep 1ms
  1399. ziva.NEW_AUDIO_CONFIG = 0x01;
  1400. while( TRUE )
  1401. {
  1402. if( 0 == ziva.NEW_AUDIO_CONFIG )
  1403. break;
  1404. TimeOut.Sleep();
  1405. if( TimeOut.CheckTimeOut()==TRUE )
  1406. {
  1407. DBG_BREAK();
  1408. return FALSE;
  1409. };
  1410. }
  1411. ziva.AUDIO_CONFIG = (ziva.AUDIO_CONFIG & 0xfffffffc) | 0x00;
  1412. CTimeOut TimeOut2( 1000, 1, m_pKernelObj ); // wait 1s, sleep 1ms
  1413. ziva.NEW_AUDIO_CONFIG = 0x01;
  1414. while( TRUE )
  1415. {
  1416. if( 0 == ziva.NEW_AUDIO_CONFIG )
  1417. break;
  1418. TimeOut2.Sleep();
  1419. if( TimeOut2.CheckTimeOut()==TRUE )
  1420. {
  1421. DBG_BREAK();
  1422. return FALSE;
  1423. };
  1424. }
  1425. };
  1426. if( *pValue == AudioOut_Decoded )
  1427. {
  1428. ziva.AUDIO_CONFIG = (ziva.AUDIO_CONFIG & 0xfffffffc) | 0x03;
  1429. CTimeOut TimeOut( 1000, 1, m_pKernelObj ); // wait 1s, sleep 1ms
  1430. ziva.NEW_AUDIO_CONFIG = 0x01;
  1431. while( TRUE )
  1432. {
  1433. if( 0 == ziva.NEW_AUDIO_CONFIG )
  1434. break;
  1435. TimeOut.Sleep();
  1436. if( TimeOut.CheckTimeOut()==TRUE )
  1437. {
  1438. DBG_BREAK();
  1439. return FALSE;
  1440. };
  1441. }
  1442. ziva.AUDIO_CONFIG = (ziva.AUDIO_CONFIG & 0xfffffffc) | 0x01;
  1443. CTimeOut TimeOut2( 1000, 1, m_pKernelObj ); // wait 1s, sleep 1ms
  1444. ziva.NEW_AUDIO_CONFIG = 0x01;
  1445. while( TRUE )
  1446. {
  1447. if( 0 == ziva.NEW_AUDIO_CONFIG )
  1448. break;
  1449. TimeOut2.Sleep();
  1450. if( TimeOut2.CheckTimeOut()==TRUE )
  1451. {
  1452. DBG_BREAK();
  1453. return FALSE;
  1454. };
  1455. }
  1456. };
  1457. };
  1458. };
  1459. m_AudioProp.m_OutType = *pValue;
  1460. return TRUE;
  1461. };
  1462. BOOL CMPEGBoardHAL::SetAudioProperty_Cgms( PVOID pData )
  1463. {
  1464. AudioProperty_Cgms_Value *pValue = (AudioProperty_Cgms_Value *)pData;
  1465. POWERSTATE PowerState;
  1466. GetPowerState( &PowerState );
  1467. if( PowerState == POWERSTATE_ON )
  1468. {
  1469. switch( *pValue )
  1470. {
  1471. case AudioCgms_Off:
  1472. ziva.IEC_958_CHANNEL_STATUS_BITS = ( ziva.IEC_958_CHANNEL_STATUS_BITS & 0xfffffffc ) | 0x01;
  1473. break;
  1474. case AudioCgms_1:
  1475. ziva.IEC_958_CHANNEL_STATUS_BITS = ( ziva.IEC_958_CHANNEL_STATUS_BITS & 0xfffffffc ) | 0x00;
  1476. break;
  1477. case AudioCgms_On:
  1478. ziva.IEC_958_CHANNEL_STATUS_BITS = ( ziva.IEC_958_CHANNEL_STATUS_BITS & 0xfffffffc ) | 0x02;
  1479. break;
  1480. default:
  1481. DBG_BREAK();
  1482. return FALSE;
  1483. };
  1484. CTimeOut TimeOut( 1000, 1, m_pKernelObj ); // wait 1s, sleep 1ms
  1485. ziva.NEW_AUDIO_CONFIG = 0x01;
  1486. while( TRUE )
  1487. {
  1488. if( 0 == ziva.NEW_AUDIO_CONFIG )
  1489. break;
  1490. TimeOut.Sleep();
  1491. if( TimeOut.CheckTimeOut()==TRUE )
  1492. {
  1493. DBG_BREAK();
  1494. return FALSE;
  1495. };
  1496. }
  1497. };
  1498. m_AudioProp.m_Cgms = *pValue;
  1499. return TRUE;
  1500. };
  1501. BOOL CMPEGBoardHAL::SetAudioProperty_AnalogOut( PVOID pData )
  1502. {
  1503. AudioProperty_AnalogOut_Value *pValue = (AudioProperty_AnalogOut_Value *)pData;
  1504. m_AudioProp.m_AnalogOut = *pValue;
  1505. return TRUE;
  1506. };
  1507. BOOL CMPEGBoardHAL::SetAudioProperty_DigitalOut( PVOID pData )
  1508. {
  1509. AudioProperty_DigitalOut_Value *pValue = (AudioProperty_DigitalOut_Value *)pData;
  1510. POWERSTATE PowerState;
  1511. GetPowerState( &PowerState );
  1512. if( PowerState == POWERSTATE_ON )
  1513. {
  1514. switch( *pValue )
  1515. {
  1516. case AudioDigitalOut_On:
  1517. ziva.AUDIO_CONFIG = ziva.AUDIO_CONFIG | 0x02; // IEC_958 on
  1518. ioif.luke2.IO_CONT = (( ioif.luke2.IO_CONT & 0xfffffff8 ) | 0x40 ); // optical out on only for SanJose
  1519. break;
  1520. case AudioDigitalOut_Off:
  1521. ziva.AUDIO_CONFIG = ziva.AUDIO_CONFIG & 0xfffffffd; // IEC_958 off
  1522. ioif.luke2.IO_CONT = (( ioif.luke2.IO_CONT & 0xfffffff8 ) &
  1523. 0xffffffbf); // optical out off only for SanJose
  1524. break;
  1525. default:
  1526. return FALSE;
  1527. };
  1528. CTimeOut TimeOut( 1000, 1, m_pKernelObj ); // wait 1s, sleep 1ms
  1529. ziva.NEW_AUDIO_CONFIG = 0x01;
  1530. while( TRUE )
  1531. {
  1532. if( 0 == ziva.NEW_AUDIO_CONFIG )
  1533. break;
  1534. TimeOut.Sleep();
  1535. if( TimeOut.CheckTimeOut()==TRUE )
  1536. {
  1537. DBG_BREAK();
  1538. return FALSE;
  1539. };
  1540. }
  1541. };
  1542. m_AudioProp.m_DigitalOut = *pValue;
  1543. return TRUE;
  1544. };
  1545. BOOL CMPEGBoardHAL::SetAudioProperty_AC3DRangeLowBoost( PVOID pData )
  1546. {
  1547. DWORD *pValue = (DWORD *)pData;
  1548. if( *pValue > 128 )
  1549. return FALSE;
  1550. POWERSTATE PowerState;
  1551. GetPowerState( &PowerState );
  1552. if( PowerState == POWERSTATE_ON )
  1553. ziva.AC3_LOW_BOOST = *pValue;
  1554. m_AudioProp.m_AC3DRangeLowBoost = *pValue;
  1555. return TRUE;
  1556. };
  1557. BOOL CMPEGBoardHAL::SetAudioProperty_AC3DRangeHighCut( PVOID pData )
  1558. {
  1559. DWORD *pValue = (DWORD *)pData;
  1560. if( *pValue > 128 )
  1561. return FALSE;
  1562. POWERSTATE PowerState;
  1563. GetPowerState( &PowerState );
  1564. if( PowerState == POWERSTATE_ON )
  1565. ziva.AC3_HIGH_CUT = *pValue;
  1566. m_AudioProp.m_AC3DRangeHighCut = *pValue;
  1567. return TRUE;
  1568. };
  1569. BOOL CMPEGBoardHAL::SetAudioProperty_AC3OperateMode( PVOID pData )
  1570. {
  1571. AudioProperty_AC3OperateMode_Value *pValue = (AudioProperty_AC3OperateMode_Value *)pData;
  1572. POWERSTATE PowerState;
  1573. GetPowerState( &PowerState );
  1574. if( PowerState == POWERSTATE_ON )
  1575. {
  1576. switch( *pValue )
  1577. {
  1578. case AC3OperateLine: ziva.AC3_OPERATIONAL_MODE = 0; break;
  1579. case AC3OperateRF: ziva.AC3_OPERATIONAL_MODE = 1; break;
  1580. case AC3OperateCustom0: ziva.AC3_OPERATIONAL_MODE = 2; break;
  1581. case AC3OperateCustom1: ziva.AC3_OPERATIONAL_MODE = 3; break;
  1582. default:
  1583. return FALSE;
  1584. };
  1585. };
  1586. m_AudioProp.m_AC3OperateMode = *pValue;
  1587. return TRUE;
  1588. };
  1589. BOOL CMPEGBoardHAL::SetAudioProperty_AC3OutputMode( PVOID pData )
  1590. {
  1591. AudioProperty_AC3OutputMode_Value *pValue = (AudioProperty_AC3OutputMode_Value *)pData;
  1592. POWERSTATE PowerState;
  1593. GetPowerState( &PowerState );
  1594. if( PowerState == POWERSTATE_ON )
  1595. {
  1596. switch( *pValue )
  1597. {
  1598. case AC3Output_Default: ziva.AC3_OUTPUT_MODE = 0; break;
  1599. case AC3Output_Karaoke: ziva.AC3_OUTPUT_MODE = 2; break;
  1600. case AC3Output_Surround: ziva.AC3_OUTPUT_MODE = 0; break;
  1601. default:
  1602. return FALSE;
  1603. };
  1604. };
  1605. m_AudioProp.m_AC3OutputMode = *pValue;
  1606. return TRUE;
  1607. };
  1608. //***************************************************************************
  1609. // Audio property private functions( Get series )
  1610. //***************************************************************************
  1611. BOOL CMPEGBoardHAL::GetAudioProperty_Type( PVOID pData )
  1612. {
  1613. AudioProperty_Type_Value *pValue = (AudioProperty_Type_Value *)pData;
  1614. *pValue = m_AudioProp.m_Type;
  1615. return TRUE;
  1616. };
  1617. BOOL CMPEGBoardHAL::GetAudioProperty_Number( PVOID pData )
  1618. {
  1619. DWORD *pValue = (DWORD *)pData;
  1620. *pValue = m_AudioProp.m_StreamNo;
  1621. return TRUE;
  1622. };
  1623. BOOL CMPEGBoardHAL::GetAudioProperty_Volume( PVOID pData )
  1624. {
  1625. DWORD *pValue = (DWORD *)pData;
  1626. *pValue = m_AudioProp.m_Volume;
  1627. return TRUE;
  1628. };
  1629. BOOL CMPEGBoardHAL::GetAudioProperty_Sampling( PVOID pData )
  1630. {
  1631. DWORD *pValue = (DWORD *)pData;
  1632. *pValue = m_AudioProp.m_Sampling;
  1633. return TRUE;
  1634. };
  1635. BOOL CMPEGBoardHAL::GetAudioProperty_Channel( PVOID pData )
  1636. {
  1637. DWORD *pValue = (DWORD *)pData;
  1638. *pValue = m_AudioProp.m_ChannelNo;
  1639. return TRUE;
  1640. };
  1641. BOOL CMPEGBoardHAL::GetAudioProperty_Quant( PVOID pData )
  1642. {
  1643. DWORD *pValue = (DWORD *)pData;
  1644. *pValue = m_AudioProp.m_Quant;
  1645. return TRUE;
  1646. };
  1647. BOOL CMPEGBoardHAL::GetAudioProperty_AudioOut( PVOID pData )
  1648. {
  1649. AudioProperty_AudioOut_Value *pValue = (AudioProperty_AudioOut_Value *)pData;
  1650. *pValue = m_AudioProp.m_OutType;
  1651. return TRUE;
  1652. };
  1653. BOOL CMPEGBoardHAL::GetAudioProperty_Cgms( PVOID pData )
  1654. {
  1655. AudioProperty_Cgms_Value *pValue = (AudioProperty_Cgms_Value *)pData;
  1656. *pValue = m_AudioProp.m_Cgms;
  1657. return TRUE;
  1658. };
  1659. BOOL CMPEGBoardHAL::GetAudioProperty_AnalogOut( PVOID pData )
  1660. {
  1661. AudioProperty_AnalogOut_Value *pValue = (AudioProperty_AnalogOut_Value *)pData;
  1662. *pValue = m_AudioProp.m_AnalogOut;
  1663. return TRUE;
  1664. };
  1665. BOOL CMPEGBoardHAL::GetAudioProperty_DigitalOut( PVOID pData )
  1666. {
  1667. AudioProperty_DigitalOut_Value *pValue = (AudioProperty_DigitalOut_Value *)pData;
  1668. *pValue = m_AudioProp.m_DigitalOut;
  1669. return TRUE;
  1670. };
  1671. BOOL CMPEGBoardHAL::GetAudioProperty_AC3DRangeLowBoost( PVOID pData )
  1672. {
  1673. DWORD *pValue = (DWORD *)pData;
  1674. *pValue = m_AudioProp.m_AC3DRangeLowBoost;
  1675. return TRUE;
  1676. };
  1677. BOOL CMPEGBoardHAL::GetAudioProperty_AC3DRangeHighCut( PVOID pData )
  1678. {
  1679. DWORD *pValue = (DWORD *)pData;
  1680. *pValue = m_AudioProp.m_AC3DRangeHighCut;
  1681. return TRUE;
  1682. };
  1683. BOOL CMPEGBoardHAL::GetAudioProperty_AC3OperateMode( PVOID pData )
  1684. {
  1685. AudioProperty_AC3OperateMode_Value *pValue = (AudioProperty_AC3OperateMode_Value *)pData;
  1686. *pValue = m_AudioProp.m_AC3OperateMode;
  1687. return TRUE;
  1688. };
  1689. BOOL CMPEGBoardHAL::GetAudioProperty_AC3OutputMode( PVOID pData )
  1690. {
  1691. AudioProperty_AC3OutputMode_Value *pValue = (AudioProperty_AC3OutputMode_Value *)pData;
  1692. *pValue = m_AudioProp.m_AC3OutputMode;
  1693. return TRUE;
  1694. };
  1695. //***************************************************************************
  1696. // Subpic property private functions( Set series )
  1697. //***************************************************************************
  1698. BOOL CMPEGBoardHAL::SetSubpicProperty_Number( PVOID pData )
  1699. {
  1700. DWORD *pValue = (DWORD *)pData;
  1701. ASSERT( *pValue <= 31 );
  1702. POWERSTATE PowerState;
  1703. GetPowerState( &PowerState );
  1704. if( PowerState == POWERSTATE_ON )
  1705. ziva.SelectStream( 1, *pValue );
  1706. m_SubpicProp.m_StreamNo = *pValue;
  1707. return TRUE;
  1708. };
  1709. BOOL CMPEGBoardHAL::SetSubpicProperty_Palette( PVOID pData )
  1710. {
  1711. UCHAR *pValue = (UCHAR *)pData;
  1712. DWORD Addr,Data;
  1713. int i;
  1714. POWERSTATE PowerState;
  1715. GetPowerState( &PowerState );
  1716. if( PowerState == POWERSTATE_ON )
  1717. {
  1718. Addr = ziva.SUB_PICTURE_PALETTE_START;
  1719. for( i = 0 ; i < 16 ; i ++ )
  1720. {
  1721. Data = (DWORD)(pValue[i*3]) * 0x10000 + (DWORD)(pValue[i*3 +1]) * 0x100 + (DWORD)(pValue[i*3 +2]);
  1722. ziva.ZiVAWriteMemory( Addr + i*4, Data );
  1723. };
  1724. ziva.NEW_SUBPICTURE_PALETTE = 0x01;
  1725. };
  1726. for( i = 0 ; i < sizeof( m_SubpicProp.m_Palette ) ; i ++ )
  1727. m_SubpicProp.m_Palette[ i ] = pValue[ i ];
  1728. return TRUE;
  1729. };
  1730. BOOL CMPEGBoardHAL::SetSubpicProperty_Hilight( PVOID pData )
  1731. {
  1732. SubpHlightStruc *pValue = (SubpHlightStruc *)pData;
  1733. POWERSTATE PowerState;
  1734. GetPowerState( &PowerState );
  1735. if( PowerState == POWERSTATE_ON )
  1736. {
  1737. switch( pValue->Hlight_Switch )
  1738. {
  1739. case Hlight_On:
  1740. // m_pKernelObj->Sleep( 40 ); // wait 40msec
  1741. ziva.HighLight2( pValue->Hlight_Contrast, pValue->Hlight_Color,
  1742. ( pValue->Hlight_StartY << 12 ) | pValue->Hlight_EndY,
  1743. ( pValue->Hlight_StartX << 12 ) | pValue->Hlight_EndX );
  1744. break;
  1745. case Hlight_Off:
  1746. ziva.HighLight2( 0, 0, 0, 0 );
  1747. break;
  1748. default:
  1749. DBG_BREAK();
  1750. return FALSE;
  1751. };
  1752. };
  1753. m_SubpicProp.m_Hlight = *pValue;
  1754. return TRUE;
  1755. };
  1756. BOOL CMPEGBoardHAL::SetSubpicProperty_State( PVOID pData )
  1757. {
  1758. SubpicProperty_State_Value *pValue = (SubpicProperty_State_Value *)pData;
  1759. POWERSTATE PowerState;
  1760. GetPowerState( &PowerState );
  1761. if( PowerState == POWERSTATE_ON )
  1762. {
  1763. switch( *pValue )
  1764. {
  1765. case Subpic_On:
  1766. ziva.SUBPICTURE_ENABLE = 0x01;
  1767. break;
  1768. case Subpic_Off:
  1769. ziva.SUBPICTURE_ENABLE = 0x00;
  1770. break;
  1771. default:
  1772. DBG_BREAK();
  1773. return FALSE;
  1774. };
  1775. };
  1776. m_SubpicProp.m_OutType = *pValue;
  1777. return TRUE;
  1778. };
  1779. // by oka
  1780. BOOL CMPEGBoardHAL::SetSubpicProperty_HilightButton( PVOID pData )
  1781. {
  1782. DWORD ret = ZIVARESULT_NOERROR;
  1783. SubpHlightButtonStruc *pValue = (SubpHlightButtonStruc *)pData;
  1784. POWERSTATE PowerState;
  1785. GetPowerState( &PowerState );
  1786. if( PowerState == POWERSTATE_ON )
  1787. {
  1788. ret = ziva.HighLight( pValue->Hlight_Button,
  1789. pValue->Hlight_Action );
  1790. };
  1791. m_SubpicProp.m_HlightButton = *pValue;
  1792. if (ret == ZIVARESULT_NOERROR)
  1793. return TRUE;
  1794. else
  1795. return FALSE;
  1796. };
  1797. BOOL CMPEGBoardHAL::SetSubpicProperty_FlushBuff( PVOID pData )
  1798. {
  1799. DWORD dwValue = m_SubpicProp.m_StreamNo;
  1800. POWERSTATE PowerState;
  1801. GetPowerState( &PowerState );
  1802. if( PowerState == POWERSTATE_ON ){
  1803. ziva.SelectStream( 1, 0xffff ); // 0xffff : discard
  1804. ziva.SelectStream( 1, dwValue );
  1805. }
  1806. return TRUE;
  1807. };
  1808. //***************************************************************************
  1809. // Subpic property private functions( Get series )
  1810. //***************************************************************************
  1811. BOOL CMPEGBoardHAL::GetSubpicProperty_Number( PVOID pData )
  1812. {
  1813. DWORD *pValue = (DWORD *)pData;
  1814. *pValue = m_SubpicProp.m_StreamNo;
  1815. return TRUE;
  1816. };
  1817. BOOL CMPEGBoardHAL::GetSubpicProperty_Palette( PVOID pData )
  1818. {
  1819. UCHAR *pValue = (UCHAR *)pData;
  1820. for( int i = 0 ; i < sizeof( m_SubpicProp.m_Palette ) ; i ++ )
  1821. pValue[ i ] = m_SubpicProp.m_Palette[ i ];
  1822. return TRUE;
  1823. };
  1824. BOOL CMPEGBoardHAL::GetSubpicProperty_Hilight( PVOID pData )
  1825. {
  1826. SubpHlightStruc *pValue = (SubpHlightStruc *)pData;
  1827. *pValue = m_SubpicProp.m_Hlight;
  1828. return TRUE;
  1829. };
  1830. BOOL CMPEGBoardHAL::GetSubpicProperty_State( PVOID pData )
  1831. {
  1832. SubpicProperty_State_Value *pValue = (SubpicProperty_State_Value *)pData;
  1833. *pValue = m_SubpicProp.m_OutType;
  1834. return TRUE;
  1835. };
  1836. // by oka
  1837. BOOL CMPEGBoardHAL::GetSubpicProperty_HilightButton( PVOID pData )
  1838. {
  1839. SubpHlightButtonStruc *pValue = (SubpHlightButtonStruc *)pData;
  1840. *pValue = m_SubpicProp.m_HlightButton;
  1841. return TRUE;
  1842. };
  1843. BOOL CMPEGBoardHAL::GetSubpicProperty_FlushBuff( PVOID pData )
  1844. {
  1845. DWORD *pValue = (DWORD *)pData;
  1846. *pValue = m_SubpicProp.m_StreamNo;
  1847. return TRUE;
  1848. };
  1849. //***************************************************************************
  1850. // End of
  1851. //***************************************************************************