Initial commit: Genpix SkyWalker-1 DVB-S driver source and DiSEqC docs

Includes original BDA driver source (headers, C++ implementation, INF
installer files), DiSEqC implementation PDF with extracted markdown
and SVG vector graphics.
This commit is contained in:
Ryan Malloy 2026-02-11 04:22:13 -07:00
commit f1674c21a3
44 changed files with 14302 additions and 0 deletions

View file

@ -0,0 +1,102 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1AntennaPin.h
Author :
Date :
Purpose : This File Holds the Antenna Pin related declarations
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
#ifndef __SKYWALKER1_ANTENNA_PIN_H
#define __SKYWALKER1_ANTENNA_PIN_H
/* Include the Library and Other header file */
#include "SkyWalker1TunerPin.h"
#include "SkyWalker1Extended.h" //For the Extended BDA
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
/* End of Macro Definitions */
/* Declare Enumerations here */
/* End of Enumeration declaration */
/* Global & Static variables Declaration */
//Antenna Pin class.
class CAntennaPin : public CTunerPin
{
public:
static NTSTATUS PinSetDeviceState(
IN PKSPIN Pin,
IN KSSTATE ToState,
IN KSSTATE FromState
);
static NTSTATUS IntersectDataFormat(
IN PVOID pContext,
IN PIRP pIoRequestPacket,
IN PKSP_PIN Pin,
IN PKSDATARANGE DataRange,
IN PKSDATARANGE MatchingDataRange,
IN ULONG DataBufferSize,
OUT PVOID Data OPTIONAL,
OUT PULONG DataSize
);
//Network provider and AVStream use these functions
//to set and get properties of nodes that are controlled
//by the input pin.
static NTSTATUS GetTunerProperty(
IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
IN PULONG pulProperty
);
static NTSTATUS SetTunerProperty(
IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
IN PULONG pulProperty
);
//Network provider and AVStream use these functions
//to set and get properties of nodes that are controlled
//by the input pin.
static NTSTATUS GetTunerLnbProperty(
IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
IN PULONG pulProperty
);
static NTSTATUS SetTunerLnbProperty(
IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
IN PULONG pulProperty
);
private:
KSSTATE m_KsState;
};
/* End of Global & Static variables Declaration */
/* External Variable Declaration */
/* End of External Variable Declaration */
/* Function Prototypes */
/* End of Function prototype definitions */
#endif /*__SKYWALKER1_TRANSPORT_PIN_H*/

View file

@ -0,0 +1,72 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1CaptureFilter.h
Author :
Date :
Purpose : This file contains the filter level header for
the capture filter.
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
#ifndef SKYWALKER1_CAPTURE_FILTER_H
#define SKYWALKER1_CAPTURE_FILTER_H
/* Include the Library and Other header file */
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
/* End of Macro Definitions */
/* Declare Enumerations here */
/* End of Enumeration declaration */
/* Global & Static variables Declaration */
//The Capture filter class.
class CCaptureFilter
{
public:
//The capture filter object constructor. Since the new operator will
//have zeroed the memory, do not bother initializing any NULL or 0
//fields. Only initialize non-NULL, non-0 fields.
CCaptureFilter (IN PKSFILTER Filter);
//The capture filter destructor.
~CCaptureFilter ();
//This is the filter creation dispatch for the capture filter. It
//creates the CCaptureFilter object, associates it with the AVStream
//object, and bags it for easy cleanup later.
static NTSTATUS Create( IN OUT PKSFILTER pKSFilter,
IN PIRP pIoRequestPacket);
private:
//The AVStream filter object associated with this CCaptureFilter.
PKSFILTER m_Filter;
//This is the bag cleanup callback for the CCaptureFilter. Not providing
//one would cause ExFreePool to be used. This is not good for C++
//constructed objects. We simply delete the object here.
static void Cleanup ( IN CCaptureFilter *CapFilter );
};
/* End of Global & Static variables Declaration */
/* External Variable Declaration */
/* End of External Variable Declaration */
/* Function Prototypes */
/* End of Function prototype definitions */
#endif /*SKYWALKER1_CAPTURE_FILTER_H*/

View file

@ -0,0 +1,161 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1CapturePin.h
Author :
Date :
Purpose : This file contains header for the video capture pin on the capture
filter.
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
/* Include the Library and Other header file */
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
/* End of Macro Definitions */
/* Declare Enumerations here */
/* End of Enumeration declaration */
/* Global & Static variables Declaration */
//This Structure can be used in future for the
//better stream management
typedef struct _STREAM_POINTER_CONTEXT
{
ULONG ulFrameIndex;
} STREAM_POINTER_CONTEXT, *PSTREAM_POINTER_CONTEXT;
//The video capture pin class.
class CCapturePin : public ICaptureSink
{
private:
//The AVStream pin we're associated with.
PKSPIN m_Pin;
//Pointer to the internal device object for our capture device.
//We access the Device through this object.
CSkyWalker1Device *m_Device;
//The state we've put the hardware into. This allows us to keep track
//of whether to do things like unpausing or restarting.
HARDWARE_STATE m_HardwareState;
//The clock we've been assigned. As with other capture filters, we do
//not expose a clock. If one has been assigned, we will use it to
//time stamp packets (plus a reasonable delta to work the capture stream
//in a preview graph).
PIKSREFERENCECLOCK m_Clock;
//The transport information for this capture pin. The settings for device will be
//programmed for this transport info.
PBDA_TRANSPORT_INFO m_TransportInfo;
//This Variable is used to keep the count of the Streams sent for the
//Data read
ULONG m_CurrentFrameIndex;
//An indication of whether or not this pin has acquired the necessary
//hardware resources to operate. When the pin reaches KSSTATE_ACQUIRE,
//we attempt to acquire the hardware. This flag will be set based on
//our success / failure.
BOOLEAN m_AcquiredResources;
//Clean up any references we hold on frames in the queue. This is called
//when we abruptly stop the fake hardware.
NTSTATUS CleanupReferences ();
//This is the state transition handler for the capture pin. It attempts
//to acquire resources for the capture pin (or releasing them if
//necessary) and starts and stops the hardware as required.
NTSTATUS SetState ( IN KSSTATE ToState,IN KSSTATE FromState);
//This is the processing dispatch for the capture pin. It handles
//sending the Streams to the Device.
NTSTATUS Process();
//This routine is not required as the Transport Information is already
//provided into the CCapturePin but still using it to make the
//settings flexible
PBDA_TRANSPORT_INFO CaptureBdaTransportInfo ();
//This is the free callback from the bagged item (CCapturePin). If we
//do not provide a callback when we bag the CCapturePin, ExFreePool
//would be called. This is not desirable for C++ constructed objects.
//We merely delete the object here.
static void Cleanup (IN CCapturePin *Pin)
{
delete Pin;
}
public:
//The capture pin's constructor. Initialize any non-0, non-NULL fields
//(since new will have zero'ed the memory anyway) and set up our
//device level pointers for access during capture routines.
CCapturePin (IN PKSPIN Pin);
//The capture pin's destructor.
~CCapturePin ();
CSkyWalker1Device* GetDevice()
{
return m_Device;
}
//This is the capture sink notification mechanism for mapping completion.
//When the device DPC detects that a given number of mappings have been
//completed by the fake hardware, it signals the capture sink of this
//through this method.
virtual void ReleaseStream(IN ULONG ulStreamIndex);
//This is the creation dispatch for the capture pin. It creates
//the CCapturePin object and associates it with the AVStream object
//bagging it in the process.
static NTSTATUS PinCreate( IN OUT PKSPIN pKSPin,
IN PIRP pIoRequestPacket
);
//This is the set device state dispatch for the pin. The routine bridges
//to SetState() in the context of the CCapturePin.
static NTSTATUS DispatchSetState (
IN PKSPIN Pin,
IN KSSTATE ToState,
IN KSSTATE FromState
)
{
return
(reinterpret_cast<CCapturePin *>(Pin->Context))->
SetState(ToState, FromState);
}
//This is the processing dispatch for the capture pin. The routine
//bridges to Process() in the context of the CCapturePin.
static NTSTATUS DispatchProcess (IN PKSPIN Pin)
{
return
(reinterpret_cast<CCapturePin *>(Pin->Context))->Process();
}
};
/* End of Global & Static variables Declaration */
/* External Variable Declaration */
/* End of External Variable Declaration */
/* Function Prototypes */
/* End of Function prototype definitions */

View file

@ -0,0 +1,149 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1CommonDef.h
Author :
Date :
Purpose : File to hold the common definitions for the Driver
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
#ifndef __SKYWALKER1_COMMON_DEF_H
#define __SKYWALKER1_COMMON_DEF_H
/* Include the Library and Other header file */
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
#define TUNER_MEM_TAG 'MNUT'
#define CAPTURE_MEM_TAG 'MPAC'
// Implementation GUID for SkyWalker1 Tuner and Capture
// Must match the KSSTRING used in the installation INFs interface sections
//Tuner Filter GUID {5C4E764F-AB43-46A9-B21E-8529C70F0A23}
#define GUID_SKYWALKER_TUNER_FILTER\
0x5C4E764F, 0xAB43, 0x46A9, 0xB2, 0x1E, 0x85, 0x29, 0xC7, 0x0F, 0x0A, 0x23
DEFINE_GUIDSTRUCT("5C4E764F-AB43-46A9-B21E-8529C70F0A23", SKYWALKER_TUNER_FILTER);
#define SKYWALKER_TUNER_FILTER DEFINE_GUIDNAMED(SKYWALKER_TUNER_FILTER)
//Capture Filter GUID {0F8F74D9-E524-4D05-BB60-F0C69ACB1756}
#define GUID_SKYWALKER_CAPTURE_FILTER\
0x0F8F74D9, 0xE524, 0x4D05, 0xBB, 0x60, 0xF0, 0xC6, 0x9A, 0xCB, 0x17, 0x56
DEFINE_GUIDSTRUCT("0F8F74D9-E524-4D05-BB60-F0C69ACB1756", SKYWALKER_CAPTURE_FILTER);
// Defines the SKYWALKER_CAPTURE_FILTER as a GUID.
#define SKYWALKER_CAPTURE_FILTER DEFINE_GUIDNAMED(SKYWALKER_CAPTURE_FILTER)
//Medium GUID {2AEB4A94-FBB7-4FB1-8D74-243B91886EAB}
#define GUID_SKYWALKER_TUNER_OUT_MEDIUM\
0x2AEB4A94, 0xFBB7, 0x4FB1, 0x8D, 0x74, 0x24, 0x3B, 0x91, 0x88, 0x6E, 0xAB
DEFINE_GUIDSTRUCT("2AEB4A94-FBB7-4FB1-8D74-243B91886EAB", SKYWALKER_TUNER_OUT_MEDIUM);
// Defines the SKYWALKER_TUNER_OUT_MEDIUM as a GUID.
#define SKYWALKER_TUNER_OUT_MEDIUM DEFINE_GUIDNAMED(SKYWALKER_TUNER_OUT_MEDIUM)
#define TRANSPORT_PACKET_SIZE 128 //188
#define TRANSPORT_PACKET_COUNT 64 //512
#define NUMBER_OF_FRAMES 8
#define PACKET_PER_FRAME 2
#define SYMBOL_RATE_MIN 1000
#define SYMBOL_RATE_MAX 45000
#define TUNER_FREQ_MIN 800000
#define TUNER_FREQ_MAX 2250000
#define IS_VALID(X) (((X)!=NULL)?true:false)
/* End of Macro Definitions */
/* Global & Static variables Declaration */
// Structure for the Tuner Parameters
typedef struct _BDATUNER_DEVICE_PARAMETER
{
//Tuner Properties
ULONG ulCarrierFrequency;
ULONG ulFrequencyMultiplier;
ULONG ulBandWidth;
Polarisation Polarity;
ULONG ulRange;
ULONG ulTransponder;
//LNB Parameters
ULONG ulLnbLowLOFrequency;
ULONG ulLnbHighLOFrequency;
ULONG ulLnbSwitchFrequency;
//Demodulator Properties
ULONG ulInnerFecType;
BinaryConvolutionCodeRate InnerFecRate;
ULONG ulOuterFecType;
BinaryConvolutionCodeRate OuterFecRate;
ModulationType CurrentModulationType;
TransmissionMode CurrentTransmissionMode;
GuardInterval CurrentGuardInterval;
SpectralInversion CurrentSpectralInversion;
ULONG ulSymbolRate;
} BDATUNER_DEVICE_PARAMETER, * PBDATUNER_DEVICE_PARAMETER;
// Define a structure that represents the underlying device status.
//
typedef struct _BDATUNER_DEVICE_STATUS
{
//Tuner Status
DWORD dwSignalStrength;
DWORD dwSignalQuality;
BOOLEAN fCarrierPresent;
//Demodulator Status
BOOLEAN fSignalLocked;
} BDATUNER_DEVICE_STATUS, * PBDATUNER_DEVICE_STATUS;
// ICaptureSink:
//
// This is a capture sink interface. The device level calls back the
// CompleteMappings method passing the number of completed mappings for
// the capture pin. This method is called during the device DPC.
class ICaptureSink
{
public:
virtual void ReleaseStream (IN ULONG ulStreamIndex) = 0;
};
/* End of Global & Static variables Declaration */
/* External Variable Declaration */
extern const BDA_FILTER_TEMPLATE TunerFilterTemplate;
extern const BDA_FILTER_TEMPLATE SkyWalker1CaptureTemplate;
extern const KSFILTER_DESCRIPTOR SkyWalker1TunerFilterDescriptor;
extern const KSFILTER_DESCRIPTOR SkyWalker1CaptureFilterDescriptor;
/* End of External Variable Declaration */
/* Declare Enumerations here */
typedef enum _HARDWARE_STATE {
HardwareStopped = 0,
HardwarePaused,
HardwareRunning
} HARDWARE_STATE, *PHARDWARE_STATE;
/* End of Enumeration declaration */
/* Function Prototypes */
/* End of Function prototype definitions */
#endif // __SKYWALKER1_COMMON_DEF_H

View file

@ -0,0 +1,127 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1Control.cpp
Author :
Date :
Purpose : This File Holds the Device Control related declarations
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
#ifndef __SKYWALKER1_CONTROL_H
#define __SKYWALKER1_CONTROL_H
/* Include the Library and Other header file */
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
/* gp8psk commands */
/* Twinhan Vendor requests */
#define TH_COMMAND_IN 0xC0
#define TH_COMMAND_OUT 0xC1
/* gp8psk commands */
#define GET_8PSK_CONFIG 0x80 /* in */
#define SET_8PSK_CONFIG 0x81
#define I2C_WRITE 0x83
#define I2C_READ 0x84
#define ARM_TRANSFER 0x85
#define TUNE_8PSK 0x86
#define GET_SIGNAL_STRENGTH 0x87 /* in */
#define LOAD_BCM4500 0x88
#define BOOT_8PSK 0x89 /* in */
#define START_INTERSIL 0x8A /* in */
#define SET_LNB_VOLTAGE 0x8B
#define SET_22KHZ_TONE 0x8C
#define SEND_DISEQC_COMMAND 0x8D
#define SET_DVB_MODE 0x8E
#define SET_DN_SWITCH 0x8F
#define GET_SIGNAL_LOCK 0x90 /* in */
#define GET_SERIAL_NUMBER 0x93 /* in */
#define USE_EXTRA_VOLT 0x94
#define CW3K_INIT 0x9d
/* PSK_configuration bits */
#define bm8pskStarted 0x01
#define bm8pskFW_Loaded 0x02
#define bmIntersilOn 0x04
#define bmDVBmode 0x08
#define bm22kHz 0x10
#define bmSEL18V 0x20
#define bmDCtuned 0x40
#define bmArmed 0x80
/* Satellite modulation modes */
#define ADV_MOD_DVB_QPSK 0 /* DVB-S QPSK */
#define ADV_MOD_TURBO_QPSK 1 /* Turbo QPSK */
#define ADV_MOD_TURBO_8PSK 2 /* Turbo 8PSK (also used for Trellis 8PSK) */
#define ADV_MOD_TURBO_16QAM 3 /* Turbo 16QAM (also used for Trellis 8PSK) */
#define ADV_MOD_DCII_C_QPSK 4 /* Digicipher II Combo */
#define ADV_MOD_DCII_I_QPSK 5 /* Digicipher II I-stream */
#define ADV_MOD_DCII_Q_QPSK 6 /* Digicipher II Q-stream */
#define ADV_MOD_DCII_C_OQPSK 7 /* Digicipher II offset QPSK */
#define ADV_MOD_DSS_QPSK 8 /* DSS (DIRECTV) QPSK */
#define ADV_MOD_DVB_BPSK 9 /* DVB-S BPSK */
#define GET_USB_SPEED 0x07
#define USB_SPEED_LOW 0
#define USB_SPEED_FULL 1
#define USB_SPEED_HIGH 2
#define RESET_FX2 0x13
#define FW_VERSION_READ 0x0B
#define VENDOR_STRING_READ 0x0C
#define PRODUCT_STRING_READ 0x0D
#define FW_BCD_VERSION_READ 0x14
#define SEC_VOLTAGE_13 0
#define SEC_VOLTAGE_18 1
#define SEC_TONE_ON 0
#define SEC_TONE_OFF 1
#define SWITCH_ON_TUNER 1
#define SWITCH_OFF_TUNER 0
/* End of Macro Definitions */
/* Global & Static variables Declaration */
/* End of Global & Static variables Declaration */
/* External Variable Declaration */
/* End of External Variable Declaration */
/* Function Prototypes */
NTSTATUS GetSignalStatus( IN PKSDEVICE pKSDeviceObject,
OUT PBOOLEAN pbSignalLockStatus
);
NTSTATUS ReadTunerSignalStrength( IN PKSDEVICE pKSDeviceObject,
OUT PULONG pulSigStrength
);
NTSTATUS SetLnbVoltage(IN PKSDEVICE pKSDeviceObject,
IN UCHAR ucVoltage);
NTSTATUS TuneDevice(IN PKSDEVICE pKSDeviceObject,
IN PBDATUNER_DEVICE_PARAMETER pDeviceParameter);
NTSTATUS SetupTunerPower( IN PKSDEVICE pKSDeviceObject,
IN BOOLEAN bOnOff);
NTSTATUS SetStreamingControl( IN PKSDEVICE pKSDeviceObject,
IN UCHAR ucOnOff);
NTSTATUS SetTunerTone( IN PKSDEVICE pKSDeviceObject,
IN UCHAR ucTone);
NTSTATUS ConfigureTuner(IN PKSDEVICE pKSDeviceObject,
IN PBDATUNER_DEVICE_PARAMETER pNewConfiguration);
NTSTATUS DiseqcCommand( IN PKSDEVICE pKSDeviceObject,
IN PDISEQC_COMMAND pCommand);
/* End of Function prototype definitions */
#endif /*__SKYWALKER1_CONTROL_H*/

View file

@ -0,0 +1,187 @@
/*****************************************************************************
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*/

View file

@ -0,0 +1,109 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1AntennaPin.h
Author :
Date :
Purpose : This File Holds the Extended BDA Definitions
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
#ifndef __SKYWALKER1_EXTENDED_H
#define __SKYWALKER1_EXTENDED_H
/* Include the Library and Other header file */
#if !defined(_KSMEDIA_)
#error KSMEDIA.H must be included before BDAMEDIA.H
#endif // !defined(_KSMEDIA_)
#if !defined(_BDATYPES_)
#error BDATYPES.H must be included before BDAMEDIA.H
#endif // !defined(_BDATYPES_)
#if !defined(_BDAMEDIA_)
#define _BDAMEDIA_
#endif // !defined(_BDAMEDIA_)
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
#define MAX_DISEQC_COMMAND_LENGTH 6
/* Extended Property*/
//Used to extend the feature of the BDA
//{0B5221EB-F4C4-4976-B959-EF74427464D9}
#define STATIC_KSPROPSETID_BdaExtendedProperty \
0x0B5221EB, 0xF4C4, 0x4976, 0xB9, 0x59, 0xEF, 0x74, 0x42, 0x74, 0x64, 0xD9
DEFINE_GUIDSTRUCT("0B5221EB-F4C4-4976-B959-EF74427464D9", KSPROPSETID_BdaExtendedProperty);
#define KSPROPSETID_BdaExtendedProperty DEFINE_GUIDNAMED(KSPROPSETID_BdaExtendedProperty)
/* End of Macro Definitions */
/* Declare Enumerations here */
//Extended Property List
typedef enum __KSPROPERTY_EXTENDED
{
/* DiSEqC Command */
//Used to send the Digital Sattelite Equipment Control (DiSEqC)
//Commands by application
KSPROPERTY_BDA_DISEQC = 0, //Extension Property 1
//Add New Extended Commands Here
}KSPROPERTY_EXTENDED;
//Enumeration can be used during Simple Tone Burst Command
typedef enum enSimpleToneBurst
{
SEC_MINI_A,
SEC_MINI_B
}SIMPLE_TONE_BURST;
/* End of Enumeration declaration */
/* Global & Static variables Declaration */
//DiSEqC Command related Structure definitions
typedef struct __DISEQC_COMMAND
{
UCHAR ucMessage[MAX_DISEQC_COMMAND_LENGTH]; /*
Byte - 0 : Framing,
Byte - 1 : Address,
Byte - 2 : Command,
Byte - 3 : Data[0],
Byte - 4 : Data[1],
Byte - 5 : Data[2]
*/
UCHAR ucMessageLength;/* The Valid values for DiSEqC Command are 3...6
If this value is 1 then the Byte 0 is taken as Simple "Tone Burst" Control
Command */
}DISEQC_COMMAND,*PDISEQC_COMMAND;
//Property that will be used to send the Diseqc command by the application
#define DEFINE_KSPROPERTY_ITEM_BDA_DISEQC(GetHandler, SetHandler)\
DEFINE_KSPROPERTY_ITEM(\
KSPROPERTY_BDA_DISEQC,\
(GetHandler),\
sizeof(KSP_NODE),\
sizeof(DISEQC_COMMAND),\
(SetHandler),\
NULL, 0, NULL, NULL, 0)
/* End of Global & Static variables Declaration */
/* External Variable Declaration */
/* End of External Variable Declaration */
/* Function Prototypes */
/* End of Function prototype definitions */
#endif /*__SKYWALKER1_EXTENDED_H*/

View file

@ -0,0 +1,69 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1Main.h
Author :
Date :
Purpose : Entry point for the Driver
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
#ifndef __SKYWALKER1_MAIN_H
#define __SKYWALKER1_MAIN_H
/* Include the Library and Other header file */
#include <winerror.h>
#include <unknown.h>
#include <ks.h> //Kernel Streaming Driver
#include <ksmedia.h>
#include <bdatypes.h>
#include <bdamedia.h>
#include <atsmedia.h>
#include <bdasup.h>
#include <kcom.h>
#include <ksdebug.h>
#include "SkyWalker1AntennaPin.h"
#include "SkyWalker1CaptureFilter.h"
#include "SkyWalker1CapturePin.h"
#include "SkyWalker1CommonDef.h"
#include "SkyWalker1Control.h"
#include "SkyWalker1Device.h"
#include "SkyWalker1TransportPin.h"
#include "SkyWalker1TunerFilter.h"
#include "SkyWalker1TunerPin.h"
#include "SkyWalker1Extended.h"
extern "C"
{
#include <wdm.h> //For the Mutex
#include <wchar.h> //For the WCHAR and swprintf
#include <stdio.h> //For sprintf() function
#include "SkyWalker1PnP.h" //Header for the PnP related definitions
#include "SkyWalker1USB.h"
#include "SkyWalker1Utility.h"
}
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
/* End of Macro Definitions */
/* Global & Static variables Declaration */
/* End of Global & Static variables Declaration */
/* External Variable Declaration */
/* End of External Variable Declaration */
/* Function Prototypes */
/* End of Function prototype definitions */
#endif /*__SKYWALKER1_MAIN_H*/

View file

@ -0,0 +1,56 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1PnP.h
Author :
Date :
Purpose : PnP IRP Message Handler
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
#ifndef __SKYWALKER1_PNP_H
#define __SKYWALKER1_PNP_H
/* Include the Library and Other header file */
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
/* End of Macro Definitions */
/* Global & Static variables Declaration */
/* End of Global & Static variables Declaration */
/* External Variable Declaration */
/* End of External Variable Declaration */
/* Declare Enumerations here */
/* End of Enumeration declaration */
/* Function Prototypes */
NTSTATUS SkyWalker1AddDevice(IN PKSDEVICE pKSDeviceObject);
VOID SkyWalker1Remove( IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket);
NTSTATUS SkyWalker1Start(IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket,
IN PCM_RESOURCE_LIST pResourceList,
IN PCM_RESOURCE_LIST pCIResourceListTranslated);
VOID SkyWalker1Stop(IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket);
NTSTATUS SkyWalker1QueryStop( IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket);
VOID SkyWalker1SetPower
(
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.
);
/* End of Function prototype definitions */
#endif // __SKYWALKER1_PNP_H

View file

@ -0,0 +1,84 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1TransportPin.h
Author :
Date :
Purpose : This file contains header for the Transport pin on the Tuner
filter.
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
#ifndef __SKYWALKER1_TRANSPORT_PIN_H
#define __SKYWALKER1_TRANSPORT_PIN_H
/* Include the Library and Other header file */
//#include "SkyWalker1CommonDef.h"
#include "SkyWalker1TunerPin.h"
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
/* End of Macro Definitions */
/* Declare Enumerations here */
/* End of Enumeration declaration */
/* Global & Static variables Declaration */
//The Trasport Pin class.
class CTransportPin : public CTunerPin
{
public:
//Define a data intersection handler function for the
//pin (KSPIN_DESCRIPTOR_EX structure).
//Network provider and AVStream use this function
//to connect the output pin with a downstream filter.
static NTSTATUS IntersectDataFormat(
IN PVOID pContext,
IN PIRP pIoRequestPacket,
IN PKSP_PIN Pin,
IN PKSDATARANGE DataRange,
IN PKSDATARANGE MatchingDataRange,
IN ULONG DataBufferSize,
OUT PVOID Data OPTIONAL,
OUT PULONG DataSize
);
static NTSTATUS GetDigitalDemodProperty(
IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
IN PULONG pulProperty
);
static NTSTATUS SetDigitalDemodProperty(
IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
IN PULONG pulProperty
);
//Function to send the Extended BDA Commands to the Tuner
static NTSTATUS SetExtendedProperty(
IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
IN PULONG pulProperty
);
};
/* End of Global & Static variables Declaration */
/* External Variable Declaration */
/* End of External Variable Declaration */
/* Function Prototypes */
/* End of Function prototype definitions */
#endif /*__SKYWALKER1_TRANSPORT_PIN_H*/

View file

