提交SMOD ATSC IMX APP版本 V122
This commit is contained in:
Executable
+7
@@ -0,0 +1,7 @@
|
||||
VPATH += $(ROOT_DIR)/app/sonytuner/source/isdb_terr
|
||||
|
||||
C_SOURCE += sony_demod_isdbt.c
|
||||
C_SOURCE += sony_demod_isdbt_monitor.c
|
||||
C_SOURCE += sony_integ_isdbt.c
|
||||
|
||||
|
||||
+1597
File diff suppressed because it is too large
Load Diff
+146
@@ -0,0 +1,146 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2018 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2018/12/13
|
||||
Modification ID : e402a4dcb0e51a00c34b174334c082c1211eebf1
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@file sony_demod_isdbt.h
|
||||
|
||||
This file provides the demodulator control interface specific to ISDB-T.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SONY_DEMOD_ISDBT_H
|
||||
#define SONY_DEMOD_ISDBT_H
|
||||
|
||||
#include "../sony_common.h"
|
||||
#include "../sony_demod.h"
|
||||
//#include "../sony_demod.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Defines
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Structs
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief The tune parameters for a ISDB-T signal
|
||||
*/
|
||||
typedef struct sony_isdbt_tune_param_t {
|
||||
uint32_t centerFreqKHz; /**< Center frequency(kHz) of the ISDB-T channel */
|
||||
sony_dtv_bandwidth_t bandwidth; /**< Bandwidth of the ISDB-T channel */
|
||||
} sony_isdbt_tune_param_t;
|
||||
|
||||
/**
|
||||
@brief The preset information for a ISDB-T signal
|
||||
*/
|
||||
typedef struct sony_demod_isdbt_preset_info_t {
|
||||
uint8_t data[13]; /**< TMCC information defined by ISDB-T */
|
||||
} sony_demod_isdbt_preset_info_t;
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/**
|
||||
@brief Enable acquisition on the demodulator for ISDB-T channels.
|
||||
|
||||
Called from the integration layer ::sony_integ_isdbt_Tune API.
|
||||
|
||||
@param pDemod The demodulator instance
|
||||
@param pTuneParam The tune parameters.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_Tune (sony_demod_t * pDemod,
|
||||
sony_isdbt_tune_param_t * pTuneParam);
|
||||
|
||||
/**
|
||||
@brief Put the demodulator into ::SONY_DEMOD_STATE_SLEEP state.
|
||||
|
||||
Can be called from Active, Shutdown or Sleep states.
|
||||
Called from the integration layer ::sony_integ_Sleep API.
|
||||
|
||||
@param pDemod The demodulator instance
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_Sleep (sony_demod_t * pDemod);
|
||||
|
||||
/**
|
||||
@brief Check ISDB-T demodulator lock status.
|
||||
|
||||
@note This API is for checking lock status in tuning stage.
|
||||
After tuning (while receiving the signal),
|
||||
please use sony_demod_isdbt_monitor_SyncStat instead
|
||||
to check current lock status.
|
||||
|
||||
@param pDemod The demodulator instance
|
||||
@param pLock Demod lock state
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_CheckDemodLock (sony_demod_t * pDemod,
|
||||
sony_demod_lock_result_t * pLock);
|
||||
|
||||
/**
|
||||
@brief Check ISDB-T TS lock status.
|
||||
|
||||
@note This API is for checking lock status in tuning stage.
|
||||
After tuning (while receiving the signal),
|
||||
please use sony_demod_isdbt_monitor_SyncStat instead
|
||||
to check current lock status.
|
||||
|
||||
@param pDemod The demodulator instance
|
||||
@param pLock TS lock state
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_CheckTSLock (sony_demod_t * pDemod,
|
||||
sony_demod_lock_result_t * pLock);
|
||||
|
||||
|
||||
/**
|
||||
@brief Set preset information to enable fast acquisition mode.
|
||||
|
||||
Preset information can be obtained by ::sony_demod_isdbt_monitor_PresetInfo API.
|
||||
|
||||
@param pDemod The demodulator instance
|
||||
@param pPresetInfo Preset information in TMCC. If NULL is set, fast acquisition is disabled.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_SetPreset (sony_demod_t * pDemod,
|
||||
sony_demod_isdbt_preset_info_t* pPresetInfo);
|
||||
|
||||
|
||||
/**
|
||||
@brief Enable acquisition on the demodulator for ISDB-T channels in EWS mode.
|
||||
|
||||
Called from the integration layer ::sony_integ_isdbt_EWSTune API.
|
||||
|
||||
@param pDemod The demodulator instance
|
||||
@param pTuneParam Tune parameters structure.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_EWSTune (sony_demod_t* pDemod,
|
||||
sony_isdbt_tune_param_t * pTuneParam);
|
||||
|
||||
/**
|
||||
@brief Completes the demodulator acquisition setup only the case for ISDB-T EWS tune.
|
||||
|
||||
Must be called after system specific demod and RF tunes.
|
||||
Called from the integration layer ::sony_integ_isdbt_EWSTune API.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_EWSTuneEnd (sony_demod_t * pDemod);
|
||||
|
||||
|
||||
#endif /* SONY_DEMOD_ISDBT_H */
|
||||
Binary file not shown.
+1683
File diff suppressed because it is too large
Load Diff
+279
@@ -0,0 +1,279 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2018 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2018/07/27
|
||||
Modification ID : ff73ffebff57618d6a5aa6e2aa9eb009b86060d1
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@file sony_demod_isdbt_monitor.h
|
||||
|
||||
This file provides the ISDB-T demodulator monitor interface.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SONY_DEMOD_ISDBT_MONITOR_H
|
||||
#define SONY_DEMOD_ISDBT_MONITOR_H
|
||||
|
||||
#include "../sony_demod.h"
|
||||
#include "sony_isdbt.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Defines
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
#define SONY_DEMOD_ISDBT_MONITOR_PRERSBER_INVALID 0xFFFFFFFF /**< BER value if the BER value is invalid */
|
||||
#define SONY_DEMOD_ISDBT_MONITOR_PER_INVALID 0xFFFFFFFF /**< PER value if the PER value is invalid */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Monitors the synchronisation state of the demodulator.
|
||||
|
||||
@note Note that early unlock condition should be used in tuning stage ONLY
|
||||
to detect that there are no desired signal in current frequency quickly.
|
||||
After tuning, early unlock condition should NOT be used to
|
||||
know current demodulator lock status.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pDmdLockStat Address of demodulator lock flag
|
||||
- 0: Not lock
|
||||
- 1: Lock
|
||||
@param pTSLockStat Indicates the TS lock condition.
|
||||
- 0: TS not locked.
|
||||
- 1: TS locked.
|
||||
@param pUnlockDetected Early unlock condition
|
||||
- 0: No early unlock.
|
||||
- 1: Early unlock detected.
|
||||
|
||||
@return SONY_RESULT_OK if successful and pSyncStat, pTSLockStat valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_monitor_SyncStat (sony_demod_t * pDemod,
|
||||
uint8_t * pDmdLockStat,
|
||||
uint8_t * pTSLockStat,
|
||||
uint8_t * pUnlockDetected);
|
||||
|
||||
/**
|
||||
@brief Monitor the IFAGC value.
|
||||
|
||||
Actual dB gain dependent on attached tuner.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pIFAGCOut The IFAGC output register value. Range 0x000 - 0xFFF. Unitless.
|
||||
|
||||
@return SONY_RESULT_OK if successful and pIFAGCOut valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_monitor_IFAGCOut (sony_demod_t * pDemod,
|
||||
uint32_t * pIFAGCOut);
|
||||
|
||||
/**
|
||||
@brief Monitors the detected carrier offset of the currently tuned channel.
|
||||
|
||||
To get the estimated center frequency of the current channel:
|
||||
Freq_Est = Freq_Tune + pOffset;
|
||||
|
||||
This function will compensate for an inverting tuner architecture if the
|
||||
demodulator has been configured accordignly using ::SONY_DEMOD_CONFIG_SPECTRUM_INV
|
||||
config option for ::sony_demod_SetConfig.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pOffset Carrier offset value (Hz).
|
||||
|
||||
@return SONY_RESULT_OK if successful and pOffset valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_monitor_CarrierOffset (sony_demod_t * pDemod,
|
||||
int32_t * pOffset);
|
||||
|
||||
/**
|
||||
@brief Monitor the Pre-RS BER.
|
||||
|
||||
If the target BER is invalid, SONY_DEMOD_ISDBT_MONITOR_PRERSBER_INVALID (0xFFFFFFFF) is set.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pBERA Layer A BER value (Pre Reed-Solomon decoder) x 1e7.
|
||||
@param pBERB Layer B BER value (Pre Reed-Solomon decoder) x 1e7.
|
||||
@param pBERC Layer C BER value (Pre Reed-Solomon decoder) x 1e7.
|
||||
|
||||
@return SONY_RESULT_OK if successful and pBER valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_monitor_PreRSBER (sony_demod_t * pDemod,
|
||||
uint32_t * pBERA, uint32_t * pBERB, uint32_t * pBERC);
|
||||
|
||||
/**
|
||||
@brief Monitor the TMCC information.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pTMCCInfo The TMCC information.
|
||||
|
||||
@return SONY_RESULT_OK if successful and pInfo valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_monitor_TMCCInfo (sony_demod_t * pDemod,
|
||||
sony_isdbt_tmcc_info_t * pTMCCInfo);
|
||||
|
||||
/**
|
||||
@brief Monitor the TMCC preset information.
|
||||
|
||||
This information enable demodulator fast acquisition by passing to
|
||||
::sony_demod_isdbt_SetPreset. Tuning time will be shortened.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pPresetInfo The TMCC Preset information struct instance.
|
||||
|
||||
@return SONY_RESULT_OK if successful and pPresetInfo is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_monitor_PresetInfo(sony_demod_t * pDemod,
|
||||
sony_demod_isdbt_preset_info_t * pPresetInfo);
|
||||
|
||||
/**
|
||||
@brief Monitors the number RS (Reed Solomon) errors detected by the
|
||||
RS decoder over 1 second. Also known as the code word reject count.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pPENA The number of RS errors detected over 1 second. (Layer A)
|
||||
@param pPENB The number of RS errors detected over 1 second. (Layer B)
|
||||
@param pPENC The number of RS errors detected over 1 second. (Layer C)
|
||||
|
||||
@return SONY_RESULT_OK if successful and pPEN valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_monitor_PacketErrorNumber (sony_demod_t * pDemod,
|
||||
uint32_t * pPENA, uint32_t * pPENB, uint32_t * pPENC);
|
||||
|
||||
/**
|
||||
@brief Monitors the channel spectrum sense.
|
||||
|
||||
To ensure correct polarity detection
|
||||
please use the ::SONY_DEMOD_CONFIG_SPECTRUM_INV config option in
|
||||
::sony_demod_SetConfig to select the appropriate spectrum inversion
|
||||
for the tuner output.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pSense Indicates the spectrum sense.
|
||||
|
||||
@return SONY_RESULT_OK if successful and pSense is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_monitor_SpectrumSense (sony_demod_t * pDemod,
|
||||
sony_demod_terr_cable_spectrum_sense_t * pSense);
|
||||
|
||||
/**
|
||||
@brief Monitors the estimated SNR value.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pSNR The estimated SNR in dBx1000.
|
||||
|
||||
@return SONY_RESULT_OK if successful and pSNR is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_monitor_SNR (sony_demod_t * pDemod,
|
||||
int32_t * pSNR);
|
||||
|
||||
/**
|
||||
@brief Monitor the detected mode/guard.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pMode Mode estimation result.
|
||||
@param pGuard Guard interval estimation result.
|
||||
|
||||
@return SONY_RESULT_OK if successful and pMode, pGuard are valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_monitor_ModeGuard(sony_demod_t * pDemod,
|
||||
sony_isdbt_mode_t * pMode,
|
||||
sony_isdbt_guard_t * pGuard);
|
||||
|
||||
/**
|
||||
@brief Monitor the sampling frequency offset value.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pPPM The sampling frequency offset in ppm x 100.
|
||||
Range: +/- 220ppm.
|
||||
|
||||
@return SONY_RESULT_OK if pPPM is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_monitor_SamplingOffset (sony_demod_t * pDemod,
|
||||
int32_t * pPPM);
|
||||
|
||||
/**
|
||||
@brief Monitor the PER (Packet Error Rate) parameters.
|
||||
|
||||
If the target PER is invalid, SONY_DEMOD_ISDBT_MONITOR_PER_INVALID (0xFFFFFFFF) is set.
|
||||
|
||||
@param pDemod The demod instance.
|
||||
@param pPERA The estimated layer A PER value (Post Reed-Solomon decoder) x 1e6.
|
||||
@param pPERB The estimated layer B PER value (Post Reed-Solomon decoder) x 1e6.
|
||||
@param pPERC The estimated layer C PER value (Post Reed-Solomon decoder) x 1e6.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_monitor_PER (sony_demod_t * pDemod,
|
||||
uint32_t * pPERA, uint32_t * pPERB, uint32_t * pPERC);
|
||||
|
||||
/**
|
||||
@brief Calculate the ISDB-T TS (Transport Stream) rate from TMCC and guard interval information.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pTSRateKbpsA The calculated TS rate of layer A in kbps.
|
||||
@param pTSRateKbpsB The calculated TS rate of layer B in kbps.
|
||||
@param pTSRateKbpsC The calculated TS rate of layer C in kbps.
|
||||
|
||||
@return SONY_RESULT_OK if pTSRateKbps is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_monitor_TSRate (sony_demod_t * pDemod,
|
||||
uint32_t * pTSRateKbpsA, uint32_t * pTSRateKbpsB, uint32_t * pTSRateKbpsC);
|
||||
|
||||
/**
|
||||
@brief Monitor the AC EEW (Earthquake Early Warning by AC signal) information
|
||||
|
||||
@param pDemod pDemod the demod instance.
|
||||
@param pIsExist ACEEW exist flag.
|
||||
If you get "0", ACEEW information does not exist.
|
||||
If you get "1", ACEEW information exists, please check pACEEWInfo.
|
||||
@param pACEEWInfo ACEEW Information struct instance.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_monitor_ACEEWInfo(sony_demod_t * pDemod,
|
||||
uint8_t * pIsExist,
|
||||
sony_isdbt_aceew_info_t * pACEEWInfo);
|
||||
|
||||
/**
|
||||
@brief Monitor the Emergency Warning Broadcasting System(EWS) detection flag.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pEWSChange The value of EWS change detection flag.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_monitor_EWSChange (sony_demod_t * pDemod,
|
||||
uint8_t * pEWSChange);
|
||||
|
||||
/**
|
||||
@brief Monitor the TMCC information change detection flag.
|
||||
|
||||
According to ARIB spec, countdown index value in TMCC information
|
||||
will be decremented from 0xF to 0x00 before changing TMCC information.
|
||||
This monitor detects this change of countdown index value.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pTMCCChange The value of TMCC change detection flag.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_monitor_TMCCChange (sony_demod_t * pDemod,
|
||||
uint8_t * pTMCCChange);
|
||||
|
||||
/**
|
||||
@brief Clear the Emergency Warning Broadcasting System(EWS) detection flag.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_ClearEWSChange (sony_demod_t * pDemod);
|
||||
|
||||
|
||||
/**
|
||||
@brief Clear the TMCC Change detection flag.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbt_ClearTMCCChange (sony_demod_t * pDemod);
|
||||
|
||||
#endif /* SONY_DEMOD_ISDBT_MONITOR_H */
|
||||
Binary file not shown.
+455
@@ -0,0 +1,455 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2018 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2018/08/30
|
||||
Modification ID : 902dae58eb5249e028ccc5d7f60bb66cca9b43a9
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
#include "../sony_integ.h"
|
||||
#include "sony_integ_isdbt.h"
|
||||
#include "sony_demod_isdbt_monitor.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Static Function Prototypes
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
sony_result_t sony_integ_isdbt_Tune(sony_integ_t * pInteg,
|
||||
sony_isdbt_tune_param_t * pTuneParam)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_isdbt_Tune");
|
||||
//printf("\n: sony_integ_isdbt_Tune enter in\n");
|
||||
|
||||
if ((!pInteg) || (!pTuneParam) || (!pInteg->pDemod)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
if ((pInteg->pDemod->state != SONY_DEMOD_STATE_SLEEP) && (pInteg->pDemod->state != SONY_DEMOD_STATE_ACTIVE)) {
|
||||
/* This api is accepted in Sleep and Active states only */
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
/* Check bandwidth validity */
|
||||
if ((pTuneParam->bandwidth != SONY_DTV_BW_6_MHZ) &&
|
||||
(pTuneParam->bandwidth != SONY_DTV_BW_7_MHZ) &&
|
||||
(pTuneParam->bandwidth != SONY_DTV_BW_8_MHZ)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_NOSUPPORT);
|
||||
}
|
||||
|
||||
/* Tune the demodulator */
|
||||
result = sony_demod_isdbt_Tune (pInteg->pDemod, pTuneParam);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
//printf("[ %s,%d] \n",__FUNCTION__,__LINE__);
|
||||
if ((pInteg->pTuner) && (pInteg->pTuner->TerrCableTune)) {
|
||||
/* Enable the I2C repeater */
|
||||
result = sony_demod_I2cRepeaterEnable (pInteg->pDemod, 0x01);
|
||||
//printf("[ %s,%d] \n",__FUNCTION__,__LINE__);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Tune the RF part */
|
||||
result = pInteg->pTuner->TerrCableTune (pInteg->pTuner, pTuneParam->centerFreqKHz, SONY_DTV_SYSTEM_ISDBT, pTuneParam->bandwidth);
|
||||
//printf("[ %s,%d] \n",__FUNCTION__,__LINE__);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Disable the I2C repeater */
|
||||
result = sony_demod_I2cRepeaterEnable (pInteg->pDemod, 0x00);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
//printf("[ %s,%d] \n",__FUNCTION__,__LINE__);
|
||||
|
||||
/* Reset the demod to enable acquisition */
|
||||
result = sony_demod_TuneEnd (pInteg->pDemod);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
//printf("[ %s,%d] \n",__FUNCTION__,__LINE__);
|
||||
if (pInteg->pDemod->scanMode) {
|
||||
/* Wait for Demod lock */
|
||||
result = sony_integ_isdbt_WaitDemodLock (pInteg);
|
||||
//printf("[ %s,%d] \n",__FUNCTION__,__LINE__);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Wait for TS lock */
|
||||
result = sony_integ_isdbt_WaitTSLock (pInteg);
|
||||
printf("[ %s,%d] %s\n",__FUNCTION__,__LINE__,"sony_integ_isdbt_WaitTSLock");
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
|
||||
//printf("[ %s,%d] \n",__FUNCTION__,__LINE__);
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
sony_result_t sony_integ_isdbt_EWSTune(sony_integ_t * pInteg,
|
||||
sony_isdbt_tune_param_t * pTuneParam)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_isdbt_EWSTune");
|
||||
|
||||
if ((!pInteg) || (!pTuneParam) || (!pInteg->pDemod)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
if ((pInteg->pDemod->state != SONY_DEMOD_STATE_SLEEP) && (pInteg->pDemod->state != SONY_DEMOD_STATE_ACTIVE)) {
|
||||
/* This api is accepted in Sleep and Active states only */
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
/* Check bandwidth validity */
|
||||
if ((pTuneParam->bandwidth != SONY_DTV_BW_6_MHZ) &&
|
||||
(pTuneParam->bandwidth != SONY_DTV_BW_7_MHZ) &&
|
||||
(pTuneParam->bandwidth != SONY_DTV_BW_8_MHZ)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_NOSUPPORT);
|
||||
}
|
||||
|
||||
/* Tune the demodulator */
|
||||
result = sony_demod_isdbt_EWSTune (pInteg->pDemod, pTuneParam);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
if ((pInteg->pTuner) && (pInteg->pTuner->TerrCableTune)) {
|
||||
/* Enable the I2C repeater */
|
||||
result = sony_demod_I2cRepeaterEnable (pInteg->pDemod, 0x01);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Tune the RF part */
|
||||
result = pInteg->pTuner->TerrCableTune (pInteg->pTuner, pTuneParam->centerFreqKHz, SONY_DTV_SYSTEM_ISDBT, pTuneParam->bandwidth);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Disable the I2C repeater */
|
||||
result = sony_demod_I2cRepeaterEnable (pInteg->pDemod, 0x00);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
|
||||
/* Reset the demod to enable acquisition */
|
||||
result = sony_demod_isdbt_EWSTuneEnd (pInteg->pDemod);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Wait for Demod lock */
|
||||
result = sony_integ_isdbt_WaitDemodLock (pInteg);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
sony_result_t sony_integ_isdbt_Scan(sony_integ_t * pInteg,
|
||||
sony_integ_isdbt_scan_param_t * pScanParam,
|
||||
sony_integ_isdbt_scan_callback_t callBack)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
sony_integ_isdbt_scan_result_t scanResult;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_isdbt_Scan");
|
||||
|
||||
if ((!pInteg) || (!pScanParam) || (!callBack) || (!pInteg->pDemod)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
if ((pInteg->pDemod->state != SONY_DEMOD_STATE_SLEEP) && (pInteg->pDemod->state != SONY_DEMOD_STATE_ACTIVE)) {
|
||||
/* This api is accepted in Sleep and Active states only */
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
/* Ensure the scan parameters are valid. */
|
||||
if (pScanParam->endFrequencyKHz < pScanParam->startFrequencyKHz) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
if (pScanParam->stepFrequencyKHz == 0) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
/* Check bandwidth validity */
|
||||
if ((pScanParam->bandwidth != SONY_DTV_BW_6_MHZ) && (pScanParam->bandwidth != SONY_DTV_BW_7_MHZ) &&
|
||||
(pScanParam->bandwidth != SONY_DTV_BW_8_MHZ)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_NOSUPPORT);
|
||||
}
|
||||
|
||||
/* Set the start frequency */
|
||||
scanResult.centerFreqKHz = pScanParam->startFrequencyKHz;
|
||||
scanResult.tuneResult = SONY_RESULT_OK;
|
||||
scanResult.tuneParam.centerFreqKHz = pScanParam->startFrequencyKHz;
|
||||
scanResult.tuneParam.bandwidth = pScanParam->bandwidth;
|
||||
|
||||
/* Set scan mode enabled */
|
||||
result = sony_demod_terr_cable_SetScanMode(pInteg->pDemod, SONY_DTV_SYSTEM_ISDBT, 0x01);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Scan routine */
|
||||
while (scanResult.centerFreqKHz <= pScanParam->endFrequencyKHz) {
|
||||
scanResult.tuneParam.centerFreqKHz = scanResult.centerFreqKHz;
|
||||
scanResult.tuneResult = sony_integ_isdbt_Tune(pInteg, &scanResult.tuneParam);
|
||||
switch (scanResult.tuneResult) {
|
||||
case SONY_RESULT_OK:
|
||||
/* Channel found, callback to application */
|
||||
callBack (pInteg, &scanResult, pScanParam);
|
||||
break;
|
||||
case SONY_RESULT_ERROR_UNLOCK:
|
||||
case SONY_RESULT_ERROR_TIMEOUT:
|
||||
/* Channel not found, callback to application for progress updates */
|
||||
callBack (pInteg, &scanResult, pScanParam);
|
||||
break;
|
||||
default:
|
||||
/* Serious error occurred -> cancel operation. */
|
||||
sony_demod_terr_cable_SetScanMode(pInteg->pDemod, SONY_DTV_SYSTEM_ISDBT, 0x00);
|
||||
SONY_TRACE_RETURN (scanResult.tuneResult);
|
||||
}
|
||||
|
||||
scanResult.centerFreqKHz += pScanParam->stepFrequencyKHz;
|
||||
|
||||
/* Check cancellation. */
|
||||
result = sony_integ_CheckCancellation (pInteg);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
sony_demod_terr_cable_SetScanMode(pInteg->pDemod, SONY_DTV_SYSTEM_ISDBT, 0x00);
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear scan mode */
|
||||
result = sony_demod_terr_cable_SetScanMode(pInteg->pDemod, SONY_DTV_SYSTEM_ISDBT, 0x00);
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
|
||||
sony_result_t sony_integ_isdbt_WaitTSLock (sony_integ_t * pInteg)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
sony_demod_lock_result_t lock = SONY_DEMOD_LOCK_RESULT_NOTDETECT;
|
||||
sony_stopwatch_t timer;
|
||||
uint8_t continueWait = 1;
|
||||
uint32_t elapsed = 0;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_isdbt_WaitTSLock");
|
||||
|
||||
if ((!pInteg) || (!pInteg->pDemod)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
if (pInteg->pDemod->state != SONY_DEMOD_STATE_ACTIVE) {
|
||||
/* This api is accepted in Active state only */
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
/* Wait for TS lock */
|
||||
result = sony_stopwatch_start (&timer);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
result = sony_stopwatch_elapsed(&timer, &elapsed);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
if (elapsed >= SONY_ISDBT_WAIT_TS_LOCK) {
|
||||
continueWait = 0;
|
||||
}
|
||||
|
||||
result = sony_demod_isdbt_CheckTSLock (pInteg->pDemod, &lock);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
switch (lock) {
|
||||
case SONY_DEMOD_LOCK_RESULT_LOCKED:
|
||||
SONY_TRACE_RETURN (SONY_RESULT_OK);
|
||||
|
||||
case SONY_DEMOD_LOCK_RESULT_UNLOCKED:
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_UNLOCK);
|
||||
|
||||
default:
|
||||
/* continue waiting... */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check cancellation. */
|
||||
result = sony_integ_CheckCancellation (pInteg);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
if (continueWait) {
|
||||
result = sony_stopwatch_sleep (&timer, SONY_ISDBT_WAIT_LOCK_INTERVAL);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
} else {
|
||||
result = SONY_RESULT_ERROR_TIMEOUT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
sony_result_t sony_integ_isdbt_WaitDemodLock (sony_integ_t * pInteg)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
sony_demod_lock_result_t lock = SONY_DEMOD_LOCK_RESULT_NOTDETECT;
|
||||
sony_stopwatch_t timer;
|
||||
uint8_t continueWait = 1;
|
||||
uint32_t elapsed = 0;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_isdbt_WaitDemodLock");
|
||||
|
||||
if ((!pInteg) || (!pInteg->pDemod)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
if (pInteg->pDemod->state != SONY_DEMOD_STATE_ACTIVE) {
|
||||
/* This api is accepted in Active state only */
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
/* Wait for demod lock */
|
||||
result = sony_stopwatch_start (&timer);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
result = sony_stopwatch_elapsed(&timer, &elapsed);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
if (elapsed >= SONY_ISDBT_WAIT_DEMOD_LOCK) {
|
||||
continueWait = 0;
|
||||
}
|
||||
|
||||
result = sony_demod_isdbt_CheckDemodLock (pInteg->pDemod, &lock);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
switch (lock) {
|
||||
case SONY_DEMOD_LOCK_RESULT_LOCKED:
|
||||
SONY_TRACE_RETURN (SONY_RESULT_OK);
|
||||
|
||||
case SONY_DEMOD_LOCK_RESULT_UNLOCKED:
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_UNLOCK);
|
||||
|
||||
default:
|
||||
/* continue waiting... */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Check cancellation. */
|
||||
result = sony_integ_CheckCancellation (pInteg);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
if (continueWait) {
|
||||
result = sony_stopwatch_sleep (&timer, SONY_ISDBT_WAIT_LOCK_INTERVAL);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
} else {
|
||||
result = SONY_RESULT_ERROR_TIMEOUT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
sony_result_t sony_integ_isdbt_monitor_RFLevel (sony_integ_t * pInteg, int32_t * pRFLeveldB)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_isdbt_monitor_RFLevel");
|
||||
|
||||
if ((!pInteg) || (!pInteg->pDemod) || (!pRFLeveldB)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
if (pInteg->pDemod->state != SONY_DEMOD_STATE_ACTIVE) {
|
||||
/* This api is accepted in Active state only */
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
if (pInteg->pDemod->system != SONY_DTV_SYSTEM_ISDBT) {
|
||||
/* Not ISDB-T */
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
if (!pInteg->pTuner) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_NOSUPPORT);
|
||||
}
|
||||
|
||||
if (pInteg->pTuner->rfLevelFuncTerr == SONY_TUNER_RFLEVEL_FUNC_READ && pInteg->pTuner->ReadRFLevel) {
|
||||
/* Enable the I2C repeater */
|
||||
result = sony_demod_I2cRepeaterEnable (pInteg->pDemod, 0x01);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
result = pInteg->pTuner->ReadRFLevel (pInteg->pTuner, pRFLeveldB);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Disable the I2C repeater */
|
||||
result = sony_demod_I2cRepeaterEnable (pInteg->pDemod, 0x00);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
} else if (pInteg->pTuner->rfLevelFuncTerr == SONY_TUNER_RFLEVEL_FUNC_CALCFROMAGC
|
||||
&& pInteg->pTuner->CalcRFLevelFromAGC) {
|
||||
uint32_t ifAgc;
|
||||
|
||||
result = sony_demod_isdbt_monitor_IFAGCOut (pInteg->pDemod, &ifAgc);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
result = pInteg->pTuner->CalcRFLevelFromAGC (pInteg->pTuner, ifAgc, pRFLeveldB);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
} else {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_NOSUPPORT);
|
||||
}
|
||||
|
||||
/* dBm * 100 -> dBm * 1000 */
|
||||
*pRFLeveldB *= 10;
|
||||
|
||||
SONY_TRACE_RETURN (SONY_RESULT_OK);
|
||||
}
|
||||
|
||||
|
||||
+184
@@ -0,0 +1,184 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2018 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2018/07/27
|
||||
Modification ID : ff73ffebff57618d6a5aa6e2aa9eb009b86060d1
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@file sony_integ_isdbt.h
|
||||
|
||||
This file provides the integration layer interface for ISDB-T
|
||||
specific demodulator functions.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SONY_INTEG_ISDBT_H
|
||||
#define SONY_INTEG_ISDBT_H
|
||||
|
||||
#include "../sony_demod.h"
|
||||
#include "../sony_integ.h"
|
||||
#include "../isdb_terr/sony_demod_isdbt.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Defines
|
||||
------------------------------------------------------------------------------*/
|
||||
#define SONY_ISDBT_WAIT_DEMOD_LOCK 1500 /**< 1.5 s timeout for wait demodulator lock process for ISDB-T channels */
|
||||
#define SONY_ISDBT_WAIT_TS_LOCK 1500 /**< 1.5 s timeout for wait TS lock process for ISDB-T channels */
|
||||
#define SONY_ISDBT_WAIT_LOCK_INTERVAL 10 /**< 10ms polling interval for demodulator and TS lock functions */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Structs
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief The parameters used for ISDB-T scanning.
|
||||
*/
|
||||
typedef struct sony_integ_isdbt_scan_param_t {
|
||||
/**
|
||||
@brief The start frequency in kHz for scanning. Ensure that this is
|
||||
aligned with the channel raster.
|
||||
*/
|
||||
uint32_t startFrequencyKHz;
|
||||
|
||||
/**
|
||||
@brief The end frequency in kHz for scanning.
|
||||
*/
|
||||
uint32_t endFrequencyKHz;
|
||||
|
||||
/**
|
||||
@brief The step frequency in kHz for scanning.
|
||||
*/
|
||||
uint32_t stepFrequencyKHz;
|
||||
/**
|
||||
@brief The bandwidth to use for tuning during the scan
|
||||
*/
|
||||
sony_dtv_bandwidth_t bandwidth;
|
||||
} sony_integ_isdbt_scan_param_t;
|
||||
|
||||
/**
|
||||
@brief The structure used to return a channel located or progress update
|
||||
as part of a ISDB-T scan.
|
||||
*/
|
||||
typedef struct sony_integ_isdbt_scan_result_t {
|
||||
/**
|
||||
@brief Indicates the current frequency just attempted for the scan. This would
|
||||
primarily be used to calculate scan progress from the scan parameters.
|
||||
*/
|
||||
uint32_t centerFreqKHz;
|
||||
|
||||
/**
|
||||
@brief Indicates if the tune result at the current frequency. SONY_RESULT_OK
|
||||
means that a channel has been locked and one of the tuneParam structures
|
||||
contain the channel information.
|
||||
*/
|
||||
sony_result_t tuneResult;
|
||||
|
||||
/**
|
||||
@brief The tune params for a located ISDB-T channel.
|
||||
*/
|
||||
sony_isdbt_tune_param_t tuneParam;
|
||||
} sony_integ_isdbt_scan_result_t;
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Function Pointers
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Callback function that is called for every attempted frequency during a scan.
|
||||
|
||||
For successful channel results the function is called after
|
||||
demodulator Lock, but before TS lock is achieved.
|
||||
|
||||
@param pInteg The driver instance.
|
||||
@param pResult The current scan result.
|
||||
@param pScanParam The current scan parameters.
|
||||
*/
|
||||
typedef void (*sony_integ_isdbt_scan_callback_t) (sony_integ_t * pInteg,
|
||||
sony_integ_isdbt_scan_result_t * pResult,
|
||||
sony_integ_isdbt_scan_param_t * pScanParam);
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Performs acquisition to a ISDB-T channel.
|
||||
|
||||
Blocks the calling thread until the TS has locked or has timed out.
|
||||
Use ::sony_integ_Cancel to cancel the operation at any time.
|
||||
|
||||
@param pInteg The driver instance.
|
||||
@param pTuneParam The parameters required for the tune.
|
||||
|
||||
@return SONY_RESULT_OK if tuned successfully to the channel.
|
||||
*/
|
||||
sony_result_t sony_integ_isdbt_Tune(sony_integ_t * pInteg,
|
||||
sony_isdbt_tune_param_t * pTuneParam);
|
||||
|
||||
|
||||
/**
|
||||
@brief Performs acquisition to a ISDB-T channel but in EWS mode.
|
||||
|
||||
In EWS mode, TS is not output and the demod waiting EWS flag.
|
||||
Blocks the calling thread until the Demod has locked or has timed out.
|
||||
Use ::sony_integ_Cancel to cancel the operation at any time.
|
||||
|
||||
@param pInteg The driver instance.
|
||||
@param pTuneParam The parameters required for the tune.
|
||||
|
||||
@return SONY_RESULT_OK if tuned successfully to the channel.
|
||||
*/
|
||||
sony_result_t sony_integ_isdbt_EWSTune(sony_integ_t * pInteg,
|
||||
sony_isdbt_tune_param_t * pTuneParam);
|
||||
|
||||
/**
|
||||
@brief Performs a scan over the spectrum specified.
|
||||
|
||||
The scan can perform a scan for ISDB-T channels.
|
||||
|
||||
Blocks the calling thread while scanning. Use ::sony_integ_Cancel to cancel
|
||||
the operation at any time.
|
||||
|
||||
@param pInteg The driver instance.
|
||||
@param pScanParam The scan parameters.
|
||||
@param callBack User registered call-back to receive scan progress information and
|
||||
notification of found channels. The call back is called for every attempted
|
||||
frequency during a scan.
|
||||
|
||||
@return SONY_RESULT_OK if scan completed successfully.
|
||||
|
||||
*/
|
||||
sony_result_t sony_integ_isdbt_Scan(sony_integ_t * pInteg,
|
||||
sony_integ_isdbt_scan_param_t * pScanParam,
|
||||
sony_integ_isdbt_scan_callback_t callBack);
|
||||
|
||||
/**
|
||||
@brief Polls the demodulator waiting for TS lock at 10ms intervals up to a timeout of 1.5s.
|
||||
|
||||
@param pInteg The driver instance
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_integ_isdbt_WaitTSLock (sony_integ_t * pInteg);
|
||||
|
||||
/**
|
||||
@brief Polls the demodulator waiting for Demod lock at 10ms intervals up to a timeout of 1.5s.
|
||||
|
||||
@param pInteg The driver instance
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_integ_isdbt_WaitDemodLock (sony_integ_t * pInteg);
|
||||
|
||||
/**
|
||||
@brief RF level monitor function.
|
||||
|
||||
This function returns the estimated RF level based on demodulator gain measurements
|
||||
and a tuner dependent conversion calculation. The calculation provided in this monitor
|
||||
may require modifications for your own HW integration.
|
||||
|
||||
@param pInteg The driver instance
|
||||
@param pRFLeveldB The RF Level estimation in dB * 1000
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_integ_isdbt_monitor_RFLevel (sony_integ_t * pInteg, int32_t * pRFLeveldB);
|
||||
|
||||
#endif /* SONY_INTEG_ISDBT_H */
|
||||
Binary file not shown.
Executable
+168
@@ -0,0 +1,168 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2018 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2018/07/27
|
||||
Modification ID : ff73ffebff57618d6a5aa6e2aa9eb009b86060d1
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@file sony_isdbt.h
|
||||
|
||||
@brief ISDB-T system related type definitions.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SONY_ISDBT_H
|
||||
#define SONY_ISDBT_H
|
||||
|
||||
#include "../sony_common.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Enumeration
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief ISDB-T system mode.
|
||||
*/
|
||||
typedef enum sony_isdbt_mode_t {
|
||||
SONY_ISDBT_MODE_1, /**< ISDB-T Mode 1 (Number of carriers = 1405) */
|
||||
SONY_ISDBT_MODE_2, /**< ISDB-T Mode 2 (Number of carriers = 2809) */
|
||||
SONY_ISDBT_MODE_3, /**< ISDB-T Mode 3 (Number of carriers = 5617) */
|
||||
SONY_ISDBT_MODE_UNKNOWN /**< ISDB-T Mode Unknown */
|
||||
} sony_isdbt_mode_t;
|
||||
|
||||
/**
|
||||
@brief ISDB-T guard interval.
|
||||
*/
|
||||
typedef enum sony_isdbt_guard_t {
|
||||
SONY_ISDBT_GUARD_1_32, /**< Guard Interval : 1/32 */
|
||||
SONY_ISDBT_GUARD_1_16, /**< Guard Interval : 1/16 */
|
||||
SONY_ISDBT_GUARD_1_8, /**< Guard Interval : 1/8 */
|
||||
SONY_ISDBT_GUARD_1_4, /**< Guard Interval : 1/4 */
|
||||
SONY_ISDBT_GUARD_UNKNOWN /**< Guard Interval : Unknown */
|
||||
} sony_isdbt_guard_t;
|
||||
|
||||
|
||||
/* ===== TMCC Information ===== */
|
||||
|
||||
/**
|
||||
@brief ISDB-T system identification described in the TMCC information.
|
||||
*/
|
||||
typedef enum sony_isdbt_system_t {
|
||||
SONY_ISDBT_SYSTEM_ISDB_T, /**< ISDB for Terrestrial Television Broadcasting */
|
||||
SONY_ISDBT_SYSTEM_ISDB_TSB, /**< ISDB for Terrestrial Sound Broadcasting */
|
||||
SONY_ISDBT_SYSTEM_RESERVED_2, /**< reserved by specification (10) */
|
||||
SONY_ISDBT_SYSTEM_RESERVED_3 /**< reserved by specification (11) */
|
||||
} sony_isdbt_system_t;
|
||||
|
||||
/**
|
||||
@brief ISDB-T modulation described in the TMCC information.
|
||||
*/
|
||||
typedef enum sony_isdbt_modulation_t {
|
||||
SONY_ISDBT_MODULATION_DQPSK, /**< DQPSK */
|
||||
SONY_ISDBT_MODULATION_QPSK, /**< QPSK */
|
||||
SONY_ISDBT_MODULATION_16QAM, /**< 16QAM */
|
||||
SONY_ISDBT_MODULATION_64QAM, /**< 64QAM */
|
||||
SONY_ISDBT_MODULATION_RESERVED_4, /**< reserved by specification (100) */
|
||||
SONY_ISDBT_MODULATION_RESERVED_5, /**< reserved by specification (101) */
|
||||
SONY_ISDBT_MODULATION_RESERVED_6, /**< reserved by specification (110) */
|
||||
SONY_ISDBT_MODULATION_UNUSED_7 /**< unused (111) */
|
||||
} sony_isdbt_modulation_t;
|
||||
|
||||
/**
|
||||
@brief ISDB-T code rate described in the TMCC information.
|
||||
*/
|
||||
typedef enum sony_isdbt_coding_rate_t {
|
||||
SONY_ISDBT_CODING_RATE_1_2, /**< Code Rate : 1/2 */
|
||||
SONY_ISDBT_CODING_RATE_2_3, /**< Code Rate : 2/3 */
|
||||
SONY_ISDBT_CODING_RATE_3_4, /**< Code Rate : 3/4 */
|
||||
SONY_ISDBT_CODING_RATE_5_6, /**< Code Rate : 5/6 */
|
||||
SONY_ISDBT_CODING_RATE_7_8, /**< Code Rate : 7/8 */
|
||||
SONY_ISDBT_CODING_RATE_RESERVED_5, /**< reserved by specification (101) */
|
||||
SONY_ISDBT_CODING_RATE_RESERVED_6, /**< reserved by specification (110) */
|
||||
SONY_ISDBT_CODING_RATE_UNUSED_7 /**< unused (111) */
|
||||
} sony_isdbt_coding_rate_t;
|
||||
|
||||
/**
|
||||
@brief ISDB-T interleave length described in the TMCC information.
|
||||
*/
|
||||
typedef enum sony_isdbt_il_length_t {
|
||||
SONY_ISDBT_IL_LENGTH_0_0_0, /**< Mode1: 0, Mode2: 0, Mode3: 0 */
|
||||
SONY_ISDBT_IL_LENGTH_4_2_1, /**< Mode1: 4, Mode2: 2, Mode3: 1 */
|
||||
SONY_ISDBT_IL_LENGTH_8_4_2, /**< Mode1: 8, Mode2: 4, Mode3: 2 */
|
||||
SONY_ISDBT_IL_LENGTH_16_8_4, /**< Mode1:16, Mode2: 8, Mode3: 4 */
|
||||
SONY_ISDBT_IL_LENGTH_RESERVED_4, /**< reserved by specification (100) */
|
||||
SONY_ISDBT_IL_LENGTH_RESERVED_5, /**< reserved by specification (101) */
|
||||
SONY_ISDBT_IL_LENGTH_RESERVED_6, /**< reserved by specification (110) */
|
||||
SONY_ISDBT_IL_LENGTH_UNUSED_7 /**< unused (111) */
|
||||
} sony_isdbt_il_length_t;
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Structs
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief ISDB-T layer information struct. (part of TMCC information)
|
||||
*/
|
||||
typedef struct sony_isdbt_tmcc_layer_info_t {
|
||||
sony_isdbt_modulation_t modulation; /**< Modulation */
|
||||
sony_isdbt_coding_rate_t codingRate; /**< Code rate */
|
||||
sony_isdbt_il_length_t ilLength; /**< Interleave length */
|
||||
uint8_t segmentsNum; /**< 1-13:Segment number, 0,14:Reserved, 15:Unused */
|
||||
} sony_isdbt_tmcc_layer_info_t;
|
||||
|
||||
/**
|
||||
@brief ISDB-T current/next information group struct. (part of TMCC information)
|
||||
*/
|
||||
typedef struct sony_isdbt_tmcc_group_param_t {
|
||||
uint8_t isPartial; /**< 0:No partial reception, 1:Partial reception available */
|
||||
sony_isdbt_tmcc_layer_info_t layerA; /**< Information of layer A */
|
||||
sony_isdbt_tmcc_layer_info_t layerB; /**< Information of layer B */
|
||||
sony_isdbt_tmcc_layer_info_t layerC; /**< Information of layer C */
|
||||
} sony_isdbt_tmcc_group_param_t;
|
||||
|
||||
/**
|
||||
@brief ISDB-T TMCC information struct.
|
||||
*/
|
||||
typedef struct sony_isdbt_tmcc_info_t {
|
||||
sony_isdbt_system_t systemId; /**< ISDB-T system identification */
|
||||
uint8_t countDownIndex; /**< Indicator of transmission-parameter switching */
|
||||
uint8_t ewsFlag; /**< Start flag for emergency-alarm broadcasting */
|
||||
sony_isdbt_tmcc_group_param_t currentInfo; /**< Current information */
|
||||
sony_isdbt_tmcc_group_param_t nextInfo; /**< Next information */
|
||||
} sony_isdbt_tmcc_info_t;
|
||||
|
||||
/**
|
||||
@brief ISDB-T ACEEW area information struct. (part of ACEEW information)
|
||||
*/
|
||||
typedef struct sony_isdbt_aceew_area_t {
|
||||
uint8_t data[11]; /**< Area data defined by ISDB-T specification */
|
||||
} sony_isdbt_aceew_area_t;
|
||||
|
||||
/**
|
||||
@brief ISDB-T ACEEW epicenter information struct. (part of ACEEW information)
|
||||
*/
|
||||
typedef struct sony_isdbt_aceew_epicenter_t {
|
||||
uint8_t data[11]; /**< Epicenter data defined by ISDB-T specification */
|
||||
} sony_isdbt_aceew_epicenter_t;
|
||||
|
||||
/**
|
||||
@brief ISDB-T ACEEW (Earthquake Early Warning by AC signal) information struct.
|
||||
*/
|
||||
typedef struct sony_isdbt_aceew_info_t {
|
||||
uint8_t startEndFlag; /**< Start/End flag (B17-B18) */
|
||||
uint8_t updateFlag; /**< Update flag (B19-B20) */
|
||||
uint8_t signalId; /**< Signal identification (B21-B23) */
|
||||
|
||||
/* Area information */
|
||||
uint8_t isAreaValid; /**< areaInfo is (0: Invalid, 1:Valid) */
|
||||
sony_isdbt_aceew_area_t areaInfo; /**< Area information (B24 - B111) */
|
||||
|
||||
/* Epicenter1 information */
|
||||
uint8_t isEpicenter1Valid; /**< epicenter1Info is (0: Invalid, 1:Valid) */
|
||||
sony_isdbt_aceew_epicenter_t epicenter1Info; /**< Epicenter1 information data (B24 - B111) */
|
||||
|
||||
/* Epicenter2 information */
|
||||
uint8_t isEpicenter2Valid; /**< epicenter2Info is (0: Invalid, 1:Valid) */
|
||||
sony_isdbt_aceew_epicenter_t epicenter2Info; /**< Epicenter2 information data (B24 - B111) */
|
||||
|
||||
} sony_isdbt_aceew_info_t;
|
||||
|
||||
#endif /* SONY_ISDBT_H */
|
||||
Reference in New Issue
Block a user