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.

335 lines
6.8 KiB

  1. #ifndef __MCAMDRV_H__
  2. #define __MCAMDRV_H__
  3. /*++
  4. Copyright (c) 1997 1998, Philips I&C
  5. Module Name:
  6. mcamdrv.h
  7. Abstract:
  8. driver for the philips camera.
  9. Author:
  10. Paul Oosterhof
  11. Environment:
  12. Kernel mode only
  13. Revision History:
  14. Date Change
  15. sept.22 98 Optimized for NT5
  16. --*/
  17. #include <strmini.h>
  18. #include <ksmedia.h>
  19. #include "usbdi.h"
  20. #include "usbcamdi.h"
  21. #include "mprpobj.h"
  22. #include "mprpobjx.h"
  23. //--- Compiler switches:------------------------------
  24. // DEFINES FOR CODEC
  25. // Copy for each line pixel 3 to pixel 2, pixel 2 to pixel 1.
  26. #define PIX12_FIX
  27. //--- end Compiler switches:------------------------------
  28. #define DRIVERVERSION 001
  29. // SSI numbers + added functionality
  30. #define SSI_INITIAL 1
  31. #define SSI_AUDIO_8KHZ 2 // 8kHz audio i.s.o. 11kHz
  32. #define SSI_STRINGS 3 // strings added
  33. #define SSI_YGAIN_MUL2 4 // Ygain divided by two in camera. Only this version !!
  34. #define SSI_CIF3 5 // PCF4 substituted by PCF3
  35. #define SSI_PIX12_FIX 5 // vertical black line pixel 1/2 change
  36. #define SSI_8117_N3 8 // new N3 silicium for 8117
  37. typedef struct _PHILIPSCAM_CAMSTATUS {
  38. DWORD ReleaseNumber;
  39. USHORT SensorType;
  40. USHORT PictureFormat;
  41. USHORT PictureFrameRate;
  42. USHORT PictureCompressing;
  43. GUID PictureSubFormat; // added RMR
  44. } PHILIPSCAM_CAMSTATUS, *PPHILIPSCAM_CAMSTATUS;
  45. typedef struct _PHILIPSCAM_DEVICE_CONTEXT {
  46. ULONG Sig;
  47. ULONG EmptyPacketCounter;
  48. PHILIPSCAM_CAMSTATUS CamStatus;
  49. PHILIPSCAM_CAMSTATUS PreviousCamStatus;
  50. BOOLEAN FrrSupported[9];
  51. // internal counters
  52. ULONG FrameLength;
  53. PUSBD_INTERFACE_INFORMATION Interface;
  54. } PHILIPSCAM_DEVICE_CONTEXT, *PPHILIPSCAM_DEVICE_CONTEXT;
  55. typedef struct _PHILIPSCAM_FRAME_CONTEXT {
  56. ULONG Sig;
  57. ULONG USBByteCounter;
  58. } PHILIPSCAM_FRAME_CONTEXT, *PPHILIPSCAM_FRAME_CONTEXT;
  59. #define PHILIPSCAM_DEVICE_SIG 0x45544e49 //"INTE"
  60. #if DBG
  61. #define ASSERT_DEVICE_CONTEXT(d) ASSERT((d)->Sig == PHILIPSCAM_DEVICE_SIG)
  62. #else
  63. #define ASSERT_DEVICE_CONTEXT(d)
  64. #endif
  65. #define PHILIPSCAM_DEFAULT_FRAME_RATE 15
  66. #define PHILIPSCAM_MAX_FRAME_RATE 24
  67. #define PHILIPSCAM_SYNC_PIPE 0
  68. #define PHILIPSCAM_DATA_PIPE 1
  69. #define ULTRA_TRACE 3
  70. #define MAX_TRACE 2
  71. #define MIN_TRACE 1
  72. #define CIF_X 352
  73. #define CIF_Y 288
  74. #define QCIF_X 176
  75. #define QCIF_Y 144
  76. #define SQCIF_X 128
  77. #define SQCIF_Y 96
  78. #define QQCIF_X 88
  79. #define QQCIF_Y 72
  80. #define VGA_X 640
  81. #define VGA_Y 480
  82. #define SIF_X 320
  83. #define SIF_Y 240
  84. #define SSIF_X 240
  85. #define SSIF_Y 180
  86. #define QSIF_X 160
  87. #define QSIF_Y 120
  88. #define SQSIF_X 80
  89. #define SQSIF_Y 60
  90. #define SCIF_X 240
  91. #define SCIF_Y 176
  92. #define ALT_INTERFACE_0 0
  93. typedef enum {
  94. FORMATCIF,
  95. FORMATQCIF,
  96. FORMATSQCIF,
  97. FORMATQQCIF,
  98. FORMATVGA,
  99. FORMATSIF,
  100. FORMATSSIF,
  101. FORMATQSIF,
  102. FORMATSQSIF,
  103. FORMATSCIF
  104. } PHFORMAT;
  105. typedef enum {
  106. FRRATEVGA,
  107. FRRATE375,
  108. FRRATE5,
  109. FRRATE75,
  110. FRRATE10,
  111. FRRATE12,
  112. FRRATE15,
  113. FRRATE20,
  114. FRRATE24
  115. } PHFRAMERATE;
  116. typedef enum{
  117. COMPRESSION0,
  118. COMPRESSION3,
  119. COMPRESSION4
  120. } PHCOMPRESSION;
  121. typedef enum{
  122. SUBTYPEP420,
  123. SUBTYPEI420,
  124. SUBTYPEIYUV
  125. } PHSUBTYPE;
  126. #if DBG
  127. extern ULONG PHILIPSCAM_DebugTraceLevel;
  128. #define PHILIPSCAM_KdPrint(_t_, _x_) \
  129. if (PHILIPSCAM_DebugTraceLevel >= _t_) { \
  130. DbgPrint("PHILCAM1.SYS: "); \
  131. DbgPrint _x_ ;\
  132. }
  133. PCHAR
  134. FRString (
  135. USHORT index
  136. );
  137. #ifdef NTKERN
  138. #define TRAP() _asm {int 3}
  139. #define TEST_TRAP() _asm {int 3}
  140. #define TRAP_ERROR(e) if (!NT_SUCCESS(e)) { _asm {int 3} }
  141. #else
  142. #define TRAP() DbgBreakPoint()
  143. #define TEST_TRAP() DbgBreakPoint()
  144. #define TRAP_ERROR(e) if (!NT_SUCCESS(e)) { DbgBreakPoint(); }
  145. #endif
  146. #else
  147. #define PHILIPSCAM_KdPrint(_t_, _x_)
  148. #define TEST_TRAP()
  149. #define TRAP()
  150. #endif /* DBG */
  151. NTSTATUS
  152. PHILIPSCAM_Initialize(
  153. PDEVICE_OBJECT BusDeviceObject,
  154. PVOID DeviceContext
  155. );
  156. NTSTATUS
  157. PHILIPSCAM_UnInitialize(
  158. PDEVICE_OBJECT BusDeviceObject,
  159. PVOID DeviceContext
  160. );
  161. NTSTATUS
  162. PHILIPSCAM_StartVideoCapture(
  163. PDEVICE_OBJECT BusDeviceObject,
  164. PVOID DeviceContext
  165. );
  166. NTSTATUS
  167. PHILIPSCAM_StopVideoCapture(
  168. PDEVICE_OBJECT BusDeviceObject,
  169. PVOID DeviceContext
  170. );
  171. ULONG
  172. PHILIPSCAM_ProcessUSBPacket(
  173. PDEVICE_OBJECT BusDeviceObject,
  174. PVOID DeviceContext,
  175. PVOID CurrentFrameContext,
  176. PUSBD_ISO_PACKET_DESCRIPTOR SyncPacket,
  177. PVOID SyncBuffer,
  178. PUSBD_ISO_PACKET_DESCRIPTOR DataPacket,
  179. PVOID DataBuffer,
  180. PBOOLEAN FrameComplete,
  181. PBOOLEAN NextFrameIsStill
  182. );
  183. VOID
  184. PHILIPSCAM_NewFrame(
  185. PVOID DeviceContext,
  186. PVOID FrameContext
  187. );
  188. NTSTATUS
  189. PHILIPSCAM_ProcessRawVideoFrame(
  190. PDEVICE_OBJECT BusDeviceObject,
  191. PVOID DeviceContext,
  192. PVOID FrameContext,
  193. PVOID FrameBuffer,
  194. ULONG FrameLength,
  195. PVOID RawFrameBuffer,
  196. ULONG RawFrameLength,
  197. ULONG NumberOfPackets,
  198. PULONG BytesReturned
  199. );
  200. NTSTATUS
  201. PHILIPSCAM_Configure(
  202. PDEVICE_OBJECT BusDeviceObject,
  203. PVOID DeviceContext,
  204. PUSBD_INTERFACE_INFORMATION Interface,
  205. PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor,
  206. PLONG DataPipeIndex,
  207. PLONG SyncPipeIndex
  208. );
  209. NTSTATUS
  210. PHILIPSCAM_SaveState(
  211. PDEVICE_OBJECT BusDeviceObject,
  212. PVOID DeviceContext
  213. );
  214. NTSTATUS
  215. PHILIPSCAM_RestoreState(
  216. PDEVICE_OBJECT BusDeviceObject,
  217. PVOID DeviceContext
  218. );
  219. NTSTATUS
  220. PHILIPSCAM_ReadRegistry(
  221. PDEVICE_OBJECT BusDeviceObject,
  222. PVOID DeviceContext
  223. );
  224. NTSTATUS
  225. PHILIPSCAM_AllocateBandwidth(
  226. IN PDEVICE_OBJECT BusDeviceObject,
  227. IN PVOID DeviceContext,
  228. OUT PULONG RawFrameLength,
  229. IN PVOID Format
  230. );
  231. NTSTATUS
  232. PHILIPSCAM_FreeBandwidth(
  233. PDEVICE_OBJECT BusDeviceObject,
  234. PVOID DeviceContext
  235. );
  236. NTSTATUS
  237. PHILIPSCAM_CameraToDriverDefaults(
  238. PDEVICE_OBJECT BusDeviceObject,
  239. PVOID DeviceContext
  240. );
  241. NTSTATUS
  242. PHILIPSCAM_SaveControlsToRegistry(
  243. PDEVICE_OBJECT BusDeviceObject,
  244. PVOID pDeviceContext
  245. );
  246. NTSTATUS
  247. PHILIPSCAM_PropertyRequest(
  248. BOOLEAN SetProperty,
  249. PDEVICE_OBJECT BusDeviceObject,
  250. PVOID DeviceContext,
  251. PVOID PropertyContext
  252. );
  253. VOID STREAMAPI
  254. PHILIPSCAM_ReceiveDataPacket(
  255. IN PHW_STREAM_REQUEST_BLOCK Srb,
  256. IN PVOID DeviceContext,
  257. IN PBOOLEAN Completed
  258. );
  259. VOID STREAMAPI
  260. PHILIPSCAM_ReceiveCtrlPacket(
  261. IN PHW_STREAM_REQUEST_BLOCK Srb,
  262. IN PVOID DeviceContext,
  263. IN PBOOLEAN Completed
  264. );
  265. BOOL
  266. AdapterVerifyFormat(
  267. PKS_DATAFORMAT_VIDEOINFOHEADER pKSDataFormatToVerify,
  268. int StreamNumber
  269. );
  270. #endif