@ -0,0 +1,140 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1TunerFilter.h
Author :
Date :
Purpose : Tuner Filter Class Definition
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
#ifndef SKYWALKER1_TUNER_FILTER_H
#define SKYWALKER1_TUNER_FILTER_H
/* Include the Library and Other header file */
#include "SkyWalker1CommonDef.h"
#include "SkyWalker1Device.h"
#include "SkyWalker1Extended.h"
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
/* End of Macro Definitions */
/* Declare Enumerations here */
/* End of Enumeration declaration */
/* Global & Static variables Declaration */
//The Tuner Filter class.
class CTunerFilter
{
public:
//Functions to Create and Close Filter
static NTSTATUS Create( IN OUT PKSFILTER pKSFilter,
IN PIRP pIoRequestPacket);
static NTSTATUS FilterClose( IN OUT PKSFILTER pKSFilter,
IN PIRP pIoRequestPacket);
//KSMETHODSETID_BdaChangeSync pKSFilter change sync methods
static NTSTATUS StartChanges( IN PIRP pIoRequestPacket,
IN PKSMETHOD pKSMethod,
OPTIONAL PVOID pvIgnored);
static NTSTATUS CheckChanges( IN PIRP pIoRequestPacket,
IN PKSMETHOD pKSMethod,
OPTIONAL PVOID pvIgnored);
static NTSTATUS CommitChanges( IN PIRP pIoRequestPacket,
IN PKSMETHOD pKSMethod,
OPTIONAL PVOID pvIgnored);
static NTSTATUS GetChangeState( IN PIRP pIoRequestPacket,
IN PKSMETHOD pKSMethod,
OUT PULONG pulChangeState);
//KSMETHODSETID_BdaDeviceConfiguration Method to modify filter topology.
static NTSTATUS CreateTopology( IN PIRP pIoRequestPacket,
IN PKSMETHOD pKSMethod,
OPTIONAL PVOID pvIgnored);
//pKSFilter Implementation Methods
(class CSkyWalker1Device *) GetDevice()
{
return m_pDevice;
};
NTSTATUS SetDeviceState(KSSTATE NewKsState)
{
m_KsState = NewKsState;
return STATUS_SUCCESS;
};
//Tuner Node Properties
NTSTATUS GetTunerProperty(OUT PBDATUNER_DEVICE_PARAMETER pTunerParameter);
NTSTATUS SetFrequency(IN ULONG ulBdaParameter);
NTSTATUS SetMultiplier(IN ULONG ulBdaParameter);
NTSTATUS SetBandwidth(IN ULONG ulBdaParameter);
NTSTATUS SetPolarity(IN Polarisation NewPolarity);
NTSTATUS SetRange(IN ULONG ulBdaParameter);
NTSTATUS SetTransponder(IN ULONG ulBdaParameter);
NTSTATUS SetLowLOFrequency(IN ULONG ulBdaParameter);
NTSTATUS SetHighLOFrequency(IN ULONG ulBdaParameter);
NTSTATUS SetSwitchFrequency(IN ULONG ulBdaParameter);
//Demodulator Node Properties
NTSTATUS GetDemodProperty(OUT PBDATUNER_DEVICE_PARAMETER pDemodParameter);
NTSTATUS SetModulatorType(IN ModulationType NewModulatorType);
NTSTATUS SetInnerFecType(IN ULONG ulNewInnerFecType);
NTSTATUS SetInnerFecRate(IN BinaryConvolutionCodeRate NewFecRate);
NTSTATUS SetOuterFecType(IN ULONG ulNewOuterFecType);
NTSTATUS SetOuterFecRate(IN BinaryConvolutionCodeRate NewFecRate);
NTSTATUS SetSymbolRate(IN ULONG ulNewSymbolRate);
NTSTATUS SetSpectralInversion(IN SpectralInversion SpecInv);
NTSTATUS SetGuardInterval(IN GuardInterval GuardInt);
NTSTATUS SetTransmissionMode(IN TransmissionMode TransMode);
//Extended Property
NTSTATUS SendDiseqcCommand(IN PDISEQC_COMMAND pDiseqcCommand);
//Function to retrive the Device Status.
NTSTATUS GetStatus(PBDATUNER_DEVICE_STATUS pDeviceStatus);
//Functions to get and release device access
NTSTATUS AcquireResources();
NTSTATUS ReleaseResources();
private:
class CSkyWalker1Device * m_pDevice;
//Filter Resources
KSSTATE m_KsState;
BDA_CHANGE_STATE m_BdaChangeState;
BDATUNER_DEVICE_PARAMETER m_CurResource;
BDATUNER_DEVICE_PARAMETER m_NewResource;
ULONG m_ulResourceID;
BOOLEAN m_fResourceAcquired;
CTunerFilter();
~CTunerFilter();
};
/* End of Global & Static variables Declaration */
/* External Variable Declaration */
/* End of External Variable Declaration */
/* Function Prototypes */
/* End of Function prototype definitions */
#endif /*SKYWALKER1_TUNER_FILTER_H*/

View file

@ -0,0 +1,82 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1TunerPin.h
Author :
Date :
Purpose : This File Holds the Generic Tuner Pin related declarations
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
#ifndef __SKYWALKER1_TUNER_PIN_H
#define __SKYWALKER1_TUNER_PIN_H
/* Include the Library and Other header file */
#include "SkyWalker1CommonDef.h"
#include "SkyWalker1TunerFilter.h"
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
/* End of Macro Definitions */
/* Declare Enumerations here */
/* End of Enumeration declaration */
/* Global & Static variables Declaration */
// The Tuner Pin class.
class CTunerPin
{
public:
//Creates the Pin
static NTSTATUS PinCreate( IN OUT PKSPIN pKSPin,
IN PIRP pIoRequestPacket
);
//Closes the Opened Pin
static NTSTATUS PinClose( IN OUT PKSPIN pKSPin,
IN PIRP pIoRequestPacket
);
//Member Function to get the Various Signal attributes
static NTSTATUS GetSignalStatus(
IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
IN PULONG pulProperty
);
(class CTunerFilter *) GetFilter(void)
{
return m_pFilter;
};
void SetFilter(class CTunerFilter * pFilter)
{
m_pFilter = pFilter;
};
protected:
class CTunerFilter* m_pFilter;
};
/* End of Global & Static variables Declaration */
/* External Variable Declaration */
/* End of External Variable Declaration */
/* Function Prototypes */
/* End of Function prototype definitions */
#endif /*__SKYWALKER1_TUNER_PIN_H*/

View file

@ -0,0 +1,126 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1Usb.h
Author :
Date :
Purpose : This File Holds all the USB Device access related declarations
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
#ifndef __SKYWALKER1_USB_H
#define __SKYWALKER1_USB_H
/* Include the Library and Other header file */
extern "C"
{
//USB Related Headers
#include <initguid.h>
#pragma warning(disable:4200)
#include <usbdi.h>
#include <usbdlib.h>
#include <stdio.h>
#include <usb100.h>
#include "SkyWalker1Device.h"
}
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
#define MAX_BULK_PACKET_SIZE 8 * 512
#define MAX_BULK_TRANSFER_SIZE (TRANSPORT_PACKET_COUNT * TRANSPORT_PACKET_SIZE) //Suppoting max Frame Size
/* End of Macro Definitions */
/* Declare Enumerations here */
typedef enum __USBSTATE {
NotStarted, // not started
Stopped, // device stopped
Working, // started and working
PendingStop, // stop pending
PendingRemove, // remove pending
SurpriseRemoved, // removed by surprise
Removed // removed
}USBSTATE;
typedef enum _QUEUE_STATE {
HoldRequests, // device is not started yet
AllowRequests, // device is ready to process
FailRequests // fail both existing and queued up requests
} QUEUE_STATE;
#define INITIALIZE_PNP_STATE(_Data_) \
(_Data_)->UsbDeviceState = NotStarted;\
(_Data_)->PreviousUsbDeviceState = NotStarted;
#define SET_NEW_PNP_STATE(_Data_, _state_) \
(_Data_)->PreviousUsbDeviceState = (_Data_)->UsbDeviceState;\
(_Data_)->UsbDeviceState = (_state_);
#define RESTORE_PREVIOUS_PNP_STATE(_Data_) \
(_Data_)->UsbDeviceState = (_Data_)->PreviousUsbDeviceState;
/* End of Enumeration declaration */
/* Global & Static variables Declaration */
//BulkUsb Read Write Context
typedef struct _BULKUSB_RW_CONTEXT {
PURB pUSBRequestBlock;
PUCHAR pTransferBuffer;
ULONG ulRemainingByteTransfer; // remaining to xfer
ULONG ulCompletedByteTransfer; // cumulate xfer
ULONG ulStreamIndex;
class CSkyWalker1Device * pDevice;
} BULKUSB_RW_CONTEXT, * PBULKUSB_RW_CONTEXT;
/* End of Global & Static variables Declaration */
/* External Variable Declaration */
/* End of External Variable Declaration */
/* Function Prototypes */
//Usb Access functions
NTSTATUS InitializeUsbDevice(IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoReqestPacket);
NTSTATUS DeconfigureUsbDevice(IN PKSDEVICE pKSDeviceObject);
NTSTATUS StopUsbDevice(IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket);
NTSTATUS ReadWriteUsbDevice(IN PKSDEVICE pKSDeviceObject,
IN ULONG ulStreamIndex,
IN ULONG ulPacketIndex,
IN PUCHAR pucTransferBuffer,
IN ULONG ulTransferLength,
IN BOOLEAN bRead);
NTSTATUS ControlUsbDevice( IN PKSDEVICE pKSDeviceObject,
IN UCHAR ucRequest,
IN USHORT usValue,
IN USHORT usIndex,
IN PUCHAR pucTransferBuffer,
IN ULONG ulTransferLength,
IN BOOLEAN bRead);
NTSTATUS RemoveUsbDevice( IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket);
NTSTATUS SurpriseUsbDeviceRemoval(IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket);
NTSTATUS CancelRemoveUsbDevice(IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket);
NTSTATUS QueryRemoveUsbDevice( IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket);
NTSTATUS QueryStopUsbDevice(IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket);
NTSTATUS CancelStopUsbDevice(IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket);
/* End of Function prototype definitions */
#endif /*__SKYWALKER1_USB_H*/

View file

@ -0,0 +1,91 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1Utility.h
Author :
Date :
Purpose : This file basically holds the Utility related Common Declarations
used in the SkyWalker Driver Module
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
#ifndef SKYWALKER1_UTILITY_H
#define SKYWALKER1_UTILITY_H
/* Include the Library and Other header file */
#include <wdm.h>
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
#define SKYWALKER1_DRIVER_NAME "SkyWalker1TVTuner"
extern int nCurrentDebugLevel;
#define DEBUG_ON
#ifdef DEBUG_ON
#define SkyWalkerDebugPrint(DebugLevel,_ARGUMENTS_) \
if((DebugLevel) <= nCurrentDebugLevel) \
{ \
DbgPrint _ARGUMENTS_; \
}
#else
#define SkyWalkerDebugPrint(DebugLevel,__ARGUMENTS__)
#endif
#define TRUE 1
#define FALSE 0
/* End of Macro Definitions */
/* Global & Static variables Declaration */
/* End of Global & Static variables Declaration */
/* External Variable Declaration */
/* End of External Variable Declaration */
/* Declare Enumerations here */
/* ENUM : enDebugLevels */
/* PURPOSE : To Define Different Debug Levels */
enum enDebugLevels
{
DISABLE_DEBUG = 0,
ENTRY_LEVEL,
INTERMEDIATE_LEVEL,
EXTREME_LEVEL,
};
/* End of Enumeration declaration */
/* Function Prototypes */
void PrintFunctionEntry(IN char * pcFunctionName);
void PrintFunctionExit(IN char * pcFunctionName, IN NTSTATUS ntReturnCode);
char * GetCurrentIrqlString(void);
VOID Delay(IN ULONG ulDelayInMicroSeconds); //To Delay the Execution Thread
NTSTATUS LowerDeviceCompletedIrp(IN PDEVICE_OBJECT pDeviceObject,
IN PIRP pIoRequestPacket,
IN PVOID pContext);
NTSTATUS PassDownIRPAndWaitForCompletion(IN PDEVICE_OBJECT pLowerDeviceObject,
IN PIRP pIoRequestPacket,
IN BOOLEAN bCopyStackLocation);
NTSTATUS PassDownIRPAndForget(IN PDEVICE_OBJECT pLowerDeviceObject,
IN PIRP pIoRequestPacket);
VOID CompleteIrpInDispatch(IN PDEVICE_OBJECT pDeviceObject,
IN PIRP pIoRequestPacket);
PUCHAR NTStatusToString(NTSTATUS Status) ;
VOID PrintDeviceChangeState(IN KSSTATE ToState,IN KSSTATE FromState);
/* End of Function prototype definitions */
#endif /*SKYWALKER1_UTILITY_H*/

View file

@ -0,0 +1,2 @@
USER_INCLUDES=..\Include;..\..
!INCLUDE $(NTMAKEENV)\makefile.def

View file

