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.

373 lines
9.4 KiB

  1. /*++
  2. Module Name:
  3. MsTpAvc.h
  4. Abstract:
  5. Header file for MsTpAvc.c.
  6. Author:
  7. Yee J. Wu 27-July-99
  8. Environment:
  9. Kernel mode only
  10. Revision History:
  11. --*/
  12. #ifndef _MSTPAVC_INC
  13. #define _MSTPAVC_INC
  14. #include "XPrtDefs.h" // WdmCap directory; derived from DShow's edevdefs.h
  15. #include "EDevCtrl.h" // External Device COM interface structures
  16. #ifdef SUPPORT_NEW_AVC_CMD
  17. //
  18. // Define an AVC command constant and strcutures
  19. //
  20. typedef enum {
  21. OPC_UNIT_CONNECT_AV_20 = 0x20,
  22. OPC_UNIT_UNIT_INFO_30 = 0x30,
  23. OPC_UNIT_SUBUNIT_INFO_31 = 0x31,
  24. OPC_TAPE_PLAY_C3 = 0xC3,
  25. OPC_TAPE_TRANSPORT_STATE_D0 = 0xD0,
  26. // More...
  27. } AVC_COMMAND_OP_CODE;
  28. #define MAX_FCP_DATA_LEN 512
  29. #define AVC_CMD_HEADER_LEN 3
  30. #define MAX_OPERAND_LEN (MAX_FCP_DATA_LEN - AVC_CMD_HEADER_LEN)
  31. typedef struct _SUBUNIT_TYPE_ID {
  32. UCHAR SubunitID:3; // 1-4 instance number; 7: unit/ignoerd
  33. UCHAR SubunitType:5; // 4:Tape; 5:Tuner; 7:VideoCamera;
  34. } SUBUNIT_TYPE_ID, *PSUBUNIT_TYPE_ID;
  35. typedef struct _AVC_CMD_FRAME_HEADER {
  36. union {
  37. UCHAR CmdType:4; // 0:Control;1:Status;2:SpecInq;3:Notify;4:Geninq;other:reserved.
  38. UCHAR RespCode:4; // 8:Not_IMPL;9:Accept;A:Rejected;B:InTransition;C:Imple/Stable;D:Changed;E:Reserved;F:Interim
  39. };
  40. UCHAR CTS:4; // 0000 for AVC
  41. SUBUNIT_TYPE_ID SubunitTypeID;
  42. UCHAR Opcode;
  43. } AVC_CMD_FRAME_HEADER, *PAVC_CMD_FRAME_HEADER;
  44. typedef struct _AVC_CMD_FRAME {
  45. AVC_CMD_FRAME_HEADER CmdHeader;
  46. UCHAR Operand[MAX_OPERAND_LEN];
  47. } AVC_CMD_FRAME, *PAVC_CMD_FRAME;
  48. typedef struct _UNIT_CONNECT_AV_20 {
  49. AVC_CMD_FRAME_HEADER CmdHeader;
  50. UCHAR AudDstType:2;
  51. UCHAR VidDstType:2;
  52. UCHAR AudSrcType:2;
  53. UCHAR VidSrvType:2;
  54. UCHAR VideoSource;
  55. UCHAR AudSrc;
  56. UCHAR VidSrc;
  57. UCHAR AudDst;
  58. UCHAR VidDst;
  59. } UNIT_CONNECT_AV_20, *PUNIT_CONNECT_AV_20;
  60. typedef struct _UNIT_UNIT_INFO_30 {
  61. AVC_CMD_FRAME_HEADER CmdHeader;
  62. UCHAR Opcode; // 0x30
  63. UCHAR Operand; // 0x07
  64. ULONG Unit:3;
  65. ULONG UnitType:5;
  66. ULONG CompanyID:24;
  67. } UNIT_UNIT_INFO_30, *PUNIT_UNIT_INFO_30;
  68. typedef struct _UNIT_SUBUNIT_INFO_31 {
  69. AVC_CMD_FRAME_HEADER CmdHeader;
  70. UCHAR ExtCode:3;
  71. UCHAR Rsv0:1;
  72. UCHAR Page:3; // 0..7
  73. UCHAR Rsv1:1;
  74. UCHAR Operand; // 0x07
  75. // Exclude extension_code, there are max of 8 pages.
  76. SUBUNIT_TYPE_ID SubunitTypeID0[4];
  77. SUBUNIT_TYPE_ID SubunitTypeID1[4];
  78. SUBUNIT_TYPE_ID SubunitTypeID2[4];
  79. SUBUNIT_TYPE_ID SubunitTypeID3[4];
  80. SUBUNIT_TYPE_ID SubunitTypeID4[4];
  81. SUBUNIT_TYPE_ID SubunitTypeID5[4];
  82. SUBUNIT_TYPE_ID SubunitTypeID6[4];
  83. SUBUNIT_TYPE_ID SubunitTypeID7[4];
  84. } UNIT_SUBUNIT_INFO_31, *PUNIT_SUBUNIT_INFO_31;
  85. typedef enum {
  86. NEXT_FRAME = 0x30, // R
  87. SLOWEST_FORWARD, // R
  88. SLOW_FORWARD_6,
  89. SLOW_FORWARD_5,
  90. SLOW_FORWARD_4,
  91. SLOW_FORWARD_3,
  92. SLOW_FORWARD_2,
  93. SLOW_FORWARD_1,
  94. X1,
  95. FAST_FORWARD_1,
  96. FAST_FORWARD_2,
  97. FAST_FORWARD_3,
  98. FAST_FORWARD_4,
  99. FAST_FORWARD_5,
  100. FAST_FORWARD_6,
  101. FASTEST_FORWARD, // M
  102. //.... more...
  103. } PlaybackMode;
  104. typedef struct _TAPE_PLAY_C3 {
  105. AVC_CMD_FRAME_HEADER CmdHeader;
  106. PlaybackMode PlaybackMode;
  107. } TAPE_PLAY_C3, *PTAPE_PLAY_C3;
  108. typedef struct _TAPE_TRANSPORT_STATE_D0 {
  109. AVC_CMD_FRAME_HEADER CmdHeader;
  110. UCHAR Operand; // 7F
  111. UCHAR TransportMode;
  112. UCHAR TransportState;
  113. } TAPE_TRANSPORT_STATE_D0, *PTAPE_TRANSPORT_STATE_D0;
  114. //
  115. // "Super" AVC command frame structure
  116. //
  117. typedef struct _AVC_CMD {
  118. ULONG DataLen; // 4..512; at least 4 (header+opcode+operand) to be valid.
  119. union {
  120. // Generic
  121. UCHAR FCP_DATA[MAX_FCP_DATA_LEN];
  122. AVC_CMD_FRAME CmdFrame;
  123. // Unit commands
  124. UNIT_CONNECT_AV_20 ConnectAV;
  125. UNIT_UNIT_INFO_30 UnitInfo;
  126. UNIT_SUBUNIT_INFO_31 SubunitInfo;
  127. // Tape subunit commands
  128. TAPE_TRANSPORT_STATE_D0 TapeTransportState;
  129. TAPE_PLAY_C3 TapePlay;
  130. };
  131. } AVC_CMD, *PAVC_CMD;
  132. #endif // SUPPORT_NEW_AVC_CMD
  133. //
  134. // The index MUST match DVcrAVCCmdTable[]
  135. //
  136. typedef enum {
  137. DV_UNIT_INFO = 0
  138. ,DV_SUBUNIT_INFO
  139. ,DV_CONNECT_AV_MODE
  140. ,DV_VEN_DEP_CANON_MODE // Vendor denpendent mode of operation for Canon DV that does not support ConnectDV
  141. ,DV_VEN_DEP_DVCPRO // Vendor depend cmd to detect DVC PRO tape format
  142. ,DV_IN_PLUG_SIGNAL_FMT
  143. ,DV_OUT_PLUG_SIGNAL_FMT // to determine if it is a PAL or NTSC
  144. ,DV_GET_POWER_STATE // Get current power state
  145. ,DV_SET_POWER_STATE_ON // Get power state to ON
  146. ,DV_SET_POWER_STATE_OFF // Get power state to OFF
  147. ,VCR_TIMECODE_SEARCH
  148. ,VCR_TIMECODE_READ
  149. ,VCR_ATN_SEARCH
  150. ,VCR_ATN_READ
  151. ,VCR_RTC_SEARCH
  152. ,VCR_RTC_READ
  153. ,VCR_OPEN_MIC_CLOSE
  154. ,VCR_OPEN_MIC_READ
  155. ,VCR_OPEN_MIC_WRITE
  156. ,VCR_OPEN_MIC_STATUS
  157. ,VCR_READ_MIC
  158. ,VCR_WRITE_MIC
  159. ,VCR_OUTPUT_SIGNAL_MODE
  160. ,VCR_INPUT_SIGNAL_MODE
  161. ,VCR_LOAD_MEDIUM_EJECT
  162. ,VCR_RECORD
  163. ,VCR_RECORD_PAUSE
  164. ,VCR_PLAY_FORWARD_STEP
  165. ,VCR_PLAY_FORWARD_SLOWEST
  166. ,VCR_PLAY_FORWARD_SLOWEST2
  167. ,VCR_PLAY_FORWARD_FASTEST
  168. ,VCR_PLAY_REVERSE_STEP
  169. ,VCR_PLAY_REVERSE_SLOWEST
  170. ,VCR_PLAY_REVERSE_SLOWEST2
  171. ,VCR_PLAY_REVERSE_FASTEST
  172. ,VCR_PLAY_FORWARD
  173. ,VCR_PLAY_FORWARD_PAUSE
  174. ,VCR_WIND_STOP
  175. ,VCR_WIND_REWIND
  176. ,VCR_WIND_FAST_FORWARD
  177. ,VCR_TRANSPORT_STATE
  178. ,VCR_TRANSPORT_STATE_NOTIFY
  179. ,VCR_MEDIUM_INFO
  180. ,VCR_RAW_AVC
  181. } DVCR_AVC_COMMAND, *PDVCR_AVC_COMMAND;
  182. #define MAX_FCP_PAYLOAD_SIZE 512
  183. //
  184. // CTYPE definitions (in bit-map form... should correlate with AvcCommandType from avc.h)
  185. //
  186. typedef enum {
  187. CMD_CONTROL = 0x01
  188. ,CMD_STATUS = 0x02
  189. ,CMD_SPEC_INQ = 0x04
  190. ,CMD_NOTIFY = 0x08
  191. ,CMD_GEN_INQ = 0x10
  192. } BITMAP_CTYPE;
  193. typedef enum {
  194. CMD_STATE_UNDEFINED
  195. ,CMD_STATE_ISSUED
  196. ,CMD_STATE_RESP_ACCEPTED
  197. ,CMD_STATE_RESP_REJECTED
  198. ,CMD_STATE_RESP_NOT_IMPL
  199. ,CMD_STATE_RESP_INTERIM
  200. ,CMD_STATE_ABORTED
  201. } AVC_CMD_STATE, *PAVC_CMD_STATE;
  202. // An AVC command entry
  203. typedef struct _AVC_CMD_ENTRY {
  204. LIST_ENTRY ListEntry;
  205. PDVCR_EXTENSION pDevExt;
  206. PIRP pIrp; // The Irp associated with this command
  207. PAVC_COMMAND_IRB pAvcIrb; // points to the AVC command information
  208. PVOID pProperty; // Data from/to COM interface
  209. DVCR_AVC_COMMAND idxDVCRCmd; // Used to check for RAW AVC command, which requires special processing
  210. AVC_CMD_STATE cmdState; // Issuing, interim, completed
  211. NTSTATUS Status; // To save the results of response parsing
  212. AvcCommandType cmdType; // Type of command: Control, Status. Notify, Gen or Spec Inquery
  213. BYTE OpCode; // Since the opcode in response frame of TRANSITION and STABLE can be different from the COMMAND frame
  214. BYTE Reserved[3]; // Pack to DWORD
  215. } AVCCmdEntry, *PAVCCmdEntry;
  216. #define CMD_IMPLEMENTED 1
  217. #define CMD_NOT_IMPLEMENTED 0
  218. #define CMD_UNDETERMINED 0xffffffff // -1
  219. typedef struct {
  220. DVCR_AVC_COMMAND command; // VCR_PLAY_FORWARD
  221. LONG lCmdImplemented; // 1:Implemented, 0:NotImpelemnted; -1:UnDetermined
  222. ULONG ulRespFlags; // DVCR_AVC_SEND
  223. ULONG ulCmdSupported; // one or more of constants defined in BITMAP_CTYPE
  224. LONG OperandLength; // -1 = variable length
  225. BYTE CType;
  226. BYTE SubunitAddr;
  227. BYTE Opcode;
  228. BYTE Operands[MAX_AVC_OPERAND_BYTES];
  229. } KSFCP_PACKET, *PKSFCP_PACKET;
  230. #define OPC_TIMECODE 0x51
  231. #define OPC_OPEN_MIC 0x60
  232. #define OPC_READ_MIC 0x61
  233. #define OPC_WRITE_MIC 0x62
  234. #define OPC_INPUT_SIGNAL_MODE 0x79
  235. #define OPC_LOAD_MEDIUM 0xc1
  236. #define OPC_RECORD 0xc2
  237. #define OPC_PLAY 0xc3
  238. #define OPC_WIND 0xc4
  239. #define OPC_TRANSPORT_STATE 0xd0
  240. #define OPC_MEDIUM_INFO 0xda
  241. #define UNIT_TYPE_ID_VCR 0x20 // VCR 00100:000; 00100 == 4 == VCR, 000 == instancve number
  242. #define UNIT_TYPE_ID_CAMERA 0x38 // Camera 00111:000; 00111 == 7 == Camera, 000 == instancve number
  243. #define UNIT_TYPE_ID_DV 0xff // DV UNIT as a whole
  244. // Vendor IDs that require special treatments
  245. #define VENDOR_ID_MASK 0x00ffffff
  246. #define VENDORID_CANON 0x85 // VEN_85 : Vendor Dependent command for ModeOfOperation
  247. #define VENDORID_PANASONIC 0x8045 // VEN_8045 : DVCPRO?
  248. #define AVC_POWER_STATE_ON 0x70
  249. #define AVC_POWER_STATE_OFF 0x60
  250. #endif
  251. NTSTATUS
  252. DVIssueAVCCommand (
  253. IN PDVCR_EXTENSION pDevExt,
  254. IN AvcCommandType cType,
  255. IN DVCR_AVC_COMMAND idxAVCCmd,
  256. IN PVOID pProperty
  257. );
  258. void
  259. DVAVCCmdResetAfterBusReset(
  260. PDVCR_EXTENSION pDevExt
  261. );
  262. NTSTATUS
  263. AVCTapeGetDeviceProperty(
  264. IN PDVCR_EXTENSION pDevExt,
  265. IN PSTREAM_PROPERTY_DESCRIPTOR pSPDesc,
  266. OUT PULONG pulActualBytetransferred
  267. );
  268. NTSTATUS
  269. AVCTapeSetDeviceProperty(
  270. IN PDVCR_EXTENSION pDevExt,
  271. IN PSTREAM_PROPERTY_DESCRIPTOR pSPD,
  272. IN PULONG pulActualBytetransferred
  273. );