Ryan Malloy f1674c21a3 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.
2026-02-11 04:22:13 -07:00

212 lines
8.1 KiB
C++

/*****************************************************************************
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;
}