@ -0,0 +1,546 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1AntennaPin.cpp
Author :
Date :
Purpose : This File Holds the Antenna Pin related declarations
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
/* Include the Library and Other header file */
#include "SkyWalker1Main.h" //Common For all the Definitions,
//Declarations and Library Routines
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
/* End of Macro Definitions */
/* Global & Static variables Declaration */
/* End of Global & Static variables Declaration */
/* External Variable Declaration */
/* End of External Variable Declaration */
/* Declare Enumerations here */
/* End of Enumeration declaration */
/* Function Prototypes */
PCHAR GetTunerPropertyString(ULONG ulTunerProperty);
PCHAR GetTunerLnbPropertyString(ULONG ulTunerLnbProperty);
/* End of Function prototype definitions */
/*****************************************************************************
Function : CAntennaPin::IntersectDataFormat
Description : Enables connection of the input pin with a upstream filter.
IN PARAM :
OUT PARAM : <NTSTATUS> Status of the IntersectDataFormat
PreCondition : None
PostCondtion : None
Logic : NONE
Assumption : NONE
Note : This is called from the PASSIVE_LEVEL_IRQL
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS CAntennaPin::IntersectDataFormat(
IN PVOID pContext,
IN PIRP pIoRequestPacket,
IN PKSP_PIN Pin,
IN PKSDATARANGE pDataRange,
IN PKSDATARANGE pMatchingDataRange,
IN ULONG ulDataBufferSize,
OUT PVOID pData OPTIONAL,
OUT PULONG pulDataSize
)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
PrintFunctionEntry(__FUNCTION__);
if ( ulDataBufferSize < sizeof(KS_DATARANGE_BDA_ANTENNA) )
{
*pulDataSize = sizeof( KS_DATARANGE_BDA_ANTENNA );
ntStatus = STATUS_BUFFER_OVERFLOW;
goto ExitDataFormat;
}
else if (pDataRange->FormatSize < sizeof (KS_DATARANGE_BDA_ANTENNA))
{
ntStatus = STATUS_NO_MATCH;
goto ExitDataFormat;
}
else
{
*pulDataSize = sizeof( KS_DATARANGE_BDA_ANTENNA );
RtlCopyMemory( pData, (PVOID)pDataRange, sizeof(KS_DATARANGE_BDA_ANTENNA));
ntStatus = STATUS_SUCCESS;
}
ExitDataFormat:
PrintFunctionExit(__FUNCTION__,ntStatus);
return ntStatus;
}
/*****************************************************************************
Function : CAntennaPin::PinSetDeviceState
Description : An AVStream minidriver's AVStrMiniPinSetDeviceState
routine is called when the state of a KSPIN structure is
changed due to the arrival of a connection state property
'set' IOCTL. Typically, this will be provided by minidrivers
that need to change the state of hardware.
The KSSTATE enumeration lists possible states of a kernel
streaming object.
typedef enum {
KSSTATE_STOP;
KSSTATE_ACQUIRE;
KSSTATE_PAUSE;
KSSTATE_RUN;
} KSSTATE;
Enumerators
KSSTATE_STOP
Indicates that the object is in minimum resource consumption mode.
KSSTATE_ACQUIRE
Indicates that the object is acquiring resources.
KSSTATE_PAUSE
Indicates that the object is preparing to make instant transition to Run state.
KSSTATE_RUN
Indicates that the object is actively streaming.
Because the most upstream pin (input pin) is the last
to transition, use this pin's state to set the state
of the filter.
Also, release filter resouces if the pin's state
transitions to stop, and acquire resources if the pin's
state transitions from stop.
IN PARAM : <PKSPIN> Pointer to the KSPIN structure for which state is changing.
<KSSTATE> The target KSSTATE after receipt of the IOCTL.
<KSSTATE> The previous KSSTATE.
OUT PARAM : <NTSTATUS> Status of the PinSetDeviceState
PreCondition : None
PostCondtion : None
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS CAntennaPin::PinSetDeviceState(
IN PKSPIN pKSPin,
IN KSSTATE ToState,
IN KSSTATE FromState
)
{
NTSTATUS ntSetStatus = STATUS_SUCCESS;
PKSDEVICE pKSDevice = NULL;
CAntennaPin * pPin = NULL;
CSkyWalker1Device * pDevice = NULL;
PrintFunctionEntry(__FUNCTION__);
//Obtain a pointer to the device object from
//the passed in pointer to the KSPIN structure.
pKSDevice = KsPinGetDevice( pKSPin);
//Obtain a pointer to the pin object from context member of
//the passed in pointer to the KSPIN structure.
pPin = reinterpret_cast<CAntennaPin*>(pKSPin->Context);
//Obtain a pointer to the device object from context member of
//the retrieved pointer to the KSDEVICE structure.
pDevice = reinterpret_cast<CSkyWalker1Device *>(pKSDevice->Context);
pPin->m_pFilter->SetDeviceState( pPin->m_KsState);
if ((ToState == KSSTATE_STOP) && (FromState != KSSTATE_STOP))
{
//Because the driver allocates resources on a filter wide basis,
//inform the filter to release resources when the last pin
//(that is, the most upstream pin) transitions to the stop state.
//
//The input pin is the last pin to transition to the stop state,
//therefore inform the filter to release its resources.
//
ntSetStatus = pPin->m_pFilter->ReleaseResources();
pPin->m_KsState = ToState;
}
else if ((ToState == KSSTATE_ACQUIRE) && (FromState == KSSTATE_STOP))
{
//Because the driver allocates resources on a filter wide basis,
//inform the filter to acquire resources when the last pin
//(that is, the most upstream pin) transitions from the stop state.
//
//The input pin is the last pin to transition from the stop state,
//therefore inform the filter to acquire its resources.
//
ntSetStatus = pPin->m_pFilter->AcquireResources();
if (NT_SUCCESS( ntSetStatus))
{
pPin->m_KsState = ToState;
}
}
else if (ToState > KSSTATE_RUN)
{
SkyWalkerDebugPrint(EXTREME_LEVEL,
("Invalid Device State. ToState 0x%08x. FromState 0x%08x.",
ToState, FromState));
ntSetStatus = STATUS_INVALID_PARAMETER;
}
else
{
pPin->m_KsState = ToState;
}
PrintDeviceChangeState(ToState,FromState);
PrintFunctionExit(__FUNCTION__,ntSetStatus);
return ntSetStatus;
}
/*****************************************************************************
Function : CAntennaPin::GetTunerProperty
Description : Retrieves the value of the Tuner node Properties
IN PARAM : IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
OUT PULONG pulProperty
OUT PARAM : <NTSTATUS> Status SUCCESS in case Valid Property request
STATUS_INVALID_PARAMETER in case of Invalid property request
Else error from the lower device
PreCondition : None
PostCondtion : Tuner propery read in case of successful execution
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS CAntennaPin::GetTunerProperty(
IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
OUT PULONG pulProperty
)
{
NTSTATUS ntGetStatus = STATUS_SUCCESS;
CAntennaPin * pPin = NULL;
CTunerFilter* pFilter = NULL;
BDATUNER_DEVICE_PARAMETER TunerProperty;
PrintFunctionEntry(__FUNCTION__);
//Call the BDA support library to
//validate that the node type is associated with the pin.
//The BdaValidateNodeProperty function validates that a node property
//request is associated with a specific pin.
ntGetStatus = BdaValidateNodeProperty( pIoRequestPacket, pKSProperty);
if (NT_SUCCESS( ntGetStatus))
{
//Obtain a pointer to the pin object.
//Because the property dispatch table calls the CAntennaPin::GetTunerProperty()
//method directly, the method must retrieve a pointer to the underlying pin object.
pPin = reinterpret_cast<CAntennaPin *>(KsGetPinFromIrp(pIoRequestPacket)->Context);
//Retrieve the filter context from the pin context.
pFilter = pPin->GetFilter();
ntGetStatus = pFilter->GetTunerProperty(&TunerProperty);
//Retrieve the actual filter parameter.
switch (pKSProperty->Id)
{
case KSPROPERTY_BDA_RF_TUNER_FREQUENCY:
*pulProperty = TunerProperty.ulCarrierFrequency;
break;
case KSPROPERTY_BDA_RF_TUNER_FREQUENCY_MULTIPLIER:
*pulProperty = TunerProperty.ulFrequencyMultiplier;
break;
case KSPROPERTY_BDA_RF_TUNER_BANDWIDTH:
*pulProperty = TunerProperty.ulBandWidth;
break;
case KSPROPERTY_BDA_RF_TUNER_POLARITY:
*pulProperty = TunerProperty.Polarity;
break;
case KSPROPERTY_BDA_RF_TUNER_RANGE:
*pulProperty = TunerProperty.ulRange;
break;
case KSPROPERTY_BDA_RF_TUNER_TRANSPONDER:
*pulProperty = TunerProperty.ulTransponder;
break;
default:
ntGetStatus = STATUS_INVALID_PARAMETER;
break;
}
}
SkyWalkerDebugPrint(EXTREME_LEVEL,("Get : %s : %ul",GetTunerPropertyString(pKSProperty->Id),*pulProperty));
PrintFunctionExit(__FUNCTION__,ntGetStatus);
return ntGetStatus;
}
/*****************************************************************************
Function : CAntennaPin::SetTunerProperty
Description : Sets the value of the Tuner node Freq. Properties
IN PARAM : IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
OUT PULONG pulProperty
OUT PARAM : <NTSTATUS> Status SUCCESS in case Valid Property request
STATUS_INVALID_PARAMETER in case of Invalid property request
Else error from the lower device
PreCondition : None
PostCondtion : Tuner Freq. property read in case of successful execution
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS CAntennaPin::SetTunerProperty(
IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
IN PULONG pulProperty
)
{
NTSTATUS ntSetStatus = STATUS_SUCCESS;
CAntennaPin * pPin;
CTunerFilter* pFilter;
PrintFunctionEntry(__FUNCTION__);
//Call the BDA support library to
//validate that the node type is associated with the pin.
//The BdaValidateNodeProperty function validates that a node property
//request is associated with a specific pin.
ntSetStatus = BdaValidateNodeProperty( pIoRequestPacket, pKSProperty);
if (NT_SUCCESS( ntSetStatus))
{
//Obtain a pointer to the pin object.
//Because the property dispatch table calls the CAntennaPin::SetTunerProperty()
//method directly, the method must retrieve a pointer to the underlying pin object.
pPin = reinterpret_cast<CAntennaPin *>(KsGetPinFromIrp(pIoRequestPacket)->Context);
//Retrieve the filter context from the pin context.
pFilter = pPin->GetFilter();
SkyWalkerDebugPrint(EXTREME_LEVEL,("Set : %s : %lu\n",
GetTunerPropertyString(pKSProperty->Id),
*pulProperty));
//Retrieve the actual filter parameter.
switch (pKSProperty->Id)
{
case KSPROPERTY_BDA_RF_TUNER_FREQUENCY:
ntSetStatus = pFilter->SetFrequency(*pulProperty);
break;
case KSPROPERTY_BDA_RF_TUNER_FREQUENCY_MULTIPLIER:
ntSetStatus = pFilter->SetMultiplier(*pulProperty);
break;
case KSPROPERTY_BDA_RF_TUNER_BANDWIDTH:
ntSetStatus = pFilter->SetBandwidth(*pulProperty);
break;
case KSPROPERTY_BDA_RF_TUNER_POLARITY:
ntSetStatus = pFilter->SetPolarity((Polarisation) *pulProperty);
break;
case KSPROPERTY_BDA_RF_TUNER_RANGE:
ntSetStatus = pFilter->SetRange(*pulProperty);
break;
case KSPROPERTY_BDA_RF_TUNER_TRANSPONDER:
ntSetStatus = pFilter->SetTransponder(*pulProperty);
break;
default:
ntSetStatus = STATUS_INVALID_PARAMETER;
break;
}
}
PrintFunctionExit(__FUNCTION__,ntSetStatus);
return ntSetStatus;
}
/*****************************************************************************
Function : CAntennaPin::GetTunerLnbProperty
Description : Retrieves the value of the Tuner Lnb node Properties
IN PARAM : IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
OUT PULONG pulProperty
OUT PARAM : <NTSTATUS> Status SUCCESS in case Valid Property request
STATUS_INVALID_PARAMETER in case of Invalid property request
Else error from the lower device
PreCondition : None
PostCondtion : Tuner lnb propery read in case of successful execution
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS CAntennaPin::GetTunerLnbProperty(
IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
OUT PULONG pulProperty
)
{
NTSTATUS ntGetStatus = STATUS_SUCCESS;
CAntennaPin * pPin;
CTunerFilter* pFilter;
BDATUNER_DEVICE_PARAMETER LnbProperty;
PrintFunctionEntry(__FUNCTION__);
//Call the BDA support library to
//validate that the node type is associated with the pin.
//The BdaValidateNodeProperty function validates that a node property
//request is associated with a specific pin.
ntGetStatus = BdaValidateNodeProperty( pIoRequestPacket, pKSProperty);
if (NT_SUCCESS( ntGetStatus))
{
//Obtain a pointer to the pin object.
//Because the property dispatch table calls the CAntennaPin::GetTunerProperty()
//method directly, the method must retrieve a pointer to the underlying pin object.
pPin = reinterpret_cast<CAntennaPin *>(KsGetPinFromIrp(pIoRequestPacket)->Context);
//Retrieve the filter context from the pin context.
pFilter = pPin->GetFilter();
ntGetStatus = pFilter->GetTunerProperty(&LnbProperty);
//Retrieve the actual filter parameter.
switch (pKSProperty->Id)
{
case KSPROPERTY_BDA_LNB_LOF_LOW_BAND:
*pulProperty = LnbProperty.ulLnbLowLOFrequency;
break;
case KSPROPERTY_BDA_LNB_LOF_HIGH_BAND:
*pulProperty = LnbProperty.ulLnbHighLOFrequency;
break;
case KSPROPERTY_BDA_LNB_SWITCH_FREQUENCY:
*pulProperty = LnbProperty.ulLnbSwitchFrequency;
break;
default:
ntGetStatus = STATUS_INVALID_PARAMETER;
break;
}
}
SkyWalkerDebugPrint(EXTREME_LEVEL,("Get : %s : %ul",GetTunerLnbPropertyString(pKSProperty->Id),*pulProperty));
PrintFunctionExit(__FUNCTION__,ntGetStatus);
return ntGetStatus;
}
/*****************************************************************************
Function : CAntennaPin::SetTunerLnbProperty
Description : Sets the value of the Tuner Lnb node Properties
IN PARAM : IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
IN PULONG pulProperty
OUT PARAM : <NTSTATUS> Status SUCCESS in case Valid Property request
STATUS_INVALID_PARAMETER in case of Invalid property request
Else error from the lower device
PreCondition : None
PostCondtion : Tuner propery Set in case of successful execution
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS CAntennaPin::SetTunerLnbProperty(
IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
IN PULONG pulProperty
)
{
NTSTATUS ntSetStatus = STATUS_SUCCESS;
CAntennaPin * pPin;
CTunerFilter* pFilter;
PrintFunctionEntry(__FUNCTION__);
//Call the BDA support library to
//validate that the node type is associated with the pin.
//The BdaValidateNodeProperty function validates that a node property
//request is associated with a specific pin.
ntSetStatus = BdaValidateNodeProperty( pIoRequestPacket, pKSProperty);
if (NT_SUCCESS( ntSetStatus))
{
//Obtain a pointer to the pin object.
//Because the property dispatch table calls the CAntennaPin::SetTunerProperty()
//method directly, the method must retrieve a pointer to the underlying pin object.
pPin = reinterpret_cast<CAntennaPin *>(KsGetPinFromIrp(pIoRequestPacket)->Context);
//Retrieve the filter context from the pin context.
pFilter = pPin->GetFilter();
SkyWalkerDebugPrint(EXTREME_LEVEL,("Set : %s : %lu(%l)",
GetTunerLnbPropertyString(pKSProperty->Id),
*pulProperty,
*((LONG*)(pulProperty))));
//Retrieve the actual filter parameter.
switch (pKSProperty->Id)
{
case KSPROPERTY_BDA_LNB_LOF_LOW_BAND:
ntSetStatus = pFilter->SetLowLOFrequency(*pulProperty);
break;
case KSPROPERTY_BDA_LNB_LOF_HIGH_BAND:
ntSetStatus = pFilter->SetHighLOFrequency(*pulProperty);
break;
case KSPROPERTY_BDA_LNB_SWITCH_FREQUENCY:
ntSetStatus = pFilter->SetSwitchFrequency(*pulProperty);
break;
default:
ntSetStatus = STATUS_INVALID_PARAMETER;
break;
}
}
PrintFunctionExit(__FUNCTION__,ntSetStatus);
return ntSetStatus;
}
PCHAR GetTunerPropertyString(ULONG ulTunerProperty)
{
switch(ulTunerProperty)
{
case KSPROPERTY_BDA_RF_TUNER_FREQUENCY:
return "KSPROPERTY_BDA_RF_TUNER_FREQUENCY";
case KSPROPERTY_BDA_RF_TUNER_POLARITY:
return "KSPROPERTY_BDA_RF_TUNER_POLARITY";
case KSPROPERTY_BDA_RF_TUNER_RANGE:
return "KSPROPERTY_BDA_RF_TUNER_RANGE";
case KSPROPERTY_BDA_RF_TUNER_TRANSPONDER:
return "KSPROPERTY_BDA_RF_TUNER_TRANSPONDER";
case KSPROPERTY_BDA_RF_TUNER_BANDWIDTH:
return "KSPROPERTY_BDA_RF_TUNER_BANDWIDTH";
case KSPROPERTY_BDA_RF_TUNER_FREQUENCY_MULTIPLIER:
return "KSPROPERTY_BDA_RF_TUNER_FREQUENCY_MULTIPLIER";
default:
return "KSPROPERTY_BDA_INVALID_PROPERTY";
}
}
PCHAR GetTunerLnbPropertyString(ULONG ulTunerLnbProperty)
{
switch(ulTunerLnbProperty)
{
case KSPROPERTY_BDA_LNB_LOF_LOW_BAND:
return "KSPROPERTY_BDA_LNB_LOF_LOW_BAND";
case KSPROPERTY_BDA_LNB_LOF_HIGH_BAND:
return "KSPROPERTY_BDA_LNB_LOF_HIGH_BAND";
case KSPROPERTY_BDA_LNB_SWITCH_FREQUENCY:
return "KSPROPERTY_BDA_LNB_SWITCH_FREQUENCY";
default:
return "KSPROPERTY_BDA_INVALID_PROPERTY";
}
}

View file

@ -0,0 +1,165 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1CaptureFilter.cpp
Author :
Date :
Purpose : This file contains the filter level header for the
capture filter.
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
/* Include the Library and Other header file */
#include "SkyWalker1Main.h" //Main Header file
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
/* End of Macro Definitions */
/* Global & Static variables Declaration */
/* 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 */
/*****************************************************************************
Function : CCaptureFilter
Description : Constructor of the CCaptureFilter Class
The capture filter object constructor. Since the new operator will
have zeroed the memory, do not bother initializing any NULL or 0
fields.Only initialize non-NULL, non-0 fields.
IN PARAM : <PKSFILTER> Filter
OUT PARAM : NONE
PreCondition : Filter Object is not created
PostCondtion : Filter Object is created and Initialzed on successful execution
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
CCaptureFilter::CCaptureFilter(IN PKSFILTER pKSFilter) :
m_Filter (pKSFilter)
{
}
/*****************************************************************************
Function : CCaptureFilter
Description : Destructor of the CCaptureFilter Class
Destroys the filter object
IN PARAM : NONE
OUT PARAM : NONE
PreCondition : Filter Object is created
PostCondtion : Filter Object is Removed and Memory freed
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
CCaptureFilter::~CCaptureFilter()
{
}
/*****************************************************************************
Function : CCaptureFilter::Cleanup()
Description : This is the bag cleanup callback for the CCaptureFilter.
Destroys the filter object
IN PARAM : <CCaptureFilter> Reference to the current Object
OUT PARAM : NONE
PreCondition : Filter Object is created
PostCondtion : Filter Object is Removed and Memory freed
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
void CCaptureFilter::Cleanup (IN CCaptureFilter *pFilter)
{
delete pFilter;
}
/*****************************************************************************
Function : CCaptureFilter::Create()
Description : It creates the CCaptureFilter object, associates it with
the AVStream filter object, and bag the CCaptureFilter
for later cleanup.
IN PARAM : <PKSFILTER > Pointer to KSFILTER that just created
<PIRP> Pointer to IRP_MJ_CREATE for Filter
OUT PARAM : <NTSTATUS> Status of the Filter Create routine
STATUS_SUCCESS on Routine success
Else Error code from the attempt to create the Filter
PreCondition : Filter is not created
PostCondtion : Filter is created and Initialzed on successful execution
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
STDMETHODIMP_(NTSTATUS) CCaptureFilter::Create( IN OUT PKSFILTER pKSFilter,
IN PIRP pIoRequestPacket)
{
NTSTATUS ntFilterCreationStatus = STATUS_SUCCESS;
ULONG ulPinId; // just useful when no network provider is present
PKSDEVICE pKSDeviceObject = NULL;
CSkyWalker1Device * pDevice = NULL;
PrintFunctionEntry(__FUNCTION__);
//Create a filter object for the filter instance.
CCaptureFilter* pFilter = new(NonPagedPool,CAPTURE_MEM_TAG) CCaptureFilter(pKSFilter); // Tags the allocated memory
if (!IS_VALID(pFilter))
{
//Exit if the Filter Memory could not be allocated
ntFilterCreationStatus = STATUS_INSUFFICIENT_RESOURCES;
goto ErrorFilterCreate;
}
else
{
// Add the item to the object bag if we we were successful.
// Whenever the filter closes, the bag is cleaned up and we will be
// freed.
//
ntFilterCreationStatus = KsAddItemToObjectBag (
pKSFilter -> Bag,
reinterpret_cast <PVOID> (pFilter),
reinterpret_cast <PFNKSFREE> (CCaptureFilter::Cleanup)
);
if (!NT_SUCCESS (ntFilterCreationStatus))
{
goto ErrorFilterCreate;
}
else
{
pKSFilter->Context = reinterpret_cast <PVOID> (pFilter);
}
}
CompleteFilterCreate :
PrintFunctionExit(__FUNCTION__,ntFilterCreationStatus);
return ntFilterCreationStatus;
ErrorFilterCreate:
if (IS_VALID(pFilter))
{
delete pFilter;
}
goto CompleteFilterCreate;
}

View file

@ -0,0 +1,336 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1CaptureFilterDefinitions.cpp
Author :
Date :
Purpose : Capture Filter Definition
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
/* Include the Library and Other header file */
#include "SkyWalker1Main.h" //Main Header file
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
/* End of Macro Definitions */
/* Global & Static variables Declaration */
const KSPIN_DISPATCH CaptureInputPinDispatch={
/* Create */ CCapturePin::PinCreate,
/* Close */ NULL,
/* Process */ NULL,
/* Reset */ NULL,
/* SetDataFormat */ NULL,
/* SetDeviceState */ NULL,
/* Connect */ NULL,
/* Disconnect */ NULL,
/* Allocator */ NULL
};
DEFINE_KSAUTOMATION_TABLE(NullAutomation) {
DEFINE_KSAUTOMATION_PROPERTIES_NULL,
DEFINE_KSAUTOMATION_METHODS_NULL,
DEFINE_KSAUTOMATION_EVENTS_NULL
};
//The list of category GUIDs for the capture filter.
const GUID SkyWalker1CaptureCatagories [] = {
STATICGUIDOF (KSCATEGORY_BDA_RECEIVER_COMPONENT)
};
//Medium GUIDs for the Transport Output Pin.
//
//Pin Medium descriptor containing all medium accepted to be connected to
//the tuner output pin.This insures contection to the correct Capture Filter pin.
//
//{2AEB4A94-FBB7-4FB1-8D74-243B91886EAB}
const KSPIN_MEDIUM TransportPinMediums[] =
{
{
GUID_SKYWALKER_TUNER_OUT_MEDIUM,
0,
0
}
};
//
//This is the data range description of the capture input pin.
//This is same as the Outpin of the Tuner i.e. The Transport Pin
//The Output of the Tuner is given to the Capture thus it has to
//be same
//
const KS_DATARANGE_BDA_TRANSPORT FormatCaptureIn =
{
//insert the KSDATARANGE and KSDATAFORMAT here
{
sizeof( KS_DATARANGE_BDA_TRANSPORT), //FormatSize
0, //Flags - (N/A)
0, //SampleSize - (N/A)
0, //Reserved
{ STATIC_KSDATAFORMAT_TYPE_STREAM }, //MajorFormat
{ STATIC_KSDATAFORMAT_TYPE_MPEG2_TRANSPORT }, //SubFormat
{ STATIC_KSDATAFORMAT_SPECIFIER_BDA_TRANSPORT } //Specifier
},
//insert the BDA_TRANSPORT_INFO here
{
TRANSPORT_PACKET_SIZE, //ulcbPhyiscalPacket
TRANSPORT_PACKET_COUNT*TRANSPORT_PACKET_SIZE, //ulcbPhyiscalFrame
0, //ulcbPhyiscalFrameAlignment (no requirement)
0 //AvgTimePerFrame (not known)
}
};
const PKSDATARANGE CaptureInPinDataRanges[]={
(PKSDATARANGE)&FormatCaptureIn,
};
//Capture Outout Pin Definitions
const KSPIN_DISPATCH CaptureOutputPinDispatch={
/* Create */ CCapturePin::PinCreate,
/* Close */ NULL,
/* Process */ CCapturePin::DispatchProcess,
/* Reset */ NULL,
/* SetDataFormat */ NULL,
/* SetDeviceState */ CCapturePin::DispatchSetState,
/* Connect */ NULL,
/* Disconnect */ NULL,
/* Allocator */ NULL
};
//
//This is the data range description of the capture output pin.
//
const KSDATARANGE FormatCaptureOut =
{
//insert the KSDATARANGE and KSDATAFORMAT here
{
sizeof( KSDATARANGE), //FormatSize
0, //Flags - (N/A)
TRANSPORT_PACKET_COUNT*TRANSPORT_PACKET_SIZE, //SampleSize
0, //Reserved
{ STATIC_KSDATAFORMAT_TYPE_STREAM }, //MajorFormat
{ STATIC_KSDATAFORMAT_SUBTYPE_BDA_MPEG2_TRANSPORT },//SubFormat
{ STATIC_KSDATAFORMAT_SPECIFIER_NONE } //Specifier
}
};
const PKSDATARANGE CaptureOutPinDataRanges[]={
(PKSDATARANGE)&FormatCaptureOut,
};
//
//CapturePinAllocatorFraming:
//
//This is the simple framing structure for the capture pin. Note that this
//will be modified via KsEdit when the actual capture format is determined.
//
DECLARE_SIMPLE_FRAMING_EX (
CapturePinAllocatorFraming, //FramingExName
STATICGUIDOF (KSMEMORY_TYPE_KERNEL_NONPAGED), //MemoryType
KSALLOCATOR_REQUIREMENTF_SYSTEM_MEMORY |
KSALLOCATOR_REQUIREMENTF_PREFERENCES_ONLY, //Flags
NUMBER_OF_FRAMES, //Frames
0, //Alignment
TRANSPORT_PACKET_COUNT*TRANSPORT_PACKET_SIZE, //MinFrameSize
TRANSPORT_PACKET_COUNT*TRANSPORT_PACKET_SIZE //MaxFrameSize
);
/**********************************************************************************/
//Not Supporting Filter Methods,Properties and Events
DEFINE_KSAUTOMATION_TABLE(SkyWalker1CaptureAutomationTable)
{
DEFINE_KSAUTOMATION_PROPERTIES_NULL,
DEFINE_KSAUTOMATION_METHODS_NULL,
DEFINE_KSAUTOMATION_EVENTS_NULL
};
/**********************************************************************************/
//
//CaptureFilterDispatch:
//
//This is the dispatch table for the capture filter. It provides notification
//of creation, closure, processing (for filter-centrics, not for the capture
//filter), and resets (for filter-centrics, not for the capture filter).
//
const KSFILTER_DISPATCH SkyWalker1CaptureDispatchTable =
{
/* Create */ CCaptureFilter::Create, //Routine called when the Filter is created
/* Close */ NULL, //Routine called when the Filter is closed
/* Process */ NULL,
/* Reset */ NULL
};
//
//Capture Pin Descriptors
//
//This data structure defines the pin types available in the filters
//template topology. These structures will be used to create a
//KDPinFactory for a pin type when BdaCreatePin or BdaMethodCreatePin
//are called.
//
//This structure defines ALL pins the filter is capable of supporting,
//including those pins which may only be created dynamically by a ring
//3 component such as a Network Provider.
//The list of pin descriptors on the capture filter.
const KSPIN_DESCRIPTOR_EX SkyWalker1CapturePinDescriptors[]={
{ //Capture Filter input pin
&CaptureInputPinDispatch, //Dispatch Table
&NullAutomation, //Automation Table
{
0, //Interfaces
NULL,
SIZEOF_ARRAY(TransportPinMediums), //Medium Count
TransportPinMediums, //Medium
SIZEOF_ARRAY(CaptureInPinDataRanges), //Range Count
CaptureInPinDataRanges, //Ranges
KSPIN_DATAFLOW_IN, //Specifies that data flow is into the pin
KSPIN_COMMUNICATION_BOTH, //Specifies that the pin factory instantiates pins
//that are both IRP sinks and IRP sources
(GUID *) &PINNAME_BDA_TRANSPORT, //Category GUID
(GUID *) &PINNAME_BDA_TRANSPORT, //GUID of the localized Unicode string
0
},
KSPIN_FLAG_DO_NOT_USE_STANDARD_TRANSPORT|
KSPIN_FLAG_FRAMES_NOT_REQUIRED_FOR_PROCESSING|
KSPIN_FLAG_FIXED_FORMAT,
1, //Maximum Possible Instances of the Pin
1, //Mandatory Instances of this for the Filter function
NULL,//Allocator Framing
NULL //Data Interaction Handler
},
{ //Capture Filter output pin
&CaptureOutputPinDispatch, //Dispatch Table
&NullAutomation, //Automation Table
{
NULL,
0,
NULL,
0,
SIZEOF_ARRAY(CaptureOutPinDataRanges), //Range Count
CaptureOutPinDataRanges,
KSPIN_DATAFLOW_OUT, //Specifies that data flow is out of the pin
KSPIN_COMMUNICATION_BOTH,//Specifies that the pin factory instantiates pins
//that are both IRP sinks and IRP sources
(GUID *) &PINNAME_BDA_TRANSPORT, //Category GUID
(GUID *) &PINNAME_BDA_TRANSPORT, //GUID of the localized Unicode string
0
},
#if !defined(_BUILD_SW_TUNER_ON_X64)
KSPIN_FLAG_GENERATE_MAPPINGS | //Pin Flags
#endif
KSPIN_FLAG_PROCESS_IN_RUN_STATE_ONLY,
1,//Maximum Possible Instances of the Pin
1,//Mandatory Instances of this for the Filter function
&CapturePinAllocatorFraming,
NULL
},
};
/*****************************************************************************************/
//Define BDA Template Topology Connections
//
//Lists the Connections that are possible between pin types and
//node types. This, together with the Template Filter Descriptor, and
//the Pin Pairings, describe how topologies can be created in the filter.
//
// =================
//TransportPin ----| Capture Filter |
// =================
//
//The Capture Filter is controlled by the Transport input pin.
//Capture Filter properties will be set as NODE properties (with NodeType == 0)
//on the filter's Tranport Pin
//
const KSTOPOLOGY_CONNECTION SkyWalker1CaptureConnections[]={
{KSFILTER_NODE, 0, KSFILTER_NODE, KSNODEPIN_STANDARD_IN}, //Transport pin -> Capture Filter pin 0
};
/*****************************************************************************************/
//Define the Filter Factory Descriptor for the filter
//This structure brings together all of the structures that define
//the tuner filter as it appears when it is first instantiated.
//Note that not all of the template pin and node types may be exposed as
//pin and node factories when the filter is first instanciated.
//The KSFILTER_DESCRIPTOR structure describes the characteristics of a filter created by a given filter factory.
DEFINE_KSFILTER_DESCRIPTOR(SkyWalker1CaptureFilterDescriptor)
{
&SkyWalker1CaptureDispatchTable, //Dispatch (Filter Specific Driver)
NULL, //AutomationTable
KSFILTER_DESCRIPTOR_VERSION, //Version
0, //Flags
&SKYWALKER_CAPTURE_FILTER, //ReferenceGuid
DEFINE_KSFILTER_PIN_DESCRIPTORS(SkyWalker1CapturePinDescriptors),
//PinDescriptorsCount; must expose at least one pin
//PinDescriptorSize; size of each item
//PinDescriptors; table of pin descriptors
DEFINE_KSFILTER_CATEGORY(KSCATEGORY_BDA_RECEIVER_COMPONENT),
//CategoriesCount; number of categories in the table
//Categories; table of categories
DEFINE_KSFILTER_NODE_DESCRIPTORS_NULL,
//NodeDescriptorsCount;
//NodeDescriptorSize;
//NodeDescriptors;
DEFINE_KSFILTER_CONNECTIONS(SkyWalker1CaptureConnections),
//Automatically fills in the connections table for a filter which defines no explicit connections
//ConnectionsCount; number of connections in the table
//Connections; table of connections
NULL //ComponentId;
};
//Array of BDA_PIN_PAIRING structures that are used to determine
//which nodes get duplicated when more than one output pin type is
//connected to a single input pin type or when more that one input pin
//type is connected to a single output pin type.
//
const BDA_PIN_PAIRING SkyWalker1CapturePinPairings[] =
{
//Input pin to Output pin Topology Joints
//
{
0, //ulInputPin; 0 element in the TemplatePinDescriptors array.
1, //ulOutputPin; 1 element in the TemplatePinDescriptors array.
1, //ulcMaxInputsPerOutput
1, //ulcMinInputsPerOutput
1, //ulcMaxOutputsPerInput
1, //ulcMinOutputsPerInput
0, //ulcTopologyJoints
NULL //pTopologyJoints; array of joints
}
//If applicable, list topology of joints between other pins.
//
};
//BDA_FILTER_TEMPLATE structure describes the template topology for BDA Driver
const BDA_FILTER_TEMPLATE SkyWalker1CaptureTemplate =
{
&SkyWalker1CaptureFilterDescriptor,//Pointer to KS_FILTER_DESCRIPTOR which describes the Filter for BDA Device
SIZEOF_ARRAY(SkyWalker1CapturePinPairings), //Number of PAIRS of pins in BDA_PIN_PAIRING Array
SkyWalker1CapturePinPairings //Array of Pin Pairing describes topology between a pair of Filter's Input and Output Pins
};
/* 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 */

View file

