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.

165 lines
4.0 KiB

  1. /******************************************************************************\
  2. * *
  3. * Streaming.C - Hardware abstraction level library. *
  4. * *
  5. * Copyright (c) C-Cube Microsystems 1998 *
  6. * All Rights Reserved. *
  7. * *
  8. * Use of C-Cube Microsystems code is governed by terms and conditions *
  9. * stated in the accompanying licensing statement. *
  10. * *
  11. \******************************************************************************/
  12. #include "headers.h"
  13. #include "bmaster.h"
  14. #include "cl6100.h"
  15. #include "Hwif.h"
  16. #include "boardio.h"
  17. BOOL IsThereDataToSend(PHW_STREAM_REQUEST_BLOCK pSrb,DWORD dwPageToSend,DWORD dwCurrentSample)
  18. {
  19. PKSSCATTER_GATHER pSGList;
  20. DWORD dwCount;
  21. if( (pSGList = pSrb->ScatterGatherBuffer) && (dwCount = pSGList[dwPageToSend].Length) )
  22. return TRUE;
  23. else
  24. return FALSE;
  25. }
  26. void XferData(PHW_STREAM_REQUEST_BLOCK pSrb,PHW_DEVICE_EXTENSION pHwDevExt,DWORD dwPageToSend,
  27. DWORD dwCurrentSample)
  28. {
  29. PKSSCATTER_GATHER pSGList;
  30. DWORD dwCount;
  31. if( (pSGList = pSrb->ScatterGatherBuffer) && (dwCount = pSGList[dwPageToSend].Length) )
  32. {
  33. IssuePendingCommands(pHwDevExt);
  34. if( (dwCount )&& (dwCount <= 2048) )
  35. {
  36. DWORD* pdwPhysAddress = (DWORD*)pSGList[dwPageToSend].PhysicalAddress.LowPart;
  37. // Fire the data
  38. if(pSrb == pHwDevExt->pCurrentVideoSrb)
  39. {
  40. pHwDevExt->dwVideoDataUsed -= dwCount;
  41. }
  42. else if(pSrb == pHwDevExt->pCurrentAudioSrb)
  43. {
  44. pHwDevExt->dwAudioDataUsed -= dwCount;
  45. }
  46. else if(pSrb == pHwDevExt->pCurrentSubPictureSrb)
  47. {
  48. pHwDevExt->dwSubPictureDataUsed -= dwCount;
  49. }
  50. if( !BMA_Send( pdwPhysAddress, dwCount ) )
  51. MonoOutStr("ZiVA: !!!! BMA_Send() has failed\n" );
  52. else
  53. {
  54. PKSSTREAM_HEADER pHeader;
  55. pHeader = (PKSSTREAM_HEADER)(pSrb->CommandData.DataBufferArray)+
  56. dwCurrentSample;
  57. pHwDevExt->bInterruptPending = TRUE;
  58. //tmp MonoOutULong(pHeader->TypeSpecificFlags >> 16);
  59. //tmp MonoOutStr("(");
  60. }
  61. }
  62. else
  63. {
  64. MonoOutStr("dwCount is 0");
  65. FinishCurrentPacketAndSendNextOne( pHwDevExt );
  66. }
  67. }
  68. else
  69. {
  70. MonoOutStr("NoDataToSend");
  71. FinishCurrentPacketAndSendNextOne( pHwDevExt );
  72. }
  73. }
  74. /*
  75. ** HwInterrupt()
  76. **
  77. ** Routine is called when an interrupt at the IRQ level specified by the
  78. ** ConfigInfo structure passed to the HwInitialize routine is received.
  79. **
  80. ** Note: IRQs may be shared, so the device should ensure the IRQ received
  81. ** was expected
  82. **
  83. ** Arguments:
  84. **
  85. ** pHwDevExt - the device extension for the hardware interrupt
  86. **
  87. ** Returns:
  88. **
  89. ** Side Effects: none
  90. */
  91. BOOLEAN STREAMAPI HwInterrupt( IN PHW_DEVICE_EXTENSION pHwDevExt )
  92. {
  93. BOOLEAN bMyIRQ = FALSE;
  94. if(!pHwDevExt->bInitialized)
  95. return FALSE;
  96. if(pHwDevExt->bInterruptPending == FALSE)
  97. MonoOutStr("{");
  98. //tmp MonoOutStr("+");
  99. if( BMA_Complete() )
  100. {
  101. //tmp if(pHwDevExt->bInterruptPending == FALSE)
  102. //tmp MonoOutStr("}");
  103. //tmp MonoOutStr(")");
  104. bMyIRQ = TRUE;
  105. pHwDevExt->bInterruptPending = FALSE;
  106. FinishCurrentPacketAndSendNextOne( pHwDevExt );
  107. // dvd_CheckCFIFO();//sri
  108. }
  109. else
  110. {
  111. //tmp if(pHwDevExt->bInterruptPending == FALSE)
  112. //tmp MonoOutStr("]");
  113. if(Aborted())
  114. {
  115. MonoOutStr("HWInt : Abort");
  116. bMyIRQ = TRUE;
  117. pHwDevExt->bInterruptPending = FALSE;
  118. // FinishCurrentPacketAndSendNextOne( pHwDevExt );
  119. }
  120. }
  121. if( BRD_CheckDecoderInterrupt() )
  122. {
  123. INTSOURCES IntSrc;
  124. DVD_Isr( &IntSrc );
  125. // MonoOutStr( "DI" );
  126. bMyIRQ = TRUE;
  127. }
  128. // Returning FALSE indicates that this was not an IRQ for this device, and
  129. // the IRQ dispatcher will pass the IRQ down the chain to the next handler
  130. // for this IRQ level
  131. return bMyIRQ;
  132. }