Ryan Malloy bbdcb243dc Normalize line endings to LF across entire repository
Apply .gitattributes normalization to convert all CRLF line
endings inherited from Windows-origin source files to Unix LF.
175 files, zero content changes.
2026-02-20 10:55:50 -07:00

704 lines
22 KiB
C++

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