@ -0,0 +1,693 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1CapturePin.cpp
Author :
Date :
Purpose : This file contains header for the video capture pin on
the capture filter.
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
/* Include the Library and Other header file */
#include "SkyWalker1Main.h" //Common For all the Definitions,
//Declarations and Library Routines
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
/* End of Macro Definitions */
/* Global & Static variables Declaration */
/* End of Global & Static variables Declaration */
/* External Variable Declaration */
/* End of External Variable Declaration */
/* Declare Enumerations here */
/* End of Enumeration declaration */
/* Function Prototypes */
VOID PrintStream(IN PKSSTREAM_POINTER pStreamPointer);
/* End of Function prototype definitions */
/*****************************************************************************
Function : CCapturePin
Description : Constructor of the CCapturePin Class
IN PARAM : NONE
OUT PARAM : NONE
PreCondition : pKSPin Object is not created
PostCondtion : pKSPin Object is created and Initialzed on successful execution
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
CCapturePin::CCapturePin(IN PKSPIN pKSPin) :
m_Pin (pKSPin)
{
PKSDEVICE pKSDevice = KsPinGetDevice (pKSPin);
PrintFunctionEntry(__FUNCTION__);
//Set up our device pointer. This gives us access to "Hardware I/O"
//during the capture routines.
m_Device = reinterpret_cast <CSkyWalker1Device *> (pKSDevice->Context);
PrintFunctionExit(__FUNCTION__,STATUS_SUCCESS);
}
/*****************************************************************************
Function : CCapturePin
Description : Destructor of the CCapturePin Class
IN PARAM : NONE
OUT PARAM : NONE
PreCondition : pKSPin Object is created
PostCondtion : pKSPin Object is Removed and Memory freed
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
CCapturePin::~CCapturePin()
{
PrintFunctionEntry(__FUNCTION__);
PrintFunctionExit(__FUNCTION__,STATUS_SUCCESS);
}
/*****************************************************************************
Function : CCapturePin::PinCreate
Description : An AVStream minidriver's AVStrMiniPinCreate routine is
called when a pin is created. Typically, this routine is
used by minidrivers that want to initialize the context
and resources associated with the pin.
IN PARAM : <PKSPIN> Pointer to the KSPIN that was just created.
<PIRP> Pointer to the IRP_MJ_CREATE for pKSPin
OUT PARAM : <NTSTATUS> STATUS_SUCCESS in case of successful pin creation
Failure Code in other cases
PreCondition : None
PostCondtion : Create a new capture pin. This is the creation dispatch for
the video capture pin.
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS CCapturePin::PinCreate ( IN PKSPIN pKSPin,
IN PIRP pIoRequestPacket
)
{
NTSTATUS ntCreateStatus = STATUS_SUCCESS;
PBDA_TRANSPORT_INFO pTransportInfo = NULL;
CCapturePin *pCapturePin = new (NonPagedPool, CAPTURE_MEM_TAG) CCapturePin (pKSPin);
PrintFunctionEntry(__FUNCTION__);
if (!IS_VALID(pCapturePin))
{
//Return failure if we couldn't create the pin.
ntCreateStatus = STATUS_INSUFFICIENT_RESOURCES;
}
else
{
//Add the item to the object bag if we we were successful.
//Whenever the pin closes, the bag is cleaned up and we will be
//freed.
ntCreateStatus = KsAddItemToObjectBag (
pKSPin->Bag,
reinterpret_cast <PVOID> (pCapturePin),
reinterpret_cast <PFNKSFREE> (CCapturePin::Cleanup)
);
if (!NT_SUCCESS (ntCreateStatus))
{
delete pCapturePin;
}
else
{
pKSPin->Context = reinterpret_cast <PVOID> (pCapturePin);
}
}
//If we succeeded so far, stash the video info header away and change
//our allocator framing to reflect the fact that only now do we know
//the framing requirements based on the connection format.
if (NT_SUCCESS (ntCreateStatus))
{
pTransportInfo = pCapturePin->CaptureBdaTransportInfo();
if (!pTransportInfo)
{
ntCreateStatus = STATUS_INSUFFICIENT_RESOURCES;
}
}
if (NT_SUCCESS (ntCreateStatus))
{
//We need to edit the descriptor to ensure we don't mess up any other
//pins using the descriptor or touch read-only memory.
ntCreateStatus = KsEdit (pKSPin, &pKSPin->Descriptor, CAPTURE_MEM_TAG);
if (NT_SUCCESS (ntCreateStatus))
{
ntCreateStatus = KsEdit (
pKSPin,
&(pKSPin->Descriptor->AllocatorFraming),
CAPTURE_MEM_TAG
);
}
//If the edits proceeded without running out of memory, adjust
//the framing based on the video info header.
if (NT_SUCCESS (ntCreateStatus))
{
//We've KsEdit'ed this... I'm safe to cast away constness as
//long as the edit succeeded.
PKSALLOCATOR_FRAMING_EX pFraming =
const_cast <PKSALLOCATOR_FRAMING_EX> (
pKSPin->Descriptor-> AllocatorFraming
);
pFraming->FramingItem[0].Frames = NUMBER_OF_FRAMES;
//The physical and optimal ranges must be biSizeImage. We only
//support one frame size, precisely the size of each capture
//image.
pFraming->FramingItem[0].PhysicalRange.MinFrameSize =
pFraming->FramingItem[0].PhysicalRange.MaxFrameSize =
pFraming->FramingItem[0].FramingRange.Range.MinFrameSize =
pFraming->FramingItem[0].FramingRange.Range.MaxFrameSize =
pTransportInfo->ulcbPhyiscalFrame;
pFraming->FramingItem[0].PhysicalRange.Stepping =
pFraming->FramingItem[0].FramingRange.Range.Stepping =
0;
}
}
PrintFunctionExit(__FUNCTION__,ntCreateStatus);
return ntCreateStatus;
}
/*****************************************************************************
Function : CCapturePin::CaptureBdaTransportInfo
Description : Capture the video info header out of the connection format.
This is what we use to base synthesized images off.
IN PARAM : NONE
OUT PARAM : <PBDA_TRANSPORT_INFO> The captured video info header or
NULL if there is insufficient memory.
PreCondition : None
PostCondtion : Create a new capture pin. This is the creation dispatch for
the video capture pin.
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
PBDA_TRANSPORT_INFO CCapturePin::CaptureBdaTransportInfo()
{
PrintFunctionEntry(__FUNCTION__);
m_TransportInfo = reinterpret_cast <PBDA_TRANSPORT_INFO> (
ExAllocatePoolWithTag (
NonPagedPool,
sizeof(BDA_TRANSPORT_INFO),
CAPTURE_MEM_TAG
)
);
if (!IS_VALID(m_TransportInfo))
{
return NULL;
}
//Bag the newly allocated header space. This will get cleaned up
//automatically when the pin closes.
NTSTATUS Status =
KsAddItemToObjectBag (
m_Pin->Bag,
reinterpret_cast <PVOID> (m_TransportInfo),
NULL
);
if (!NT_SUCCESS (Status))
{
ExFreePoolWithTag (m_TransportInfo, CAPTURE_MEM_TAG);
return NULL;
}
else
{
m_TransportInfo->ulcbPhyiscalPacket = TRANSPORT_PACKET_SIZE;
m_TransportInfo->ulcbPhyiscalFrame = TRANSPORT_PACKET_SIZE * TRANSPORT_PACKET_COUNT;
m_TransportInfo->ulcbPhyiscalFrameAlignment = 1;
m_TransportInfo->AvgTimePerFrame = ((ULONGLONG)(19200)/* Maximum Sample Frequency */ *
10000 /* Maximum Bits Per second */ *
NUMBER_OF_FRAMES) /*Maximum Channels */ /
(TRANSPORT_PACKET_SIZE * TRANSPORT_PACKET_COUNT);
}
PrintFunctionExit(__FUNCTION__,STATUS_SUCCESS);
return m_TransportInfo;
}
/*****************************************************************************
Function : CCapturePin::CleanupReferences
Description : Clean up any references we're holding on frames after
we abruptly stop the hardware.
IN PARAM : NONE
OUT PARAM : <NTSTATUS> Success / Failure
PreCondition : NONE
PostCondtion : NONE
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS CCapturePin::CleanupReferences ()
{
PKSSTREAM_POINTER pCloneStream = KsPinGetFirstCloneStreamPointer(m_Pin);
PKSSTREAM_POINTER pNextCloneStream = NULL;
PrintFunctionEntry(__FUNCTION__);
//Walk through the clones, deleting them, and setting DataUsed to
//zero since we didn't use any data!
while (pCloneStream)
{
pNextCloneStream = KsStreamPointerGetNextClone(pCloneStream);
pCloneStream->StreamHeader->DataUsed = 0;
KsStreamPointerDelete (pCloneStream);
pCloneStream = pNextCloneStream;
}
PrintFunctionExit(__FUNCTION__,STATUS_SUCCESS);
return STATUS_SUCCESS;
}
/*****************************************************************************
Function : CCapturePin::SetState
Description : This is called when the caputre pin transitions state.
The routine attempts to acquire / release any hardware
resources and start up or shut down capture based on
the states we are transitioning to and away from.
IN PARAM : <KSSTATE> ToState : The state we're transitioning to
<KSSTATE> FromState : The state we're transitioning away from
OUT PARAM : <NTSTATUS> Success / Failure
PreCondition : NONE
PostCondtion : NONE
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS CCapturePin::SetState (
IN KSSTATE ToState,
IN KSSTATE FromState
)
{
NTSTATUS ntSetStatus = STATUS_SUCCESS;
PrintFunctionEntry(__FUNCTION__);
PrintDeviceChangeState(ToState,FromState);
switch (ToState)
{
case KSSTATE_STOP:
//Stopping the Device Operation
if (m_HardwareState != HardwareStopped)
{
ntSetStatus = m_Device->StopStream();
m_HardwareState = HardwareStopped;
}
//The Device is Stopped
//It has cancelled the IRPs and Stopped the Streaming
//In case any Streaming Pointer is left Clean it up
ntSetStatus = CleanupReferences();
//Release any hardware resources related to this pin.
if (m_AcquiredResources)
{
//Release the Clock Reference on the Pin
if (m_Clock)
{
m_Clock->Release();
m_Clock = NULL;
}
m_Device->RemoveCaptureSink();
m_AcquiredResources = FALSE;
}
break;
case KSSTATE_ACQUIRE:
//Acquire Hardware resources here instead of Filter
//Creation Time.So that the Filter creation does not
//Fail because of Limited Hardware resources.
if (FromState == KSSTATE_STOP)
{
ntSetStatus = m_Device->SetupCaptureSink(this,m_TransportInfo);
if (NT_SUCCESS (ntSetStatus))
{
m_AcquiredResources = TRUE;
//Attempt to get an interface to the master clock.
//This will fail if one has not been assigned. Since
//one must be assigned while the pin is still in
//KSSTATE_STOP, this is a guranteed method of getting
//the clock should one be assigned.
if (!NT_SUCCESS (KsPinGetReferenceClockInterface(m_Pin,
&m_Clock)))
{
//If we could not get an interface to the clock,
//don't use one.
SkyWalkerDebugPrint(ENTRY_LEVEL,("No Clock Assigned to the Pin\n"));
m_Clock = NULL;
}
}
else
{
m_AcquiredResources = FALSE;
}
}
else
{
//
//Standard transport pins will always receive transitions in
//+/- 1 manner. This means we'll always see a PAUSE->ACQUIRE
//transition before stopping the pin.
//
//The below is done because on DirectX 8.0, when the pin gets
//a message to stop, the queue is inaccessible. The reset
//which comes on every stop happens after this (at which time
//the queue is inaccessible also). So, for compatibility with
//DirectX 8.0, I am stopping the hardware at this
//point and cleaning up all references we have on frames.See
//the comments above regarding the CleanupReferences call.
if (m_HardwareState != HardwareStopped)
{
ntSetStatus = m_Device->StopStream();
m_HardwareState = HardwareStopped;
}
ntSetStatus = CleanupReferences ();
}
break;
case KSSTATE_PAUSE:
//Stop the Streaming if we're coming down from run.
if (FromState == KSSTATE_RUN)
{
ntSetStatus = m_Device->PauseStream(TRUE);
if (NT_SUCCESS (ntSetStatus))
{
m_HardwareState = HardwarePaused;
}
}
break;
case KSSTATE_RUN:
//Start the Streaming or unpause it depending on
//whether we're initially running or we've paused and restarted.
if (m_HardwareState == HardwarePaused)
{
ntSetStatus = m_Device->PauseStream (FALSE);
}
else
{
ntSetStatus = m_Device->StartStream();
}
if (NT_SUCCESS (ntSetStatus))
{
m_HardwareState = HardwareRunning;
}
break;
}
SkyWalkerDebugPrint(EXTREME_LEVEL,("Completed the State Change\n"));
PrintFunctionExit(__FUNCTION__,ntSetStatus);
return ntSetStatus;
}
/*****************************************************************************
Function : CCapturePin::Process
Description : The process dispatch for the pin bridges to this location.
We handle setting up scatter gather mappings, etc...
IN PARAM : NONE
OUT PARAM : <NTSTATUS> Success / Failure
PreCondition : NONE
PostCondtion : NONE
Logic : NONE
Assumption : NONE
Note : Future Approach for the Streaming Buffer
1) Create a Buffer of Size Stream->Data/m_SampleSize Here
2) Store the reference of the Newly Created Buffer into the
Stream Context
3) Send the Buffer to the ReadStream(BufferPointer)
4) When CompleteMapping is returned Copy Data from Stream
Context to Stream->Data
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS CCapturePin::Process()
{
NTSTATUS ntProcessStatus = STATUS_SUCCESS;
PKSSTREAM_POINTER pLeadingStream = NULL;
PKSSTREAM_POINTER pCloneStream = NULL;
PSTREAM_POINTER_CONTEXT pStreamContext = NULL;
PrintFunctionEntry(__FUNCTION__);
pLeadingStream = KsPinGetLeadingEdgeStreamPointer (
m_Pin,
KSSTREAM_POINTER_STATE_LOCKED
);
if( !pLeadingStream )
{
//no system buffer available
//This case can happen if it is the last pointer in the queue or
//the system cannot give us the required buffer
SkyWalkerDebugPrint(ENTRY_LEVEL,("Warning: No system buffer available\n"));
ntProcessStatus = STATUS_UNSUCCESSFUL;
goto CompleteProcessing;
}
else
{
//First thing we need to do is clone the leading edge. This allows
//us to keep reference on the frames while they're in DMA.
ntProcessStatus = KsStreamPointerClone (
pLeadingStream,
NULL,
sizeof (STREAM_POINTER_CONTEXT),
&pCloneStream
);
if( !NT_SUCCESS(ntProcessStatus) )
{
//No System Buffer Available
SkyWalkerDebugPrint(ENTRY_LEVEL,
("Error: Streampointer cloning unsuccessful\n"));
ntProcessStatus = STATUS_UNSUCCESSFUL;
goto CompleteProcessing;
}
//Is the buffer size correct
if( pCloneStream->StreamHeader->FrameExtent <
(static_cast <DWORD>(m_TransportInfo->ulcbPhyiscalFrame)) )
{
//Buffer size incorrect
KsStreamPointerDelete(pCloneStream); //void function
SkyWalkerDebugPrint(ENTRY_LEVEL,("Error: Buffer size Incorrect\n"));
ntProcessStatus = STATUS_UNSUCCESSFUL;
goto CompleteProcessing;
}
//Set the stream header data used to 0. We update this
//in the USB Data Read completions.
pCloneStream->StreamHeader->DataUsed = 0;
pStreamContext = reinterpret_cast <PSTREAM_POINTER_CONTEXT>
(pCloneStream->Context);
//Set the Stream Index
pStreamContext->ulFrameIndex = m_CurrentFrameIndex;
PrintStream(pLeadingStream);
//(Refer NOTE above) Create a Stream Buffer Here and Submit
//it for the Reading / DMA
SkyWalkerDebugPrint(EXTREME_LEVEL,("Current Stream Index = %lu",m_CurrentFrameIndex));
m_Device->ReadStream(m_CurrentFrameIndex);
m_CurrentFrameIndex = (m_CurrentFrameIndex+1) % NUMBER_OF_FRAMES;
//Advance Stream pointer to the next available data frame
ntProcessStatus = KsStreamPointerAdvance(pLeadingStream);
if( (ntProcessStatus != STATUS_DEVICE_NOT_READY) &&
(ntProcessStatus != STATUS_SUCCESS) )
{
SkyWalkerDebugPrint(ENTRY_LEVEL,
("Error: Video Capture Streampointer Advacement Failed\n"));
}
}
CompleteProcessing:
PrintFunctionExit(__FUNCTION__,ntProcessStatus);
return ntProcessStatus;
}
/*****************************************************************************
Function : CCapturePin::ReleaseStream
Description : Called to notify the pin that a given Stream is completed
IN PARAM : <ULONG> The Stream Index
OUT PARAM : NONE
PreCondition : NONE
PostCondtion : Stream data is filled from the Internal Stream Buffer
Other Stream Parameters are set and Clone is Deleted
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
void CCapturePin::ReleaseStream(IN ULONG ulStreamIndex)
{
PrintFunctionEntry(__FUNCTION__);
//Walk through the clones list and delete clones whose time has come.
//The list is guaranteed to be kept in the order they were cloned.
SkyWalkerDebugPrint(EXTREME_LEVEL,("Completing Stream %lu\n",ulStreamIndex));
PKSSTREAM_POINTER pCloneStream = KsPinGetFirstCloneStreamPointer (m_Pin);
SkyWalkerDebugPrint(EXTREME_LEVEL,("Clone Stream pointer = 0x%p\n",pCloneStream));
if(pCloneStream)
{
//Copy the Stream data from the Corresponding Streaming Buffer
RtlCopyMemory((PUCHAR)pCloneStream->StreamHeader->Data,
m_Device->GetSynthBuffer(ulStreamIndex),
m_TransportInfo->ulcbPhyiscalFrame);
pCloneStream->StreamHeader->DataUsed = m_TransportInfo->ulcbPhyiscalFrame;
SkyWalkerDebugPrint(EXTREME_LEVEL,("pCloneStream->StreamHeader->DataUsed = "
"%lu\n",
pCloneStream->StreamHeader->DataUsed));
pCloneStream->StreamHeader->Duration = m_TransportInfo->AvgTimePerFrame;
pCloneStream->StreamHeader->PresentationTime.Numerator =
pCloneStream->StreamHeader->PresentationTime.Denominator = 1;
//If a clock has been assigned, timestamp the packets with the
//time shown on the clock.
if (m_Clock)
{
LONGLONG ClockTime = m_Clock->GetTime ();
pCloneStream->StreamHeader->PresentationTime.Time = ClockTime;
pCloneStream->StreamHeader->OptionsFlags =
KSSTREAM_HEADER_OPTIONSF_TIMEVALID |
KSSTREAM_HEADER_OPTIONSF_DURATIONVALID;
}
else
{
//If there is no clock, don't time stamp the packets.
pCloneStream->StreamHeader->PresentationTime.Time = 0;
}
PrintStream(pCloneStream);
SkyWalkerDebugPrint(EXTREME_LEVEL,("Stream Processed thus deleting the Clone\n"));
KsStreamPointerDelete (pCloneStream);
}
PrintFunctionExit(__FUNCTION__,STATUS_SUCCESS);
}
VOID PrintStream(IN PKSSTREAM_POINTER pStreamPointer)
{
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->Context = 0x%p\n",pStreamPointer->Context));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->Pin = 0x%p\n",pStreamPointer->Pin));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->StreamHeader = 0x%p\n",pStreamPointer->StreamHeader));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->StreamHeader->Size = %lu\n",pStreamPointer->StreamHeader->Size));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->StreamHeader->TypeSpecificFlags = %lu\n",pStreamPointer->StreamHeader->TypeSpecificFlags));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->StreamHeader->PresentationTime.Time= %l\n",pStreamPointer->StreamHeader->PresentationTime.Time));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->StreamHeader->PresentationTime.Numerator= %lu\n",pStreamPointer->StreamHeader->PresentationTime.Numerator));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->StreamHeader->PresentationTime.Denominator= %lu\n",pStreamPointer->StreamHeader->PresentationTime.Denominator));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->StreamHeader->Duration = %l\n",pStreamPointer->StreamHeader->Duration));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->StreamHeader->FrameExtent = %lu\n",pStreamPointer->StreamHeader->FrameExtent));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->StreamHeader->DataUsed = %lu\n",pStreamPointer->StreamHeader->DataUsed));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->StreamHeader->Data = 0x%p\n",pStreamPointer->StreamHeader->Data));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->StreamHeader->OptionsFlags = %lu\n",pStreamPointer->StreamHeader->OptionsFlags));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->Offset = 0x%p\n",pStreamPointer->Offset));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->Offset->Data = 0x%p\n",pStreamPointer->Offset->Data));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->Offset->Mappings = 0x%p\n",pStreamPointer->Offset->Mappings));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->Offset->Count = %lu\n",pStreamPointer->Offset->Count));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->Offset->Remaining = %lu\n",pStreamPointer->Offset->Remaining));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->OffsetIn.Data = 0x%p\n",pStreamPointer->OffsetIn.Data));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->OffsetIn.Mappings = 0x%p\n",pStreamPointer->OffsetIn.Mappings));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->OffsetIn.Count = %lu\n",pStreamPointer->OffsetIn.Count));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->OffsetIn.Remaining = %lu\n",pStreamPointer->OffsetIn.Remaining));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->OffsetOut.Data = 0x%p\n",pStreamPointer->OffsetOut.Data));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->OffsetOut.Mappings = 0x%p\n",pStreamPointer->OffsetOut.Mappings));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->OffsetOut.Count = %lu\n",pStreamPointer->OffsetOut.Count));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pStreamPointer->OffsetOut.Remaining = %lu\n",pStreamPointer->OffsetOut.Remaining));
}

View file

@ -0,0 +1,704 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1Control.cpp
Author :
Date :
Purpose : This File Holds the Device Control related declarations
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
/* Include the Library and Other header file */
#include "SkyWalker1Main.h" //Common For all the Definitions,
//Declarations and Library Routines
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
/* End of Macro Definitions */
/* Global & Static variables Declaration */
/* End of Global & Static variables Declaration */
/* External Variable Declaration */
/* End of External Variable Declaration */
/* Declare Enumerations here */
/* End of Enumeration declaration */
/* Function Prototypes */
VOID PrintDiseqcCommand(PDISEQC_COMMAND pDiseqcCommand);
/* End of Function prototype definitions */
/*****************************************************************************
Function : GetSignalStatus
Description : This Function Get the Signal Lock Status
IN PARAM : <PKSDEVICE> Pointer to the KSDevice Object
<PBOOLEAN> true in case of Signal Locked else False
OUT PARAM : <NTSTATUS> STATUS_SUCCESS in case of successful Lock Read
Failure Code in other cases
PreCondition : None
PostCondtion : Gets the Signal Lock Status in case of successful execution
Logic : NONE
Assumption : NONE
Note : None
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS GetSignalStatus( IN PKSDEVICE pKSDeviceObject,
OUT PBOOLEAN pbSignalLockStatus
)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
UCHAR ucSignalStatus = 0;
PrintFunctionEntry(__FUNCTION__);
//gp8psk_usb_in_op(st->d, GET_SIGNAL_LOCK, 0, 0, &lock,1)
ntStatus = ControlUsbDevice( pKSDeviceObject,
GET_SIGNAL_LOCK,
0,
0,
&ucSignalStatus,
1,
true);
if(NT_SUCCESS(ntStatus))
{
SkyWalkerDebugPrint(EXTREME_LEVEL,("ucSignalStatus = 0x%02X\n",ucSignalStatus));
if(ucSignalStatus)
{
*pbSignalLockStatus = TRUE;
}
else
{
*pbSignalLockStatus = FALSE;
}
}
//if (lock)
// *status = FE_HAS_LOCK | FE_HAS_SYNC | FE_HAS_VITERBI | FE_HAS_SIGNAL | FE_HAS_CARRIER;
//else
// *status = 0;
if(ucSignalStatus)
{
SkyWalkerDebugPrint(EXTREME_LEVEL,("Signal Lock = 0x%02X\n",*pbSignalLockStatus));
}
PrintFunctionExit(__FUNCTION__,ntStatus);
return ntStatus;
}
/*****************************************************************************
Function : ReadTunerSignalStrength
Description : This Function reads the Tuner Signal Strength
IN PARAM : <PKSDEVICE> Pointer to the KSDevice Object
<PULONG> Pointer to hold the Signal Strength
OUT PARAM : <NTSTATUS> STATUS_SUCCESS in case of successful read
Failure Code in other cases
PreCondition : None
PostCondtion : Reads the Signal Strength
Logic : NONE
Assumption : NONE
Note : None
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS ReadTunerSignalStrength( IN PKSDEVICE pKSDeviceObject,
OUT PULONG pulSigStrength
)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
UCHAR ucBuffer[6] = {0,0,0,0,0,0};
ULONG ulSignalStrength = 0L;
PrintFunctionEntry(__FUNCTION__);
//gp8psk_usb_in_op(st->d, GET_SIGNAL_STRENGTH, 0,0,buf,6);
ntStatus = ControlUsbDevice( pKSDeviceObject,
GET_SIGNAL_STRENGTH,
0,
0,
ucBuffer,
6,
true);
if(NT_SUCCESS(ntStatus))
{
ulSignalStrength = (int)(ucBuffer[1]) << 8 | ucBuffer[0];
SkyWalkerDebugPrint(EXTREME_LEVEL,("ulSignalStrength = %lu,ucBuffer[1] = 0x%02X, ucBuffer[2] = 0x%02X\n",
ulSignalStrength,ucBuffer[1],ucBuffer[0]));
//*pulSigStrength = (int)(ucBuffer[1]) << 8 | ucBuffer[0];
/* snr is reported in dBu*256 */
/* snr / 38.4 ~= 100% strength */
/* snr * 17 returns 100% strength as 65535 */
if (ulSignalStrength <= 0x0F00)
{
*pulSigStrength = (ulSignalStrength <<4) + ulSignalStrength;
}
else
{
*pulSigStrength = 0xFFFF;
}
}
SkyWalkerDebugPrint(EXTREME_LEVEL,("Signal Strength = %lu\n",*pulSigStrength));
PrintFunctionExit(__FUNCTION__,ntStatus);
return ntStatus;
}
/*****************************************************************************
Function : SetLnbVoltage
Description : This Function Sets the LNB Voltage
IN PARAM : <PKSDEVICE> Pointer to the KSDevice Object
<UCHAR> Voltage to set 1 for 18V and 0 for 13V
OUT PARAM : <NTSTATUS> STATUS_SUCCESS in case of successful Set
Failure Code in other cases
PreCondition : None
PostCondtion : Sets the LNB Voltage in case of successful execution
Logic : NONE
Assumption : NONE
Note : None
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS SetLnbVoltage(IN PKSDEVICE pKSDeviceObject,
IN UCHAR ucVoltage)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
PrintFunctionEntry(__FUNCTION__);
SkyWalkerDebugPrint(EXTREME_LEVEL,("New Lnb Voltage (0 = 13V, 1 = 18V) = %02d \n",ucVoltage));
//gp8psk_usb_out_op(state->d,SET_LNB_VOLTAGE,
// voltage == SEC_VOLTAGE_18, 0, NULL, 0)
ntStatus = ControlUsbDevice( pKSDeviceObject,
SET_LNB_VOLTAGE,
(ucVoltage == SEC_VOLTAGE_18),
0,
NULL,
0,
false);
PrintFunctionExit(__FUNCTION__,ntStatus);
return ntStatus;
}
/*****************************************************************************
Function : TuneDevice
Description : This Function Tunes the Tuner
IN PARAM : <PKSDEVICE> Pointer to the KSDevice Object
<PBDATUNER_DEVICE_PARAMETER> Tuner parameters to set
OUT PARAM : <NTSTATUS> STATUS_SUCCESS in case of successful Set
Failure Code in other cases
PreCondition : None
PostCondtion : Tuners the Tuner in case of successful execution
Logic : NONE
Assumption : NONE
Note : To tune the Tuner following command needs to be sent
9 8 7 6 5 4 3 2 1 0
=================================================================================
| FECR | MOD | TFQ0 | TFQ0 | TFQ0 | TFQ0 | SBR3 | SBR2 | SBR1 | SBR0 |
=================================================================================
Where FECR -> Inner FEC Rate (1 Byte)
MOD = Modulation = QPSK (1 Byte)
TF = Tuner Frequency (4 Bytes)
SBR = Symbol Rate (4 Bytes)
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS TuneDevice(IN PKSDEVICE pKSDeviceObject,
IN PBDATUNER_DEVICE_PARAMETER pDeviceParameter)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
UCHAR ucCommand[10];
ULONG ulTempFrequency = 0L;
ULONG ulTunerFrequency = 0L;
ULONG ulLOFrequency = 0L;
ULONG ulTempSymbolRate = 0L;
PrintFunctionEntry(__FUNCTION__);
//Setting the Local Oscillator Frequency
if(pDeviceParameter->ulLnbSwitchFrequency >= pDeviceParameter->ulCarrierFrequency)
{
ulLOFrequency = pDeviceParameter->ulLnbLowLOFrequency;
}
else
{
ulLOFrequency = pDeviceParameter->ulLnbHighLOFrequency;
}
//Getting the Frequency to be tuned based on the Carrier frequency and
//Local Oscillator frequency (LOF)
if(pDeviceParameter->ulCarrierFrequency > ulLOFrequency)
{
ulTempFrequency = pDeviceParameter->ulCarrierFrequency - ulLOFrequency;
}
else
{
ulTempFrequency = ulLOFrequency - pDeviceParameter->ulCarrierFrequency;
}
if( (ulTempFrequency < TUNER_FREQ_MIN) ||
(ulTempFrequency > TUNER_FREQ_MAX))
{
SkyWalkerDebugPrint(EXTREME_LEVEL,
("Frequency Out of Bound %lu, Resetting to %lu\n",
ulTempFrequency,TUNER_FREQ_MIN));
ulTempFrequency = TUNER_FREQ_MIN;
}
ulTunerFrequency= ulTempFrequency * pDeviceParameter->ulFrequencyMultiplier;
//Symbol Rate should be in Sample Per Second thus converting the
//Kilo Samples per Second (ksps) to Samples Per Second (sps)
ulTempSymbolRate = pDeviceParameter->ulSymbolRate * 1000;
SkyWalkerDebugPrint(EXTREME_LEVEL,("New Symbol Rate = %lu sps (%lu ksps)\n"
"Carrier Frequency = %lu\n"
"Local Oscillator Freq = %lu\n"
"Frequency Multiplier = %lu\n"
"Tuner Frequency = %lu\n"
"New Modulation Type (QPSK = 0)= %lu\n"
"New FEC Rate (VITERBI = 1)= %lu \n",
ulTempSymbolRate,
pDeviceParameter->ulSymbolRate,
pDeviceParameter->ulCarrierFrequency,
ulLOFrequency,
pDeviceParameter->ulFrequencyMultiplier,
ulTunerFrequency,
ADV_MOD_DVB_QPSK,
pDeviceParameter->InnerFecRate));
ucCommand[0] = (UCHAR)(ulTempSymbolRate & 0xFF);
ucCommand[1] = (UCHAR)((ulTempSymbolRate >> 8) & 0xFF);
ucCommand[2] = (UCHAR)((ulTempSymbolRate >> 16) & 0xFF);
ucCommand[3] = (UCHAR)((ulTempSymbolRate >> 24) & 0xFF);
ucCommand[4] = (UCHAR)(ulTunerFrequency & 0xFF);
ucCommand[5] = (UCHAR)((ulTunerFrequency >> 8) & 0xFF);
ucCommand[6] = (UCHAR)((ulTunerFrequency >> 16) & 0xFF);
ucCommand[7] = (UCHAR)((ulTunerFrequency >> 24) & 0xFF);
ucCommand[8] = ADV_MOD_DVB_QPSK;
ucCommand[9] = 0x05;
SkyWalkerDebugPrint(EXTREME_LEVEL,("Tune Command : Symbol Rate = 0x%02X%02X%02X%02X,"
"Frequency = 0x%02X%02X%02X%02X",
ucCommand[3],ucCommand[2],ucCommand[1],ucCommand[0],
ucCommand[7],ucCommand[6],ucCommand[5],ucCommand[4]));
//gp8psk_usb_out_op(state->d,TUNE_8PSK,0,0,cmd,10);
ntStatus = ControlUsbDevice( pKSDeviceObject,
TUNE_8PSK,
0,
0,
ucCommand,
10,
false);
PrintFunctionExit(__FUNCTION__,ntStatus);
return ntStatus;
}
/*****************************************************************************
Function : SetupTunerPower
Description : Function to used to Setup the SkyWalker1 Device Power
IN PARAM : <PKSDEVICE> Pointer to Device Object which needs Power setup
<BOOLEAN> Switch on / Switch Off
OUT PARAM : <NTSTATUS> ntStatus of the SkyWalker1 Power Setup
STATUS_SUCCESS on Successful execution
else Error from the Bus Driver
PreCondition : NONE
PostCondtion : On Success Device ready for the Operation
Logic : Linux Method to Setup the Device
1) Download Firmware (Not done here)
2) Set Power State to ON
3) Read 8PSK Config ntStatus
4) if(Device not Started) then Start it
5) if(BCM4500 Firmware not loaded) then load it
6) if (LNB Power not set) then Set it
7) Set DVB_MODE to 1
8) Read Again the 8PSK Config ntStatus
Assumption : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS SetupTunerPower( IN PKSDEVICE pKSDeviceObject,
IN BOOLEAN bOnOff)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
UCHAR ucDeviceConfig = 0;
UCHAR ucBuffer = 0;
PrintFunctionEntry(__FUNCTION__);
if (bOnOff)
{
//If Tuner Power On
//Read the Tuner Configuration First
//gp8psk_usb_in_op(d, GET_8PSK_CONFIG,0,0,&status,1);
ntStatus = ControlUsbDevice( pKSDeviceObject,
GET_8PSK_CONFIG,
0,
0,
&ucDeviceConfig,
1,
true);
if(!NT_SUCCESS(ntStatus))
{
SkyWalkerDebugPrint(ENTRY_LEVEL,("Unable to Read the Device Configuration\n"));
goto ExitSetupPower;
}
SkyWalkerDebugPrint(EXTREME_LEVEL,
("Device Status Bit0:Device Start,Bit1:Firmware Loaded," \
"Bit2:LNB Powerup = 0x%02X\n",
ucDeviceConfig));
if (!(ucDeviceConfig & bm8pskStarted)) /* Device Start ntStatus BIT-0 */
{
//Device Not Started
//Send the Boot Command to the Device
//gp8psk_usb_in_op(d, BOOT_8PSK, 1, 0, &buf, 1))
ntStatus = ControlUsbDevice( pKSDeviceObject,
BOOT_8PSK,
1,
0,
&ucBuffer,
1,
true);
if(!NT_SUCCESS(ntStatus))
{
SkyWalkerDebugPrint(ENTRY_LEVEL,("Unable to Boot the Device\n"));
goto ExitSetupPower;
}
SkyWalkerDebugPrint(EXTREME_LEVEL,("Boot Response 0x%02X\n",ucBuffer));
SkyWalkerDebugPrint(EXTREME_LEVEL,("Device Bootedup\n"));
}
if (!(ucDeviceConfig & bm8pskFW_Loaded)) /* Firmware ntStatus BIT-1 */
{
//Firmware Not Loaded
SkyWalkerDebugPrint(ENTRY_LEVEL,("Firmware not Loaded\n"));
}
if (!(ucDeviceConfig & bmIntersilOn)) /* LNB Power Status BIT-2 */
{
//LNB Not powered On
//Sent the Power On Command to the LNB
ucBuffer = 0;
//gp8psk_usb_in_op(d, START_INTERSIL, 1, 0,&buf, 1))
ntStatus = ControlUsbDevice( pKSDeviceObject,
START_INTERSIL,
1,
0,
&ucBuffer,
1,
true);
if(!NT_SUCCESS(ntStatus))
{
SkyWalkerDebugPrint(ENTRY_LEVEL,("Unable to Powerup the Device\n"));
goto ExitSetupPower;
}
SkyWalkerDebugPrint(EXTREME_LEVEL,("LNB Powerup Response 0x%02X\n",ucBuffer));
SkyWalkerDebugPrint(EXTREME_LEVEL,("Device Poweredup\n"));
}
/* Abort possible TS (if previous tune crashed) */
//gp8psk_usb_out_op(d, ARM_TRANSFER, 0, 0, NULL, 0)
ntStatus = ControlUsbDevice( pKSDeviceObject,
ARM_TRANSFER,
0,
0,
NULL,
0,
false);
//Reread the Device Configuration
//gp8psk_usb_in_op(d, GET_8PSK_CONFIG,0,0,&status,1);
ntStatus = ControlUsbDevice( pKSDeviceObject,
GET_8PSK_CONFIG,
0,
0,
&ucDeviceConfig,
1,
true);
if(!NT_SUCCESS(ntStatus))
{
SkyWalkerDebugPrint(ENTRY_LEVEL,("Unable to Read the Device Configuration\n"));
goto ExitSetupPower;
}
SkyWalkerDebugPrint(EXTREME_LEVEL,
("Device ntStatus Bit0:Device Start,Bit1:Firmware Loaded," \
"Bit2:LNB Powerup = 0x%02X\n",
ucDeviceConfig));
}
else
{
//Turn Off LNB Power
//gp8psk_usb_in_op(d, START_INTERSIL, 0, 0, &buf, 1)
ucBuffer = 0;
ntStatus = ControlUsbDevice( pKSDeviceObject,
START_INTERSIL,
0,
0,
&ucBuffer,
1,
true);
if(!NT_SUCCESS(ntStatus))
{
SkyWalkerDebugPrint(ENTRY_LEVEL,("Unable to Powerdown the LNB\n"));
goto ExitSetupPower;
}
SkyWalkerDebugPrint(EXTREME_LEVEL,("LNB Powerdown Response 0x%02X\n",ucBuffer));
//Turn Off 8PSK Power
//gp8psk_usb_in_op(d, BOOT_8PSK, 0, 0, &buf, 1)
ucBuffer = 0;
ntStatus = ControlUsbDevice( pKSDeviceObject,
BOOT_8PSK,
0,
0,
&ucBuffer,
1,
true);
if(!NT_SUCCESS(ntStatus))
{
SkyWalkerDebugPrint(ENTRY_LEVEL,("Unable to Powerdown the SkyWalker1\n"));
goto ExitSetupPower;
}
SkyWalkerDebugPrint(EXTREME_LEVEL,("Tuner Powerdown Response 0x%02X\n",ucBuffer));
}
ExitSetupPower:
PrintFunctionExit(__FUNCTION__,ntStatus);
return ntStatus;
}
/*****************************************************************************
Function : SetStreamingControl
Description : This Function Enables / Disables the Streaming
IN PARAM : <PKSDEVICE> Pointer to the KSDevice Object
<UCHAR> Streaming Control 1 for ON and 0 for OFF
OUT PARAM : <NTSTATUS> STATUS_SUCCESS in case of successful Set
Failure Code in other cases
PreCondition : None
PostCondtion : Controls Streaming in case of successful execution
Logic : NONE
Assumption : NONE
Note : None
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS SetStreamingControl( IN PKSDEVICE pKSDeviceObject,
IN UCHAR ucOnOff)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
PrintFunctionEntry(__FUNCTION__);
SkyWalkerDebugPrint(EXTREME_LEVEL,("Streaming Control (0 = OFF, 1 = ON) = %02d \n",ucOnOff));
//gp8psk_usb_out_op(adap->dev, ARM_TRANSFER, onoff, 0 , NULL, 0);
ntStatus = ControlUsbDevice( pKSDeviceObject,
ARM_TRANSFER,
ucOnOff,
0,
NULL,
0,
false);
PrintFunctionExit(__FUNCTION__,ntStatus);
return ntStatus;
}
/*****************************************************************************
Function : SetTunerTone
Description : This Function Sets the Tuner Tone
IN PARAM : <PKSDEVICE> Pointer to the KSDevice Object
<UCHAR> Tuner Tone : 0 for TONE ON and 1 for TONE OFF
OUT PARAM : <NTSTATUS> STATUS_SUCCESS in case of successful Set
Failure Code in other cases
PreCondition : None
PostCondtion : Sets the Tuner Tone in case of successful execution
Logic : NONE
Assumption : NONE
Note : None
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS SetTunerTone( IN PKSDEVICE pKSDeviceObject,
IN UCHAR ucTone)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
PrintFunctionEntry(__FUNCTION__);
SkyWalkerDebugPrint(EXTREME_LEVEL,("Tuner Tone (0 = TONE_ON, 1 = TONE_OFF) = %02d \n",ucTone));
//gp8psk_usb_out_op(state->d,SET_22KHZ_TONE,
// (tone == SEC_TONE_ON), 0, NULL, 0)
ntStatus = ControlUsbDevice( pKSDeviceObject,
SET_22KHZ_TONE,
(ucTone == 0),
0,
NULL,
0,
false);
PrintFunctionExit(__FUNCTION__,ntStatus);
return ntStatus;
}
/*****************************************************************************
Function : ConfigureTuner
Description : This Function Configures Tuner Frequency, Polarity,
Symbol Rate, Tone etc.
IN PARAM : <PKSDEVICE> Pointer to the KSDevice Object
<PBDATUNER_DEVICE_PARAMETER> Configuration to tune
OUT PARAM : <NTSTATUS> STATUS_SUCCESS in case of successful Set
Failure Code in other cases
PreCondition : None
PostCondtion : Configures the Tuner with the COnfiguration provided
Logic : NONE
Assumption : NONE
Note : None
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS ConfigureTuner(IN PKSDEVICE pKSDeviceObject,
IN PBDATUNER_DEVICE_PARAMETER pNewConfiguration)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
PrintFunctionEntry(__FUNCTION__);
//Set the LNB Voltage based on the Polarity
if((pNewConfiguration->Polarity == BDA_POLARISATION_LINEAR_H) ||
(pNewConfiguration->Polarity == BDA_POLARISATION_CIRCULAR_L))
{
//Set the LNB Voltage to 18 Volts
ntStatus = SetLnbVoltage(pKSDeviceObject,SEC_VOLTAGE_18);
}
else
{
//Set the LNB Voltage to 13 Volts
ntStatus = SetLnbVoltage(pKSDeviceObject,SEC_VOLTAGE_13);
}
if(NT_SUCCESS(ntStatus))
{
ntStatus = SetTunerTone(pKSDeviceObject,SEC_TONE_OFF);
if(NT_SUCCESS(ntStatus))
{
//Configure the updated resource on the hardware here.
ntStatus = TuneDevice(pKSDeviceObject,pNewConfiguration);
}
}
PrintFunctionExit(__FUNCTION__,ntStatus);
return ntStatus;
}
/*****************************************************************************
Function : DiseqcCommand
Description : This Function Sends Diseqc Command to the Tuner
IN PARAM : <PKSDEVICE> Pointer to the KSDevice Object
<PDISEQC_COMMAND> Command to be sent to the Device
OUT PARAM : <NTSTATUS> STATUS_SUCCESS in case of successful Set
Failure Code in other cases
PreCondition : None
PostCondtion : Diseqc Command sent to the Tuner
Logic : 1) Validate the Diseqc Message
2) Check the Diseqc Message Length
3) If length == 1
Treat the Diseqc Command as the Simple Tone Burst
4) Else
Treat it as normal Diseqc Command
Assumption : NONE
Note : None
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS DiseqcCommand( IN PKSDEVICE pKSDeviceObject,
IN PDISEQC_COMMAND pCommand)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
PrintFunctionEntry(__FUNCTION__);
if( !IS_VALID(pCommand) ||
(pCommand->ucMessageLength == 0) ||
(pCommand->ucMessageLength == 2) ||
(pCommand->ucMessageLength > MAX_DISEQC_COMMAND_LENGTH))
{
SkyWalkerDebugPrint(ENTRY_LEVEL,("Invalid Diseqc Command Received \n"));
ntStatus = STATUS_INVALID_PARAMETER;
goto ExitDiseqcCommand;
}
if(pCommand->ucMessageLength == 1)
{
//Simple Tone Burst
UCHAR ucBurst = (pCommand->ucMessage[0] == SEC_MINI_A) ? 0x00 : 0x01;
SkyWalkerDebugPrint(EXTREME_LEVEL,("Sending Simple Tone Burst Command = 0x%02X \n",ucBurst));
//gp8psk_usb_out_op(st->d,SEND_DISEQC_COMMAND, cmd, 0,&cmd, 0)
ntStatus = ControlUsbDevice( pKSDeviceObject,
SEND_DISEQC_COMMAND,
ucBurst,
0,
&ucBurst,
0,
false);
}
else
{
//Normal Diseqc Command
SkyWalkerDebugPrint(EXTREME_LEVEL,("Sending Normal Diseqc Command\n"));
PrintDiseqcCommand(pCommand);
//gp8psk_usb_out_op(st->d,SEND_DISEQC_COMMAND, m->msg[0], 0,m->msg, m->msg_len)
ntStatus = ControlUsbDevice( pKSDeviceObject,
SEND_DISEQC_COMMAND,
pCommand->ucMessage[0],
0,
pCommand->ucMessage,
pCommand->ucMessageLength,
false);
}
ExitDiseqcCommand:
PrintFunctionExit(__FUNCTION__,ntStatus);
return ntStatus;
}
VOID PrintDiseqcCommand(PDISEQC_COMMAND pDiseqcCommand)
{
if(pDiseqcCommand)
{
SkyWalkerDebugPrint(EXTREME_LEVEL,("pDiseqcCommand->ucMessage[0] = 0x%02X\n",pDiseqcCommand->ucMessage[0]));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pDiseqcCommand->ucMessage[1] = 0x%02X\n",pDiseqcCommand->ucMessage[1]));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pDiseqcCommand->ucMessage[2] = 0x%02X\n",pDiseqcCommand->ucMessage[2]));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pDiseqcCommand->ucMessage[3] = 0x%02X\n",pDiseqcCommand->ucMessage[3]));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pDiseqcCommand->ucMessage[4] = 0x%02X\n",pDiseqcCommand->ucMessage[4]));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pDiseqcCommand->ucMessage[5] = 0x%02X\n",pDiseqcCommand->ucMessage[5]));
SkyWalkerDebugPrint(EXTREME_LEVEL,("pDiseqcCommand->ucMessageLength = %02u\n",pDiseqcCommand->ucMessageLength));
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,142 @@
; SkyWalker1Installer.INF -- This file installs SkyWalker1 Driver
;
[Version]
signature="$CHICAGO$"
Class=Media
ClassGUID={4d36e96c-e325-11ce-bfc1-08002be10318}
Provider=%SGI%
CatalogFile=SkyWalker1Installer.cat
DriverVer= 8/17/2009
; F i l e c o p y i n g s e c t i o n s (where the files go to).
;
[DestinationDirs]
DefaultDestDir=10,system32\drivers
[Manufacturer]
%SGI%=SGI
[ControlFlags]
;ExcludeFromSelect=*
;ExcludeFromSelect.NT=*
; =================== Generic ==================================
[SGI]
%SkyWalker1.DeviceDesc%=Skywalker1.Device,USB\VID_09C0&PID_0203 ;SkyWalker1
[Skywalker1.Device]
Include = ks.inf, kscaptur.inf, bda.inf
needs = KS.Registration, KSCAPTUR.Registration, BDA.Installation
AddReg = Skywalker1.AddReg
CopyFiles = Skywalker1.CopyDrivers
[Skywalker1.Device.NT]
Include = ks.inf, kscaptur.inf, bda.inf
needs = KS.Registration.NT, KSCAPTUR.Registration.NT, BDA.Installation.NT
;AddReg = Skywalker1.AddReg
CopyFiles = Skywalker1.CopyDrivers
; KnownFiles = Skywalker1.KnownFiles
[Skywalker1.Device.NT.Services]
Addservice=SkyWalker1TVTuner, 0x00000002, Skywalker1.AddService
[Skywalker1.AddService]
DisplayName=%SkyWalker1.FriendlyName%
ServiceType=1 ; SERVICE_KERNEL_DRIVER
StartType=3 ; SERVICE_DEMAND_START
ErrorControl=1 ; SERVICE_ERROR_NORMAL
ServiceBinary=%10%\System32\Drivers\SkyWalker1TVTuner.sys
LoadOrderGroup=ExtendedBase
[Skywalker1.CopyDrivers]
SkyWalker1TVTuner.sys
[Skywalker1.AddReg]
HKR,,DevLoader,,*NTKERN
HKR,,NTMPDriver,,SkyWalker1TVTuner.sys
HKR,,PageOutWhenUnopened,3,01
[Skywalker1.Device.Interfaces]
AddInterface=%KSCATEGORY_BDA_RECEIVER_COMPONENT%,%SKYWALKER_CAPTURE%,Skywalker1.Receiver.Interfaces
AddInterface=%KSCATEGORY_BDA_NETWORK_TUNER%,%SKYWALKER_TUNER%,Skywalker1.Tuner.Interfaces
[Skywalker1.Device.NT.Interfaces]
AddInterface=%KSCATEGORY_BDA_RECEIVER_COMPONENT%,%SKYWALKER_CAPTURE%,Skywalker1.Receiver.Interfaces
AddInterface=%KSCATEGORY_BDA_NETWORK_TUNER%,%SKYWALKER_TUNER%,Skywalker1.Tuner.Interfaces
[Skywalker1.Tuner.Interfaces]
AddReg=Skywalker1.Tuner.Interfaces.AddReg
[Skywalker1.Tuner.Interfaces.AddReg]
HKR,,CLSID,,%KSProxy.CLSID%
HKR,,FriendlyName,,%SkyWalker1.Tuner.FriendlyName%
[Skywalker1.Receiver.Interfaces]
AddReg=Skywalker1.Receiver.Interfaces.AddReg
[Skywalker1.Receiver.Interfaces.AddReg]
HKR,,CLSID,,%KSProxy.CLSID%
HKR,,FriendlyName,,%SkyWalker1.Receiver.FriendlyName%
[Strings]
;non-localizable
SGI="Plethorasoft"
MfgName="SGI"
SkyWalker1.DeviceDesc="SkyWalker1 BDA TVTuner"
SkyWalker1.Tuner.FriendlyName="SkyWalker1 TV Tuner"
SkyWalker1.Receiver.FriendlyName="SkyWalker1 TV Receiver"
SkyWalker1.Tuner="SkyWalker1.Tuner"
KSProxy.CLSID="{17CCA71B-ECD7-11D0-B908-00A0C9223196}"
KSCATEGORY_BDA_NETWORK_TUNER="{71985F48-1CA1-11d3-9CC8-00C04F7971E0}"
KSCATEGORY_BDA_RECEIVER_COMPONENT="{FD0A5AF4-B41D-11d2-9C95-00C04F7971E0}"
SKYWALKER_TUNER="{5C4E764F-AB43-46A9-B21E-8529C70F0A23}"
SKYWALKER_CAPTURE="{0F8F74D9-E524-4D05-BB60-F0C69ACB1756}"
;
; ServiceType values
SERVICE_KERNEL_DRIVER = 0x00000001
SERVICE_FILE_SYSTEM_DRIVER = 0x00000002
SERVICE_ADAPTER = 0x00000004
SERVICE_RECOGNIZER_DRIVER = 0x00000008
SERVICE_WIN32_OWN_PROCESS = 0x00000010
SERVICE_WIN32_SHARE_PROCESS = 0x00000020
SERVICE_INTERACTIVE_PROCESS = 0x00000100
SERVICE_INTERACTIVE_SHARE_PROCESS = 0x00000120
; StartType values
SERVICE_BOOT_START = 0x00000000
SERVICE_SYSTEM_START = 0x00000001
SERVICE_AUTO_START = 0x00000002
SERVICE_DEMAND_START = 0x00000003
SERVICE_DISABLED = 0x00000004
; ErrorControl values
SERVICE_ERROR_IGNORE = 0x00000000
SERVICE_ERROR_NORMAL = 0x00000001
SERVICE_ERROR_SEVERE = 0x00000002
SERVICE_ERROR_CRITICAL = 0x00000003
; Characteristic flags
NCF_VIRTUAL = 0x0001
NCF_WRAPPER = 0x0002
NCF_PHYSICAL = 0x0004
NCF_HIDDEN = 0x0008
NCF_NO_SERVICE = 0x0010
NCF_NOT_USER_REMOVABLE = 0x0020
NCF_HAS_UI = 0x0080
NCF_MODEM = 0x0100
; Registry types
REG_MULTI_SZ = 0x10000
REG_EXPAND_SZ = 0x20000
REG_DWORD = 0x10001
; Win9x Compatible Types
REG_BINARY = 17
REG_SZ = 0
; Service install flags
SPSVCINST_TAGTOFRONT = 0x1
SPSVCINST_ASSOCSERVICE = 0x2

View file

@ -0,0 +1,137 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1Main.cpp
Author :
Date :
Purpose : This file contains the Entry Point of the Device Driver.
The File also defines various Dispatch Routine pointers
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
/* Include the Library and Other header file */
#include "SkyWalker1Main.h" //Common For all the Definitions,
//Declarations and Library Routines
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
/* End of Macro Definitions */
/* Global & Static variables Declaration */
//Device Dispatch Table : Lists the dispatch routines for the
//major events in the life of Device
const KSDEVICE_DISPATCH SkyWalker1DispatchTable = {
/* Add */ SkyWalker1AddDevice,
/* Start */ SkyWalker1Start,
/* PostStart */ NULL,
/* QueryStop */ SkyWalker1QueryStop,
/* CancelStop */ NULL,
/* Stop */ SkyWalker1Stop,
/* QueryRemove */ NULL, /*QueryRemoveUsbDevice,*/
/* CancelRemove */ NULL,
/* Remove */ SkyWalker1Remove,
/* QueryCapabilities */ NULL,
/* SurpriseRemoval */ NULL,
/* QueryPower */ NULL,
/* SetPower */ SkyWalker1SetPower
};
//Array of Filter Descriptors supported by the Current Driver
// Hold all the filter descriptors in an array
DEFINE_KSFILTER_DESCRIPTOR_TABLE(FilterDescriptors)
{
&SkyWalker1CaptureFilterDescriptor //Only Capture filter is a Kernel Streaming Filter
};
//Device Descriptor : It Describes the Device with all it's dispatch
//functions and Filters
const KSDEVICE_DESCRIPTOR SkyWalker1DeviceDescriptor =
{
&SkyWalker1DispatchTable,
SIZEOF_ARRAY(FilterDescriptors), //Filter Descriptor Count
FilterDescriptors, //Filter Descriptor Table
KSDEVICE_DESCRIPTOR_VERSION
};
/* 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 */
/*****************************************************************************
Function : DriverEntry
Description : This is a Entry Point function of the Windows Device Driver
It defines various dispatch routine Entry Point for the Driver
IN PARAM : <PDRIVER_OBJECT > Pointer to Driver Object which is called
<PUNICODE_STRING> Pointer to the Registry Entry of the Driver
OUT PARAM : <NTSTATUS> Status of the Driver Entry routine
STATUS_SUCCESS always
PreCondition : Driver is Unloaded
PostCondtion : Driver is Loaded with various Entry Point defined
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
extern "C" NTSTATUS DriverEntry(IN PDRIVER_OBJECT pDriverObject,
IN PUNICODE_STRING pRegistryPath)
{
NTSTATUS ntEntryStatus = STATUS_SUCCESS;
PrintFunctionEntry(__FUNCTION__);
SkyWalkerDebugPrint(ENTRY_LEVEL, ("SkyWalker1 Driver Compiled on Date = %s, Time = %s\n",__DATE__,__TIME__));
SkyWalkerDebugPrint(ENTRY_LEVEL, ("Debug Level = %u\n",nCurrentDebugLevel));
//As this is an AVStream Minidriver it should call the KsInitializeDriver()
ntEntryStatus = KsInitializeDriver(
pDriverObject,
pRegistryPath,
&SkyWalker1DeviceDescriptor);
PrintFunctionExit(__FUNCTION__,ntEntryStatus);
return ntEntryStatus;
}
/*****************************************************************************
Function : SkyWalker1DriverUnload
Description : This is a Exit Point function of the Windows Device Driver
It does not usedful job for the PnP Driver but required to
unload the Driver from the Running System.
IN PARAM : <PDRIVER_OBJECT > Pointer to Driver Object which is to be Unloaded
OUT PARAM : NONE
PreCondition : Driver is Loaded
PostCondtion : Driver is Unloaded
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
VOID SkyWalker1DriverUnload(PDRIVER_OBJECT pDriverObject)
{
PrintFunctionEntry(__FUNCTION__);
//No Processing
PrintFunctionExit(__FUNCTION__,STATUS_SUCCESS);
}

View file

@ -0,0 +1,336 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1PnP.cpp
Author :
Date :
Purpose : PnP IRP Message Handler
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
/* Include the Library and Other header file */
#include "SkyWalker1Main.h" //Common For all the Definitions,
//Declarations and Library Routines
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
/* End of Global & Static variables Declaration */
/* External Variable Declaration */
/* End of External Variable Declaration */
/* Declare Enumerations here */
/* End of Enumeration declaration */
/* Function Prototypes */
void PrintKSDeviceObject(IN PKSDEVICE pKSDeviceObject);
/* End of Function prototype definitions */
/*****************************************************************************
Function : SkyWalker1AddDevice
Description : This Function is called by the PnP Manager for each Device
managed by the Driver.It is called during the System Initialization
and any time a new Device is enumerated while the System is running.
IN PARAM : <PKSDEVICE > Pointer to the Enumerated Physical Device
KSDEVICE is a WDM Functional Device which is managed by the AVStream
OUT PARAM : <NTSTATUS> Status of the Device Addition
STATUS_SUCCESS when the Device added to the System
Reason for Failure incase of Error
PreCondition : Driver is Loaded without Functional/ Filter Device Objects
PostCondtion : Functional Device Object [FDO] or Filter Device Object [FiDO] are created
Logic : NONE
Assumption : NONE
Note : AddDevice is Must for the PnP Drivers
This routine runs at PASSIVE_LEVEL_IRQL
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS SkyWalker1AddDevice(IN PKSDEVICE pKSDeviceObject)
{
NTSTATUS ntAddDeviceStatus = STATUS_SUCCESS;
PKSFILTERFACTORY pFilterFactory = NULL;
PrintFunctionEntry(__FUNCTION__);
PrintKSDeviceObject(pKSDeviceObject);
if(!IS_VALID(pKSDeviceObject))
{
SkyWalkerDebugPrint(ENTRY_LEVEL,("Invalid KS Device Object Received\n"));
ntAddDeviceStatus = STATUS_UNSUCCESSFUL;
goto FinishAddDevice;
}
//Allcate Memory for the SkyWalker1 Device
CSkyWalker1Device * pDevice = new(NonPagedPool,TUNER_MEM_TAG)CSkyWalker1Device;
if(!IS_VALID(pDevice))
{
SkyWalkerDebugPrint(ENTRY_LEVEL,("Can not allocate Memory for the SkyWalker1 Device\n"));
ntAddDeviceStatus = STATUS_INSUFFICIENT_RESOURCES;
goto FinishAddDevice;
}
ntAddDeviceStatus = pDevice->Create(pKSDeviceObject);
PrintKSDeviceObject(pKSDeviceObject);
FinishAddDevice:
PrintFunctionExit(__FUNCTION__,ntAddDeviceStatus);
return ntAddDeviceStatus;
}
/*****************************************************************************
Function : SkyWalker1Remove
Description : This function is called when the IRP_MN_REMOVE_DEVICE is sent
by the PnP Manager during Device Removal
IN PARAM : <PKSDEVICE > Pointer to the Enumerated Physical Device
KSDEVICE is a WDM Functional Device which is managed by the AVStream
<PIRP> Remove Device Io Request Packet
OUT PARAM : NONE
PreCondition : Started Device
PostCondtion : Device Removed
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
VOID SkyWalker1Remove( IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket)
{
NTSTATUS ntDeviceRemoveStatus = STATUS_SUCCESS;
CSkyWalker1Device * pDevice = NULL;
PrintFunctionEntry(__FUNCTION__);
//Get the SkyWalker1 Device Object from the Context Info.
pDevice = reinterpret_cast<CSkyWalker1Device *>(pKSDeviceObject->Context);
if(!IS_VALID(pDevice))
{
//Unexpected Remove for the Device
SkyWalkerDebugPrint(ENTRY_LEVEL,("No Connection found with SkyWalker Device\n"));
ntDeviceRemoveStatus = STATUS_UNSUCCESSFUL;
goto ExitRemoveDevice;
}
ntDeviceRemoveStatus = pDevice->Close(pKSDeviceObject,pIoRequestPacket);
//Deallocate the SkyWalker1 Device Object Memory
delete pDevice;
//Remove Reference of the SkyWalker1 Device from the KS Object
pKSDeviceObject->Context = NULL;
ExitRemoveDevice:
PrintFunctionExit(__FUNCTION__,ntDeviceRemoveStatus);
}
/*****************************************************************************
Function : SkyWalker1Start
Description : This function is called when the IRP_MN_START_DEVICE is sent
by the PnP Manager after Allocating Resources to the Device.
IRP_MN_START_DEVICE is called once for each device created from
the Driver using the IoCreateDevice() call.
When BDA Device Starts operating Pnp Dispatches the IRP_MN_START_DEVICE to the ks.sys
AvStream class Driver inturn calls the start routine of the BDA minidriver
associated with the BDA Device. This Start Routine retrives information about the
device from the registry, sets information about the Device and then calls the
BdaCreateFilterFactory() support function to
1) Create Filter Factory from the Initial Filter Descriptor (KSFILTER_DESCRIPTOR)
for the Device.The Initial Filter Descriptor references Dispatch and Automation
tables for the Filter and Input Pins
2) Associate Filter Factory with the BDA_FILTER_TEMPLATE structure.This structure
references template filter descriptor for the Device and the list of possible
pairs of the input and output pins.The Descriptor and list inturn reference.
a) Static Template Structure that can be used by Network Provider to determine
BDA Driver topology
b) Static Template Structure that can be used by Network Provider to manipulate
BDA Filter
c) Nodes and Pins for a BDA Filter along with possible ways to connect the Filter
d) Routines that a Netwrok provider can use to Create and Close a Filter instance
3) Register the Static Template structures that are specified by BDA_FILTER_TEMPLATE
with the BDA support library so that the library can provide default handling
for a BDA MiniDriver's Properties and methods.
IN PARAM : <PKSDEVICE> Reference to Device to be Started
<PIRP> IoRequest Packet
OUT PARAM : <NTSTATUS> Status of the Tuner Start
STATUS_SUCCESS in case of successful execution
Failure Code in other cases
PreCondition : Stopped Device or Device Enumerated for the First Time
PostCondtion : Device Initialized with the Newly allocated Resources,
Logic : NONE
Assumption : NONE
Note : This is called from the PASSIVE_LEVEL_IRQL
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS SkyWalker1Start(IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket,
IN PCM_RESOURCE_LIST pResourceList,
IN PCM_RESOURCE_LIST pResourceListTranslated)
{
NTSTATUS ntStartStatus = STATUS_SUCCESS;
CSkyWalker1Device * pDevice = NULL;
PrintFunctionEntry(__FUNCTION__);
//Get the SkyWalker1 Device Object from the Context Info.
pDevice = reinterpret_cast<CSkyWalker1Device *>(pKSDeviceObject->Context);
if(!IS_VALID(pDevice))
{
//No Device Found
SkyWalkerDebugPrint(ENTRY_LEVEL,("No Connection with SkyWalker Device\n"));
ntStartStatus = STATUS_UNSUCCESSFUL;
goto ExitStartDevice;
}
//Call the Start device function of the SkyWalker1 Device class
ntStartStatus = pDevice->Start( pKSDeviceObject,
pIoRequestPacket,
pResourceList,
pResourceListTranslated);
ExitStartDevice:
PrintFunctionExit(__FUNCTION__,ntStartStatus);
return STATUS_SUCCESS;
}
/*****************************************************************************
Function : SkyWalker1Stop
Description : This function is called when the IRP_MN_STOP_DEVICE is sent
by the PnP Manager during Device Removal
IN PARAM : <PKSDEVICE> Reference to Device to be Removed
<PIRP> Stop Device Io Request Packet
OUT PARAM : NONE
PreCondition : Started Device
PostCondtion : Device Stopped
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
VOID SkyWalker1Stop(IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket)
{
NTSTATUS ntStopStatus = STATUS_SUCCESS;
CSkyWalker1Device * pDevice = NULL;
PrintFunctionEntry(__FUNCTION__);
//Get the SkyWalker1 Device Object from the Context Info.
pDevice = reinterpret_cast<CSkyWalker1Device *>(pKSDeviceObject->Context);
if(!IS_VALID(pDevice))
{
SkyWalkerDebugPrint(ENTRY_LEVEL,("No Connection with SkyWalker Device\n"));
goto ExitStopDevice;
}
//Call the Stop device function of the SkyWalker1 Device class
ntStopStatus = pDevice->Stop( pKSDeviceObject,
pIoRequestPacket
);
ExitStopDevice:
PrintFunctionExit(__FUNCTION__,ntStopStatus);
}
/*****************************************************************************
Function : SkyWalker1QueryStop
Description : This function is called when the IRP_MN_QUERY_STOP_DEVICE is sent
by the PnP Manager during Device Stop
IN PARAM : <PKSDEVICE > Pointer to the Enumerated Physical Device
KSDEVICE is a WDM Functional Device which is managed by the AVStream
<PIRP> Remove Device Io Request Packet
OUT PARAM : NONE
PreCondition : Started Device
PostCondtion : Query for stopping device is returned
Logic : NONE
Assumption : NONE
Note : All the Devices created by the Driver are connected with Each other
with the NextDevice Member of the Device Object
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS SkyWalker1QueryStop( IN PKSDEVICE pKSDeviceObject,
IN PIRP pIoRequestPacket)
{
PrintFunctionEntry(__FUNCTION__);
PrintFunctionExit(__FUNCTION__,STATUS_SUCCESS);
return STATUS_SUCCESS;
}
/*****************************************************************************
Function : SkyWalker1SetPower
Description : This function is called when the IRP_MJ_POWER is sent
by the PnP Manager during Power Management
IN PARAM : <PKSDEVICE > Pointer to the Enumerated Physical Device
KSDEVICE is a WDM Functional Device which is managed by the AVStream
<PIRP> Power Device Io Request Packet
OUT PARAM : NONE
PreCondition : Started Device
PostCondtion : Query for stopping device is returned
Logic : NONE
Assumption : NONE
Note : All the Devices created by the Driver are connected with Each other
with the NextDevice Member of the Device Object
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
VOID SkyWalker1SetPower
(
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.
)
{
CSkyWalker1Device * pDevice = NULL;
PrintFunctionEntry(__FUNCTION__);
//Get the SkyWalker1 Device Object from the Context Info.
pDevice = reinterpret_cast<CSkyWalker1Device *>(pKSDeviceObject->Context);
if(!IS_VALID(pDevice))
{
SkyWalkerDebugPrint(ENTRY_LEVEL,("No Connection with SkyWalker Device\n"));
goto ExitSetPower;
}
//Call the Set Power device function of the SkyWalker1 Device class
pDevice->SetPower( pKSDeviceObject,
pIoRequestPacket,
To,
From
);
ExitSetPower:
PrintFunctionExit(__FUNCTION__,STATUS_SUCCESS);
}
void PrintKSDeviceObject(IN PKSDEVICE pKSDeviceObject)
{
SkyWalkerDebugPrint(ENTRY_LEVEL, (__FUNCTION__"\n"));
SkyWalkerDebugPrint(ENTRY_LEVEL, ("pKsDeviceObject->pDeviceDescriptor = 0x%p \n",pKSDeviceObject->Descriptor));
SkyWalkerDebugPrint(ENTRY_LEVEL, ("pKsDeviceObject->pDeviceDescriptor->Dispatch = 0x%p \n",pKSDeviceObject->Descriptor->Dispatch));
SkyWalkerDebugPrint(ENTRY_LEVEL, ("pKsDeviceObject->pDeviceDescriptor->FilterDescriptorsCount = %lu \n",pKSDeviceObject->Descriptor->FilterDescriptorsCount));
SkyWalkerDebugPrint(ENTRY_LEVEL, ("pKsDeviceObject->pDeviceDescriptor->FilterDescriptors = 0x%p \n",pKSDeviceObject->Descriptor->FilterDescriptors));
SkyWalkerDebugPrint(ENTRY_LEVEL, ("pKsDeviceObject->pDeviceDescriptor->Version = %lu \n",pKSDeviceObject->Descriptor->Version));
SkyWalkerDebugPrint(ENTRY_LEVEL, ("pKsDeviceObject->Bag = 0x%p\n",pKSDeviceObject->Bag));
SkyWalkerDebugPrint(ENTRY_LEVEL, ("pKsDeviceObject->Context = 0x%p\n",pKSDeviceObject->Context));
SkyWalkerDebugPrint(ENTRY_LEVEL, ("pKsDeviceObject->FunctionalDeviceObject = 0x%p\n",pKSDeviceObject->FunctionalDeviceObject));
SkyWalkerDebugPrint(ENTRY_LEVEL, ("pKsDeviceObject->PhysicalDeviceObject = 0x%p\n",pKSDeviceObject->PhysicalDeviceObject));
SkyWalkerDebugPrint(ENTRY_LEVEL, ("pKsDeviceObject->NextDeviceObject = 0x%p\n",pKSDeviceObject->NextDeviceObject));
SkyWalkerDebugPrint(ENTRY_LEVEL, ("pKsDeviceObject->Started = %d\n",pKSDeviceObject->Started));
SkyWalkerDebugPrint(ENTRY_LEVEL, ("pKsDeviceObject->SystemPowerState = %d\n",pKSDeviceObject->SystemPowerState));
SkyWalkerDebugPrint(ENTRY_LEVEL, ("pKsDeviceObject->DevicePowerState = %d\n",pKSDeviceObject->DevicePowerState));
}

View file

@ -0,0 +1,414 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1TransportPin.cpp
Author :
Date :
Purpose : This file contains header for the Transport pin on the Tuner
filter.
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
/* Include the Library and Other header file */
#include "SkyWalker1Main.h" //Common For all the Definitions,
//Declarations and Library Routines
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
/* End of Macro Definitions */
/* Global & Static variables Declaration */
/* End of Global & Static variables Declaration */
/* External Variable Declaration */
/* End of External Variable Declaration */
/* Declare Enumerations here */
/* End of Enumeration declaration */
/* Function Prototypes */
VOID PrintBdaTransport(PKS_DATARANGE_BDA_TRANSPORT pBdaTransport);
VOID PrintBdaTransportInfo(PBDA_TRANSPORT_INFO pBdaTransportInfo);
VOID PrintKsDataFormat(PKSDATAFORMAT pKsDataFormat);
PCHAR GetDemodPropertyString(ULONG ulDemodProperty);
PCHAR GetExtendedPropertyString(ULONG ulTunerExtendedProperty);
/* End of Function prototype definitions */
/*****************************************************************************
Function : CTransportPin::IntersectDataFormat
Description : Enables connection of the output pin with a downstream filter.
IN PARAM :
OUT PARAM : <NTSTATUS> Status of the IntersectDataFormat
PreCondition : None
PostCondtion : None
Logic : NONE
Assumption : NONE
Note : This is called from the PASSIVE_LEVEL_IRQL
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS CTransportPin::IntersectDataFormat(
IN PVOID pContext,
IN PIRP pIoRequestPacket,
IN PKSP_PIN Pin,
IN PKSDATARANGE pDataRange,
IN PKSDATARANGE pMatchingDataRange,
IN ULONG ulDataBufferSize,
OUT PVOID pData OPTIONAL,
OUT PULONG pulDataSize
)
{
NTSTATUS ntStatus = STATUS_SUCCESS;
PrintFunctionEntry(__FUNCTION__);
if ( ulDataBufferSize < sizeof(KS_DATARANGE_BDA_TRANSPORT) )
{
*pulDataSize = sizeof( KS_DATARANGE_BDA_TRANSPORT );
ntStatus = STATUS_BUFFER_OVERFLOW;
goto ExitDataFormat;
}
else if (pDataRange->FormatSize < sizeof (KS_DATARANGE_BDA_TRANSPORT))
{
ntStatus = STATUS_NO_MATCH;
goto ExitDataFormat;
}
else
{
*pulDataSize = sizeof( KS_DATARANGE_BDA_TRANSPORT );
RtlCopyMemory( pData, (PVOID)pDataRange, sizeof(KS_DATARANGE_BDA_TRANSPORT));
ntStatus = STATUS_SUCCESS;
PrintBdaTransport((PKS_DATARANGE_BDA_TRANSPORT)pDataRange);
}
ExitDataFormat:
PrintFunctionExit(__FUNCTION__,ntStatus);
return ntStatus;
}
/*****************************************************************************
Function : CTransportPin::SetDigitalDemodProperty
Description : Sets the value of the digital demodulator node properties.
IN PARAM :
OUT PARAM : <NTSTATUS> Status SUCCESS in case Valid Property Set request
STATUS_INVALID_PARAMETER in case of Invalid property set request
PreCondition : None
PostCondtion : Demodulator propery Set in case of successful execution
Logic : NONE
Assumption : NONE
Note : This is called from the PASSIVE_LEVEL_IRQL
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS CTransportPin::SetDigitalDemodProperty(
IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
IN PULONG pulProperty
)
{
NTSTATUS ntSetStatus = STATUS_SUCCESS;
CTransportPin* pPin;
CTunerFilter* pFilter;
ModulationType NewModulationType;
BinaryConvolutionCodeRate NewFecRate;
ULONG ulNewSymbolRate;
PrintFunctionEntry(__FUNCTION__);
// Call the BDA support library to
// validate that the node type is associated with this pin.
//
ntSetStatus = BdaValidateNodeProperty( pIoRequestPacket, pKSProperty);
if (NT_SUCCESS( ntSetStatus))
{
// Obtain a pointer to the pin object.
//
// Because the property dispatch table calls the CTransportPin::SetDigitalDemodProperty()
// method directly, the method must retrieve a pointer to the underlying pin object.
//
pPin = reinterpret_cast<CTransportPin *>(KsGetPinFromIrp(pIoRequestPacket)->Context);
// Retrieve the filter context from the pin context.
//
pFilter = pPin->GetFilter();
SkyWalkerDebugPrint(EXTREME_LEVEL,("Set : %s : %lu(%l)",GetDemodPropertyString(pKSProperty->Id),*pulProperty,*((LONG*)(pulProperty))));
switch (pKSProperty->Id)
{
case KSPROPERTY_BDA_MODULATION_TYPE:
ntSetStatus = pFilter->SetModulatorType((ModulationType)*pulProperty);
break;
case KSPROPERTY_BDA_INNER_FEC_TYPE:
ntSetStatus = pFilter->SetInnerFecType(*pulProperty);
break;
case KSPROPERTY_BDA_INNER_FEC_RATE:
ntSetStatus = pFilter->SetInnerFecRate((BinaryConvolutionCodeRate)*pulProperty);
break;
case KSPROPERTY_BDA_OUTER_FEC_TYPE:
ntSetStatus = pFilter->SetOuterFecType(*pulProperty);
break;
case KSPROPERTY_BDA_OUTER_FEC_RATE:
ntSetStatus = pFilter->SetOuterFecRate((BinaryConvolutionCodeRate)*pulProperty);
break;
case KSPROPERTY_BDA_SYMBOL_RATE:
ntSetStatus = pFilter->SetSymbolRate(*pulProperty);
break;
case KSPROPERTY_BDA_SPECTRAL_INVERSION:
ntSetStatus = pFilter->SetSpectralInversion((SpectralInversion)*pulProperty);
break;
case KSPROPERTY_BDA_GUARD_INTERVAL:
ntSetStatus = pFilter->SetGuardInterval((GuardInterval)*pulProperty);
break;
case KSPROPERTY_BDA_TRANSMISSION_MODE:
ntSetStatus = pFilter->SetTransmissionMode((TransmissionMode)*pulProperty);
break;
default:
ntSetStatus = STATUS_INVALID_PARAMETER;
break;
}
}
PrintFunctionExit(__FUNCTION__,ntSetStatus);
return ntSetStatus;
}
/*****************************************************************************
Function : CTransportPin::GetDigitalDemodProperty
Description : Gets the value of the digital demodulator node properties.
IN PARAM :
OUT PARAM : <NTSTATUS> Status SUCCESS in case Valid Property Get request
STATUS_INVALID_PARAMETER in case of Invalid property Get request
PreCondition : None
PostCondtion : Demodulator propery returned in case of successful execution
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS CTransportPin::GetDigitalDemodProperty(
IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
IN PULONG pulProperty
)
{
NTSTATUS ntGetStatus = STATUS_SUCCESS;
CTransportPin* pPin;
CTunerFilter* pFilter;
BDATUNER_DEVICE_PARAMETER DemodProperty;
PrintFunctionEntry(__FUNCTION__);
// Call the BDA support library to
// validate that the node type is associated with this pin.
//
ntGetStatus = BdaValidateNodeProperty( pIoRequestPacket, pKSProperty);
if (NT_SUCCESS( ntGetStatus))
{
// Obtain a pointer to the pin object.
//
// Because the property dispatch table calls the CTransportPin::GetDigitalDemodProperty()
// method directly, the method must retrieve a pointer to the underlying pin object.
//
pPin = reinterpret_cast<CTransportPin *>(KsGetPinFromIrp(pIoRequestPacket)->Context);
// Retrieve the filter context from the pin context.
//
pFilter = pPin->GetFilter();
ntGetStatus = pFilter->GetDemodProperty(&DemodProperty);
switch (pKSProperty->Id)
{
case KSPROPERTY_BDA_MODULATION_TYPE:
*pulProperty = (ModulationType)DemodProperty.CurrentModulationType;
break;
case KSPROPERTY_BDA_INNER_FEC_TYPE:
*pulProperty = BDA_FEC_VITERBI;
break;
case KSPROPERTY_BDA_INNER_FEC_RATE:
*pulProperty = (BinaryConvolutionCodeRate)DemodProperty.InnerFecRate;
break;
case KSPROPERTY_BDA_OUTER_FEC_TYPE:
*pulProperty = BDA_FEC_VITERBI;
break;
case KSPROPERTY_BDA_OUTER_FEC_RATE:
*pulProperty = (BinaryConvolutionCodeRate)DemodProperty.OuterFecRate;
break;
case KSPROPERTY_BDA_SYMBOL_RATE:
*pulProperty = DemodProperty.ulSymbolRate;
break;
case KSPROPERTY_BDA_SPECTRAL_INVERSION:
*pulProperty = (SpectralInversion) DemodProperty.CurrentSpectralInversion;
break;
case KSPROPERTY_BDA_GUARD_INTERVAL:
*pulProperty = (GuardInterval) DemodProperty.CurrentGuardInterval;
break;
case KSPROPERTY_BDA_TRANSMISSION_MODE:
*pulProperty = (TransmissionMode) DemodProperty.CurrentTransmissionMode;
break;
default:
ntGetStatus = STATUS_INVALID_PARAMETER;
break;
}
}
SkyWalkerDebugPrint(EXTREME_LEVEL,("Get : %s : %ul",GetDemodPropertyString(pKSProperty->Id),*pulProperty));
PrintFunctionExit(__FUNCTION__,ntGetStatus);
return ntGetStatus;
}
/*****************************************************************************
Function : CTransportPin::SetExtendedProperty
Description : Sets the Extended Property of the Tuner
IN PARAM : IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
IN PULONG pulProperty
OUT PARAM : <NTSTATUS> Status SUCCESS in case Valid Property request
STATUS_INVALID_PARAMETER in case of Invalid property request
Else error from the lower device
PreCondition : None
PostCondtion : Extended Property Set in case of successful execution
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS CTransportPin::SetExtendedProperty(
IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
IN PULONG pulProperty
)
{
NTSTATUS ntSetStatus = STATUS_SUCCESS;
CTransportPin * pPin = NULL;
CTunerFilter* pFilter = NULL;
PrintFunctionEntry(__FUNCTION__);
//Call the BDA support library to
//validate that the node type is associated with the pin.
//The BdaValidateNodeProperty function validates that a node property
//request is associated with a specific pin.
ntSetStatus = BdaValidateNodeProperty( pIoRequestPacket, pKSProperty);
if (NT_SUCCESS( ntSetStatus))
{
//Obtain a pointer to the pin object.
//Because the property dispatch table calls the CTransportPin::SetExtendedProperty()
//method directly, the method must retrieve a pointer to the underlying pin object.
pPin = reinterpret_cast<CTransportPin *>(KsGetPinFromIrp(pIoRequestPacket)->Context);
//Retrieve the filter context from the pin context.
pFilter = pPin->GetFilter();
SkyWalkerDebugPrint(EXTREME_LEVEL,("Set : %s : %lu(%l)",
GetExtendedPropertyString(pKSProperty->Id),
*pulProperty,
*((LONG*)(pulProperty))));
//Retrieve the actual filter parameter.
switch (pKSProperty->Id)
{
case KSPROPERTY_BDA_DISEQC:
ntSetStatus = pFilter->SendDiseqcCommand((PDISEQC_COMMAND) pulProperty);
break;
default:
ntSetStatus = STATUS_INVALID_PARAMETER;
break;
}
}
PrintFunctionExit(__FUNCTION__,ntSetStatus);
return ntSetStatus;
}
//Debug Functions
VOID PrintBdaTransport(PKS_DATARANGE_BDA_TRANSPORT pBdaTransport)
{
PrintBdaTransportInfo(&pBdaTransport->BdaTransportInfo);
PrintKsDataFormat(&pBdaTransport->DataRange);
}
VOID PrintBdaTransportInfo(PBDA_TRANSPORT_INFO pBdaTransportInfo)
{
SkyWalkerDebugPrint(EXTREME_LEVEL, ("pBdaTransportInfo->ulcbPhyiscalPacket = %lu Bytes\n",
pBdaTransportInfo->ulcbPhyiscalPacket));
SkyWalkerDebugPrint(EXTREME_LEVEL, ("pBdaTransportInfo->ulcbPhyiscalFrame = %lu Bytes\n",
pBdaTransportInfo->ulcbPhyiscalFrame));
SkyWalkerDebugPrint(EXTREME_LEVEL, ("pBdaTransportInfo->ulcbPhyiscalFrameAlignment = %lu\n",
pBdaTransportInfo->ulcbPhyiscalFrameAlignment));
SkyWalkerDebugPrint(EXTREME_LEVEL, ("pBdaTransportInfo->ulcbPhyiscalPacket = %ll (Normal Active Movie units)\n",
pBdaTransportInfo->ulcbPhyiscalPacket));
}
VOID PrintKsDataFormat(PKSDATAFORMAT pKsDataFormat)
{
SkyWalkerDebugPrint(EXTREME_LEVEL, ("pKsDataFormat->FormatSize = %lu\n",
pKsDataFormat->FormatSize));
SkyWalkerDebugPrint(EXTREME_LEVEL, ("pKsDataFormat->Flags = %lu\n",
pKsDataFormat->Flags));
SkyWalkerDebugPrint(EXTREME_LEVEL, ("pKsDataFormat->SampleSize = %lu\n",
pKsDataFormat->SampleSize));
SkyWalkerDebugPrint(EXTREME_LEVEL, ("pKsDataFormat->Reserved = %lu\n",
pKsDataFormat->Reserved));
}
PCHAR GetDemodPropertyString(ULONG ulDemodProperty)
{
switch(ulDemodProperty)
{
case KSPROPERTY_BDA_MODULATION_TYPE:
return "KSPROPERTY_BDA_MODULATION_TYPE";
case KSPROPERTY_BDA_INNER_FEC_TYPE:
return "KSPROPERTY_BDA_INNER_FEC_TYPE";
case KSPROPERTY_BDA_INNER_FEC_RATE:
return "KSPROPERTY_BDA_INNER_FEC_RATE";
case KSPROPERTY_BDA_OUTER_FEC_TYPE:
return "KSPROPERTY_BDA_OUTER_FEC_TYPE";
case KSPROPERTY_BDA_OUTER_FEC_RATE:
return "KSPROPERTY_BDA_OUTER_FEC_RATE";
case KSPROPERTY_BDA_SYMBOL_RATE:
return "KSPROPERTY_BDA_SYMBOL_RATE";
case KSPROPERTY_BDA_SPECTRAL_INVERSION:
return "KSPROPERTY_BDA_SPECTRAL_INVERSION";
case KSPROPERTY_BDA_GUARD_INTERVAL:
return "KSPROPERTY_BDA_GUARD_INTERVAL";
case KSPROPERTY_BDA_TRANSMISSION_MODE:
return "KSPROPERTY_BDA_TRANSMISSION_MODE";
default:
return "KSPROPERTY_BDA_INVALID_PROPERTY";
}
}
PCHAR GetExtendedPropertyString(ULONG ulTunerExtendedProperty)
{
switch(ulTunerExtendedProperty)
{
case KSPROPERTY_BDA_DISEQC:
return "KSPROPERTY_BDA_DISEQC";
default:
return "KSPROPERTY_BDA_INVALID_PROPERTY";
}
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,717 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1TunerFilterDefinitions.cpp
Author :
Date :
Purpose : Tuner Filter Definition
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
/* Include the Library and Other header file */
#include "SkyWalker1Main.h" //Main Header file
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
/* End of Macro Definitions */
/* Global & Static variables Declaration */
//BDA Tuner Frequency Property Set
DEFINE_KSPROPERTY_TABLE(SkyWalker1TunerFrequencyProperties)
{
DEFINE_KSPROPERTY_ITEM_BDA_RF_TUNER_FREQUENCY(
CAntennaPin::GetTunerProperty,
CAntennaPin::SetTunerProperty
),
DEFINE_KSPROPERTY_ITEM_BDA_RF_TUNER_FREQUENCY_MULTIPLIER(
CAntennaPin::GetTunerProperty,
CAntennaPin::SetTunerProperty
),
DEFINE_KSPROPERTY_ITEM_BDA_RF_TUNER_POLARITY(
CAntennaPin::GetTunerProperty,
CAntennaPin::SetTunerProperty
),
DEFINE_KSPROPERTY_ITEM_BDA_RF_TUNER_RANGE(
CAntennaPin::GetTunerProperty,
CAntennaPin::SetTunerProperty
),
DEFINE_KSPROPERTY_ITEM_BDA_RF_TUNER_BANDWIDTH(
CAntennaPin::GetTunerProperty,
CAntennaPin::SetTunerProperty
),
DEFINE_KSPROPERTY_ITEM_BDA_RF_TUNER_TRANSPONDER(
CAntennaPin::GetTunerProperty,
CAntennaPin::SetTunerProperty
),
};
//BDA LNB Info Property Set
DEFINE_KSPROPERTY_TABLE(SkyWalker1TunerLnbProperties)
{
DEFINE_KSPROPERTY_ITEM_BDA_LNB_LOF_HIGH_BAND(
CAntennaPin::GetTunerLnbProperty,
CAntennaPin::SetTunerLnbProperty
),
DEFINE_KSPROPERTY_ITEM_BDA_LNB_LOF_LOW_BAND(
CAntennaPin::GetTunerLnbProperty,
CAntennaPin::SetTunerLnbProperty
),
DEFINE_KSPROPERTY_ITEM_BDA_LNB_SWITCH_FREQUENCY(
CAntennaPin::GetTunerLnbProperty,
CAntennaPin::SetTunerLnbProperty
),
};
//BDA Signal Statistics Properties
//
//Defines the dispatch routines for the Signal Statistics Properties
//on the RF Tuner, Demodulator, and PID Filter Nodes
//
DEFINE_KSPROPERTY_TABLE(SkyWalker1TunerSignalProperties)
{
DEFINE_KSPROPERTY_ITEM_BDA_SIGNAL_STRENGTH(
CAntennaPin::GetSignalStatus,
NULL
),
DEFINE_KSPROPERTY_ITEM_BDA_SIGNAL_QUALITY(
CAntennaPin::GetSignalStatus,
NULL
),
DEFINE_KSPROPERTY_ITEM_BDA_SIGNAL_PRESENT(
CAntennaPin::GetSignalStatus,
NULL
),
DEFINE_KSPROPERTY_ITEM_BDA_SIGNAL_LOCKED(
CAntennaPin::GetSignalStatus,
NULL
),
#ifdef LOCK_CODE
DEFINE_KSPROPERTY_ITEM_BDA_SIGNAL_LOCK_CAPS(
CAntennaPin::GetSignalStatus
),
DEFINE_KSPROPERTY_ITEM_BDA_SIGNAL_LOCK_TYPE(
CAntennaPin::GetSignalStatus
),
DEFINE_KSPROPERTY_ITEM_BDA_SAMPLE_TIME(
CTransportPin::GetSignalStatus,
NULL
),
#endif
};
DEFINE_KSPROPERTY_SET_TABLE(SkyWalker1TunerAutomationProperties)
{
DEFINE_KSPROPERTY_SET
(
&KSPROPSETID_BdaFrequencyFilter, //Property Set defined elsewhere
SIZEOF_ARRAY(SkyWalker1TunerFrequencyProperties), //Number of properties in the array
SkyWalker1TunerFrequencyProperties, //Property set array
0, //FastIoCount
NULL //FastIoTable
),
DEFINE_KSPROPERTY_SET
(
&KSPROPSETID_BdaLNBInfo, //Property Set defined elsewhere
SIZEOF_ARRAY(SkyWalker1TunerLnbProperties), //Number of properties in the array
SkyWalker1TunerLnbProperties, //Property set array
0, //FastIoCount
NULL //FastIoTable
),
DEFINE_KSPROPERTY_SET
(
&KSPROPSETID_BdaSignalStats, //Property Set defined elsewhere
SIZEOF_ARRAY(SkyWalker1TunerSignalProperties), //Number of properties in the array
SkyWalker1TunerSignalProperties, //Property set array
0, //FastIoCount
NULL //FastIoTable
),
};
//Tuner Automation Table.Used to get and tuner related Methods,
//Events and Properties
DEFINE_KSAUTOMATION_TABLE(SkyWalker1TunerAutomation)
{
DEFINE_KSAUTOMATION_PROPERTIES(SkyWalker1TunerAutomationProperties),
DEFINE_KSAUTOMATION_METHODS_NULL,
DEFINE_KSAUTOMATION_EVENTS_NULL
};
//BDA Signal Statistics Properties for Demodulator Node
//Defines the dispatch routines for the Signal Statistics Properties
//on the Demodulator Node.
DEFINE_KSPROPERTY_TABLE(SkyWalker1DemodulatorSignalStats)
{
DEFINE_KSPROPERTY_ITEM_BDA_SIGNAL_QUALITY(
CTransportPin::GetSignalStatus,
NULL
),
DEFINE_KSPROPERTY_ITEM_BDA_SIGNAL_LOCKED(
CTransportPin::GetSignalStatus,
NULL
),
DEFINE_KSPROPERTY_ITEM_BDA_SIGNAL_PRESENT(
CTransportPin::GetSignalStatus,
NULL
),
DEFINE_KSPROPERTY_ITEM_BDA_SIGNAL_STRENGTH(
CTransportPin::GetSignalStatus,
NULL
),
};
//
//BDA Digital Demodulator Property Set for Demodulator Node
//
//Defines the dispatch routines for the Digital Demodulator Properties
//on the Demodulator Node.
//
DEFINE_KSPROPERTY_TABLE(SkyWalker1DemodulatorProps)
{
DEFINE_KSPROPERTY_ITEM_BDA_MODULATION_TYPE(
CTransportPin::GetDigitalDemodProperty,
CTransportPin::SetDigitalDemodProperty
),
DEFINE_KSPROPERTY_ITEM_BDA_INNER_FEC_TYPE(
CTransportPin::GetDigitalDemodProperty,
CTransportPin::SetDigitalDemodProperty
),
DEFINE_KSPROPERTY_ITEM_BDA_INNER_FEC_RATE(
CTransportPin::GetDigitalDemodProperty,
CTransportPin::SetDigitalDemodProperty
),
DEFINE_KSPROPERTY_ITEM_BDA_OUTER_FEC_TYPE(
CTransportPin::GetDigitalDemodProperty,
CTransportPin::SetDigitalDemodProperty
),
DEFINE_KSPROPERTY_ITEM_BDA_OUTER_FEC_RATE(
CTransportPin::GetDigitalDemodProperty,
CTransportPin::SetDigitalDemodProperty
),
DEFINE_KSPROPERTY_ITEM_BDA_SYMBOL_RATE(
CTransportPin::GetDigitalDemodProperty,
CTransportPin::SetDigitalDemodProperty
),
DEFINE_KSPROPERTY_ITEM_BDA_SPECTRAL_INVERSION(
CTransportPin::GetDigitalDemodProperty,
CTransportPin::SetDigitalDemodProperty
),
DEFINE_KSPROPERTY_ITEM_BDA_TRANSMISSION_MODE(
CTransportPin::GetDigitalDemodProperty,
CTransportPin::SetDigitalDemodProperty
),
};
//BDA Extended Property Set
DEFINE_KSPROPERTY_TABLE(SkyWalker1ExtendedProperties)
{
DEFINE_KSPROPERTY_ITEM_BDA_DISEQC(
NULL,
CTransportPin::SetExtendedProperty
),
};
/*****************************************************************************************/
//Demodulator Node Property Sets supported
//
//This table defines all property sets supported by the
//Demodulator Node associated with the transport output pin.
//
DEFINE_KSPROPERTY_SET_TABLE(SkyWalker1DemodulatorProperties)
{
DEFINE_KSPROPERTY_SET
(
&KSPROPSETID_BdaDigitalDemodulator, //Set
SIZEOF_ARRAY(SkyWalker1DemodulatorProps), //PropertiesCount
SkyWalker1DemodulatorProps, //PropertyItems
0, //FastIoCount
NULL //FastIoTable
),
DEFINE_KSPROPERTY_SET
(
&KSPROPSETID_BdaExtendedProperty, //Set
SIZEOF_ARRAY(SkyWalker1ExtendedProperties), //PropertiesCount
SkyWalker1ExtendedProperties, //PropertyItems
0, //FastIoCount
NULL //FastIoTable
),
DEFINE_KSPROPERTY_SET
(
&KSPROPSETID_BdaSignalStats, //Set
SIZEOF_ARRAY(SkyWalker1DemodulatorSignalStats), //PropertiesCount
SkyWalker1DemodulatorSignalStats, //PropertyItems
0, //FastIoCount
NULL //FastIoTable
),
//
//Additional property sets for the node can be added here.
//
};
DEFINE_KSAUTOMATION_TABLE(SkyWalker1DemodulatorAutomation) {
DEFINE_KSAUTOMATION_PROPERTIES(SkyWalker1DemodulatorProperties),
DEFINE_KSAUTOMATION_METHODS_NULL,
DEFINE_KSAUTOMATION_EVENTS_NULL
};
/*****************************************************************************************/
//Template Node Descriptors
//
//Define an array that contains all the node types that are available in the template
//topology of the filter.
//These node types must be supported by BDA and
//defined elsewhere (for example, in Bdamedia.h).
//
const KSNODE_DESCRIPTOR TunerFilterNodeDescriptors[] =
{
DEFINE_NODE_DESCRIPTOR(
&SkyWalker1TunerAutomation, //Point to KSAUTOMATION_TABLE structure
//for the node's automation table
&KSNODE_BDA_RF_TUNER, //Point to the guid that defines function
//of the node
NULL //Point to the guid that represents the
//name of the topology node
),
DEFINE_NODE_DESCRIPTOR(
&SkyWalker1DemodulatorAutomation,//Point to KSAUTOMATION_TABLE structure
//for the node's automation table
&KSNODE_BDA_QPSK_DEMODULATOR,//Point to the guid that defines function
//of the node
NULL //Point to the guid that represents the
//name of the topology node
),
};
/*****************************************************************************************/
//Define BDA Template Topology Connections
//
//Lists the Connections that are possible between pin types and
//node types. This, together with the Template Filter Descriptor, and
//the Pin Pairings, describe how topologies can be created in the filter.
//
// =========== ============
//AntennaPin ----| RF Node |--Joint--|Demod Node|----TransportPin
// =========== ============
//
//The RF Node of this filter is controlled by the Antenna input pin.
//RF properties will be set as NODE properties (with NodeType == 0)
//on the filter's Antenna Pin
//
//The Demodulator Node of this filter is controlled by the Transport output pin.
//Demod properties will be set as NODE properties (with NodeType == 1)
//on the filter's Transport Pin
const KSTOPOLOGY_CONNECTION TunerFilterConnections[]={
{KSFILTER_NODE, 0, 0, KSNODEPIN_STANDARD_IN}, //Antenna pin -> Tuner pin 0
{0, KSNODEPIN_STANDARD_OUT, 1, KSNODEPIN_STANDARD_IN}, //Tuner pin 1 -> Demodulator pin 0
{1, KSNODEPIN_STANDARD_OUT, KSFILTER_NODE, 1}, //Demodulator pin 1 -> Transport pin
};
//Lists the template joints between the Antenna Input Pin Type and
//the Transport Output Pin Type.
//
//In this case the RF Node is considered to belong to the antennea input
//pin and the 8VSB Demodulator Node is considered to belong to the
//tranport stream output pin.
//
const ULONG InterNodeJoints[] =
{
1 //joint occurs between the two node types (second element in array)
//indicates that 1st node is controlled by input pin and 2nd node by output pin
};
//Array of BDA_PIN_PAIRING structures that are used to determine
//which nodes get duplicated when more than one output pin type is
//connected to a single input pin type or when more that one input pin
//type is connected to a single output pin type.
//
const BDA_PIN_PAIRING TunerFilterPinPairings[] =
{
//Input pin to Output pin Topology Joints
{
0, //ulInputPin; 0 element in the TemplatePinDescriptors array.
1, //ulOutputPin; 1 element in the TemplatePinDescriptors array.
1, //ulcMaxInputsPerOutput
1, //ulcMinInputsPerOutput
1, //ulcMaxOutputsPerInput
1, //ulcMinOutputsPerInput
SIZEOF_ARRAY(InterNodeJoints), //ulcTopologyJoints
InterNodeJoints //pTopologyJoints; array of joints
}
//If applicable, list topology of joints between other pins.
};
/*****************************************************************************************/
const KSCOMPONENTID TunerFilterComponentId={
NULL,
NULL,
NULL,
NULL,
1, //Version
0 //Revision
};
/**********************************************************************************/
//
//Dispatch Table for the antenna pin.
//
const KSPIN_DISPATCH AntennaPinDispatch={
/* Create */ CAntennaPin::PinCreate,
/* Close */ CAntennaPin::PinClose,
/* Process */ NULL,
/* Reset */ NULL,
/* SetDataFormat */ NULL,
/* SetDeviceState */ CAntennaPin::PinSetDeviceState,
/* Connect */ NULL,
/* Disconnect */ NULL,
/* Allocator */ NULL
};
DEFINE_KSAUTOMATION_TABLE(NullAutomation)
{
DEFINE_KSAUTOMATION_PROPERTIES_NULL,
DEFINE_KSAUTOMATION_METHODS_NULL,
DEFINE_KSAUTOMATION_EVENTS_NULL
};
const KS_DATARANGE_BDA_ANTENNA AntennaPinRange =
{
//insert the KSDATARANGE and KSDATAFORMAT here
{
sizeof( KS_DATARANGE_BDA_ANTENNA), //FormatSize
0, //Flags - (N/A)
0, //SampleSize - (N/A)
0, //Reserved
{ STATIC_KSDATAFORMAT_TYPE_BDA_ANTENNA }, //MajorFormat
{ STATIC_KSDATAFORMAT_SUBTYPE_NONE }, //SubFormat
{ STATIC_KSDATAFORMAT_SPECIFIER_NONE } //Specifier
}
};
const PKSDATARANGE AntennaPinRanges[]={
(PKSDATARANGE)&AntennaPinRange,
};
//
//Dispatch Table for the transport Output pin.
//
//Since data on the transport is actually delivered to the
//PCI bridge in hardware, this pin does not process data.
//
//Connection of, and state transitions on, this pin help the
//driver to determine when to allocate hardware resources for
//each node.
//
const KSPIN_DISPATCH TransportPinDispatch =
{
CTransportPin::PinCreate, //Create
CTransportPin::PinClose, //Close
NULL, //Process
NULL, //Reset
NULL, //SetDataFormat
/*AntennaPinSetDeviceState*/ NULL, //SetDeviceState
NULL, //Connect
NULL, //Disconnect
NULL, //Clock
NULL //Allocator
};
const KSPIN_INTERFACE StreamInterface[]={
{
STATICGUIDOF(KSINTERFACESETID_Standard),
KSINTERFACE_STANDARD_STREAMING,
0
},
};
//Medium GUIDs for the Transport Output Pin.
//
//Pin Medium descriptor containing all medium accepted to be connected to
//the tuner output pin.This insures contection to the correct Capture Filter pin.
//
//{2AEB4A94-FBB7-4FB1-8D74-243B91886EAB}
const KSPIN_MEDIUM TransportPinMediums[] =
{
{
GUID_SKYWALKER_TUNER_OUT_MEDIUM,
0,
0
}
};
const KS_DATARANGE_BDA_TRANSPORT TransportPinRange =
{
//insert the KSDATARANGE and KSDATAFORMAT here
{
sizeof( KS_DATARANGE_BDA_TRANSPORT), //FormatSize
0, //Flags - (N/A)
0, //SampleSize - (N/A)
0, //Reserved
{ STATIC_KSDATAFORMAT_TYPE_STREAM }, //MajorFormat
{ STATIC_KSDATAFORMAT_TYPE_MPEG2_TRANSPORT }, //SubFormat
{ STATIC_KSDATAFORMAT_SPECIFIER_BDA_TRANSPORT } //Specifier
},
//BDA_TRANSPORT_INFO
{
TRANSPORT_PACKET_SIZE, //Bytes in Line
TRANSPORT_PACKET_SIZE * TRANSPORT_PACKET_COUNT, //Frame Size
0, //ulcbPhysicalFrameAlignment (no requirement)
0 //AvgTimePerFrame, Time / Sample (not known)
}
};
//Format Ranges of Transport Output Pin.
//
static PKSDATAFORMAT TransportPinRanges[] =
{
(PKSDATAFORMAT) &TransportPinRange,
//Add more formats here if additional transport formats are supported.
//
};
DECLARE_SIMPLE_FRAMING_EX(TransportAllocator,
STATICGUIDOF(KSMEMORY_TYPE_KERNEL_NONPAGED),
KSALLOCATOR_REQUIREMENTF_SYSTEM_MEMORY/*|KSALLOCATOR_REQUIREMENTF_PREFERENCES_ONLY*/,
8,
0,
TRANSPORT_PACKET_COUNT*TRANSPORT_PACKET_SIZE,
TRANSPORT_PACKET_COUNT*TRANSPORT_PACKET_SIZE);
//Template Pin Descriptors
//This data structure defines the pin types available in the filters
//template topology. These structures will be used to create a
//KDPinFactory for a pin type when BdaCreatePin or BdaMethodCreatePin
//are called.
//
//This structure defines ALL pins the filter is capable of supporting,
//including those pins which may only be created dynamically by a ring
//3 component such as a Network Provider.
const KSPIN_DESCRIPTOR_EX TunerFilterPinDescriptors[]={
{ //Antenna input pin
&AntennaPinDispatch, //Dispatch Table
&NullAutomation, //Automation Table
{
0, //Interfaces
NULL,
0, //Mediums
NULL,
SIZEOF_ARRAY(AntennaPinRanges),
AntennaPinRanges,
KSPIN_DATAFLOW_IN, //Specifies that data flow is into the pin
KSPIN_COMMUNICATION_BOTH, //Specifies that the pin factory instantiates pins
//that are both IRP sinks and IRP sources
NULL, //Category
NULL, //Name
0
},
KSPIN_FLAG_DO_NOT_USE_STANDARD_TRANSPORT|
KSPIN_FLAG_FRAMES_NOT_REQUIRED_FOR_PROCESSING|
KSPIN_FLAG_FIXED_FORMAT,
1, //Maximum Possible Instances of the Pin
1, //Mandatory Instances of this for the Filter function
NULL,
CAntennaPin::IntersectDataFormat //Data Interaction Handler
},
//Tranport Output Pin
{
&TransportPinDispatch, //Point to the dispatch table for the output pin
&NullAutomation, //Point to the automation table for the output pin
{ //Specify members of a KSPIN_DESCRIPTOR structure for the output pin
0, //Interface Count
NULL, //Interfaces
SIZEOF_ARRAY(TransportPinMediums), //Medium Count
TransportPinMediums, //Medium
SIZEOF_ARRAY(TransportPinRanges), //Range Count
TransportPinRanges, //Ranges
KSPIN_DATAFLOW_OUT, //specifies that data flow is out of the pin
KSPIN_COMMUNICATION_BOTH, //specifies that the pin factory instantiates pins
(GUID *) &PINNAME_BDA_TRANSPORT, //Category GUID
(GUID *) &PINNAME_BDA_TRANSPORT, //GUID of the localized Unicode string //name for the pin type
0
}, //Specify flags
KSPIN_FLAG_DO_NOT_USE_STANDARD_TRANSPORT |
KSPIN_FLAG_FRAMES_NOT_REQUIRED_FOR_PROCESSING |
KSPIN_FLAG_FIXED_FORMAT,
1, //Specify the maximum number of possible instances of the output pin
1, //Specify the number of instances of this pin type that are necessary for proper functioning of this filter
NULL, //Allocator Framing
CTransportPin::IntersectDataFormat //Point to the data intersection handler function
}
};
/**********************************************************************************/
//BDA Device Topology Property Set
//The BDA Support Library supplies a default implementation of the
//BDA Device Topology Property Set. If the driver needs to override
//this default implemenation, the definitions for the override properties
//will be defined here.
//BDA Device Configuration Method Set
//The BDA Support Library provides a default implementation of
//the BDA Device Configuration Method Set. In this , the
//driver overrides the CreateTopology method. Note that the
//support libraries CreateTopology method is called before the
//driver's implementation returns.
//
DEFINE_KSMETHOD_TABLE(TunerFilterConfiguration)
{
DEFINE_KSMETHOD_ITEM_BDA_CREATE_TOPOLOGY(
CTunerFilter::CreateTopology, //Calls BdaMethodCreateTopology
NULL
)
};
//BDA Change Sync Method Set
//The Change Sync Method Set is required on BDA filters. Setting a
//node property should not become effective on the underlying device
//until CommitChanges is called.
//The BDA Support Library provides routines that handle committing
//changes to topology. The BDA Support Library routines should be
//called from the driver's implementation before the driver implementation
//returns.
DEFINE_KSMETHOD_TABLE(TunerFilterChangeSync)
{
DEFINE_KSMETHOD_ITEM_BDA_START_CHANGES(
CTunerFilter::StartChanges, //Calls BdaStartChanges
NULL
),
DEFINE_KSMETHOD_ITEM_BDA_CHECK_CHANGES(
CTunerFilter::CheckChanges, //Calls BdaCheckChanges
NULL
),
DEFINE_KSMETHOD_ITEM_BDA_COMMIT_CHANGES(
CTunerFilter::CommitChanges, //Calls BdaCommitChanges
NULL
),
DEFINE_KSMETHOD_ITEM_BDA_GET_CHANGE_STATE(
CTunerFilter::GetChangeState, //Calls BdaGetChangeState
NULL
)
};
//Array of Method sets supported by filter
DEFINE_KSMETHOD_SET_TABLE(TunerFilterMethods)
{
DEFINE_KSMETHOD_SET
(
&KSMETHODSETID_BdaChangeSync, //Method set GUID
SIZEOF_ARRAY(TunerFilterChangeSync), //Number of methods
TunerFilterChangeSync, //Array of KSMETHOD_ITEM structures
0, //FastIoCount
NULL //FastIoTable
),
DEFINE_KSMETHOD_SET
(
&KSMETHODSETID_BdaDeviceConfiguration, //Method set GUID
SIZEOF_ARRAY(TunerFilterConfiguration), //Number of methods
TunerFilterConfiguration, //Array of KSMETHOD_ITEM structures
0, //FastIoCount
NULL //FastIoTable
)
};
//Supporting only Filter Methods;Properties and Events are not supported
DEFINE_KSAUTOMATION_TABLE(TunerFilterAutomationTable)
{
DEFINE_KSAUTOMATION_PROPERTIES_NULL,
DEFINE_KSAUTOMATION_METHODS(TunerFilterMethods),
DEFINE_KSAUTOMATION_EVENTS_NULL
};
/**********************************************************************************/
//Dispatch table for the Filter Processing
const KSFILTER_DISPATCH TunerFilterDispatchTable =
{
/* Create */ CTunerFilter::Create, //Routine called when the Filter is created
/* Close */ CTunerFilter::FilterClose, //Routine called when the Filter is closed
/* Process */ NULL,
/* Reset */ NULL
};
/*****************************************************************************************/
//Define the Filter Factory Descriptor for the filter
//This structure brings together all of the structures that define
//the tuner filter as it appears when it is first instantiated.
//Note that not all of the template pin and node types may be exposed as
//pin and node factories when the filter is first instanciated.
//The KSFILTER_DESCRIPTOR structure describes the characteristics of a filter created by a given filter factory.
DEFINE_KSFILTER_DESCRIPTOR(SkyWalker1TunerFilterDescriptor)
{
&TunerFilterDispatchTable, //Dispatch (Filter Specific Driver)
&TunerFilterAutomationTable, //AutomationTable
KSFILTER_DESCRIPTOR_VERSION, //Version
0, //Flags
&SKYWALKER_TUNER_FILTER, //ReferenceGuid
DEFINE_KSFILTER_PIN_DESCRIPTORS(TunerFilterPinDescriptors),
//PinDescriptorsCount; must expose at least one pin
//PinDescriptorSize; size of each item
//PinDescriptors; table of pin descriptors
DEFINE_KSFILTER_CATEGORY(KSCATEGORY_BDA_NETWORK_TUNER),
//CategoriesCount; number of categories in the table
//Categories; table of categories
DEFINE_KSFILTER_NODE_DESCRIPTORS(TunerFilterNodeDescriptors),
//NodeDescriptorsCount;
//NodeDescriptorSize;
//NodeDescriptors;
DEFINE_KSFILTER_CONNECTIONS(TunerFilterConnections),
//Automatically fills in the connections table for a filter which defines no explicit connections
//ConnectionsCount; number of connections in the table
//Connections; table of connections
&TunerFilterComponentId //ComponentId;
};
//BDA_FILTER_TEMPLATE structure describes the template topology for BDA Driver
const BDA_FILTER_TEMPLATE TunerFilterTemplate =
{
&SkyWalker1TunerFilterDescriptor,//Pointer to KS_FILTER_DESCRIPTOR which describes the Filter for BDA Device
SIZEOF_ARRAY(TunerFilterPinPairings), //Number of PAIRS of pins in BDA_PIN_PAIRING Array
TunerFilterPinPairings //Array of Pin Pairing describes topology between a pair of Filter's Input and Output Pins
};
/* 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 */

