📄 tmbsl10086.c
字号:
//
tmErrorCode_t
tmbsl10086SetTC (
tmUnitSelect_t demodUnit, // I: Demod unit number
tmhalFETurboCode_t eTC // I: Turbocode
)
{
return TMBSL_ERR_DEMOD_NOT_SUPPORTED;
}
//-----------------------------------------------------------------------------
// FUNCTION: tmbsl10086GetTC
//
// DESCRIPTION: this function reads the turbo code
//
// RETURN: TMBSL_ERR_DEMOD_NOT_SUPPORTED
//
// NOTES: not implemented for the TDA10086
//-----------------------------------------------------------------------------
//
tmErrorCode_t
tmbsl10086GetTC (
tmUnitSelect_t demodUnit, // I: Demod unit number
tmhalFETurboCode_t *peTC // O: Turbocode
)
{
return TMBSL_ERR_DEMOD_NOT_SUPPORTED;
}
//-----------------------------------------------------------------------------
// FUNCTION: tmbsl10086SetMod
//
// DESCRIPTION: this function programs the modulation (QPSK/BPSK)
//
// RETURN: TMBSL_ERR_DEMOD_BAD_UNIT_NUMBER
// TMBSL_ERR_DEMOD_NOT_INITIALIZED
// TMBSL_ERR_DEMOD_BAD_PARAMETER
// TM_OK
//
// NOTES:
//-----------------------------------------------------------------------------
//
tmErrorCode_t
tmbsl10086SetMod (
tmUnitSelect_t demodUnit, // I: Demod unit number
tmhalFEModulation_t eMod // I: Modulation type
)
{
UInt32 uMod;
//----------------------
// test input parameters
//----------------------
// test the instance number
if (demodUnit > TDA10086_MAX_UNITS)
return TMBSL_ERR_DEMOD_BAD_UNIT_NUMBER;
// test the object
if (g10086Instance[demodUnit].Init == False)
return TMBSL_ERR_DEMOD_NOT_INITIALIZED;
// test the parameter value
if (eMod >= tmhalFEModulationMax)
return TMBSL_ERR_DEMOD_BAD_PARAMETER;
//----------------------
// Core function
//----------------------
switch (eMod)
{
case tmhalFEModulationBpsk:
uMod = TDA10086_MODE_PSK_BIT;
break;
case tmhalFEModulationQpsk:
uMod = 0;
break;
default:
uMod = 0;
}
g10086Instance[demodUnit].systemFunc.SY_WriteBit(
g10086Instance[demodUnit].uDemodHwAdd,
TDA10086_MODE_IND,
TDA10086_MODE_PSK_BIT,
uMod);
// start algo
g10086Instance[demodUnit].bStartAlgo = True;
g10086Instance[demodUnit].sCurrentChannel.eMOD = eMod;
return TM_OK;
}
//-----------------------------------------------------------------------------
// FUNCTION: tmbsl10086GetMod
//
// DESCRIPTION: this function reads the current modulation (QPSK/BPSK).
//
// RETURN: TMBSL_ERR_DEMOD_BAD_UNIT_NUMBER
// TMBSL_ERR_DEMOD_NOT_INITIALIZED
// TM_OK
//
// NOTES:
//-----------------------------------------------------------------------------
//
tmErrorCode_t
tmbsl10086GetMod (
tmUnitSelect_t demodUnit, // I: Demod unit number
tmhalFEModulation_t *peMod // O: Modulation type
)
{
UInt32 uByte;
//----------------------
// test input parameters
//----------------------
// test the instance number
if (demodUnit > TDA10086_MAX_UNITS)
return TMBSL_ERR_DEMOD_BAD_UNIT_NUMBER;
// test the object
if (g10086Instance[demodUnit].Init == False)
return TMBSL_ERR_DEMOD_NOT_INITIALIZED;
//----------------------
// Core function
//----------------------
g10086Instance[demodUnit].systemFunc.SY_Read(
g10086Instance[demodUnit].uDemodHwAdd,
TDA10086_MODE_IND,
1,
&uByte);
switch (uByte & TDA10086_MODE_PSK_BIT)
{
case 0:
*peMod = tmhalFEModulationQpsk;
break;
case TDA10086_MODE_PSK_BIT:
*peMod = tmhalFEModulationBpsk;
break;
}
return TM_OK;
}
//-----------------------------------------------------------------------------
// FUNCTION: tmbsl10086SetLNB
//
// DESCRIPTION: this function programs the LNB
//
// RETURN: TMBSL_ERR_DEMOD_BAD_UNIT_NUMBER
// TMBSL_ERR_DEMOD_NOT_INITIALIZED
// TM_OK
//
// NOTES:
//-----------------------------------------------------------------------------
//
tmErrorCode_t
tmbsl10086SetLNB (
tmUnitSelect_t demodUnit, // I: Demod unit number
UInt8 bVoltage, // I: LNB voltage in volt
UInt16 wFrequency // I: LNB frequency of modulation in hertz (usually 22000 or 0)
)
{
UInt32 uByte;
//----------------------
// test input parameters
//----------------------
// test the instance number
if (demodUnit > TDA10086_MAX_UNITS)
return TMBSL_ERR_DEMOD_BAD_UNIT_NUMBER;
// test the object
if (g10086Instance[demodUnit].Init == False)
return TMBSL_ERR_DEMOD_NOT_INITIALIZED;
// test the parameter value
if (bVoltage>18 || bVoltage<0)
return TMBSL_ERR_DEMOD_BAD_PARAMETER;
//----------------------
// Core function
//----------------------
// BUG: test the end of the previous transmission otherwise
// message resseted
g10086Instance[demodUnit].systemFunc.SY_Read(
g10086Instance[demodUnit].uDemodHwAdd,
TDA10086_ENDOFMSG_IND,
1,
&uByte);
// previous transmission not completed
if (uByte == 0x00)
return TM_FALSE;
// BUG : the bit SENDBUR and SENDM must be force to 0
// select 22khz
if (wFrequency != 0)
g10086Instance[demodUnit].systemFunc.SY_WriteBit(
g10086Instance[demodUnit].uDemodHwAdd,
TDA10086_DISEQC_IND,
TDA10086_DISEQC_SEL22K_MSK |
TDA10086_DISEQC_SENDM_MSK |
TDA10086_DISEQC_SENDBUR_MSK,
TDA10086_DISEQC_SEL22K_MSK);
else
g10086Instance[demodUnit].systemFunc.SY_WriteBit(
g10086Instance[demodUnit].uDemodHwAdd,
TDA10086_DISEQC_IND,
TDA10086_DISEQC_SEL22K_MSK |
TDA10086_DISEQC_SENDM_MSK |
TDA10086_DISEQC_SENDBUR_MSK,
0);
// LNB is OFF
if (bVoltage == TDA10086_0VOLT_VAL)
g10086Instance[demodUnit].systemFunc.SY_WriteBit(
g10086Instance[demodUnit].uDemodHwAdd,
TDA10086_TEST_IND,
TDA10086_TEST_LNBONOFF_MSK,
TDA10086_TEST_LNBOFF_MSK);
// LNB is ON 13V
else if (bVoltage < 15)
g10086Instance[demodUnit].systemFunc.SY_WriteBit(
g10086Instance[demodUnit].uDemodHwAdd,
TDA10086_TEST_IND,
TDA10086_TEST_VOLT_MSK,
TDA10086_TEST_13V_MSK);
// LNB is ON 18V
else if (bVoltage >= 15)
g10086Instance[demodUnit].systemFunc.SY_WriteBit(
g10086Instance[demodUnit].uDemodHwAdd,
TDA10086_TEST_IND,
TDA10086_TEST_VOLT_MSK,
TDA10086_TEST_18V_MSK);
// store current status
g10086Instance[demodUnit].sCurrentChannel.wLNBfrequency = wFrequency;
g10086Instance[demodUnit].sCurrentChannel.bLNBvoltage = bVoltage;
return TM_OK;
}
//-----------------------------------------------------------------------------
// FUNCTION: tmbsl10086GetLNB
//
// DESCRIPTION: this function reads the LNB parameters
//
// RETURN: TMBSL_ERR_DEMOD_BAD_UNIT_NUMBER
// TMBSL_ERR_DEMOD_NOT_INITIALIZED
// TM_OK
//
// NOTES:
//-----------------------------------------------------------------------------
//
tmErrorCode_t
tmbsl10086GetLNB (
tmUnitSelect_t demodUnit, // I: Demod unit number
UInt8* pbVoltage, // O: LNB voltage in volt
UInt16* pwFrequency // O: LNB frequency of modulation in hertz (usually 22000 or 0)
)
{
//----------------------
// test input parameters
//----------------------
// test the instance number
if (demodUnit > TDA10086_MAX_UNITS)
return TMBSL_ERR_DEMOD_BAD_UNIT_NUMBER;
// test the object
if (g10086Instance[demodUnit].Init == False)
return TMBSL_ERR_DEMOD_NOT_INITIALIZED;
//----------------------
// Core function
//----------------------
*pwFrequency = g10086Instance[demodUnit].sCurrentChannel.wLNBfrequency;
*pbVoltage = g10086Instance[demodUnit].sCurrentChannel.bLNBvoltage;
return TM_OK;
}
//-----------------------------------------------------------------------------
// FUNCTION: tmbsl10086SetDiSEqC
//
// DESCRIPTION: this function programs the tone burst & DiSeqc
//
// RETURN: TMBSL_ERR_DEMOD_BAD_UNIT_NUMBER
// TMBSL_ERR_DEMOD_NOT_INITIALIZED
// TM_OK
//
// NOTES:
//-----------------------------------------------------------------------------
//
tmErrorCode_t
tmbsl10086SetDiSEqC (
tmUnitSelect_t demodUnit, // I: Demod unit number
tmhalFEToneBurst_t eToneBurst, // I: Type of the tone burst (none - Satellite A - Satellite B)
UInt8 bDiSEqCNbByte, // I: Number of byte to send
UInt8* pDiSEqCMsg // I: Pointer a the frame to send
)
{
UInt32 uByte;
UInt32 puMsg[8];
//----------------------
// test input parameters
//----------------------
// test the instance number
if (demodUnit > TDA10086_MAX_UNITS)
return TMBSL_ERR_DEMOD_BAD_UNIT_NUMBER;
// test the object
if (g10086Instance[demodUnit].Init == False)
return TMBSL_ERR_DEMOD_NOT_INITIALIZED;
// test if diseqc message will be sent
if (bDiSEqCNbByte != 0)
{
// test value
if (bDiSEqCNbByte < 3 || bDiSEqCNbByte > 8)
return TM_ERR_BAD_PARAMETER;
}
//----------------------
// Core function
//----------------------
// test the end of the previous transmission
g10086Instance[demodUnit].systemFunc.SY_Read(
g10086Instance[demodUnit].uDemodHwAdd,
TDA10086_ENDOFMSG_IND,
1,
&uByte);
// previous transmission not completed
if (uByte == 0x00)
return TM_FALSE;
//-----------
// Tone burst
//-----------
switch(eToneBurst)
{
case tmhalFEToneBurstSatA:
uByte = TDA10086_DISEQC_SENDBUR_MSK;
break;
case tmhalFEToneBurstSatB:
uByte = TDA10086_DISEQC_SENDBUR_MSK | TDA10086_DISEQC_SELBUR_MSK;
break;
default:
uByte = 0;
break;
}
// store current config
g10086Instance[demodUnit].sCurrentChannel.eDiSEqCtoneburst = eToneBurst;
//---------------
// Diseqc message
//---------------
if (bDiSEqCNbByte != 0)
{
// Write the DiSEqC Message
puMsg[0] = pDiSEqCMsg[0]; puMsg[1] = pDiSEqCMsg[1];
puMsg[2] = pDiSEqCMsg[2]; puMsg[3] = pDiSEqCMsg[3];
puMsg[4] = pDiSEqCMsg[4]; puMsg[5] = pDiSEqCMsg[5];
puMsg[6] = pDiSEqCMsg[6]; puMsg[7] = pDiSEqCMsg[7];
g10086Instance[demodUnit].systemFunc.SY_Write(
g10086Instance[demodUnit].uDemodHwAdd,
TDA10086_OCT1_IND,
(UInt32)bDiSEqCNbByte,
puMsg);
// number of bytes to send and send the DiSEqC Message
uByte |= ((bDiSEqCNbByte-1) << 4) | TDA10086_DISEQC_SENDM_MSK;
// store values
g10086Instance[demodUnit].sCurrentChannel.bDiSEqCNbByte = bDiSEqCNbByte;
g10086Instance[demodUnit].sCurrentChannel.pDiSEqCMessage[0] = pDiSEqCMsg[0];
g10086Instance[demodUnit].sCurrentChannel.pDiSEqCMessage[1] = pDiSEqCMsg[1];
g10086Instance[demodUnit].sCurrentChannel.pDiSEqCMessage[2] = pDiSEqCMsg[2];
g10086Instance[demodUnit].sCurrentChannel.pDiSEqCMessage[3] = pDiSEqCMsg[3];
g10086Instance[demodUnit].sCurrentChannel.pDiSEqCMessage[4] = pDiSEqCMsg[4];
g10086Instance[demodUnit].sCurrentChannel.pDiSEqCMessage[5] = pDiSEqCMsg[5];
g10086Instance[demodUnit].sCurrentChannel.pDiSEqCMessage[6] = pDiSEqCMsg[6];
g10086Instance[demodUnit].sCurrentChannel.pDiSEqCMessage[7] = pDiSEqCMsg[7];
}
// send the tone burst an the DiSEqC message
g10086Instance[demodUnit].systemFunc.SY_WriteBit(
g10086Instance[demodUnit].uDemodHwAdd,
TDA10086_DISEQC_IND,
TDA10086_DISEQC_OCTNB_MSK |
TDA10086_DISEQC_SENDM_MSK |
TDA10086_DISEQC_SENDBUR_MSK |
TDA10
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -