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.

261 lines
6.8 KiB

  1. // $Header: G:/SwDev/WDM/Video/bt848/rcs/Riscprog.h 1.9 1998/04/29 22:43:39 tomz Exp $
  2. #ifndef __RISCPROG_H
  3. #define __RISCPROG_H
  4. #ifndef __MYTYPES_H
  5. #include "mytypes.h"
  6. #endif
  7. #ifndef __VIDDEFS_H
  8. #include "viddefs.h"
  9. #endif
  10. #ifndef __COLSPACE_H
  11. #include "colspace.h"
  12. #endif
  13. #ifndef __PSPAGEBL_H
  14. #include "pspagebl.h"
  15. #endif
  16. #ifndef __COMMAND_H
  17. #include "command.h"
  18. #endif
  19. const Programs = 24;
  20. inline LONGLONG operator-( const LARGE_INTEGER &first, const LARGE_INTEGER &second )
  21. {
  22. return first.QuadPart - second.QuadPart;
  23. }
  24. inline bool operator>( const LARGE_INTEGER &first, const LARGE_INTEGER &second )
  25. {
  26. return bool( first.QuadPart > second.QuadPart );
  27. }
  28. inline bool operator>=( const LARGE_INTEGER &first, const LARGE_INTEGER &second )
  29. {
  30. return bool( first.QuadPart >= second.QuadPart );
  31. }
  32. /* Class: RISCProgram
  33. * Purpose: Facilitates creation and maintenance of a RISC programs
  34. * Attributes: ImageSize_: SIZE - structure containing dimentions of the image
  35. * dwBufPitch_: DWORD - buffer pitch
  36. * Field_: VideoField - which field the program is for
  37. * Interrupting_: bool
  38. * ProgramSpace_: PsPageBlock * - pointer to the class that manages the memory
  39. * occupied by a program ( allocates, deallocates, obtains information )
  40. * BufFormat_: ColorSpace - format of the data in the buffer
  41. * Operations:
  42. * void ChangeAddress( DWORD dwNewAddr )
  43. * void SetClipping( LPRECT pRect )
  44. * void Create( bool NeedInterrupt )
  45. * void SetChain( DWORD dwProgAddr )
  46. * DWORD GetProgAddress()
  47. * bool IsInterrupting()
  48. */
  49. class RISCProgram
  50. {
  51. public:
  52. PDWORD pChainAddress_;
  53. private:
  54. MSize ImageSize_;
  55. DWORD dwBufPitch_;
  56. bool Interrupting_;
  57. bool Counting_;
  58. PsPageBlock *ProgramSpace_;
  59. ColorSpace BufFormat_;
  60. RISCProgram *pChild_;
  61. RISCProgram *pParent_;
  62. PDWORD pIRQAddress_;
  63. DWORD dwBufAddr_;
  64. DWORD dwLinBufAddr_;
  65. bool Skipped_;
  66. bool GenerateResync_;
  67. BOOL bAlreadyDumped_;
  68. PVOID tag_;
  69. LARGE_INTEGER ExtraTag_;
  70. LARGE_INTEGER ExpectedExecutionTime_;
  71. DWORD dwPlanarAdjust_;
  72. DWORD dwSize_;
  73. protected:
  74. ErrorCode AllocateStorage( bool extra = false, int cnt = 1 );
  75. PDWORD CreatePrologEpilog( PDWORD pProgLoc, SyncCode SyncBits,
  76. Command &CurCommand, bool Resync = false );
  77. ErrorCode GetDataBufPhys( DataBuf &buf );
  78. void PutInChain();
  79. public:
  80. PHW_STREAM_REQUEST_BLOCK pSrb_;
  81. DWORD GetDataBuffer( );
  82. void SetDataBuffer( DWORD addr );
  83. void ChangeAddress( DataBuf &buf );
  84. ErrorCode Create( SyncCode SyncBits, bool resync = false );
  85. ErrorCode Create( bool NeedInterrupt, DataBuf buf, DWORD dwPlanAdjust,
  86. bool resync = false, bool Loop = true );
  87. void MakeFault() { *((PDWORD)GetProgAddress()) = (DWORD)-1; }
  88. DWORD GetProgAddress();
  89. void SetJump( PDWORD JumpAddr );
  90. // chaining/unchaining group
  91. RISCProgram *GetParent() { return pParent_; }
  92. RISCProgram *GetChild() { return pChild_; }
  93. void SetParent( RISCProgram *p ) { pParent_ = p; }
  94. void SetChild ( RISCProgram *p ) { pChild_ = p; }
  95. void CreateLoop( bool );
  96. void SetChain( RISCProgram *ChainTo );
  97. void Skip();
  98. void SetSkipped( bool sk = true );
  99. void SetToCount();
  100. void ResetStatus();
  101. void SetStatus( int val );
  102. void SetResync( bool val );
  103. bool IsSkipped();
  104. bool IsInterrupting();
  105. void SetTag( PVOID value );
  106. PVOID GetTag();
  107. void SetTagEx( LARGE_INTEGER val );
  108. LARGE_INTEGER GetTagEx();
  109. LARGE_INTEGER GetExecTime() { return ExpectedExecutionTime_; }
  110. // static RISCProgram CreateStarter();
  111. DWORD GetPhysProgAddr();
  112. void Dump();
  113. RISCProgram( MSize &size, DWORD pitch, ColFmt aColor );
  114. RISCProgram();
  115. ~RISCProgram();
  116. friend class RISCEng;
  117. };
  118. /* Method: RISCProgram::GetProgramAddress
  119. * Purpose: Obtains address of this program
  120. * Input: None
  121. * Output: DWORD: program's address
  122. */
  123. inline DWORD RISCProgram::GetProgAddress()
  124. {
  125. return ProgramSpace_->getLinearBase();
  126. }
  127. inline void RISCProgram::SetToCount()
  128. {
  129. Command IRQCommand;
  130. IRQCommand.SetToCount( pIRQAddress_ );
  131. Counting_ = true;
  132. }
  133. inline void RISCProgram::ResetStatus()
  134. {
  135. Command IRQCommand;
  136. IRQCommand.ResetStatus( pIRQAddress_, 0xF );
  137. Counting_ = false;
  138. }
  139. inline void RISCProgram::SetStatus( int val )
  140. {
  141. Command IRQCommand;
  142. IRQCommand.SetStatus( pIRQAddress_, val );
  143. }
  144. inline void RISCProgram::SetResync( bool val )
  145. {
  146. Command SyncCommand;
  147. SyncCommand.SetResync( (PVOID)GetProgAddress(), val );
  148. }
  149. inline void RISCProgram::SetSkipped( bool sk )
  150. {
  151. Skipped_ = sk;
  152. }
  153. inline bool RISCProgram::IsSkipped()
  154. {
  155. return Skipped_;
  156. }
  157. inline bool RISCProgram::IsInterrupting()
  158. {
  159. return Interrupting_;
  160. }
  161. inline void RISCProgram::SetTag( PVOID value )
  162. {
  163. tag_ = value;
  164. }
  165. inline PVOID RISCProgram::GetTag()
  166. {
  167. return tag_;
  168. }
  169. inline void RISCProgram::SetTagEx( LARGE_INTEGER val )
  170. {
  171. ExtraTag_ = val;
  172. }
  173. inline LARGE_INTEGER RISCProgram::GetTagEx()
  174. {
  175. return ExtraTag_;
  176. }
  177. /*
  178. inline RISCProgram RISCProgram::CreateStarter()
  179. {
  180. return RISCProgram();
  181. }
  182. */
  183. inline DWORD RISCProgram::GetPhysProgAddr()
  184. {
  185. return ProgramSpace_->GetPhysAddr();
  186. }
  187. inline RISCProgram::RISCProgram( MSize &size, DWORD pitch, ColFmt aColor ) :
  188. ImageSize_( size ), dwBufPitch_( pitch ), Interrupting_( false ),
  189. BufFormat_( aColor ), ProgramSpace_( NULL ), tag_( NULL ),
  190. dwPlanarAdjust_( 0 ), pChild_( NULL ), pParent_( NULL ),
  191. pChainAddress_( NULL ), GenerateResync_( false ), Skipped_( false ),
  192. pIRQAddress_( NULL ), dwBufAddr_( 0 ), Counting_( false )
  193. {
  194. ExtraTag_.QuadPart = 0;
  195. ExpectedExecutionTime_.QuadPart = 0;
  196. bAlreadyDumped_ = FALSE;
  197. dwSize_ = 0xffffffff;
  198. pSrb_ = 0;
  199. }
  200. inline RISCProgram::RISCProgram() :
  201. ImageSize_( 10, 10 ), dwBufPitch_( 0 ), Interrupting_( false ),
  202. Counting_( false ), BufFormat_( CF_RGB32 ), ProgramSpace_( NULL ),
  203. tag_( NULL ), GenerateResync_( false ), pChild_( NULL ), pParent_( NULL ),
  204. pChainAddress_( NULL ), Skipped_( false ),
  205. pIRQAddress_( NULL ), dwBufAddr_( 0 ), dwLinBufAddr_( 0 )
  206. {
  207. ExtraTag_.QuadPart = 0;
  208. ExpectedExecutionTime_.QuadPart = 0;
  209. bAlreadyDumped_ = FALSE;
  210. dwSize_ = 0xffffffff;
  211. pSrb_ = 0;
  212. }
  213. #endif