View file

@ -0,0 +1,212 @@
/*****************************************************************************
Company : Shree Ganesha Inc.
File Name : SkyWalker1CPin.cpp
Author :
Date :
Purpose : This File Holds the General Pin related declarations
Revision History:
===============================================================================
DATE VERSION AUTHOR REMARK
===============================================================================
XXth April,2009 01 Initial Version
*****************************************************************************/
/* Include the Library and Other header file */
#include "SkyWalker1Main.h" //Common For all the Definitions,
//Declarations and Library Routines
/* End of Inclusion the Library and Other header file */
/* Macro Definitions */
/* End of Macro Definitions */
/* Global & Static variables Declaration */
/* 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 */
/*****************************************************************************
Function : CTunerPin::PinCreate
Description : An AVStream minidriver's AVStrMiniPinCreate routine is
called when a pin is created. Typically, this routine is
used by minidrivers that want to initialize the context
and resources associated with the pin.
IN PARAM : <PKSPIN> Pointer to the KSPIN that was just created.
<PIRP> Pointer to the IRP_MJ_CREATE for Pin
OUT PARAM : <NTSTATUS> STATUS_SUCCESS in case of successful pin creation
Failure Code in other cases
PreCondition : None
PostCondtion : Creates the Tuner pin object and associates it
with the filter object.
Logic : NONE
Assumption : NONE
Note : None
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS CTunerPin::PinCreate( IN OUT PKSPIN pKSPin,
IN PIRP pIoRequestPacket
)
{
NTSTATUS ntCreateStatus = STATUS_SUCCESS;
CTunerPin* pPin = NULL; //Pointer to the Current Pin Instance
CTunerFilter* pFilter = NULL; //Pointer to the Filter associted with the Pin
PrintFunctionEntry(__FUNCTION__);
SkyWalkerDebugPrint(ENTRY_LEVEL,("Sizeof DISEQC_COMMAND = %d\n",sizeof(DISEQC_COMMAND)));
//Obtain a pointer to the filter object for which the input pin is created.
//The KsGetFilterFromIrp function returns the AVStream filter object
//associated with a given IRP.
pFilter = reinterpret_cast<CTunerFilter*>(KsGetFilterFromIrp(pIoRequestPacket)->Context);
//Create the Tuner pin object.
pPin = new(PagedPool,TUNER_MEM_TAG) CTunerPin; // Tags the allocated memory
if (pPin)
{
//Link the pin context to the filter context.
//That is, set the input pin's filter pointer data member to the obtained filter pointer.
pPin->SetFilter( pFilter);
//Link the pin context to the passed in pointer to the KSPIN structure.
pKSPin->Context = pPin;
}
else
{
ntCreateStatus = STATUS_INSUFFICIENT_RESOURCES;
}
PrintFunctionExit(__FUNCTION__,ntCreateStatus);
return ntCreateStatus;
}
/*****************************************************************************
Function : CTunerPin::PinClose
Description : An AVStream minidriver's AVStrMiniPinClose routine is
called when a pin is closed.It usually is provided by
minidrivers that want to free the context and resources
associated with the pin.
IN PARAM : <PKSPIN> Pointer to the KSPIN that was just closed.
<PIRP> Pointer to the IRP_MJ_CLOSE for Pin.
OUT PARAM : <NTSTATUS> STATUS_SUCCESS in case of successful pin Close
Failure Code in other cases
PreCondition : None
PostCondtion : Deletes the previously created Tuner pin object.
Logic : NONE
Assumption : NONE
Note : This is called from the PASSIVE_LEVEL_IRQL
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS CTunerPin::PinClose( IN OUT PKSPIN pKSPin,
IN PIRP pIoRequestPacket
)
{
NTSTATUS ntCloseStatus = STATUS_SUCCESS;
CTunerPin* pPin = NULL; //Pointer to the Current Pin Instance
CTunerFilter* pFilter = NULL; //Pointer to the Filter associted with the Pin
PrintFunctionEntry(__FUNCTION__);
// Retrieve the Tuner pin object from the passed in
// KSPIN structure's context member.
//
pPin = reinterpret_cast<CTunerPin*>(pKSPin->Context);
if(IS_VALID(pPin))
{
delete pPin;
pPin = NULL;
}
PrintFunctionExit(__FUNCTION__,ntCloseStatus);
return ntCloseStatus;
}
/*****************************************************************************
Function : CTunerPin::GetSignalStatus
Description : Retrieves the value of the signal statistics properties.
IN PARAM : IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
OUT PULONG pulProperty
OUT PARAM : <NTSTATUS> Status SUCCESS in case Valid Property request
STATUS_INVALID_PARAMETER in case of Invalid property request
Else error from the lower device
PreCondition : None
PostCondtion : Signal Status read in case of successful execution
Logic : NONE
Assumption : NONE
Note : NONE
Revision History: <REVISION HISTORY OF THE FUNCTION, MUST BE MAINTAINED BY MAINTAINER >
*****************************************************************************/
NTSTATUS CTunerPin::GetSignalStatus(
IN PIRP pIoRequestPacket,
IN PKSPROPERTY pKSProperty,
OUT PULONG pulProperty
)
{
NTSTATUS ntGetStatus = STATUS_SUCCESS;
CTunerPin* pPin = NULL; //Pointer to the Current Pin Instance
CTunerFilter* pFilter = NULL; //Pointer to the Filter associted with the Pin
BDATUNER_DEVICE_STATUS TunerStatus;
PrintFunctionEntry(__FUNCTION__);
// Call the BDA support library to
// validate that the node type is associated with this pin.
ntGetStatus = BdaValidateNodeProperty( pIoRequestPacket, pKSProperty);
if (NT_SUCCESS( ntGetStatus))
{
// Obtain a pointer to the pin object.
//
// Because the property dispatch table calls the CTunerPin::GetSignalStatus()
// method directly, the method must retrieve a pointer to the underlying pin object.
//
pPin = reinterpret_cast<CTunerPin *>(KsGetPinFromIrp(pIoRequestPacket)->Context);
// Retrieve the filter context from the pin context.
//
pFilter = pPin->GetFilter();
ntGetStatus = pFilter->GetStatus( &TunerStatus);
if (ntGetStatus == STATUS_SUCCESS)
{
switch (pKSProperty->Id)
{
case KSPROPERTY_BDA_SIGNAL_LOCKED:
*pulProperty = TunerStatus.fSignalLocked;
SkyWalkerDebugPrint(EXTREME_LEVEL,("Signal Lock = 0x%02X\n",*pulProperty));
break;
case KSPROPERTY_BDA_SIGNAL_QUALITY:
*pulProperty = TunerStatus.dwSignalQuality;
SkyWalkerDebugPrint(EXTREME_LEVEL,("Signal Quality = %lu\n",*pulProperty));
break;
case KSPROPERTY_BDA_SIGNAL_PRESENT:
*pulProperty = TunerStatus.fCarrierPresent;
SkyWalkerDebugPrint(EXTREME_LEVEL,("Signal Present = 0x%02X\n",*pulProperty));
break;
case KSPROPERTY_BDA_SIGNAL_STRENGTH:
*pulProperty = TunerStatus.dwSignalStrength;
SkyWalkerDebugPrint(EXTREME_LEVEL,("Signal Strength = %lu\n", *pulProperty));
break;
default:
ntGetStatus = STATUS_INVALID_PARAMETER;
}
}
}
PrintFunctionExit(__FUNCTION__,ntGetStatus);
return ntGetStatus;
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,142 @@
; SkyWalker2Installer.INF -- This file installs SkyWalker2 Driver
;
[Version]
signature="$CHICAGO$"
Class=Media
ClassGUID={4d36e96c-e325-11ce-bfc1-08002be10318}
Provider=%SGI%
CatalogFile=SkyWalker2Installer.cat
DriverVer= 8/17/2009
; F i l e c o p y i n g s e c t i o n s (where the files go to).
;
[DestinationDirs]
DefaultDestDir=10,system32\drivers
[Manufacturer]
%SGI%=SGI
[ControlFlags]
;ExcludeFromSelect=*
;ExcludeFromSelect.NT=*
; =================== Generic ==================================
[SGI]
%SkyWalker2.DeviceDesc%=SkyWalker2.Device,USB\VID_09C0&PID_0206 ;SkyWalker2
[SkyWalker2.Device]
Include = ks.inf, kscaptur.inf, bda.inf
needs = KS.Registration, KSCAPTUR.Registration, BDA.Installation
AddReg = SkyWalker2.AddReg
CopyFiles = SkyWalker2.CopyDrivers
[SkyWalker2.Device.NT]
Include = ks.inf, kscaptur.inf, bda.inf
needs = KS.Registration.NT, KSCAPTUR.Registration.NT, BDA.Installation.NT
;AddReg = SkyWalker2.AddReg
CopyFiles = SkyWalker2.CopyDrivers
; KnownFiles = SkyWalker2.KnownFiles
[SkyWalker2.Device.NT.Services]
Addservice=SkyWalker2TVTuner, 0x00000002, SkyWalker2.AddService
[SkyWalker2.AddService]
DisplayName=%SkyWalker2.FriendlyName%
ServiceType=1 ; SERVICE_KERNEL_DRIVER
StartType=3 ; SERVICE_DEMAND_START
ErrorControl=1 ; SERVICE_ERROR_NORMAL
ServiceBinary=%10%\System32\Drivers\SkyWalker1TVTuner.sys
LoadOrderGroup=ExtendedBase
[SkyWalker2.CopyDrivers]
SkyWalker1TVTuner.sys
[SkyWalker2.AddReg]
HKR,,DevLoader,,*NTKERN
HKR,,NTMPDriver,,SkyWalker1TVTuner.sys
HKR,,PageOutWhenUnopened,3,01
[SkyWalker2.Device.Interfaces]
AddInterface=%KSCATEGORY_BDA_RECEIVER_COMPONENT%,%SKYWALKER_CAPTURE%,SkyWalker2.Receiver.Interfaces
AddInterface=%KSCATEGORY_BDA_NETWORK_TUNER%,%SKYWALKER_TUNER%,SkyWalker2.Tuner.Interfaces
[SkyWalker2.Device.NT.Interfaces]
AddInterface=%KSCATEGORY_BDA_RECEIVER_COMPONENT%,%SKYWALKER_CAPTURE%,SkyWalker2.Receiver.Interfaces
AddInterface=%KSCATEGORY_BDA_NETWORK_TUNER%,%SKYWALKER_TUNER%,SkyWalker2.Tuner.Interfaces
[SkyWalker2.Tuner.Interfaces]
AddReg=SkyWalker2.Tuner.Interfaces.AddReg
[SkyWalker2.Tuner.Interfaces.AddReg]
HKR,,CLSID,,%KSProxy.CLSID%
HKR,,FriendlyName,,%SkyWalker2.Tuner.FriendlyName%
[SkyWalker2.Receiver.Interfaces]
AddReg=SkyWalker2.Receiver.Interfaces.AddReg
[SkyWalker2.Receiver.Interfaces.AddReg]
HKR,,CLSID,,%KSProxy.CLSID%
HKR,,FriendlyName,,%SkyWalker2.Receiver.FriendlyName%
[Strings]
;non-localizable
SGI="Plethorasoft"
MfgName="SGI"
SkyWalker2.DeviceDesc="SkyWalker2 BDA TVTuner"
SkyWalker2.Tuner.FriendlyName="SkyWalker2 TV Tuner"
SkyWalker2.Receiver.FriendlyName="SkyWalker2 TV Receiver"
SkyWalker2.Tuner="SkyWalker2.Tuner"
KSProxy.CLSID="{17CCA71B-ECD7-11D0-B908-00A0C9223196}"
KSCATEGORY_BDA_NETWORK_TUNER="{71985F48-1CA1-11d3-9CC8-00C04F7971E0}"
KSCATEGORY_BDA_RECEIVER_COMPONENT="{FD0A5AF4-B41D-11d2-9C95-00C04F7971E0}"
SKYWALKER_TUNER="{5C4E764F-AB43-46A9-B21E-8529C70F0A23}"
SKYWALKER_CAPTURE="{0F8F74D9-E524-4D05-BB60-F0C69ACB1756}"
;
; ServiceType values
SERVICE_KERNEL_DRIVER = 0x00000001
SERVICE_FILE_SYSTEM_DRIVER = 0x00000002
SERVICE_ADAPTER = 0x00000004
SERVICE_RECOGNIZER_DRIVER = 0x00000008
SERVICE_WIN32_OWN_PROCESS = 0x00000010
SERVICE_WIN32_SHARE_PROCESS = 0x00000020
SERVICE_INTERACTIVE_PROCESS = 0x00000100
SERVICE_INTERACTIVE_SHARE_PROCESS = 0x00000120
; StartType values
SERVICE_BOOT_START = 0x00000000
SERVICE_SYSTEM_START = 0x00000001
SERVICE_AUTO_START = 0x00000002
SERVICE_DEMAND_START = 0x00000003
SERVICE_DISABLED = 0x00000004
; ErrorControl values
SERVICE_ERROR_IGNORE = 0x00000000
SERVICE_ERROR_NORMAL = 0x00000001
SERVICE_ERROR_SEVERE = 0x00000002
SERVICE_ERROR_CRITICAL = 0x00000003
; Characteristic flags
NCF_VIRTUAL = 0x0001
NCF_WRAPPER = 0x0002
NCF_PHYSICAL = 0x0004
NCF_HIDDEN = 0x0008
NCF_NO_SERVICE = 0x0010
NCF_NOT_USER_REMOVABLE = 0x0020
NCF_HAS_UI = 0x0080
NCF_MODEM = 0x0100
; Registry types
REG_MULTI_SZ = 0x10000
REG_EXPAND_SZ = 0x20000
REG_DWORD = 0x10001
; Win9x Compatible Types
REG_BINARY = 17
REG_SZ = 0
; Service install flags
SPSVCINST_TAGTOFRONT = 0x1
SPSVCINST_ASSOCSERVICE = 0x2

View file

@ -0,0 +1,62 @@
#############################################################################
# Shree Ganesha Inc.
# Sources File for the Skywalker1 TV Tuner
# Date : 29th September, 2009
# Description : This file is a must for the Compilation of the
# Skywalker Driver.
#
##########################################################################
TARGETNAME=SkyWalker1TVTuner # Set driver's name
TARGETTYPE=DRIVER # Set type of file built, for example, program, DLL, or driver
# For BDA minidriver, set to DRIVER.
TARGETPATH=obj$(BUILD_ALT_DIR) # Set destination directory for the built file
# Depending on whether your build environment is "free" or "checked",
# the BUILD_ALT_DIR variable appends "fre" or "chk" to the \obj subdirectory.
DRIVERTYPE=WDM # Set type of driver, can be set to either WDM or VXD.
# For BDA, set to WDM.
# Generate .SYM and .PDB (map) files. These files map names to addresses.
# Required to debug on Win9x.
USE_MAPSYM=1
# Point to the header files that the sample source requires.
INCLUDES= \
$(DDK_INC_PATH); \
$(DDK_INC_PATH)\wdm; \
$(SDK_INC_PATH); \
$(SDK_PATH)\AMovie\Inc; \
$(INCLUDES)
# Point to the library files that the sample source requires.
TARGETLIBS= \
$(DDK_LIB_PATH)\ks.lib \
$(DDK_LIB_PATH)\ksguid.lib \
$(DDK_LIB_PATH)\BdaSup.lib \
$(DDK_LIB_PATH)\usbd.lib
# The following macros are used with the Soft-ICE debugging tool.
!ifdef BUILD_SOFTICE_SYMBOLS
TARGETPATHEX=$(TARGETPATH)\$(TARGET_DIRECTORY)
NTTARGETFILES=$(TARGETPATH)\$(TARGETNAME).dbg
NTTARGETFILES=$(TARGETPATHEX)\$(TARGETNAME).nms $(NTTARGETFILES)
!endif
# Source files that must be compiled.
SOURCES = SkyWalker1TunerPin.cpp \
SkyWalker1AntennaPin.cpp \
SkyWalker1CaptureFilter.cpp \
SkyWalker1CaptureFilterDefinitions.cpp \
SkyWalker1CapturePin.cpp \
SkyWalker1Control.cpp \
SkyWalker1Device.cpp \
SkyWalker1Main.cpp \
SkyWalker1PnP.cpp \
SkyWalker1TransportPin.cpp \
SkyWalker1TunerFilter.cpp \
SkyWalker1TunerFilterDefinitions.cpp \
SkyWalker1USB.cpp \
SkyWalker1Utility.cpp

Binary file not shown.

View file

@ -0,0 +1,142 @@
; SkyWalker1Installer.INF -- This file installs SkyWalker1 Driver
;
[Version]
signature="$CHICAGO$"
Class=Media
ClassGUID={4d36e96c-e325-11ce-bfc1-08002be10318}
Provider=%SGI%
CatalogFile=SkyWalker1Installer.cat
DriverVer= 8/17/2009
; F i l e c o p y i n g s e c t i o n s (where the files go to).
;
[DestinationDirs]
DefaultDestDir=10,system32\drivers
[Manufacturer]
%SGI%=SGI
[ControlFlags]
;ExcludeFromSelect=*
;ExcludeFromSelect.NT=*
; =================== Generic ==================================
[SGI]
%SkyWalker1.DeviceDesc%=Skywalker1.Device,USB\VID_09C0&PID_0203 ;SkyWalker1
[Skywalker1.Device]
Include = ks.inf, kscaptur.inf, bda.inf
needs = KS.Registration, KSCAPTUR.Registration, BDA.Installation
AddReg = Skywalker1.AddReg
CopyFiles = Skywalker1.CopyDrivers
[Skywalker1.Device.NT]
Include = ks.inf, kscaptur.inf, bda.inf
needs = KS.Registration.NT, KSCAPTUR.Registration.NT, BDA.Installation.NT
;AddReg = Skywalker1.AddReg
CopyFiles = Skywalker1.CopyDrivers
; KnownFiles = Skywalker1.KnownFiles
[Skywalker1.Device.NT.Services]
Addservice=SkyWalker1TVTuner, 0x00000002, Skywalker1.AddService
[Skywalker1.AddService]
DisplayName=%SkyWalker1.FriendlyName%
ServiceType=1 ; SERVICE_KERNEL_DRIVER
StartType=3 ; SERVICE_DEMAND_START
ErrorControl=1 ; SERVICE_ERROR_NORMAL
ServiceBinary=%10%\System32\Drivers\SkyWalker1TVTuner.sys
LoadOrderGroup=ExtendedBase
[Skywalker1.CopyDrivers]
SkyWalker1TVTuner.sys
[Skywalker1.AddReg]
HKR,,DevLoader,,*NTKERN
HKR,,NTMPDriver,,SkyWalker1TVTuner.sys
HKR,,PageOutWhenUnopened,3,01
[Skywalker1.Device.Interfaces]
AddInterface=%KSCATEGORY_BDA_RECEIVER_COMPONENT%,%SKYWALKER_CAPTURE%,Skywalker1.Receiver.Interfaces
AddInterface=%KSCATEGORY_BDA_NETWORK_TUNER%,%SKYWALKER_TUNER%,Skywalker1.Tuner.Interfaces
[Skywalker1.Device.NT.Interfaces]
AddInterface=%KSCATEGORY_BDA_RECEIVER_COMPONENT%,%SKYWALKER_CAPTURE%,Skywalker1.Receiver.Interfaces
AddInterface=%KSCATEGORY_BDA_NETWORK_TUNER%,%SKYWALKER_TUNER%,Skywalker1.Tuner.Interfaces
[Skywalker1.Tuner.Interfaces]
AddReg=Skywalker1.Tuner.Interfaces.AddReg
[Skywalker1.Tuner.Interfaces.AddReg]
HKR,,CLSID,,%KSProxy.CLSID%
HKR,,FriendlyName,,%SkyWalker1.Tuner.FriendlyName%
[Skywalker1.Receiver.Interfaces]
AddReg=Skywalker1.Receiver.Interfaces.AddReg
[Skywalker1.Receiver.Interfaces.AddReg]
HKR,,CLSID,,%KSProxy.CLSID%
HKR,,FriendlyName,,%SkyWalker1.Receiver.FriendlyName%
[Strings]
;non-localizable
SGI="Plethorasoft"
MfgName="SGI"
SkyWalker1.DeviceDesc="SkyWalker1 BDA TVTuner"
SkyWalker1.Tuner.FriendlyName="SkyWalker1 TV Tuner"
SkyWalker1.Receiver.FriendlyName="SkyWalker1 TV Receiver"
SkyWalker1.Tuner="SkyWalker1.Tuner"
KSProxy.CLSID="{17CCA71B-ECD7-11D0-B908-00A0C9223196}"
KSCATEGORY_BDA_NETWORK_TUNER="{71985F48-1CA1-11d3-9CC8-00C04F7971E0}"
KSCATEGORY_BDA_RECEIVER_COMPONENT="{FD0A5AF4-B41D-11d2-9C95-00C04F7971E0}"
SKYWALKER_TUNER="{5C4E764F-AB43-46A9-B21E-8529C70F0A23}"
SKYWALKER_CAPTURE="{0F8F74D9-E524-4D05-BB60-F0C69ACB1756}"
;
; ServiceType values
SERVICE_KERNEL_DRIVER = 0x00000001
SERVICE_FILE_SYSTEM_DRIVER = 0x00000002
SERVICE_ADAPTER = 0x00000004
SERVICE_RECOGNIZER_DRIVER = 0x00000008
SERVICE_WIN32_OWN_PROCESS = 0x00000010
SERVICE_WIN32_SHARE_PROCESS = 0x00000020
SERVICE_INTERACTIVE_PROCESS = 0x00000100
SERVICE_INTERACTIVE_SHARE_PROCESS = 0x00000120
; StartType values
SERVICE_BOOT_START = 0x00000000
SERVICE_SYSTEM_START = 0x00000001
SERVICE_AUTO_START = 0x00000002
SERVICE_DEMAND_START = 0x00000003
SERVICE_DISABLED = 0x00000004
; ErrorControl values
SERVICE_ERROR_IGNORE = 0x00000000
SERVICE_ERROR_NORMAL = 0x00000001
SERVICE_ERROR_SEVERE = 0x00000002
SERVICE_ERROR_CRITICAL = 0x00000003
; Characteristic flags
NCF_VIRTUAL = 0x0001
NCF_WRAPPER = 0x0002
NCF_PHYSICAL = 0x0004
NCF_HIDDEN = 0x0008
NCF_NO_SERVICE = 0x0010
NCF_NOT_USER_REMOVABLE = 0x0020
NCF_HAS_UI = 0x0080
NCF_MODEM = 0x0100
; Registry types
REG_MULTI_SZ = 0x10000
REG_EXPAND_SZ = 0x20000
REG_DWORD = 0x10001
; Win9x Compatible Types
REG_BINARY = 17
REG_SZ = 0
; Service install flags
SPSVCINST_TAGTOFRONT = 0x1
SPSVCINST_ASSOCSERVICE = 0x2

View file

@ -0,0 +1,142 @@
; SkyWalker2Installer.INF -- This file installs SkyWalker2 Driver
;
[Version]
signature="$CHICAGO$"
Class=Media
ClassGUID={4d36e96c-e325-11ce-bfc1-08002be10318}
Provider=%SGI%
CatalogFile=SkyWalker2Installer.cat
DriverVer= 8/17/2009
; F i l e c o p y i n g s e c t i o n s (where the files go to).
;
[DestinationDirs]
DefaultDestDir=10,system32\drivers
[Manufacturer]
%SGI%=SGI
[ControlFlags]
;ExcludeFromSelect=*
;ExcludeFromSelect.NT=*
; =================== Generic ==================================
[SGI]
%SkyWalker2.DeviceDesc%=SkyWalker2.Device,USB\VID_09C0&PID_0206 ;SkyWalker2
[SkyWalker2.Device]
Include = ks.inf, kscaptur.inf, bda.inf
needs = KS.Registration, KSCAPTUR.Registration, BDA.Installation
AddReg = SkyWalker2.AddReg
CopyFiles = SkyWalker2.CopyDrivers
[SkyWalker2.Device.NT]
Include = ks.inf, kscaptur.inf, bda.inf
needs = KS.Registration.NT, KSCAPTUR.Registration.NT, BDA.Installation.NT
;AddReg = SkyWalker2.AddReg
CopyFiles = SkyWalker2.CopyDrivers
; KnownFiles = SkyWalker2.KnownFiles
[SkyWalker2.Device.NT.Services]
Addservice=SkyWalker2TVTuner, 0x00000002, SkyWalker2.AddService
[SkyWalker2.AddService]
DisplayName=%SkyWalker2.FriendlyName%
ServiceType=1 ; SERVICE_KERNEL_DRIVER
StartType=3 ; SERVICE_DEMAND_START
ErrorControl=1 ; SERVICE_ERROR_NORMAL
ServiceBinary=%10%\System32\Drivers\SkyWalker1TVTuner.sys
LoadOrderGroup=ExtendedBase
[SkyWalker2.CopyDrivers]
SkyWalker1TVTuner.sys
[SkyWalker2.AddReg]
HKR,,DevLoader,,*NTKERN
HKR,,NTMPDriver,,SkyWalker1TVTuner.sys
HKR,,PageOutWhenUnopened,3,01
[SkyWalker2.Device.Interfaces]
AddInterface=%KSCATEGORY_BDA_RECEIVER_COMPONENT%,%SKYWALKER_CAPTURE%,SkyWalker2.Receiver.Interfaces
AddInterface=%KSCATEGORY_BDA_NETWORK_TUNER%,%SKYWALKER_TUNER%,SkyWalker2.Tuner.Interfaces
[SkyWalker2.Device.NT.Interfaces]
AddInterface=%KSCATEGORY_BDA_RECEIVER_COMPONENT%,%SKYWALKER_CAPTURE%,SkyWalker2.Receiver.Interfaces
AddInterface=%KSCATEGORY_BDA_NETWORK_TUNER%,%SKYWALKER_TUNER%,SkyWalker2.Tuner.Interfaces
[SkyWalker2.Tuner.Interfaces]
AddReg=SkyWalker2.Tuner.Interfaces.AddReg
[SkyWalker2.Tuner.Interfaces.AddReg]
HKR,,CLSID,,%KSProxy.CLSID%
HKR,,FriendlyName,,%SkyWalker2.Tuner.FriendlyName%
[SkyWalker2.Receiver.Interfaces]
AddReg=SkyWalker2.Receiver.Interfaces.AddReg
[SkyWalker2.Receiver.Interfaces.AddReg]
HKR,,CLSID,,%KSProxy.CLSID%
HKR,,FriendlyName,,%SkyWalker2.Receiver.FriendlyName%
[Strings]
;non-localizable
SGI="Plethorasoft"
MfgName="SGI"
SkyWalker2.DeviceDesc="SkyWalker2 BDA TVTuner"
SkyWalker2.Tuner.FriendlyName="SkyWalker2 TV Tuner"
SkyWalker2.Receiver.FriendlyName="SkyWalker2 TV Receiver"
SkyWalker2.Tuner="SkyWalker2.Tuner"
KSProxy.CLSID="{17CCA71B-ECD7-11D0-B908-00A0C9223196}"
KSCATEGORY_BDA_NETWORK_TUNER="{71985F48-1CA1-11d3-9CC8-00C04F7971E0}"
KSCATEGORY_BDA_RECEIVER_COMPONENT="{FD0A5AF4-B41D-11d2-9C95-00C04F7971E0}"
SKYWALKER_TUNER="{5C4E764F-AB43-46A9-B21E-8529C70F0A23}"
SKYWALKER_CAPTURE="{0F8F74D9-E524-4D05-BB60-F0C69ACB1756}"
;
; ServiceType values
SERVICE_KERNEL_DRIVER = 0x00000001
SERVICE_FILE_SYSTEM_DRIVER = 0x00000002
SERVICE_ADAPTER = 0x00000004
SERVICE_RECOGNIZER_DRIVER = 0x00000008
SERVICE_WIN32_OWN_PROCESS = 0x00000010
SERVICE_WIN32_SHARE_PROCESS = 0x00000020
SERVICE_INTERACTIVE_PROCESS = 0x00000100
SERVICE_INTERACTIVE_SHARE_PROCESS = 0x00000120
; StartType values
SERVICE_BOOT_START = 0x00000000
SERVICE_SYSTEM_START = 0x00000001
SERVICE_AUTO_START = 0x00000002
SERVICE_DEMAND_START = 0x00000003
SERVICE_DISABLED = 0x00000004
; ErrorControl values
SERVICE_ERROR_IGNORE = 0x00000000
SERVICE_ERROR_NORMAL = 0x00000001
SERVICE_ERROR_SEVERE = 0x00000002
SERVICE_ERROR_CRITICAL = 0x00000003
; Characteristic flags
NCF_VIRTUAL = 0x0001
NCF_WRAPPER = 0x0002
NCF_PHYSICAL = 0x0004
NCF_HIDDEN = 0x0008
NCF_NO_SERVICE = 0x0010
NCF_NOT_USER_REMOVABLE = 0x0020
NCF_HAS_UI = 0x0080
NCF_MODEM = 0x0100
; Registry types
REG_MULTI_SZ = 0x10000
REG_EXPAND_SZ = 0x20000
REG_DWORD = 0x10001
; Win9x Compatible Types
REG_BINARY = 17
REG_SZ = 0
; Service install flags
SPSVCINST_TAGTOFRONT = 0x1
SPSVCINST_ASSOCSERVICE = 0x2

BIN
firmware-driver/Source.zip Normal file

Binary file not shown.