/***************************************************************************** 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 : Status of the IntersectDataFormat PreCondition : None PostCondtion : None Logic : NONE Assumption : NONE Note : This is called from the PASSIVE_LEVEL_IRQL Revision History: *****************************************************************************/ 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 : 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: *****************************************************************************/ 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(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 : 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: *****************************************************************************/ 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(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 : 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: *****************************************************************************/ 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(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"; } }