📄 lnb.c
字号:
LNBPOL polarization_voltage;
lnb_state.polarization = polarization;
if(lnb_parameters.type == LNB_FREQUENCY_STACK)
{
/* For stacked frequency LNBs we drive the high output voltage all
the time since voltage signalling is not relevant in this case
and the LNB may need the higher voltage as power supply */
polarization_voltage = LNB_HIGH;
}
else
{
/* Polarization voltage is calculated the same way for all
LNB other types. */
switch ( polarization )
{
case M_HORIZONTAL:
polarization_voltage = (LNBPOL)(
lnb_parameters.horizontal_voltage == V_12VOLTS ?
LNB_LOW : LNB_HIGH );
break;
case M_LEFT:
polarization_voltage = (LNBPOL)( lnb_parameters.left_voltage ==
V_12VOLTS ? LNB_LOW : LNB_HIGH );
break;
case M_VERTICAL:
polarization_voltage = (LNBPOL)( lnb_parameters.vertical_voltage ==
V_12VOLTS ? LNB_LOW : LNB_HIGH );
break;
case M_RIGHT:
polarization_voltage = (LNBPOL)( lnb_parameters.right_voltage ==
V_12VOLTS ? LNB_LOW : LNB_HIGH );
break;
default:
#if RTOS != NOOS
error_log( ERROR_WARNING | RC_SDM_BADVAL );
#endif /* RTOS != NOOS */
polarization_voltage = (LNBPOL)( lnb_parameters.right_voltage ==
V_12VOLTS ? LNB_LOW : LNB_HIGH );
lnb_state.polarization = M_RIGHT;
}
}
#if (LNBH21PD_ENABLED == TRUE)
{
u_int8 bData;
read_lnb21( &bData );
bData &= ~0x08;
if (polarization_voltage == LNB_HIGH) bData |= 0x08 ;
write_lnb21( bData );
}
#else
#if (LNBISL6421_ENABLED == TRUE)
if (polarization_voltage == LNB_LOW)
{
write_lnb6421(0x22);
}
else
{
write_lnb6421(0x26);
}
#endif /* #if (LNBISL6421_ENABLED == TRUE) */
if ( !API_SetLNBDC( pNIM, polarization_voltage ) )
{
#if RTOS != NOOS
{
int api_error;
trace_new( TL_ERROR, "API_SetLNBDC failed. File: %s, line: %d\n",
API_GetErrorFilename( pNIM ),
API_GetErrorLineNumber( pNIM ) );
api_error = API_GetLastError( pNIM );
trace_new( TL_ERROR, "Error %d, %s\n", api_error,
API_GetErrorMessage( pNIM, (APIERRNO)api_error) );
}
#endif /* RTOS != NOOS */
return DEMOD_ERROR;
}
#endif
return DEMOD_SUCCESS;
}
DEMOD_STATUS cnxt_lnb_get_polarization( NIM *pNIM,
NIM_SATELLITE_POLARISATION *polarization )
{
*polarization = lnb_state.polarization;
return DEMOD_SUCCESS;
}
DEMOD_STATUS cnxt_lnb_set_tone_enable( NIM *pNIM, bool enable )
{
#if (LNB_22KHZ_CONTROL == LNB_22KHZ_ENABLE)
LNBMODE lnbmode;
#else
LNBTONE tone;
#endif
#if (LNB_22KHZ_CONTROL == LNB_22KHZ_ENABLE)
if ( enable == FALSE )
{
lnbmode.lnb_mode = LNBMODE_MANUAL_ZERO;
}
else
{
lnbmode.lnb_mode = LNBMODE_MANUAL_ONE;
}
if ( !API_SetLNBMode( pNIM, &lnbmode ) )
{
#if RTOS != NOOS
{
int api_error;
trace_new( TL_ERROR, "API_SetLNBMode failed. "
"File: %s, line: %d\n", API_GetErrorFilename( pNIM ),
API_GetErrorLineNumber( pNIM ) );
api_error = API_GetLastError( pNIM );
trace_new( TL_ERROR, "Error %d, %s\n", api_error,
API_GetErrorMessage( pNIM, (APIERRNO)api_error) );
}
#endif /* RTOS != NOOS */
return DEMOD_ERROR;
}
#else
if ( enable )
{
tone = LNBTONE_ON;
}
else
{
tone = LNBTONE_OFF;
}
#if (LNBH21PD_ENABLED == TRUE)
{
u_int8 bData;
read_lnb21( &bData );
bData &= ~0x20;
if (tone == LNBTONE_ON) bData |= 0x20 ;
write_lnb21( bData );
}
#else
if ( !API_SetLNBTone( pNIM, tone ) )
{
#if RTOS != NOOS
{
int api_error;
trace_new( TL_ERROR, "API_SetLNBTone failed. File: %s, line: %d\n",
API_GetErrorFilename( pNIM ),
API_GetErrorLineNumber( pNIM ) );
api_error = API_GetLastError( pNIM );
trace_new( TL_ERROR, "Error %d, %s\n", api_error,
API_GetErrorMessage( pNIM, (APIERRNO)api_error) );
}
#endif /* RTOS != NOOS */
return DEMOD_ERROR;
}
#endif
#endif
lnb_state.tone_enabled = enable;
return DEMOD_SUCCESS;
}
DEMOD_STATUS cnxt_lnb_get_tone_enable( NIM *pNIM, bool *enable )
{
*enable = lnb_state.tone_enabled;
return DEMOD_SUCCESS;
}
/****************************************************************************
* Modifications:
*
* $Log:
* 19 mpeg 1.18 10/14/04 3:52:58 PM Bobby Bradford CR(s)
* 11119 11120 : Slight cleanup of I2C LNB device support ... also added
* minimal support for ISL6421 device
* 18 mpeg 1.17 9/1/04 9:45:25 AM Bobby Bradford CR(s)
* 10308 : Modified the LNB processing to support the I2C LNB device
* (LNBH21PD) on the D11 Blue hardware. This support should only be
* enabled if the I2C address is defined for the LNB device in the
* hardware config file.
* 17 mpeg 1.16 6/8/04 4:20:56 AM Ian Mitchell CR(s)
* 9382 : Math overflow in the function cnxt_set_lnb caused an incorrect
* frequency to be returned in cases where the frequency is near the
* upper limit.
*
* 16 mpeg 1.15 6/7/04 9:06:28 AM Dave Wilson CR(s)
* 9360 : Added support for frequency-stacking LNBs such as Echostar's
* DishPro.
* 15 mpeg 1.14 4/1/04 8:57:00 AM Billy Jackman CR(s)
* 8722 8723 : Modified to scale RF frequency from KHz to Hz when using
* manual LNB control.
* 14 mpeg 1.13 3/24/04 11:25:55 AM Matt Korte CR(s)
* 8648 8649 : Fix warnings
* 13 mpeg 1.12 3/24/04 10:45:31 AM Matt Korte CR(s)
* 8648 8649 : If built with NOOS, then don't call trace_new()
* 12 mpeg 1.11 3/22/04 2:40:55 PM Billy Jackman CR(s)
* 8585 : Correct errors when building for external Hamaro demod.
* 11 mpeg 1.10 3/22/04 2:05:48 PM Billy Jackman CR(s)
* 8585 : Fix initialization error.
* 10 mpeg 1.9 3/22/04 1:10:29 PM Billy Jackman CR(s)
* 8585 : Modified keywords to new StarTeam format.
* Changed cnxt_set_lnb function to not pass back indications for how to
* set polarization voltage and tone but to set them directly.
* Added cnxt_lnb_init function for Hamaro driver to call.
* Added APIs cnxt_lnb_set_output_enable, cnxt_lnb_get_output_enable,
* cnxt_lnb_set_polarization, cnxt_lnb_get_polarization,
* cnxt_lnb_set_tone_enable and cnxt_lnb_get_tone_enable to support
* NDSCORE requirements.
* Added LNB of type LNB_MANUAL to allow NDSCORE manual control of LNB
* signalling.
*
* 9 mpeg 1.8 10/17/03 9:59:30 AM Larry Wang CR(s):
* 7673 Replace memcpy and memset with FCopy and FFillBytes.
* 8 mpeg 1.7 7/8/03 7:12:12 PM Billy Jackman SCR(s)
* 6909 :
* Put things back the way they belong.
*
* 7 mpeg 1.6 7/8/03 4:24:54 PM Tim White SCR(s)
* 6908 :
* Back out last change (1.5) due to error when attempting to tune using
* NDSTESTS
* (or NDSTESTS_STUB) application from file cobra_cx24108.c. Defect
* #6909 opened
* to fix this problem.
*
*
* 6 mpeg 1.5 6/30/03 6:14:24 PM Billy Jackman SCR(s)
* 5816 :
* Modified cnxt_set_lnb to take into account the type of LNB used and
* do the
* right thing for each of single, dual, and orbital position.
*
* 5 mpeg 1.4 6/24/03 6:31:56 PM Tim White SCR(s)
* 6831 :
* Add flash, hsdp, demux, OSD, and demod support to codeldrext
*
*
* 4 mpeg 1.3 3/21/03 9:46:02 AM Billy Jackman SCR(s)
* 5842 :
* If the resulting frequency from an LNB calculation is negative, take
* its
* absolute value before returning the result.
*
* 3 mpeg 1.2 3/19/03 8:54:50 AM Billy Jackman SCR(s)
* 5792 :
* Modified 22KHz tone setting so that if the lnb_a and lnb_b parameters
* are the
* same and equal to 11250KHz, the code will activate 22KHz. If they
* are the same
* and not equal to 11250KHz, the code will deactivate 22KHz.
*
* 2 mpeg 1.1 11/27/02 1:25:32 PM Billy Jackman SCR(s)
* 4989 :
* Modified handling of LNB polarization and tone to allow correct
* setting
* by the channel change API.
*
* 1 mpeg 1.0 9/30/02 12:16:22 PM Billy Jackman
* $
*
****************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -