/***************************************************************************** Company : Shree Ganesha Inc. File Name : SkyWalker1Device.h Author : Date : Purpose : Main Skywalker Device level Implementation Revision History: =============================================================================== DATE VERSION AUTHOR REMARK =============================================================================== 01 Initial Version *****************************************************************************/ #ifndef SKYWALKER1_TUNER_DEVICE_H #define SKYWALKER1_TUNER_DEVICE_H /* Include the Library and Other header file */ #include "SkyWalker1USB.h" #include "SkyWalker1Extended.h" /* End of Inclusion the Library and Other header file */ /* Macro Definitions */ /* End of Macro Definitions */ /* Global & Static variables Declaration */ //The SkyWalker1 Device class. class CSkyWalker1Device { public: //Device Initialization and Dispatch Related definitions NTSTATUS Create(IN PKSDEVICE pKSDeviceObject); NTSTATUS Start( IN PKSDEVICE pKSDeviceObject, IN PIRP pIrp, IN PCM_RESOURCE_LIST pResourceList OPTIONAL, IN PCM_RESOURCE_LIST pTranslatedResourceList OPTIONAL ); NTSTATUS Stop( IN PKSDEVICE pKSDeviceObject, IN PIRP pIoRequestPacket); NTSTATUS Close( IN PKSDEVICE pKSDeviceObject, IN PIRP pIoRequestPacket); NTSTATUS SetPower( IN PKSDEVICE pKSDeviceObject, //Pointer to the device object //provided by the system. IN PIRP pIoRequestPacket,//Pointer to the IRP related to this request. IN DEVICE_POWER_STATE To, //Requested power state. IN DEVICE_POWER_STATE From //Current power state. ); NTSTATUS InitializeTuner( IN PKSDEVICE pKSDeviceObject, IN PIRP pIoRequestPacket); // Device access related Function definitions // An instance of the filter uses these functions // to manage resources on the device. NTSTATUS Acquire(IN PBDATUNER_DEVICE_PARAMETER pNewResource, OUT PULONG pulAcquiredResourceID); NTSTATUS Update( IN PBDATUNER_DEVICE_PARAMETER pNewResource, IN ULONG ulResourceID); NTSTATUS SendDiseqcCommand( IN PDISEQC_COMMAND pDiseqcCommand, IN ULONG ulResourceID ); NTSTATUS Release(IN ULONG ulResourceID); NTSTATUS GetStatus(PBDATUNER_DEVICE_STATUS pDeviceStatus); //DMA Adapter related Functions NTSTATUS InitializeAdapterStream(IN PKSDEVICE pKSDeviceObject); //Stream Capture Related Fuctions NTSTATUS SetupCaptureSink ( IN ICaptureSink * pCapturePin, IN PBDA_TRANSPORT_INFO TransportInfo ); void RemoveCaptureSink (); NTSTATUS StartStream (); NTSTATUS PauseStream (IN BOOLEAN Pausing); NTSTATUS StopStream (); NTSTATUS ReadStream(IN ULONG ulStreamIndex); void ProcessStream(IN ULONG ulStreamIndex); BOOLEAN TimeToReadSignalStatus(void); PKSDEVICE m_pKSDevice; //USB Related definitions USB_DEVICE_DESCRIPTOR USBDeviceDescriptor; USBD_PIPE_INFORMATION ReadPipe; USBD_PIPE_INFORMATION WritePipe; USBSTATE UsbDeviceState; USBSTATE PreviousUsbDeviceState; //Pending I/O queue state QUEUE_STATE QueueState; //obtain and hold this lock while changing the device state, //the queue state and while processing the queue. KSPIN_LOCK DeviceStateLock; //Current Usb Irp PIRP pUsbStreamIrp[PACKET_PER_FRAME * NUMBER_OF_FRAMES]; //Device Stop Event KEVENT EvDeviceStopOk; //Device Remove Event KEVENT EvDeviceRemoveOk; //Outstanding IO Count for the Driver ULONG ulOutStandingIoCount; //Outstanding IO Count Lock KSPIN_LOCK kIoCountLock; PDMA_ADAPTER m_pDMAAdapter; ULONG m_SampleSize; //Temporary Bytes Read Counter ULONG m_NumberOfBytesRead[NUMBER_OF_FRAMES]; PUCHAR GetSynthBuffer(ULONG ulStreamIndex) { return m_SynthesisBuffer[ulStreamIndex]; } private: ULONG m_ulDeviceInstance; BDATUNER_DEVICE_PARAMETER m_CurResource; BDATUNER_DEVICE_STATUS m_TunerStatus; ULONG m_ulCurResourceID; ULONG m_ulcResourceUsers; LARGE_INTEGER m_PreviousStatusReadTime; //The synthesis buffer. This is a private buffer we use to store the //references of the Streaming Data.It is used for the Reading data //from the device and also Copying Data to the Stream Buffer sent //by the application PUCHAR m_SynthesisBuffer[NUMBER_OF_FRAMES]; //Key information regarding the frames we generate. LONGLONG m_TimePerFrame; ULONG m_PacketSize; ULONG m_PacketsPerSample; //The current state of the Device HARDWARE_STATE m_HardwareState; //The pause / stop hardware flag and event. BOOLEAN m_StopHardware; KEVENT m_HardwareEvent; //Number of pins with resources acquired. This is used as a locking //mechanism for resource acquisition on the device. LONG m_PinsWithResources; //The capture sink. When we complete stream reading, we //notify the capture sink. ICaptureSink *m_CaptureSink; //The video info header we're basing hardware settings on. The pin //provides this to us when acquiring resources and must guarantee its //stability until resources are released. PBDA_TRANSPORT_INFO m_TransportInfo; }; /* End of Global & Static variables Declaration */ /* External Variable Declaration */ /* End of External Variable Declaration */ /* Declare Enumerations here */ /* End of Enumeration declaration */ /* Function Prototypes */ /* End of Function prototype definitions */ #endif /*SKYWALKER1_TUNER_DEVICE_H*/