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.

152 lines
3.8 KiB

  1. //***************************************************************************
  2. //
  3. // FileName:
  4. // $Workfile: mixhal.h $
  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/mixhal.h 15 98/06/23 3:13p Seichan $
  14. // $Modtime: 98/06/23 3:12p $
  15. // $Nokeywords:$
  16. //***************************************************************************
  17. #ifndef _MIXHAL_H_
  18. #define _MIXHAL_H_
  19. class CMPEGBoardHAL;
  20. #define ZIVA_QUEUE_SIZE (2)
  21. template<class T, class PT> class CHALFIFO
  22. {
  23. private:
  24. T m_datas[ ZIVA_QUEUE_SIZE ];
  25. DWORD m_DataNum;
  26. public:
  27. CHALFIFO( )
  28. {
  29. m_DataNum = 0;
  30. };
  31. BOOL AddItem( T No )
  32. {
  33. ASSERT( m_DataNum != ZIVA_QUEUE_SIZE );
  34. if( m_DataNum==ZIVA_QUEUE_SIZE )
  35. return FALSE;
  36. m_datas[ m_DataNum ] = No;
  37. m_DataNum ++;
  38. return TRUE;
  39. };
  40. BOOL GetItem( PT No )
  41. {
  42. ASSERT( m_DataNum != 0 );
  43. *No = m_datas[0];
  44. for( DWORD i = 0 ; i < m_DataNum -1; i ++ )
  45. m_datas[i] = m_datas[i+1];
  46. m_DataNum --;
  47. return TRUE;
  48. };
  49. void Flush( void )
  50. {
  51. m_DataNum = 0;
  52. };
  53. DWORD GetItemNum( void )
  54. {
  55. return m_DataNum;
  56. };
  57. DWORD GetMaxSize( void )
  58. {
  59. return ZIVA_QUEUE_SIZE;
  60. };
  61. };
  62. typedef CHALFIFO< DWORD, DWORD * > CDMAFIFO;
  63. typedef CHALFIFO< IHALBuffer *,IHALBuffer ** > CPAUSEFIFO;
  64. typedef enum
  65. {
  66. StreamStop = 0,
  67. StreamPlay,
  68. StreamScan,
  69. StreamPause,
  70. StreamSlow,
  71. StreamSingleStep
  72. } StreamState;
  73. typedef enum
  74. {
  75. CppState_OK = 0,
  76. CppState_Error
  77. } CppState;
  78. //***************************************************************************
  79. // MixHAL Stream control class
  80. //***************************************************************************
  81. class CMixHALStream: public IHALStreamControl
  82. {
  83. private:
  84. CZiVA *m_pZiVA;
  85. IKernelService *m_pKernelObj;
  86. CIOIF *m_pioif;
  87. IHALBuffer *pQueuedBuff[ZIVA_QUEUE_SIZE];
  88. CMPEGBoardHAL *m_pZiVABoard;
  89. BOOL fCanSendData; // queueing
  90. BOOL fCanDMA; // 98.02.17
  91. StreamState m_StreamState;
  92. CppState m_CppState; // Yagi 98.02.09
  93. private:
  94. BOOL ZiVACopyProtectStatusCheck( COPY_PROTECT_COMMAND Cmd );
  95. BOOL ZiVAStatusWait( DWORD Status );
  96. BOOL ZiVADVDMode( void );
  97. HALRESULT SendToDMA( IHALBuffer *pData );
  98. public:
  99. CMixHALStream( void );
  100. void Init( CZiVA *pZiVA , IKernelService *pKernelObj, CIOIF *pIOIF , CMPEGBoardHAL *pZiVABoard);
  101. IHALBuffer *DMAFinish( DWORD dwDMA_No );
  102. StreamState GetStreamState( void ){ return m_StreamState; };
  103. HALRESULT DeFifo( void );
  104. CDMAFIFO m_DmaFifo;
  105. CPAUSEFIFO m_HalFifo;
  106. //---------------------------------------
  107. // HAL Stream Control Interface
  108. //---------------------------------------
  109. HALRESULT SendData( IHALBuffer *pData );
  110. HALRESULT SetTransferMode( HALSTREAMMODE StreamMode );
  111. HALRESULT GetAvailableQueue( DWORD *pQueueNum );
  112. HALRESULT SetPlayNormal( void );
  113. HALRESULT SetPlaySlow( DWORD SlowFlag );
  114. HALRESULT SetPlayPause( void );
  115. HALRESULT SetPlayScan( DWORD ScanFlag );
  116. HALRESULT SetPlaySingleStep( void );
  117. HALRESULT SetPlayStop( void );
  118. HALRESULT CPPInit( void );
  119. HALRESULT GetDriveChallenge( UCHAR *pDriveChallenge );
  120. HALRESULT SetDriveResponse( UCHAR *pDriveResponse );
  121. HALRESULT SetDecoderChallenge( UCHAR *pDecoderChallenge );
  122. HALRESULT GetDecoderResponse( UCHAR *pDecoderResponse );
  123. HALRESULT SetDiskKey( UCHAR *pDiskKey );
  124. HALRESULT SetTitleKey( UCHAR *pTitleKey );
  125. HALRESULT SetDataDirection( DirectionType DataType );
  126. HALRESULT GetDataDirection( DirectionType *pDataType );
  127. };
  128. #endif // _MIXHAL_H_
  129. //***************************************************************************
  130. // End of
  131. //***************************************************************************