📄 demod_dcf8722.c
字号:
#define CABLE_GET_SIGNAL_FUNC cnxt_c_get_signal_stats
#define CABLE_GET_LOCK_FUNC cnxt_c_get_lock_status
#define CABLE_GET_TUNING_FUNC cnxt_c_get_tuning
#define CABLE_SET_CALLBACK_FUNC cnxt_c_set_callback
#define CABLE_CLEAR_CALLBACK_FUNC cnxt_c_clear_callback
#define CABLE_SCAN_FUNC (0)
#define CABLE_SCAN_NEXT_FUNC (0)
#define CABLE_RE_ACQUIRE_FUNC (0)
static DEMOD_STATUS cnxt_c_get_unit_type (u_int32 uUnit, DEMOD_NIM_TYPE *pUnitType);
static DEMOD_STATUS cnxt_c_ioctl (u_int32 uUnit, DEMOD_IOCTL_TYPE eType, void *pData);
static DEMOD_STATUS cnxt_c_connect (u_int32 uUnit, TUNING_SPEC *pTuning, u_int32 *pTimeLimit);
static DEMOD_STATUS cnxt_c_disconnect (u_int32 uUnit);
static DEMOD_STATUS cnxt_c_get_signal_stats (u_int32 uUnit, SIGNAL_STATS *pSignalStats);
static DEMOD_STATUS cnxt_c_get_lock_status (u_int32 uUnit, bool *pLocked);
static DEMOD_STATUS cnxt_c_get_tuning (u_int32 uUnit, TUNING_SPEC *pTuning);
static DEMOD_STATUS cnxt_c_set_callback (u_int32 uUnit, MODULE_STATUS_FUNCTION *pfnCallback);
static DEMOD_STATUS cnxt_c_clear_callback (u_int32 uUnit);
/*
static bool cnxt_c_scan_next (u_int32 uUnit, SCAN_SPEC *pScan);
static bool cnxt_c_reacquire (TUNING_SPEC *pOriginal, TUNING_SPEC *pActual);
*/
/*****************************************************************************/
/* FUNCTION: cnxt_c_get_unit_type */
/* */
/* PARAMETERS: uUnit - unit number for which type information is requested */
/* */
/* pUnitType - pointer to the DEMOD_NIM_TYPE variable to be */
/* filled out. */
/* */
/* DESCRIPTION: This function returns information about the type of the */
/* unit that is the subject of the request. */
/* */
/* RETURNS: DEMOD_UNINITIALIZED - this module has not been initialized. */
/* DEMOD_BAD_UNIT - the unit number is not valid. */
/* DEMOD_BAD_PARAMETER - there is a bad parameter. */
/* DEMOD_SUCCESS - the function completed successfully. */
/* */
/* CONTEXT: Must be called from a non-interrupt context. */
/* */
/*****************************************************************************/
static DEMOD_STATUS cnxt_c_get_unit_type (u_int32 uUnit, DEMOD_NIM_TYPE *pUnitType)
{
if (!guInitialized)
{
return (DEMOD_UNINITIALIZED);
}
if (NIM_NO_HARDWARE == guNewLOCState[uUnit])
{
return (DEMOD_BAD_UNIT);
}
if (NULL == pUnitType)
{
return (DEMOD_BAD_PARAMETER);
}
*pUnitType = DEMOD_NIM_CABLE;
return (DEMOD_SUCCESS);
}
/*****************************************************************************/
/* FUNCTION: cnxt_c_ioctl */
/* */
/* PARAMETERS: uUnit - the unit number for which the ioctl operation is */
/* requested. */
/* eType - the type of ioctl operation requested. */
/* pData - pointer to the DEMOD_IOCTL_TYPE structure that */
/* contains data for the operation or will be filled */
/* out with data by the operation. */
/* */
/* DESCRIPTION: This function implements various module-specific control or */
/* status functions. */
/* */
/* RETURNS: DEMOD_UNINITIALIZED - this module has not been initialized. */
/* DEMOD_BAD_UNIT - the unit number is not valid. */
/* DEMOD_UNIMPLEMENTED - The IOCTL is not used in this driver */
/* */
/* CONTEXT: Must be called from a non-interrupt context. */
/* */
/*****************************************************************************/
static DEMOD_STATUS cnxt_c_ioctl (u_int32 uUnit, DEMOD_IOCTL_TYPE eType, void *pData)
{
if (!guInitialized)
{
return (DEMOD_UNINITIALIZED);
}
if (NIM_NO_HARDWARE == guNewLOCState[uUnit])
{
return (DEMOD_BAD_UNIT);
}
return (DEMOD_UNIMPLEMENTED);
}
/*****************************************************************************/
/* FUNCTION: cnxt_c_connect */
/* */
/* PARAMETERS: uUnit - the unit number for which the connect operation is */
/* requested */
/* pTuning - pointer to the TUNING_SPEC structure containing */
/* parameters for the requested connection. */
/* pTimeLimit - timeout value (ms) to be filled-out. if it's */
/* OK for state machine to do it, allow plenty. */
/* */
/* DESCRIPTION: This function connects to a stream by tuning the interface */
/* to the requested specification. */
/* */
/* RETURNS: DEMOD_SUCCESS - the function completed successfully. */
/* DEMOD_UNINITIALIZED - this module has not been initialized. */
/* DEMOD_BAD_UNIT - the unit is not valid. */
/* DEMOD_BAD_PARAMETER - there is a bad parameter. */
/* DEMOD_ERROR - there has been an error. */
/* */
/* CONTEXT: Must be called from a non-interrupt context. */
/* */
/*****************************************************************************/
static DEMOD_STATUS cnxt_c_connect (
u_int32 uUnit,
TUNING_SPEC *pTuning,
u_int32 *pTimeLimit
)
{
u_int32 uTxMsg[4];
int32 iReturnCode;
debug_out (TL_INFO, "DEMOD CONNECTION FUNC: Enter.\n");
if (!guInitialized)
{
return (DEMOD_UNINITIALIZED);
}
if (NIM_NO_HARDWARE == guNewLOCState[uUnit])
{
return (DEMOD_BAD_UNIT);
}
/* the NIM type must be always DEMOD_NIM_CABLE */
if ( (pTuning == NULL) || (pTuning->type != DEMOD_NIM_CABLE) )
{
return (DEMOD_BAD_PARAMETER);
}
#if 0
/* ONLY FOR TEST */
pTuning->tune.nim_cable_tune.frequency = 682000000;
pTuning->tune.nim_cable_tune.symbol_rate = 6900000;
pTuning->tune.nim_cable_tune.modulation = MOD_QAM64;
pTuning->tune.nim_cable_tune.spectrum = SPECTRUM_NORMAL;
pTuning->tune.nim_cable_tune.annex = ANNEX_A;
#endif
/* save the tuning parameters to local memory */
gLocalTuning[uUnit].type = pTuning->type;
gLocalTuning[uUnit].tune.nim_cable_tune.frequency = pTuning->tune.nim_cable_tune.frequency;
gLocalTuning[uUnit].tune.nim_cable_tune.symbol_rate = pTuning->tune.nim_cable_tune.symbol_rate;
gLocalTuning[uUnit].tune.nim_cable_tune.modulation = pTuning->tune.nim_cable_tune.modulation;
gLocalTuning[uUnit].tune.nim_cable_tune.auto_spectrum = pTuning->tune.nim_cable_tune.auto_spectrum;
gLocalTuning[uUnit].tune.nim_cable_tune.spectrum = pTuning->tune.nim_cable_tune.spectrum;
gLocalTuning[uUnit].tune.nim_cable_tune.annex = pTuning->tune.nim_cable_tune.annex;
/* check the AUTO-QAM DETECTION mode */
if (MOD_QAMAUTO == gLocalTuning[uUnit].tune.nim_cable_tune.modulation)
{
gAutoQAMMode = 1;
}
else
{
gAutoQAMMode = 0;
}
/* send a control message to the demod task to signal the connection. */
uTxMsg[0] = uUnit;
uTxMsg[1] = (u_int32)(&gLocalTuning[uUnit]);
uTxMsg[2] = (u_int32)(0);
uTxMsg[3] = (u_int32)(NIM_MSG_CONNECT);
iReturnCode = qu_send (gNIMQueue, uTxMsg);
if (RC_OK != iReturnCode)
{
return (DEMOD_ERROR);
}
/* return the connection timeout */
/* *pTimeLimit = (2 * LOCK_TIMEOUT); */
debug_out (TL_INFO, "DEMOD CONNECTION FUNC: Return.\n");
return (DEMOD_SUCCESS);
}
/*****************************************************************************/
/* FUNCTION: cnxt_c_disconnect */
/* */
/* PARAMETERS: uUnit - the unit number for which the disconnect operation */
/* is requested. */
/* */
/* DESCRIPTION: This function disconnects from a stream. */
/* */
/* RETURNS: DEMOD_SUCCESS - the function completed successfully. */
/* DEMOD_BAD_UNIT - the unit number is not valid. */
/* DEMOD_UNINITIALIZED - this module has not been initialized. */
/* */
/* CONTEXT: Must be called from a non-interrupt context. */
/* */
/*****************************************************************************/
static DEMOD_STATUS cnxt_c_disconnect (u_int32 uUnit)
{
u_int32 uMsg[4];
int32 iReturnCode;
if (!guInitialized)
{
return (DEMOD_UNINITIALIZED);
}
if (NIM_NO_HARDWARE == guNewLOCState[uUnit])
{
return (DEMOD_BAD_UNIT);
}
/* send a control message to the demod task to signal the disconnection. */
uMsg[0] = uUnit;
uMsg[1] = 0;
uMsg[2] = 0;
uMsg[3] = (u_int32)(NIM_MSG_DISCONNECT);
iReturnCode = qu_send (gNIMQueue, uMsg);
if (RC_OK != iReturnCode)
{
return (DEMOD_ERROR);
}
/* update the state */
guOldLOCState[uUnit] = guNewLOCState[uUnit];
guNewLOCState[uUnit] = NIM_DISCONNECTING;
return (DEMOD_SUCCESS);
}
/*****************************************************************************/
/* FUNCTION: cnxt_c_get_tuning */
/* */
/* PARAMETERS: uUnit - the unit number for which the get tuning operation */
/* is requested. */
/* pTuning - pointer to the TUNING_SPEC structure to be filled */
/* out with parameters for the current connection. */
/* */
/* DESCRIPTION: This function returns the tuning parameters for the */
/* specified unit. */
/* */
/* RETURNS: DEMOD_SUCCESS - the function completed successfully. */
/* DEMOD_UNINITIALIZED - this module has not been initialized. */
/* DEMOD_BAD_PARAMETER - there is a bad parameter. */
/* DEMOD_BAD_UNIT - the unit number is not valid. */
/* DEMOD_ERROR - there has been an error. */
/* */
/* CONTEXT: Must be called from a non-interrupt context. */
/* */
/* Since there is no actual underlying tuner, this function just returns */
/* the last tuning parameters set. */
/* */
/*****************************************************************************/
static DEMOD_STATUS cnxt_c_get_tuning (u_int32 uUnit, TUNING_SPEC *pTuning)
{
if (!guInitialized)
{
return (DEMOD_UNINITIALIZED);
}
if (NIM_NO_HARDWARE == guNewLOCState[uUnit])
{
return (DEMOD_BAD_UNIT);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -