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.

121 lines
3.1 KiB

  1. //==========================================================================;
  2. //
  3. // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. // PURPOSE.
  7. //
  8. // Copyright (c) 1992 - 1996 Microsoft Corporation. All Rights Reserved.
  9. //
  10. //==========================================================================;
  11. #ifndef __XBAR_H
  12. #define __XBAR_H
  13. #include "capmain.h"
  14. #include "mediums.h"
  15. struct _XBAR_PIN_DESCRIPTION {
  16. ULONG PinType;
  17. ULONG RelatedPinIndex;
  18. ULONG IsRoutedTo; // Index of input pin in use
  19. KSPIN_MEDIUM Medium;
  20. _XBAR_PIN_DESCRIPTION(ULONG type, ULONG rel, const KSPIN_MEDIUM * PinMedium);
  21. _XBAR_PIN_DESCRIPTION(){}
  22. };
  23. inline _XBAR_PIN_DESCRIPTION::_XBAR_PIN_DESCRIPTION(ULONG type, ULONG rel , const KSPIN_MEDIUM * PinMedium) :
  24. PinType(type), RelatedPinIndex(rel), IsRoutedTo(0) // , Medium(PinMedium)
  25. {
  26. Medium = *PinMedium;
  27. }
  28. const ULONG NUMBER_OF_XBAR_OUTPUTS = 1;
  29. const ULONG NUMBER_OF_XBAR_INPUTS = 3;
  30. class CrossBar
  31. {
  32. friend class Device;
  33. _XBAR_PIN_DESCRIPTION OutputPins [NUMBER_OF_XBAR_OUTPUTS];
  34. _XBAR_PIN_DESCRIPTION InputPins [NUMBER_OF_XBAR_INPUTS];
  35. public:
  36. ULONG GetNoInputs();
  37. ULONG GetNoOutputs();
  38. void * operator new(size_t size, void * pAllocation) { return(pAllocation);}
  39. void operator delete(void * pAllocation) {}
  40. BOOL TestRoute(ULONG InPin, ULONG OutPin);
  41. ULONG GetPinInfo(KSPIN_DATAFLOW dir, ULONG idx, ULONG &related);
  42. KSPIN_MEDIUM * GetPinMedium(KSPIN_DATAFLOW dir, ULONG idx);
  43. void Route(ULONG OutPin, ULONG InPin);
  44. BOOL GoodPins(ULONG InPin, ULONG OutPin);
  45. ULONG GetRoute(ULONG OutPin);
  46. CrossBar();
  47. };
  48. inline CrossBar::CrossBar()
  49. {
  50. OutputPins [0] = _XBAR_PIN_DESCRIPTION(KS_PhysConn_Video_VideoDecoder, 1 , &CrossbarMediums[3]);
  51. // InputPins are set in device.cpp
  52. }
  53. inline ULONG CrossBar::GetNoInputs()
  54. {
  55. return NUMBER_OF_XBAR_INPUTS;
  56. }
  57. inline ULONG CrossBar::GetNoOutputs()
  58. {
  59. return NUMBER_OF_XBAR_OUTPUTS;
  60. }
  61. inline BOOL CrossBar::GoodPins(ULONG InPin, ULONG OutPin)
  62. {
  63. return BOOL(InPin < NUMBER_OF_XBAR_INPUTS && OutPin < NUMBER_OF_XBAR_OUTPUTS);
  64. }
  65. inline void CrossBar::Route(ULONG OutPin, ULONG InPin)
  66. {
  67. OutputPins [OutPin].IsRoutedTo = InPin;
  68. }
  69. inline ULONG CrossBar::GetRoute(ULONG OutPin)
  70. {
  71. return OutputPins [OutPin].IsRoutedTo;
  72. }
  73. inline KSPIN_MEDIUM * CrossBar::GetPinMedium(KSPIN_DATAFLOW dir, ULONG idx)
  74. {
  75. _XBAR_PIN_DESCRIPTION *pPinDesc;
  76. if (dir == KSPIN_DATAFLOW_IN) {
  77. pPinDesc = InputPins;
  78. } else {
  79. pPinDesc = OutputPins;
  80. }
  81. return &pPinDesc [idx].Medium;
  82. }
  83. inline ULONG CrossBar::GetPinInfo(KSPIN_DATAFLOW dir, ULONG idx, ULONG &related)
  84. {
  85. _XBAR_PIN_DESCRIPTION *pPinDesc;
  86. if (dir == KSPIN_DATAFLOW_IN) {
  87. pPinDesc = InputPins;
  88. } else {
  89. pPinDesc = OutputPins;
  90. }
  91. related = pPinDesc [idx].RelatedPinIndex;
  92. return pPinDesc [idx].PinType;
  93. }
  94. #endif