提交SMOD ATSC IMX APP版本 V122
This commit is contained in:
+1152
File diff suppressed because it is too large
Load Diff
+130
@@ -0,0 +1,130 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2018 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2018/07/27
|
||||
Modification ID : ff73ffebff57618d6a5aa6e2aa9eb009b86060d1
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@file sony_demod_dvbt.h
|
||||
|
||||
This file provides the demodulator control interface specific to DVB-T.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SONY_DEMOD_DVBT_H
|
||||
#define SONY_DEMOD_DVBT_H
|
||||
|
||||
#include "sony_common.h"
|
||||
#include "sony_demod.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Defines
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Structs
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief The tune parameters for a DVB-T signal
|
||||
*/
|
||||
typedef struct sony_dvbt_tune_param_t{
|
||||
uint32_t centerFreqKHz; /**< Center frequency in kHz of the DVB-T channel */
|
||||
sony_dtv_bandwidth_t bandwidth; /**< Bandwidth of the DVB-T channel */
|
||||
sony_dvbt_profile_t profile; /**< Indicates the HP/LP profile to be selected. */
|
||||
}sony_dvbt_tune_param_t;
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Configure the DVBT profile for acquisition, Low Priority or High Priority.
|
||||
|
||||
@param pDemod The demodulator instance
|
||||
@param profile The profile to use for DVB-T acquisition.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt_SetProfile (sony_demod_t * pDemod,
|
||||
sony_dvbt_profile_t profile);
|
||||
|
||||
/**
|
||||
@brief Enable acquisition on the demodulator for DVB-T channels.
|
||||
|
||||
Called from the integration layer ::sony_integ_dvbt_Tune API.
|
||||
|
||||
@param pDemod The demodulator instance
|
||||
@param pTuneParam The tune parameters.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt_Tune (sony_demod_t * pDemod,
|
||||
sony_dvbt_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_dvbt_Sleep (sony_demod_t * pDemod);
|
||||
|
||||
/**
|
||||
@brief Check DVB-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_dvbt_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_dvbt_CheckDemodLock (sony_demod_t * pDemod,
|
||||
sony_demod_lock_result_t * pLock);
|
||||
|
||||
/**
|
||||
@brief Check DVB-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_dvbt_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_dvbt_CheckTSLock (sony_demod_t * pDemod,
|
||||
sony_demod_lock_result_t * pLock);
|
||||
|
||||
/**
|
||||
@brief Check DVB-T Echo Optomisation requirement.
|
||||
|
||||
@param pDemod The demodulator instance
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt_EchoOptimization (sony_demod_t * pDemod);
|
||||
|
||||
/**
|
||||
@brief Clear BER, SNR history data for averaged BER, SNR, SQI monitors.
|
||||
|
||||
@note This function may be useful if the user would like to calculate
|
||||
averaged BER, SNR, SQI without using old BER, SNR data.
|
||||
Please check document and example code for recommended setting and sequence.
|
||||
|
||||
@param pDemod The demodulator instance
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt_ClearBERSNRHistory (sony_demod_t * pDemod);
|
||||
|
||||
#endif /* SONY_DEMOD_DVBT_H */
|
||||
+1247
File diff suppressed because it is too large
Load Diff
+205
@@ -0,0 +1,205 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2018 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2018/07/27
|
||||
Modification ID : ff73ffebff57618d6a5aa6e2aa9eb009b86060d1
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@file sony_demod_dvbt2.h
|
||||
|
||||
This file provides the demodulator control interface specific to DVB-T2.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SONY_DEMOD_DVBT2_H
|
||||
#define SONY_DEMOD_DVBT2_H
|
||||
|
||||
#include "sony_common.h"
|
||||
#include "sony_demod.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Enumerations
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief DVBT2 specific tune information, stored in the tune param struct
|
||||
result. This should be checked if a call to DVBT2 tune returns
|
||||
SONY_RESULT_OK_CONFIRM.
|
||||
*/
|
||||
typedef enum {
|
||||
/**
|
||||
@brief Tune successful.
|
||||
*/
|
||||
SONY_DEMOD_DVBT2_TUNE_INFO_OK,
|
||||
|
||||
/**
|
||||
@brief PLP provided in tune params is not available. The demodulator
|
||||
will output the auto PLP in this case.
|
||||
*/
|
||||
SONY_DEMOD_DVBT2_TUNE_INFO_INVALID_PLP_ID
|
||||
} sony_demod_dvbt2_tune_info_t;
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Structs
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief The tune parameters for a DVB-T2 signal
|
||||
*/
|
||||
typedef struct sony_dvbt2_tune_param_t{
|
||||
/**
|
||||
@brief Center frequency in kHz of the DVB-T2 channel.
|
||||
*/
|
||||
uint32_t centerFreqKHz;
|
||||
|
||||
/**
|
||||
@brief Bandwidth of the DVB-T2 channel.
|
||||
*/
|
||||
sony_dtv_bandwidth_t bandwidth;
|
||||
|
||||
/**
|
||||
@brief The data PLP ID to select in acquisition.
|
||||
*/
|
||||
uint8_t dataPlpId;
|
||||
|
||||
/**
|
||||
@brief The DVB-T2 profile to select in acquisition. Must be set to either
|
||||
SONY_DVBT2_PROFILE_BASE or SONY_DVBT2_PROFILE_LITE. If the profile
|
||||
is unknown use the blind tune API with the profile set to
|
||||
SONY_DVBT2_PROFILE_ANY.
|
||||
*/
|
||||
sony_dvbt2_profile_t profile;
|
||||
|
||||
/**
|
||||
@brief Specific tune information relating to DVB-T2 acquisition. If result
|
||||
from Tune function is SONY_RESULT_OK_CONFIRM this result code
|
||||
will provide more information on the tune process. Refer to
|
||||
::sony_demod_dvbt2_tune_info_t for further details on the specific
|
||||
codes.
|
||||
*/
|
||||
sony_demod_dvbt2_tune_info_t tuneInfo;
|
||||
}sony_dvbt2_tune_param_t;
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Enable acquisition on the demodulator for DVB-T2 channels.
|
||||
|
||||
Called from the integration layer ::sony_integ_dvbt2_Tune API.
|
||||
|
||||
@param pDemod The demodulator instance
|
||||
@param pTuneParam The tune parameters.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_Tune (sony_demod_t * pDemod,
|
||||
sony_dvbt2_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_dvbt2_Sleep (sony_demod_t * pDemod);
|
||||
|
||||
/**
|
||||
@brief Check DVB-T2 demodulator lock status.
|
||||
|
||||
@note This API is for checking lock status in tuning stage.
|
||||
After tuning (while receiving the signal),
|
||||
please use sony_demod_dvbt2_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_dvbt2_CheckDemodLock (sony_demod_t * pDemod,
|
||||
sony_demod_lock_result_t * pLock);
|
||||
|
||||
/**
|
||||
@brief Check DVB-T2 TS lock status.
|
||||
|
||||
@note This API is for checking lock status in tuning stage.
|
||||
After tuning (while receiving the signal),
|
||||
please use sony_demod_dvbt2_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_dvbt2_CheckTSLock (sony_demod_t * pDemod,
|
||||
sony_demod_lock_result_t * pLock);
|
||||
|
||||
/**
|
||||
@brief Setup the PLP configuration of the demodulator
|
||||
|
||||
Selecting both the device PLP operation (automatic/manual PLP select)
|
||||
and the PLP to be selected in manual PLP mode.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param autoPLP The auto PLP setting.
|
||||
- 0x00: The data PLP ID set by plpId will be output.
|
||||
If the PLP with the ID is not found, then a PLP error is indicated
|
||||
(::sony_demod_dvbt2_monitor_DataPLPError) but the
|
||||
demod will still output the first found data PLP Id.
|
||||
- 0x01: Fully automatic. The first PLP found during acquisition will be output.
|
||||
@param plpId The PLP Id to set.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_SetPLPConfig (sony_demod_t * pDemod,
|
||||
uint8_t autoPLP,
|
||||
uint8_t plpId);
|
||||
|
||||
/**
|
||||
@brief Set the DVB-T2 profile and tune mode for acquisition.
|
||||
|
||||
Note: This API changes DVB-T2 early unlock detection time.
|
||||
If SONY_DVBT2_PROFILE_LITE or SONY_DVBT2_PROFILE_ANY are specified,
|
||||
early unlock detection time will be longer.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param profile The DVB-T2 profile option. SONY_DVBT2_PROFILE_BASE and
|
||||
SONY_DVBT2_PROFILE_LITE will set the demodulator into fixed tune mode
|
||||
without recovery. SONY_DVBT2_PROFILE_ANY will use auto detection
|
||||
meaning the demodulator will acquire to the first valid frame
|
||||
received, Base or Lite.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_SetProfile (sony_demod_t * pDemod,
|
||||
sony_dvbt2_profile_t profile);
|
||||
|
||||
/**
|
||||
@brief Check DVB-T2 L1_Post valid status.
|
||||
|
||||
@param pDemod The demodulator instance
|
||||
@param pL1PostValid L1 Post valid status
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_CheckL1PostValid (sony_demod_t * pDemod,
|
||||
uint8_t * pL1PostValid);
|
||||
|
||||
/**
|
||||
@brief Clear BER, SNR history data for averaged BER, SNR, SQI monitors.
|
||||
|
||||
@note This function may be useful if the user would like to calculate
|
||||
averaged BER, SNR, SQI without using old BER, SNR data.
|
||||
Please check document and example code for recommended setting and sequence.
|
||||
|
||||
@param pDemod The demodulator instance
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_ClearBERSNRHistory (sony_demod_t * pDemod);
|
||||
|
||||
#endif /* SONY_DEMOD_DVBT2_H */
|
||||
+3145
File diff suppressed because it is too large
Load Diff
+432
@@ -0,0 +1,432 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2018 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2018/07/27
|
||||
Modification ID : ff73ffebff57618d6a5aa6e2aa9eb009b86060d1
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@file sony_demod_dvbt2_monitor.h
|
||||
|
||||
This file provides the DVB-T2 demodulator monitor interface.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SONY_DEMOD_DVBT2_MONITOR_H
|
||||
#define SONY_DEMOD_DVBT2_MONITOR_H
|
||||
|
||||
#include "sony_demod.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Monitors the synchronisation state of the T2 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.
|
||||
Especially, DVB-T2 early unlock condition does NOT change after tuning.
|
||||
(keeps the value decided in tuning stage.)
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pSyncStat The demodulator state.
|
||||
- 0: WAIT_GO,
|
||||
- 1: WAIT_AGC,
|
||||
- 2: WAIT_P1DET,
|
||||
- 3: WAIT_L1PRE,
|
||||
- 4: WAIT_L1POST,
|
||||
- 5: WAIT_DMD_OK,
|
||||
- 6: DMD_OK
|
||||
@param pTSLockStat Indicates the TS lock condition.
|
||||
- 0: TS not locked.
|
||||
- 1: TS locked.
|
||||
@param pUnlockDetected Indicates the early unlock condition.
|
||||
- 0: No early unlock.
|
||||
- 1: Early unlock.
|
||||
|
||||
@return SONY_RESULT_OK if pSyncStat, pTSLockStat is valid, otherwise an error is returned.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_SyncStat (sony_demod_t * pDemod,
|
||||
uint8_t * pSyncStat,
|
||||
uint8_t * pTSLockStat,
|
||||
uint8_t * pUnlockDetected);
|
||||
|
||||
/**
|
||||
@brief Monitors the detected carrier offset of the currently tuned channel, using
|
||||
the continual pilot (CP) estimation from the demodulator.
|
||||
|
||||
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 accordingly using ::SONY_DEMOD_CONFIG_SPECTRUM_INV
|
||||
config option for ::sony_demod_SetConfig.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pOffset The detected carrier offset in Hz.
|
||||
|
||||
@return SONY_RESULT_OK if pOffset is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_CarrierOffset (sony_demod_t * pDemod,
|
||||
int32_t * pOffset);
|
||||
|
||||
/**
|
||||
@brief Monitor the IFAGC value of the T2 demodulator.
|
||||
|
||||
Actual dB gain dependent on attached tuner.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pIFAGC The IFAGC output register value. Range 0 - 0xFFF. Unitless.
|
||||
|
||||
@return SONY_RESULT_OK if pIFAGC is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_IFAGCOut (sony_demod_t * pDemod,
|
||||
uint32_t * pIFAGC);
|
||||
|
||||
/**
|
||||
@brief Monitor the L1-pre signaling information.
|
||||
|
||||
L1-pre signaling information is available when TS is locked, and earlier in the
|
||||
acquisition sequence, after the P1 symbols have been decoded.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pL1Pre Pointer to receive the L1-pre signaling information.
|
||||
|
||||
@return SONY_RESULT_OK if the pL1Pre is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_L1Pre (sony_demod_t * pDemod,
|
||||
sony_dvbt2_l1pre_t * pL1Pre);
|
||||
|
||||
/**
|
||||
@brief Monitor the T2 version in use.
|
||||
|
||||
The version is available from the L1-pre signaling information.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pVersion Pointer to receive the version information.
|
||||
|
||||
@return SONY_RESULT_OK if the pVersion is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_Version (sony_demod_t * pDemod,
|
||||
sony_dvbt2_version_t * pVersion);
|
||||
|
||||
/**
|
||||
@brief Monitor the tuning information on the active channel.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pOfdm Pointer to receive the tuning information.
|
||||
|
||||
@return SONY_RESULT_OK if the pPresetInfo is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_OFDM (sony_demod_t * pDemod,
|
||||
sony_dvbt2_ofdm_t * pOfdm);
|
||||
|
||||
/**
|
||||
@brief Monitor the data PLPs that the demodulator has detected.
|
||||
|
||||
If a single PLP service is in use, then numberPlps = 1
|
||||
and the plpIds[0] shall contain the signalled PLP Id.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pPLPIds Pointer to an array of at least 255 bytes in length
|
||||
that can receive the list of data PLPs carried.
|
||||
This parameter can be NULL. If so, number of data PLP is only returned.
|
||||
@param pNumPLPs The number of data PLPs detected (signalled in L1-post).
|
||||
|
||||
@return SONY_RESULT_OK if the pPLPIds and pNumPLPs are valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_DataPLPs (sony_demod_t * pDemod,
|
||||
uint8_t * pPLPIds,
|
||||
uint8_t * pNumPLPs);
|
||||
|
||||
/**
|
||||
@brief Monitor the active PLP information in L1-post signaling.
|
||||
|
||||
For multiple PLP systems, then able to monitor both the data
|
||||
and common PLP.
|
||||
For single PLP systems, only able to monitor the data PLP.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param type The type of the PLP to monitor.
|
||||
@param pPLPInfo The PLP structure to receive the PLP information into.
|
||||
|
||||
@return SONY_RESULT_OK if pPLPInfo is valid, otherwise an error is returned.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_ActivePLP (sony_demod_t * pDemod,
|
||||
sony_dvbt2_plp_btype_t type,
|
||||
sony_dvbt2_plp_t * pPLPInfo);
|
||||
|
||||
/**
|
||||
@brief Monitor the data PLP error indicator.
|
||||
|
||||
A data PLP error is indicated
|
||||
when the selected PLP was not found in the channel.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pPLPError The error indicated.
|
||||
- 0: No data PLP error.
|
||||
- 1: Data PLP error detected.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_DataPLPError (sony_demod_t * pDemod,
|
||||
uint8_t * pPLPError);
|
||||
|
||||
/**
|
||||
@brief Monitor the L1 change indicator.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pL1Change Indicator of L1 change.
|
||||
- 0: L1 has not changed.
|
||||
- 1: L1 changed.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_L1Change (sony_demod_t * pDemod,
|
||||
uint8_t * pL1Change);
|
||||
|
||||
/**
|
||||
@brief Monitors the basic L1-post data.
|
||||
|
||||
The device must have L1-post lock before calling,
|
||||
if L1 post lock is not detected and error is returned.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pL1Post The L1 post data monitored.
|
||||
|
||||
@return SONY_RESULT_OK if successful and pL1Post is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_L1Post (sony_demod_t * pDemod,
|
||||
sony_dvbt2_l1post_t * pL1Post);
|
||||
|
||||
/**
|
||||
@brief Monitors the BBHEADER data.
|
||||
|
||||
The device must have TS lock before calling,
|
||||
if TS lock is not detected and error is returned.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param type The type of the PLP to monitor.
|
||||
@param pBBHeader The BBHEADER data monitored.
|
||||
|
||||
@return SONY_RESULT_OK if successful and pBBHeader is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_BBHeader (sony_demod_t * pDemod,
|
||||
sony_dvbt2_plp_btype_t type,
|
||||
sony_dvbt2_bbheader_t * pBBHeader);
|
||||
|
||||
/**
|
||||
@brief Monitor the in-band type B signaling TS (Transport Stream) rate.
|
||||
|
||||
Available V1.2.1 or later.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param type The type of the PLP to monitor.
|
||||
@param pTSRateBps The TS rate of the PLP in bits/s.
|
||||
|
||||
@return SONY_RESULT_OK if pTSRateBps is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_InBandBTSRate (sony_demod_t * pDemod,
|
||||
sony_dvbt2_plp_btype_t type,
|
||||
uint32_t * pTSRateBps);
|
||||
|
||||
/**
|
||||
@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_dvbt2_monitor_SpectrumSense (sony_demod_t * pDemod,
|
||||
sony_demod_terr_cable_spectrum_sense_t * pSense);
|
||||
|
||||
/**
|
||||
@brief Monitor the SNR estimation made by the demodulator, clipped to a
|
||||
maximum of 40dB.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pSNR The returned SNR in dB x 1000.
|
||||
|
||||
@return SONY_RESULT_OK if pSNR is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_SNR (sony_demod_t * pDemod,
|
||||
int32_t * pSNR);
|
||||
|
||||
/**
|
||||
@brief Monitor the pre-LDPC BER.
|
||||
|
||||
This provides the data PLP BER in multiple PLP case.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pBER The returned BER x 1e7.
|
||||
|
||||
@return SONY_RESULT_OK if the pBER is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_PreLDPCBER (sony_demod_t * pDemod,
|
||||
uint32_t * pBER);
|
||||
|
||||
/**
|
||||
@brief Monitor the post BCH FER (FEC block error rate) parameters.
|
||||
|
||||
@param pDemod The demod instance.
|
||||
@param pFER The estimated FER x 1e6.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_PostBCHFER (sony_demod_t * pDemod,
|
||||
uint32_t * pFER);
|
||||
|
||||
/**
|
||||
@brief Monitor the pre-BCH BER.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pBER The returned BER x 1e9.
|
||||
|
||||
@return SONY_RESULT_OK if pBER is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_PreBCHBER (sony_demod_t * pDemod,
|
||||
uint32_t * pBER);
|
||||
|
||||
/**
|
||||
@brief Monitor the Packet Error Number. Also known as the code word reject count.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pPEN The returned Packet Error Number.
|
||||
|
||||
@return SONY_RESULT_OK if pPEN is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_PacketErrorNumber (sony_demod_t * pDemod,
|
||||
uint32_t * pPEN);
|
||||
|
||||
/**
|
||||
@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_dvbt2_monitor_SamplingOffset (sony_demod_t * pDemod,
|
||||
int32_t * pPPM);
|
||||
|
||||
/**
|
||||
@brief Monitor the demodulator *estimated* DVB-T2 TS (Transport Stream) rate.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pTSRateKbps The estimated TS rate in kbps.
|
||||
|
||||
@return SONY_RESULT_OK if pTSRateKbps is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_TSRate (sony_demod_t * pDemod,
|
||||
uint32_t * pTSRateKbps);
|
||||
|
||||
/**
|
||||
@brief Monitor the DVB-T2 quality metric.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pQuality The quality as a percentage (0-100).
|
||||
|
||||
@return SONY_RESULT_OK if successful and pQuality valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_Quality (sony_demod_t * pDemod,
|
||||
uint8_t * pQuality);
|
||||
|
||||
/**
|
||||
@brief Monitor the DVB-T2 PER (Packet Error Rate).
|
||||
|
||||
@param pDemod The demod instance.
|
||||
@param pPER The estimated PER x 1e6.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_PER (sony_demod_t * pDemod,
|
||||
uint32_t * pPER);
|
||||
|
||||
/**
|
||||
@brief Monitor the active PLP constellation.
|
||||
|
||||
The common PLP in the current
|
||||
group can also be monitored if one exists.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param type The type of the PLP to monitor (data or common).
|
||||
@param pQAM The PLP constellation.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_QAM (sony_demod_t * pDemod,
|
||||
sony_dvbt2_plp_btype_t type,
|
||||
sony_dvbt2_plp_constell_t * pQAM);
|
||||
|
||||
/**
|
||||
@brief Monitor the active PLP code rate.
|
||||
|
||||
The common PLP in the current
|
||||
group can also be monitored if one exists.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param type The type of the PLP to monitor (data or common).
|
||||
@param pCodeRate The PLP code rate.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_CodeRate (sony_demod_t * pDemod,
|
||||
sony_dvbt2_plp_btype_t type,
|
||||
sony_dvbt2_plp_code_rate_t * pCodeRate);
|
||||
|
||||
/**
|
||||
@brief Monitor the currently acquired DVB-T2 profile.
|
||||
|
||||
This will return SONY_RESULT_ERROR_HW_STATE if the register value is not valid.
|
||||
|
||||
@param pDemod The demod instance.
|
||||
@param pProfile The profile of the DVB-T2 output from the demodulator.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_Profile (sony_demod_t * pDemod,
|
||||
sony_dvbt2_profile_t * pProfile);
|
||||
|
||||
/**
|
||||
@brief Monitor the averaged pre-BCH BER.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pBER The returned BER x 1e9.
|
||||
|
||||
@return SONY_RESULT_OK if pBER is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_AveragedPreBCHBER (sony_demod_t * pDemod,
|
||||
uint32_t * pBER);
|
||||
|
||||
/**
|
||||
@brief Monitor the estimated averaged SNR value, clipped to a
|
||||
maximum of 40dB.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pSNR The returned SNR in dB x 1000.
|
||||
|
||||
@return SONY_RESULT_OK if pSNR is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_AveragedSNR (sony_demod_t * pDemod,
|
||||
int32_t * pSNR);
|
||||
|
||||
/**
|
||||
@brief Monitor the DVB-T2 quality metric using averaged BER and SNR.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pQuality The quality as a percentage (0-100).
|
||||
|
||||
@return SONY_RESULT_OK if successful and pQuality valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt2_monitor_AveragedQuality (sony_demod_t * pDemod,
|
||||
uint8_t * pQuality);
|
||||
|
||||
#endif /* SONY_DEMOD_DVBT2_MONITOR_H */
|
||||
+1632
File diff suppressed because it is too large
Load Diff
+254
@@ -0,0 +1,254 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2018 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2018/07/27
|
||||
Modification ID : ff73ffebff57618d6a5aa6e2aa9eb009b86060d1
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@file sony_demod_dvbt_monitor.h
|
||||
|
||||
This file provides the DVB-T demodulator monitor interface.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SONY_DEMOD_DVBT_MONITOR_H
|
||||
#define SONY_DEMOD_DVBT_MONITOR_H
|
||||
|
||||
#include "sony_demod.h"
|
||||
#include "sony_dvbt.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Sync state monitor.
|
||||
|
||||
@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 pSyncStat The demodulator state.
|
||||
- 0: WAIT_AGC,
|
||||
- 1: WAIT_MGD,
|
||||
- 2: WAIT_FFCR,
|
||||
- 3: WAIT_ARGD,
|
||||
- 4: WAIT_TITP,
|
||||
- 5: WAIT_TPS,
|
||||
- 6: TPS_LOCK
|
||||
@param pTSLockStat Indicates the TS lock condition.
|
||||
- 0: TS not locked.
|
||||
- 1: TS locked.
|
||||
@param pUnlockDetected Indicates the early unlock condition.
|
||||
- 0: No early unlock.
|
||||
- 1: Early unlock.
|
||||
|
||||
@return SONY_RESULT_OK if successful and pSyncStat, pTSLockStat valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt_monitor_SyncStat (sony_demod_t * pDemod,
|
||||
uint8_t * pSyncStat,
|
||||
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_dvbt_monitor_IFAGCOut (sony_demod_t * pDemod,
|
||||
uint32_t * pIFAGCOut);
|
||||
|
||||
/**
|
||||
@brief Monitor the detected mode/guard (not TPS 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 valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt_monitor_ModeGuard (sony_demod_t * pDemod,
|
||||
sony_dvbt_mode_t * pMode,
|
||||
sony_dvbt_guard_t * pGuard);
|
||||
|
||||
/**
|
||||
@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 accordingly 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_dvbt_monitor_CarrierOffset (sony_demod_t * pDemod,
|
||||
int32_t * pOffset);
|
||||
|
||||
/**
|
||||
@brief Monitor the Pre-Viterbi BER.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pBER BER value (Pre Viterbi decoder) x 1e7.
|
||||
|
||||
@return SONY_RESULT_OK if successful and pBER valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt_monitor_PreViterbiBER (sony_demod_t * pDemod,
|
||||
uint32_t * pBER);
|
||||
|
||||
/**
|
||||
@brief Monitor the Pre-RS BER.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pBER BER value (Pre Reed-Solomon decoder) x 1e7.
|
||||
|
||||
@return SONY_RESULT_OK if successful and pBER valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt_monitor_PreRSBER (sony_demod_t * pDemod,
|
||||
uint32_t * pBER);
|
||||
|
||||
/**
|
||||
@brief Monitor the TPS information.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pInfo The TPS information.
|
||||
|
||||
@return SONY_RESULT_OK if successful and pInfo valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt_monitor_TPSInfo (sony_demod_t * pDemod,
|
||||
sony_dvbt_tpsinfo_t * pInfo);
|
||||
|
||||
/**
|
||||
@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 pPEN The number of RS errors detected over 1 second.
|
||||
|
||||
@return SONY_RESULT_OK if successful and pPEN valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt_monitor_PacketErrorNumber (sony_demod_t * pDemod,
|
||||
uint32_t * pPEN);
|
||||
|
||||
/**
|
||||
@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_dvbt_monitor_SpectrumSense (sony_demod_t * pDemod,
|
||||
sony_demod_terr_cable_spectrum_sense_t * pSense);
|
||||
|
||||
/**
|
||||
@brief Monitors the estimated SNR value, clipped to a
|
||||
maximum of 40dB.
|
||||
|
||||
@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_dvbt_monitor_SNR (sony_demod_t * pDemod,
|
||||
int32_t * pSNR);
|
||||
|
||||
/**
|
||||
@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_dvbt_monitor_SamplingOffset (sony_demod_t * pDemod,
|
||||
int32_t * pPPM);
|
||||
|
||||
/**
|
||||
@brief Monitor the DVB-T quality metric. Based on Nordig SQI
|
||||
equation.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pQuality The quality as a percentage (0-100).
|
||||
|
||||
@return SONY_RESULT_OK if successful and pQuality valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt_monitor_Quality (sony_demod_t * pDemod,
|
||||
uint8_t * pQuality);
|
||||
|
||||
|
||||
/**
|
||||
@brief Monitor the DVB-T PER (Packet Error Rate) parameters.
|
||||
|
||||
@param pDemod The demod instance.
|
||||
@param pPER The estimated PER x 1e6.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt_monitor_PER (sony_demod_t * pDemod,
|
||||
uint32_t * pPER);
|
||||
|
||||
/**
|
||||
@brief Calculate the TS (Transport Stream) rate from TPS information.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pTSRateKbps The estimated TS rate in kbps.
|
||||
|
||||
@return SONY_RESULT_OK if pTSRateKbps is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt_monitor_TSRate (sony_demod_t * pDemod,
|
||||
uint32_t * pTSRateKbps);
|
||||
|
||||
/**
|
||||
@brief Monitor the averaged Pre-RS BER.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pBER BER value (Pre reed solomon decoder) x 1e7.
|
||||
|
||||
@return SONY_RESULT_OK if successful and pBER valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt_monitor_AveragedPreRSBER (sony_demod_t * pDemod,
|
||||
uint32_t * pBER);
|
||||
|
||||
/**
|
||||
@brief Monitor the estimated averaged SNR value, clipped to a
|
||||
maximum of 40dB.
|
||||
|
||||
@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_dvbt_monitor_AveragedSNR (sony_demod_t * pDemod,
|
||||
int32_t * pSNR);
|
||||
|
||||
/**
|
||||
@brief Monitor the DVB-T quality metric using averaged BER and SNR.
|
||||
|
||||
Based on Nordig SQI equation.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pQuality The quality as a percentage (0-100).
|
||||
|
||||
@return SONY_RESULT_OK if successful and pQuality valid.
|
||||
*/
|
||||
sony_result_t sony_demod_dvbt_monitor_AveragedQuality (sony_demod_t * pDemod,
|
||||
uint8_t * pQuality);
|
||||
|
||||
#endif /* SONY_DEMOD_DVBT_MONITOR_H */
|
||||
Executable
+102
@@ -0,0 +1,102 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2016/06/24
|
||||
Modification ID : 3b74e280b7ad8ce430b6a9419ac53e8f2e3737f9
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@file sony_dvbt.h
|
||||
|
||||
This file provides DVB-T related type definitions.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SONY_DVBT_H
|
||||
#define SONY_DVBT_H
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Enumerations
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief DVB-T constellation.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT_CONSTELLATION_QPSK, /**< QPSK */
|
||||
SONY_DVBT_CONSTELLATION_16QAM, /**< 16-QAM */
|
||||
SONY_DVBT_CONSTELLATION_64QAM, /**< 64-QAM */
|
||||
SONY_DVBT_CONSTELLATION_RESERVED_3 /**< Reserved. */
|
||||
} sony_dvbt_constellation_t;
|
||||
|
||||
/**
|
||||
@brief DVB-T hierarchy.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT_HIERARCHY_NON, /**< Non-hierarchical service. */
|
||||
SONY_DVBT_HIERARCHY_1, /**< a = 1. */
|
||||
SONY_DVBT_HIERARCHY_2, /**< a = 2. */
|
||||
SONY_DVBT_HIERARCHY_4 /**< a = 4. */
|
||||
} sony_dvbt_hierarchy_t;
|
||||
|
||||
/**
|
||||
@brief DVB-T code rate.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT_CODERATE_1_2, /**< Code Rate : 1/2 */
|
||||
SONY_DVBT_CODERATE_2_3, /**< Code Rate : 2/3 */
|
||||
SONY_DVBT_CODERATE_3_4, /**< Code Rate : 3/4 */
|
||||
SONY_DVBT_CODERATE_5_6, /**< Code Rate : 5/6 */
|
||||
SONY_DVBT_CODERATE_7_8, /**< Code Rate : 7/8 */
|
||||
SONY_DVBT_CODERATE_RESERVED_5, /**< Code Rate : Reserved */
|
||||
SONY_DVBT_CODERATE_RESERVED_6, /**< Code Rate : Reserved */
|
||||
SONY_DVBT_CODERATE_RESERVED_7 /**< Code Rate : Reserved */
|
||||
} sony_dvbt_coderate_t;
|
||||
|
||||
/**
|
||||
@brief DVB-T guard interval.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT_GUARD_1_32, /**< Guard Interval : 1/32 */
|
||||
SONY_DVBT_GUARD_1_16, /**< Guard Interval : 1/16 */
|
||||
SONY_DVBT_GUARD_1_8, /**< Guard Interval : 1/8 */
|
||||
SONY_DVBT_GUARD_1_4 /**< Guard Interval : 1/4 */
|
||||
} sony_dvbt_guard_t;
|
||||
|
||||
/**
|
||||
@brief DVB-T mode.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT_MODE_2K, /**< 2k mode */
|
||||
SONY_DVBT_MODE_8K, /**< 8k mode */
|
||||
SONY_DVBT_MODE_RESERVED_2, /**< Mode Reserved 2 */
|
||||
SONY_DVBT_MODE_RESERVED_3 /**< Mode Reserved 3 */
|
||||
} sony_dvbt_mode_t;
|
||||
|
||||
/**
|
||||
@brief DVB-T HP/LP profile.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT_PROFILE_HP = 0, /**< High Priority */
|
||||
SONY_DVBT_PROFILE_LP /**< Low Priority */
|
||||
} sony_dvbt_profile_t;
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Structs
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief The TPS information structure.
|
||||
*/
|
||||
typedef struct {
|
||||
sony_dvbt_constellation_t constellation; /**< DVB-T constellation. */
|
||||
sony_dvbt_hierarchy_t hierarchy; /**< DVB-T hierarchy. */
|
||||
sony_dvbt_coderate_t rateHP; /**< The HP code rate. */
|
||||
sony_dvbt_coderate_t rateLP; /**< The LP code rate. */
|
||||
sony_dvbt_guard_t guard; /**< The guard interval. */
|
||||
sony_dvbt_mode_t mode; /**< The mode. */
|
||||
uint8_t fnum; /**< The f number. */
|
||||
uint8_t lengthIndicator; /**< The Length indicator. */
|
||||
uint16_t cellID; /**< The Cell ID. */
|
||||
uint8_t reservedEven; /**< Reserved (Even). */
|
||||
uint8_t reservedOdd; /**< Reserved (Odd). */
|
||||
} sony_dvbt_tpsinfo_t;
|
||||
|
||||
#endif /* SONY_DVBT_H */
|
||||
Executable
+734
@@ -0,0 +1,734 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2018 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2018/07/27
|
||||
Modification ID : ff73ffebff57618d6a5aa6e2aa9eb009b86060d1
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@file sony_dvbt2.h
|
||||
|
||||
This file provides DVB-T2 related type definitions.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SONY_DVBT2_H
|
||||
#define SONY_DVBT2_H
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Enumerations
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Specifies the DVB-T2 profile for tuning functionality.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT2_PROFILE_BASE, /**< Acquire to DVB-T2 base profile */
|
||||
SONY_DVBT2_PROFILE_LITE, /**< Acquire to DVB-T2 lite profile */
|
||||
SONY_DVBT2_PROFILE_ANY /**< Acquire to DVB-T2 base or lite profile (blind tune only) */
|
||||
}sony_dvbt2_profile_t;
|
||||
|
||||
/**
|
||||
@brief DVBT2 version definition.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT2_V111, /**< DVBT2 V1.1.1. */
|
||||
SONY_DVBT2_V121, /**< DVBT2 V1.2.1. */
|
||||
SONY_DVBT2_V131 /**< DVBT2 V1.3.1. */
|
||||
} sony_dvbt2_version_t;
|
||||
|
||||
/**
|
||||
@brief DVBT2 S1 signaling definition.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT2_S1_BASE_SISO = 0x00, /**< DVB-T2-Base SISO. */
|
||||
SONY_DVBT2_S1_BASE_MISO = 0x01, /**< DVB-T2-Base MISO. */
|
||||
SONY_DVBT2_S1_NON_DVBT2 = 0x02, /**< Non DVB-T2. */
|
||||
SONY_DVBT2_S1_LITE_SISO = 0x03, /**< DVB-T2-Lite SISO. */
|
||||
SONY_DVBT2_S1_LITE_MISO = 0x04, /**< DVB-T2-Lite MISO. */
|
||||
SONY_DVBT2_S1_RSVD3 = 0x05, /**< Reserved. */
|
||||
SONY_DVBT2_S1_RSVD4 = 0x06, /**< Reserved. */
|
||||
SONY_DVBT2_S1_RSVD5 = 0x07, /**< Reserved. */
|
||||
SONY_DVBT2_S1_UNKNOWN = 0xFF /**< Unknown. */
|
||||
} sony_dvbt2_s1_t;
|
||||
|
||||
/**
|
||||
@brief DVBT2-Base S2 Signalling definition.
|
||||
Actual values are S2 >> 1.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT2_BASE_S2_M2K_G_ANY = 0x00, /**< 2K mode with any guard. */
|
||||
SONY_DVBT2_BASE_S2_M8K_G_DVBT = 0x01, /**< 8K mode with DVBT guard. */
|
||||
SONY_DVBT2_BASE_S2_M4K_G_ANY = 0x02, /**< 4K mode with any guard. */
|
||||
SONY_DVBT2_BASE_S2_M1K_G_ANY = 0x03, /**< 1K mode with any guard. */
|
||||
SONY_DVBT2_BASE_S2_M16K_G_ANY = 0x04, /**< 16K mode with any guard. */
|
||||
SONY_DVBT2_BASE_S2_M32K_G_DVBT = 0x05, /**< 32K mode with DVBT guard. */
|
||||
SONY_DVBT2_BASE_S2_M8K_G_DVBT2 = 0x06, /**< 8K mode with DVBT2 guard. */
|
||||
SONY_DVBT2_BASE_S2_M32K_G_DVBT2 = 0x07, /**< 32K mode with DVBT2 guard. */
|
||||
SONY_DVBT2_BASE_S2_UNKNOWN = 0xFF /**< Unknown mode/guard. */
|
||||
} sony_dvbt2_base_s2_t;
|
||||
|
||||
/**
|
||||
@brief DVBT2-Lite S2 Signalling definition.
|
||||
Actual values are S2 >> 1.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT2_LITE_S2_M2K_G_ANY = 0x00, /**< 2K mode with any guard. */
|
||||
SONY_DVBT2_LITE_S2_M8K_G_DVBT = 0x01, /**< 8K mode with DVBT guard. */
|
||||
SONY_DVBT2_LITE_S2_M4K_G_ANY = 0x02, /**< 4K mode with any guard. */
|
||||
SONY_DVBT2_LITE_S2_M16K_G_DVBT2 = 0x03, /**< 16K mode with DVBT2 guard. */
|
||||
SONY_DVBT2_LITE_S2_M16K_G_DVBT = 0x04, /**< 16K mode with DVBT guard. */
|
||||
SONY_DVBT2_LITE_S2_RSVD1 = 0x05, /**< Reserved. */
|
||||
SONY_DVBT2_LITE_S2_M8K_G_DVBT2 = 0x06, /**< 8K mode with DVBT2 guard. */
|
||||
SONY_DVBT2_LITE_S2_RSVD2 = 0x07, /**< Reserved. */
|
||||
SONY_DVBT2_LITE_S2_UNKNOWN = 0xFF /**< Unknown mode/guard. */
|
||||
} sony_dvbt2_lite_s2_t;
|
||||
|
||||
/**
|
||||
@brief DVBT2 guard intervals.
|
||||
Same encoding as used for L1-pre signaling Guard Interval.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT2_G1_32 = 0x00, /**< Guard Interval : 1/32. */
|
||||
SONY_DVBT2_G1_16 = 0x01, /**< Guard Interval : 1/16. */
|
||||
SONY_DVBT2_G1_8 = 0x02, /**< Guard Interval : 1/8. */
|
||||
SONY_DVBT2_G1_4 = 0x03, /**< Guard Interval : 1/4. */
|
||||
SONY_DVBT2_G1_128 = 0x04, /**< Guard Interval : 1/128. */
|
||||
SONY_DVBT2_G19_128 = 0x05, /**< Guard Interval : 19/128. */
|
||||
SONY_DVBT2_G19_256 = 0x06, /**< Guard Interval : 19/256. */
|
||||
SONY_DVBT2_G_RSVD1 = 0x07, /**< Reserved. */
|
||||
SONY_DVBT2_G_UNKNOWN = 0xFF /**< Unknown. */
|
||||
} sony_dvbt2_guard_t;
|
||||
|
||||
/**
|
||||
@brief The DVBT2 FFT modes.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT2_M2K = 0x00, /**< 2K mode. */
|
||||
SONY_DVBT2_M8K = 0x01, /**< 8K mode. */
|
||||
SONY_DVBT2_M4K = 0x02, /**< 4K mode. */
|
||||
SONY_DVBT2_M1K = 0x03, /**< 1K mode. */
|
||||
SONY_DVBT2_M16K = 0x04, /**< 16K mode. */
|
||||
SONY_DVBT2_M32K = 0x05, /**< 32K mode. */
|
||||
SONY_DVBT2_M_RSVD1 = 0x06, /**< Reserved. */
|
||||
SONY_DVBT2_M_RSVD2 = 0x07 /**< Reserved. */
|
||||
} sony_dvbt2_mode_t;
|
||||
|
||||
/**
|
||||
@brief The DVBT2 bandwidth.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT2_BW_8 = 0x00, /**< Bandwidth : 8MHz. */
|
||||
SONY_DVBT2_BW_7 = 0x01, /**< Bandwidth : 7MHz. */
|
||||
SONY_DVBT2_BW_6 = 0x02, /**< Bandwidth : 6MHz. */
|
||||
SONY_DVBT2_BW_5 = 0x03, /**< Bandwidth : 5MHz. */
|
||||
SONY_DVBT2_BW_10 = 0x04, /**< Bandwidth : 10MHz. Professional/Test Receivers Only */
|
||||
SONY_DVBT2_BW_1_7 = 0x05, /**< Bandwidth : 1.7MHz. */
|
||||
SONY_DVBT2_BW_RSVD1 = 0x06, /**< Reserved. */
|
||||
SONY_DVBT2_BW_RSVD2 = 0x07, /**< Reserved. */
|
||||
SONY_DVBT2_BW_RSVD3 = 0x08, /**< Reserved. */
|
||||
SONY_DVBT2_BW_RSVD4 = 0x09, /**< Reserved. */
|
||||
SONY_DVBT2_BW_RSVD5 = 0x0A, /**< Reserved. */
|
||||
SONY_DVBT2_BW_RSVD6 = 0x0B, /**< Reserved. */
|
||||
SONY_DVBT2_BW_RSVD7 = 0x0C, /**< Reserved. */
|
||||
SONY_DVBT2_BW_RSVD8 = 0x0D, /**< Reserved. */
|
||||
SONY_DVBT2_BW_RSVD9 = 0x0E, /**< Reserved. */
|
||||
SONY_DVBT2_BW_RSVD10 = 0x0F, /**< Reserved. */
|
||||
SONY_DVBT2_BW_UNKNOWN = 0xFF /**< Unknown Bandwidth. */
|
||||
} sony_dvbt2_bw_t;
|
||||
|
||||
/**
|
||||
@brief The DVBT2 current T2 super-frame stream type.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT2_L1PRE_TYPE_TS = 0x00, /**< DVBT2 Streams : Transport Stream (TS) Only. */
|
||||
SONY_DVBT2_L1PRE_TYPE_GS = 0x01, /**< DVBT2 Streams : Generic Streams (GS) Only. */
|
||||
SONY_DVBT2_L1PRE_TYPE_TS_GS = 0x02, /**< DVBT2 Streams : Mixed GS and TS. */
|
||||
SONY_DVBT2_L1PRE_TYPE_RESERVED = 0x03, /**< DVBT2 Streams : Reserved. */
|
||||
SONY_DVBT2_L1PRE_TYPE_UNKNOWN = 0xFF /**< DVBT2 Stream s: Unknown. */
|
||||
} sony_dvbt2_l1pre_type_t;
|
||||
|
||||
/**
|
||||
@brief The DVBT2 L1-pre PAPR (Peak to Average Power Ratio) reduction indicator.
|
||||
The mode used is dependent on the channel DVB-T2 version. Refer to
|
||||
individual enumeration value comments for details.
|
||||
*/
|
||||
typedef enum {
|
||||
/**
|
||||
@brief DVBT2 PAPR reduction mode = 0x00
|
||||
- DVB-T2 V1.1.1 : None
|
||||
- DVB-T2 V1.2.1 and V1.3.1 : L1-ACE and TR on P2 Symbols
|
||||
*/
|
||||
SONY_DVBT2_PAPR_0 = 0x00,
|
||||
|
||||
/**
|
||||
@brief DVBT2 PAPR reduction mode = 0x01
|
||||
- DVB-T2 V1.1.1 : ACE
|
||||
- DVB-T2 V1.2.1 and V1.3.1 : L1-ACE and ACE
|
||||
*/
|
||||
SONY_DVBT2_PAPR_1 = 0x01,
|
||||
|
||||
/**
|
||||
@brief DVBT2 PAPR reduction mode = 0x02
|
||||
- DVB-T2 V1.1.1 : TR
|
||||
- DVB-T2 V1.2.1 and V1.3.1 : L1-ACE and TR
|
||||
*/
|
||||
SONY_DVBT2_PAPR_2 = 0x02,
|
||||
|
||||
/**
|
||||
@brief DVBT2 PAP reduction mode = 0x03
|
||||
- DVB-T2 V1.1.1 : TR and ACE
|
||||
- DVB-T2 V1.2.1 and V1.3.1 : L1-ACE, ACE and TR
|
||||
*/
|
||||
SONY_DVBT2_PAPR_3 = 0x03,
|
||||
|
||||
SONY_DVBT2_PAPR_RSVD1 = 0x04, /**< Reseved. */
|
||||
SONY_DVBT2_PAPR_RSVD2 = 0x05, /**< Reseved. */
|
||||
SONY_DVBT2_PAPR_RSVD3 = 0x06, /**< Reseved. */
|
||||
SONY_DVBT2_PAPR_RSVD4 = 0x07, /**< Reseved. */
|
||||
SONY_DVBT2_PAPR_RSVD5 = 0x08, /**< Reseved. */
|
||||
SONY_DVBT2_PAPR_RSVD6 = 0x09, /**< Reseved. */
|
||||
SONY_DVBT2_PAPR_RSVD7 = 0x0A, /**< Reseved. */
|
||||
SONY_DVBT2_PAPR_RSVD8 = 0x0B, /**< Reseved. */
|
||||
SONY_DVBT2_PAPR_RSVD9 = 0x0C, /**< Reseved. */
|
||||
SONY_DVBT2_PAPR_RSVD10 = 0x0D, /**< Reseved. */
|
||||
SONY_DVBT2_PAPR_RSVD11 = 0x0E, /**< Reseved. */
|
||||
SONY_DVBT2_PAPR_RSVD12 = 0x0F, /**< Reseved. */
|
||||
SONY_DVBT2_PAPR_UNKNOWN = 0xFF /**< Unknown. */
|
||||
} sony_dvbt2_papr_t;
|
||||
|
||||
/**
|
||||
@brief The DVBT2 L1-post constellation/modulation.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT2_L1POST_BPSK = 0x00, /**< DVBT2 L1-post uses BPSK. */
|
||||
SONY_DVBT2_L1POST_QPSK = 0x01, /**< DVBT2 L1-post uses QPSK. */
|
||||
SONY_DVBT2_L1POST_QAM16 = 0x02, /**< DVBT2 L1-post uses 16-QAM. */
|
||||
SONY_DVBT2_L1POST_QAM64 = 0x03, /**< DVBT2 L1-post uses 64-QAM. */
|
||||
SONY_DVBT2_L1POST_C_RSVD1 = 0x04, /**< Reserved */
|
||||
SONY_DVBT2_L1POST_C_RSVD2 = 0x05, /**< Reserved */
|
||||
SONY_DVBT2_L1POST_C_RSVD3 = 0x06, /**< Reserved */
|
||||
SONY_DVBT2_L1POST_C_RSVD4 = 0x07, /**< Reserved */
|
||||
SONY_DVBT2_L1POST_C_RSVD5 = 0x08, /**< Reserved */
|
||||
SONY_DVBT2_L1POST_C_RSVD6 = 0x09, /**< Reserved */
|
||||
SONY_DVBT2_L1POST_C_RSVD7 = 0x0A, /**< Reserved */
|
||||
SONY_DVBT2_L1POST_C_RSVD8 = 0x0B, /**< Reserved */
|
||||
SONY_DVBT2_L1POST_C_RSVD9 = 0x0C, /**< Reserved */
|
||||
SONY_DVBT2_L1POST_C_RSVD10 = 0x0D, /**< Reserved */
|
||||
SONY_DVBT2_L1POST_C_RSVD11 = 0x0E, /**< Reserved */
|
||||
SONY_DVBT2_L1POST_C_RSVD12 = 0x0F, /**< Reserved */
|
||||
SONY_DVBT2_L1POST_CONSTELL_UNKNOWN = 0xFF /**< Unknown. */
|
||||
} sony_dvbt2_l1post_constell_t;
|
||||
|
||||
/**
|
||||
@brief The DVBT2 L1-post code rate.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT2_L1POST_R1_2 = 0x00, /**< DVBT2 L1-post uses 1/2 code rate. */
|
||||
SONY_DVBT2_L1POST_R_RSVD1 = 0x01, /**< Reserved */
|
||||
SONY_DVBT2_L1POST_R_RSVD2 = 0x02, /**< Reserved */
|
||||
SONY_DVBT2_L1POST_R_RSVD3 = 0x03, /**< Reserved */
|
||||
SONY_DVBT2_L1POST_R_UNKNOWN = 0xFF /**< Unknown. */
|
||||
} sony_dvbt2_l1post_cr_t;
|
||||
|
||||
/**
|
||||
@brief The L1-post FEC type.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT2_L1POST_FEC_LDPC16K = 0x00, /**< DVBT2 L1-post uses 16K LDPC FEC. */
|
||||
SONY_DVBT2_L1POST_FEC_RSVD1 = 0x01, /**< Reserved */
|
||||
SONY_DVBT2_L1POST_FEC_RSVD2 = 0x02, /**< Reserved */
|
||||
SONY_DVBT2_L1POST_FEC_RSVD3 = 0x03, /**< Reserved */
|
||||
SONY_DVBT2_L1POST_FEC_UNKNOWN = 0xFF /**< Unknown. */
|
||||
} sony_dvbt2_l1post_fec_type_t;
|
||||
|
||||
/**
|
||||
@brief The L1-pre pilot pattern signaling.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT2_PP1 = 0x00, /**< DVBT2 pilot pattern 1. */
|
||||
SONY_DVBT2_PP2 = 0x01, /**< DVBT2 pilot pattern 2. */
|
||||
SONY_DVBT2_PP3 = 0x02, /**< DVBT2 pilot pattern 3. */
|
||||
SONY_DVBT2_PP4 = 0x03, /**< DVBT2 pilot pattern 4. */
|
||||
SONY_DVBT2_PP5 = 0x04, /**< DVBT2 pilot pattern 5. */
|
||||
SONY_DVBT2_PP6 = 0x05, /**< DVBT2 pilot pattern 6. */
|
||||
SONY_DVBT2_PP7 = 0x06, /**< DVBT2 pilot pattern 7. */
|
||||
SONY_DVBT2_PP8 = 0x07, /**< DVBT2 pilot pattern 8. */
|
||||
SONY_DVBT2_PP_RSVD1 = 0x08, /**< Reserved */
|
||||
SONY_DVBT2_PP_RSVD2 = 0x09, /**< Reserved */
|
||||
SONY_DVBT2_PP_RSVD3 = 0x0A, /**< Reserved */
|
||||
SONY_DVBT2_PP_RSVD4 = 0x0B, /**< Reserved */
|
||||
SONY_DVBT2_PP_RSVD5 = 0x0C, /**< Reserved */
|
||||
SONY_DVBT2_PP_RSVD6 = 0x0D, /**< Reserved */
|
||||
SONY_DVBT2_PP_RSVD7 = 0x0E, /**< Reserved */
|
||||
SONY_DVBT2_PP_RSVD8 = 0x0F, /**< Reserved */
|
||||
SONY_DVBT2_PP_UNKNOWN = 0xFF /**< Unknown. */
|
||||
} sony_dvbt2_pp_t;
|
||||
|
||||
/**
|
||||
@brief DVBT2 PLP code rate definition.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT2_R1_2 = 0x00, /**< Code rate : 1/2. */
|
||||
SONY_DVBT2_R3_5 = 0x01, /**< Code rate : 3/5. */
|
||||
SONY_DVBT2_R2_3 = 0x02, /**< Code rate : 2/3. */
|
||||
SONY_DVBT2_R3_4 = 0x03, /**< Code rate : 3/4. */
|
||||
SONY_DVBT2_R4_5 = 0x04, /**< Code rate : 4/5, DVB-T2-Base only. */
|
||||
SONY_DVBT2_R5_6 = 0x05, /**< Code rate : 5/6, DVB-T2-Base only. */
|
||||
SONY_DVBT2_R1_3 = 0x06, /**< Code rate : 1/3, DVB-T2-Lite only. */
|
||||
SONY_DVBT2_R2_5 = 0x07, /**< Code rate : 2/5, DVB-T2-Lite only. */
|
||||
SONY_DVBT2_PLP_CR_UNKNOWN = 0xFF /**< Unknown. */
|
||||
} sony_dvbt2_plp_code_rate_t;
|
||||
|
||||
/**
|
||||
@brief DVBT2 PLP constellation.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT2_QPSK = 0x00, /**< QPSK. */
|
||||
SONY_DVBT2_QAM16 = 0x01, /**< QAM16. */
|
||||
SONY_DVBT2_QAM64 = 0x02, /**< QAM64. */
|
||||
SONY_DVBT2_QAM256 = 0x03, /**< QAM256. */
|
||||
SONY_DVBT2_CON_RSVD1 = 0x04, /**< Reserved */
|
||||
SONY_DVBT2_CON_RSVD2 = 0x05, /**< Reserved */
|
||||
SONY_DVBT2_CON_RSVD3 = 0x06, /**< Reserved */
|
||||
SONY_DVBT2_CON_RSVD4 = 0x07, /**< Reserved */
|
||||
SONY_DVBT2_CONSTELL_UNKNOWN = 0xFF /**< Unknown. */
|
||||
} sony_dvbt2_plp_constell_t;
|
||||
|
||||
/**
|
||||
@brief DVBT2 PLP type definition.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT2_PLP_TYPE_COMMON = 0x00, /**< DVBT2 PLP Common Type. */
|
||||
SONY_DVBT2_PLP_TYPE_DATA1 = 0x01, /**< DVBT2 PLP Data Type 1. */
|
||||
SONY_DVBT2_PLP_TYPE_DATA2 = 0x02, /**< DVBT2 PLP Data Type 2. */
|
||||
SONY_DVBT2_PLP_TYPE_RSVD1 = 0x03, /**< Reserved */
|
||||
SONY_DVBT2_PLP_TYPE_RSVD2 = 0x04, /**< Reserved */
|
||||
SONY_DVBT2_PLP_TYPE_RSVD3 = 0x05, /**< Reserved */
|
||||
SONY_DVBT2_PLP_TYPE_RSVD4 = 0x06, /**< Reserved */
|
||||
SONY_DVBT2_PLP_TYPE_RSVD5 = 0x07, /**< Reserved */
|
||||
SONY_DVBT2_PLP_TYPE_UNKNOWN = 0xFF /**< DVBT2 PLP type UNKNOWN. */
|
||||
} sony_dvbt2_plp_type_t;
|
||||
|
||||
/**
|
||||
@brief DVBT2 PLP payload type definition.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT2_PLP_PAYLOAD_GFPS = 0x00, /**< DVBT2 GFPS payload type. */
|
||||
SONY_DVBT2_PLP_PAYLOAD_GCS = 0x01, /**< DVBT2 GCS payload type. */
|
||||
SONY_DVBT2_PLP_PAYLOAD_GSE = 0x02, /**< DVBT2 GSE payload type. */
|
||||
SONY_DVBT2_PLP_PAYLOAD_TS = 0x03, /**< DVBT2 TS payload type. */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD1 = 0x04, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD2 = 0x05, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD3 = 0x06, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD4 = 0x07, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD5 = 0x08, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD6 = 0x09, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD7 = 0x0A, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD8 = 0x0B, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD9 = 0x0C, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD10 = 0x0D, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD11 = 0x0E, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD12 = 0x0F, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD13 = 0x10, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD14 = 0x11, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD15 = 0x12, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD16 = 0x13, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD17 = 0x14, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD18 = 0x15, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD19 = 0x16, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD20 = 0x17, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD21 = 0x18, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD22 = 0x19, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD23 = 0x1A, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD24 = 0x1B, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD25 = 0x1C, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD26 = 0x1D, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD27 = 0x1E, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_RSVD28 = 0x1F, /**< Reserved */
|
||||
SONY_DVBT2_PLP_PAYLOAD_UNKNOWN = 0xFF /**< DVBT2 UNKNOWN payload type. */
|
||||
} sony_dvbt2_plp_payload_t;
|
||||
|
||||
/**
|
||||
@brief The DVBT2 FEC type definition.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT2_FEC_LDPC_16K = 0x00, /**< LDPC 16K (Short FECFRAME). */
|
||||
SONY_DVBT2_FEC_LDPC_64K = 0x01, /**< LDPC 64K (Long FECFRAME), DVB-T2-Base only. */
|
||||
SONY_DVBT2_FEC_RSVD1 = 0x02, /**< Reserved. */
|
||||
SONY_DVBT2_FEC_RSVD2 = 0x03, /**< Reserved. */
|
||||
SONY_DVBT2_FEC_UNKNOWN = 0xFF /**< DVBT2 FEC Type Unknown. */
|
||||
} sony_dvbt2_plp_fec_t;
|
||||
|
||||
/**
|
||||
@brief DVB-T2 PLP input stream mode. (In L1-Post information, CRC-8 MODE field in BBHEADER)
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT2_PLP_MODE_NOTSPECIFIED = 0x00, /**< Not Specified. (Cannot get PLP_MODE from L1-Post) */
|
||||
SONY_DVBT2_PLP_MODE_NM = 0x01, /**< Normal Mode. */
|
||||
SONY_DVBT2_PLP_MODE_HEM = 0x02, /**< High Efficiency Mode. */
|
||||
SONY_DVBT2_PLP_MODE_RESERVED = 0x03, /**< Reserved. */
|
||||
SONY_DVBT2_PLP_MODE_UNKNOWN = 0xFF /**< Unknown. */
|
||||
} sony_dvbt2_plp_mode_t;
|
||||
|
||||
/**
|
||||
@brief DVBT2 basic types of PLP available.
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT2_PLP_COMMON, /**< DVBT2 basic PLP common type. */
|
||||
SONY_DVBT2_PLP_DATA /**< DVBT2 basic PLP data type. */
|
||||
} sony_dvbt2_plp_btype_t;
|
||||
|
||||
/**
|
||||
@brief DVB-T2 TS/GS (Input Stream Format) bits definition. (MATYPE-1 field in BBHEADER)
|
||||
*/
|
||||
typedef enum {
|
||||
SONY_DVBT2_STREAM_GENERIC_PACKETIZED = 0x00, /**< Generic Packetized Stream. */
|
||||
SONY_DVBT2_STREAM_GENERIC_CONTINUOUS = 0x01, /**< Generic Continuous Stream. */
|
||||
SONY_DVBT2_STREAM_GENERIC_ENCAPSULATED = 0x02, /**< Generic Encapsulated Stream. */
|
||||
SONY_DVBT2_STREAM_TRANSPORT = 0x03, /**< Transport Stream. */
|
||||
SONY_DVBT2_STREAM_UNKNOWN = 0xFF /**< Unknown. */
|
||||
} sony_dvbt2_stream_t;
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Structs
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief L1-pre signaling information structure definition.
|
||||
*/
|
||||
typedef struct sony_dvbt2_l1pre_t {
|
||||
sony_dvbt2_l1pre_type_t type; /**< The stream type contained within the current T2 super-frame. */
|
||||
uint8_t bwExt; /**< BW extension indicator (8K/16K/32K only). */
|
||||
sony_dvbt2_s1_t s1; /**< S1 signaling. P1 S1. */
|
||||
uint8_t s2; /**< S2 signaling. P1 S2. */
|
||||
uint8_t mixed; /**< Mixed indicator; 0: Not mixed, 1: Mixed (from S2 field). */
|
||||
sony_dvbt2_mode_t fftMode; /**< FFT mode. (from S2) */
|
||||
uint8_t l1Rep; /**< L1 repeat enable flag. */
|
||||
sony_dvbt2_guard_t gi; /**< The guard interval used for the current super-frame. */
|
||||
sony_dvbt2_papr_t papr; /**< The PAPR indicator. */
|
||||
sony_dvbt2_l1post_constell_t mod; /**< The L1-post modulation in this frame. */
|
||||
sony_dvbt2_l1post_cr_t cr; /**< The L1-post code rate in this frame. */
|
||||
sony_dvbt2_l1post_fec_type_t fec; /**< The L1-post FEC type. */
|
||||
uint32_t l1PostSize; /**< Size of the L1-post in OFDM cells. */
|
||||
uint32_t l1PostInfoSize; /**< L1-post info size = L1-post configurable+dynamic+extension. */
|
||||
sony_dvbt2_pp_t pp; /**< The pilot pattern for the OFDM symbols in this frame. */
|
||||
uint8_t txIdAvailability; /**< The TX Id. */
|
||||
uint16_t cellId; /**< The T2 cell Id. */
|
||||
uint16_t networkId; /**< The T2 network Id. */
|
||||
uint16_t systemId; /**< T2 system Id. */
|
||||
uint8_t numFrames; /**< Number of T2-frames per T2 super-frame. */
|
||||
uint16_t numSymbols; /**< Number of OFDM symbols per T2-frame. */
|
||||
uint8_t regen; /**< Regeneration count indicator. */
|
||||
uint8_t postExt; /**< L1-post extensions enabled. */
|
||||
uint8_t numRfFreqs; /**< The number of RF frequencies in use. */
|
||||
uint8_t rfIdx; /**< The current RF index. */
|
||||
sony_dvbt2_version_t t2Version; /**< The T2 Version */
|
||||
uint8_t l1PostScrambled; /**< L1-Post scrambling enabled, DVB-T2 V1.3.1 or later only. */
|
||||
uint8_t t2BaseLite; /**< Indicates if the DVB-T2-Base profile is compatible with DVB-T2-Lite. */
|
||||
uint32_t crc32; /**< CRC-32 of L1-pre data. */
|
||||
} sony_dvbt2_l1pre_t;
|
||||
|
||||
/**
|
||||
@brief DVBT2 PLP information in L1-post signaling.
|
||||
*/
|
||||
typedef struct sony_dvbt2_plp_t {
|
||||
|
||||
/**
|
||||
@brief The PLP ID.
|
||||
*/
|
||||
uint8_t id;
|
||||
|
||||
/**
|
||||
@brief The type of the PLP.
|
||||
*/
|
||||
sony_dvbt2_plp_type_t type;
|
||||
|
||||
/**
|
||||
@brief The payload carried by the PLP.
|
||||
*/
|
||||
sony_dvbt2_plp_payload_t payload;
|
||||
|
||||
/**
|
||||
@brief TFS not supported, no meaning.
|
||||
*/
|
||||
uint8_t ff;
|
||||
|
||||
/**
|
||||
@brief TFS not supported, no meaning.
|
||||
*/
|
||||
uint8_t firstRfIdx;
|
||||
|
||||
/**
|
||||
@brief TFS not supported, no meaning.
|
||||
*/
|
||||
uint8_t firstFrmIdx;
|
||||
|
||||
/**
|
||||
@brief The group of PLPs that this PLP belongs too.
|
||||
*/
|
||||
uint8_t groupId;
|
||||
|
||||
/**
|
||||
@brief The constellation of this PLP.
|
||||
*/
|
||||
sony_dvbt2_plp_constell_t constell;
|
||||
|
||||
/**
|
||||
@brief The code rate of this PLP.
|
||||
*/
|
||||
sony_dvbt2_plp_code_rate_t plpCr;
|
||||
|
||||
/**
|
||||
@brief DVBT2 rotated constellation indicator.
|
||||
*/
|
||||
uint8_t rot;
|
||||
|
||||
/**
|
||||
@brief The FEC type used on this PLP.
|
||||
*/
|
||||
sony_dvbt2_plp_fec_t fec;
|
||||
|
||||
/**
|
||||
@brief Maximum number of PLP blocks.
|
||||
*/
|
||||
uint16_t numBlocksMax;
|
||||
|
||||
/**
|
||||
@brief The T2 frame interval within the superframe of this PLP.
|
||||
*/
|
||||
uint8_t frmInt;
|
||||
|
||||
/**
|
||||
@brief Time Interleaver length.
|
||||
*/
|
||||
uint8_t tilLen;
|
||||
|
||||
/**
|
||||
@brief Time Interleaver type indicator.
|
||||
*/
|
||||
uint8_t tilType;
|
||||
|
||||
/**
|
||||
@brief In-band A signaling indicator.
|
||||
- 1 = enabled.
|
||||
- 0 = disabled
|
||||
*/
|
||||
uint8_t inBandAFlag;
|
||||
|
||||
/* New fields from V1.2.1 */
|
||||
|
||||
/**
|
||||
@brief In band B signaling indicator.
|
||||
- 1 = enabled.
|
||||
- 0 = disabled
|
||||
*/
|
||||
uint8_t inBandBFlag;
|
||||
|
||||
/**
|
||||
@brief Reserved field. (RESERVED_1 11bit)
|
||||
*/
|
||||
uint16_t rsvd;
|
||||
|
||||
/**
|
||||
@brief PLP input stream mode.
|
||||
If T2 version is V1.1.1, this field will be 0. (Not Specified)
|
||||
The user should get this information from BBHEADER information.
|
||||
*/
|
||||
sony_dvbt2_plp_mode_t plpMode;
|
||||
|
||||
/**
|
||||
@brief This 1-bit field indicates whether the scheduling for the current PLP
|
||||
varies from T2-frame to T2-frame or remains static.
|
||||
*/
|
||||
uint8_t staticFlag;
|
||||
|
||||
/**
|
||||
@brief This 1-bit field indicates whether BBFRAME padding is used
|
||||
other than for in-band signaling for the current PLP
|
||||
*/
|
||||
uint8_t staticPaddingFlag;
|
||||
|
||||
} sony_dvbt2_plp_t;
|
||||
|
||||
|
||||
/**
|
||||
@brief L1-post information excluding PLPs.
|
||||
*/
|
||||
typedef struct sony_dvbt2_l1post_t {
|
||||
|
||||
/**
|
||||
@brief The number of sub-slices per T2 frame.
|
||||
*/
|
||||
uint16_t subSlicesPerFrame;
|
||||
|
||||
/**
|
||||
@brief The number of PLPs in the current superframe.
|
||||
Minimum value of 1.
|
||||
*/
|
||||
uint8_t numPLPs;
|
||||
|
||||
/**
|
||||
@brief Number of auxiliary streams.
|
||||
*/
|
||||
uint8_t numAux;
|
||||
|
||||
/**
|
||||
@brief Auxiliary stream config (Reserved for Future Use)
|
||||
*/
|
||||
uint8_t auxConfigRFU;
|
||||
|
||||
/**
|
||||
@brief The RF index.
|
||||
TFS only so not supported.
|
||||
*/
|
||||
uint8_t rfIdx;
|
||||
|
||||
/**
|
||||
@brief The frequency in Hz whose index is rfIdx.
|
||||
TFS only so not supported.
|
||||
*/
|
||||
uint32_t freq;
|
||||
|
||||
/**
|
||||
@brief Indicates the type of FEF part. Undefined.
|
||||
Only valid if S2 LSB is 1.
|
||||
*/
|
||||
uint8_t fefType;
|
||||
|
||||
/**
|
||||
@brief The length of the FEF as part of the elementary
|
||||
period.
|
||||
Only valid if S2 LSB is 1.
|
||||
*/
|
||||
uint32_t fefLength;
|
||||
|
||||
/**
|
||||
@brief The number of T2-frames between two FEF parts.
|
||||
*/
|
||||
uint8_t fefInterval;
|
||||
|
||||
} sony_dvbt2_l1post_t;
|
||||
|
||||
/**
|
||||
@brief The DVB-T2 tuning information.
|
||||
*/
|
||||
typedef struct sony_dvbt2_ofdm_t {
|
||||
|
||||
/**
|
||||
@brief The pre-amble mixed indicator (from the S2).
|
||||
- 0: Not mixed.
|
||||
- 1: Mixed.
|
||||
*/
|
||||
uint8_t mixed;
|
||||
|
||||
/**
|
||||
@brief SISO/MISO indication.
|
||||
- 0: SISO,
|
||||
- 1: MISO.
|
||||
*/
|
||||
uint8_t isMiso;
|
||||
|
||||
/**
|
||||
@brief The FFT mode of transmission (from the S2).
|
||||
*/
|
||||
sony_dvbt2_mode_t mode;
|
||||
|
||||
/**
|
||||
@brief The guard interval used for the super-frame.
|
||||
*/
|
||||
sony_dvbt2_guard_t gi;
|
||||
|
||||
/**
|
||||
@brief The pilot pattern for the OFDM symbols in this frame.
|
||||
*/
|
||||
sony_dvbt2_pp_t pp;
|
||||
|
||||
/**
|
||||
@brief BW extension indicator (8K/16K/32K only).
|
||||
*/
|
||||
uint8_t bwExt;
|
||||
|
||||
/**
|
||||
@brief The PAPR indicator.
|
||||
*/
|
||||
sony_dvbt2_papr_t papr;
|
||||
|
||||
/**
|
||||
@brief Number of OFDM symbols per T2-frame.
|
||||
*/
|
||||
uint16_t numSymbols;
|
||||
|
||||
} sony_dvbt2_ofdm_t;
|
||||
|
||||
/**
|
||||
@brief The DVB-T2 BBHEADER information.
|
||||
*/
|
||||
typedef struct sony_dvbt2_bbheader_t {
|
||||
/**
|
||||
@brief TS/GS (Input Stream Format) bits in MATYPE-1 field.
|
||||
*/
|
||||
sony_dvbt2_stream_t streamInput;
|
||||
|
||||
/**
|
||||
@brief SIS/MIS (Single or Multiple Input Streams) bit in MATYPE-1 field.
|
||||
- 1: single
|
||||
- 0: multiple
|
||||
*/
|
||||
uint8_t isSingleInputStream;
|
||||
|
||||
/**
|
||||
@brief CCM/ACM (Constant Coding and Modulation or Variable Coding and Modulation) bit in MATYPE-1 field.
|
||||
- 1: CCM
|
||||
- 0: ACM
|
||||
*/
|
||||
uint8_t isConstantCodingModulation;
|
||||
|
||||
/**
|
||||
@brief ISSYI (Input Stream Synchronization Indicator) bit in MATYPE-1 field.
|
||||
- 1: active
|
||||
- 0: not-active
|
||||
*/
|
||||
uint8_t issyIndicator;
|
||||
|
||||
/**
|
||||
@brief NPD (Null-packet deletion active/not active) bit in MATYPE-1 field.
|
||||
- 1: active
|
||||
- 0: not-active
|
||||
*/
|
||||
uint8_t nullPacketDeletion;
|
||||
|
||||
/**
|
||||
@brief EXT bits in MATYPE-1 field.
|
||||
*/
|
||||
uint8_t ext;
|
||||
|
||||
/**
|
||||
@brief Input Stream Identifier (ISI) in MATYPE-2 field. (only valid for MIS)
|
||||
*/
|
||||
uint8_t inputStreamIdentifier;
|
||||
|
||||
/**
|
||||
@brief UPL (User Packet Length in bits) field. Valid only for NM mode.
|
||||
*/
|
||||
uint16_t userPacketLength;
|
||||
|
||||
/**
|
||||
@brief DFL (Data Field Length in bits) field.
|
||||
*/
|
||||
uint16_t dataFieldLength;
|
||||
|
||||
/**
|
||||
@brief SYNC (A copy of the User Packet Sync-byte) field. Valid only for NM mode.
|
||||
*/
|
||||
uint8_t syncByte;
|
||||
|
||||
/**
|
||||
@brief ISSY (Input Stream Synchronization) field (3bytes). Valid only for HEM mode.
|
||||
*/
|
||||
uint32_t issy;
|
||||
|
||||
/**
|
||||
@brief PLP input stream mode in CRC-8 MODE field.
|
||||
*/
|
||||
sony_dvbt2_plp_mode_t plpMode;
|
||||
} sony_dvbt2_bbheader_t;
|
||||
|
||||
#endif /* SONY_DVBT2_H */
|
||||
+558
@@ -0,0 +1,558 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2018 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2018/08/30
|
||||
Modification ID : 902dae58eb5249e028ccc5d7f60bb66cca9b43a9
|
||||
------------------------------------------------------------------------------*/
|
||||
#include "sony_integ.h"
|
||||
#include "sony_integ_dvbt.h"
|
||||
#include "sony_demod.h"
|
||||
#include "sony_demod_dvbt_monitor.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Local Function Prototypes
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Waits for demodulator lock, polling ::sony_demod_dvbt_monitor_SyncStat
|
||||
at 10ms intervals. Called as part of the Tune process.
|
||||
*/
|
||||
static sony_result_t dvbt_WaitDemodLock (sony_integ_t * pInteg);
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
sony_result_t sony_integ_dvbt_Tune(sony_integ_t * pInteg,
|
||||
sony_dvbt_tune_param_t * pTuneParam)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_dvbt_Tune");
|
||||
|
||||
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_5_MHZ) && (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);
|
||||
}
|
||||
|
||||
/* Set DVB-T profile for acquisition */
|
||||
result = sony_demod_dvbt_SetProfile(pInteg->pDemod, pTuneParam->profile);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Tune the demodulator */
|
||||
result = sony_demod_dvbt_Tune (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_DVBT, 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_TuneEnd (pInteg->pDemod);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Wait for TS lock */
|
||||
result = sony_integ_dvbt_WaitTSLock (pInteg);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
sony_result_t sony_integ_dvbt_Scan(sony_integ_t * pInteg,
|
||||
sony_integ_dvbt_scan_param_t * pScanParam,
|
||||
sony_integ_dvbt_scan_callback_t callBack)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
sony_integ_dvbt_scan_result_t scanResult;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_dvbt_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_5_MHZ) && (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.dvbtTuneParam.centerFreqKHz = pScanParam->startFrequencyKHz;
|
||||
scanResult.dvbtTuneParam.bandwidth = pScanParam->bandwidth;
|
||||
scanResult.dvbtTuneParam.profile = SONY_DVBT_PROFILE_HP;
|
||||
|
||||
/* Set scan mode enabled */
|
||||
result = sony_demod_terr_cable_SetScanMode(pInteg->pDemod, SONY_DTV_SYSTEM_DVBT, 0x01);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Scan routine */
|
||||
while (scanResult.centerFreqKHz <= pScanParam->endFrequencyKHz) {
|
||||
scanResult.dvbtTuneParam.centerFreqKHz = scanResult.centerFreqKHz;
|
||||
scanResult.tuneResult = sony_integ_dvbt_BlindTune(pInteg, scanResult.centerFreqKHz, pScanParam->bandwidth);
|
||||
switch (scanResult.tuneResult) {
|
||||
/* Channel found, callback to application */
|
||||
case SONY_RESULT_OK:
|
||||
callBack (pInteg, &scanResult, pScanParam);
|
||||
break;
|
||||
|
||||
/* Intentional fall-through. */
|
||||
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_DVBT, 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_DVBT, 0x00);
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear scan mode */
|
||||
result = sony_demod_terr_cable_SetScanMode(pInteg->pDemod, SONY_DTV_SYSTEM_DVBT, 0x00);
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
sony_result_t sony_integ_dvbt_BlindTune(sony_integ_t * pInteg,
|
||||
uint32_t centerFreqKHz,
|
||||
sony_dtv_bandwidth_t bandwidth)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
sony_dvbt_tune_param_t tuneParam;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_dvbt_BlindTune");
|
||||
|
||||
if ((!pInteg) || (!pInteg->pDemod)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
/* Confirm the demod is in a valid state to accept this API */
|
||||
if ((pInteg->pDemod->state != SONY_DEMOD_STATE_SLEEP) && (pInteg->pDemod->state != SONY_DEMOD_STATE_ACTIVE)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
/* Check bandwidth validity */
|
||||
if ((bandwidth != SONY_DTV_BW_5_MHZ) && (bandwidth != SONY_DTV_BW_6_MHZ) &&
|
||||
(bandwidth != SONY_DTV_BW_7_MHZ) && (bandwidth != SONY_DTV_BW_8_MHZ)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_NOSUPPORT);
|
||||
}
|
||||
|
||||
/* Attempt DVB-T acquisition */
|
||||
tuneParam.bandwidth = bandwidth;
|
||||
tuneParam.centerFreqKHz = centerFreqKHz;
|
||||
tuneParam.profile = SONY_DVBT_PROFILE_HP;
|
||||
|
||||
/* Set DVB-T profile to HP to allow detection of hierachical and non-hierachical modes */
|
||||
result = sony_demod_dvbt_SetProfile(pInteg->pDemod, SONY_DVBT_PROFILE_HP);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Tune the demodulator */
|
||||
result = sony_demod_dvbt_Tune (pInteg->pDemod, &tuneParam);
|
||||
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, tuneParam.centerFreqKHz, SONY_DTV_SYSTEM_DVBT, tuneParam.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_TuneEnd (pInteg->pDemod);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Wait for demodulator lock */
|
||||
result = dvbt_WaitDemodLock (pInteg);
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
sony_result_t sony_integ_dvbt_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_dvbt_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_DVBT_WAIT_TS_LOCK) {
|
||||
continueWait = 0;
|
||||
}
|
||||
|
||||
result = sony_demod_dvbt_CheckTSLock (pInteg->pDemod, &lock);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Check Echo Optomization */
|
||||
result = sony_demod_dvbt_EchoOptimization(pInteg->pDemod);
|
||||
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_DVBT_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_dvbt_monitor_RFLevel (sony_integ_t * pInteg, int32_t * pRFLeveldB)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_dvbt_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_DVBT) {
|
||||
/* Not DVB-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_dvbt_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);
|
||||
}
|
||||
|
||||
sony_result_t sony_integ_dvbt_monitor_SSI (sony_integ_t * pInteg, uint8_t * pSSI)
|
||||
{
|
||||
int32_t rfLevel;
|
||||
sony_dvbt_tpsinfo_t tps;
|
||||
int32_t prel;
|
||||
int32_t tempSSI = 0;
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
|
||||
static const int32_t pRefdBm1000[3][5] = {
|
||||
/* 1/2, 2/3, 3/4, 5/6, 7/8, */
|
||||
{-93000, -91000, -90000, -89000, -88000}, /* QPSK */
|
||||
{-87000, -85000, -84000, -83000, -82000}, /* 16-QAM */
|
||||
{-82000, -80000, -78000, -77000, -76000}, /* 64-QAM */
|
||||
};
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_dvbt_monitor_SSI");
|
||||
|
||||
if ((!pInteg) || (!pInteg->pDemod) || (!pSSI)) {
|
||||
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_DVBT) {
|
||||
/* Not DVB-T */
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
/* Get estimated RF Level */
|
||||
result = sony_integ_dvbt_monitor_RFLevel (pInteg, &rfLevel);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Monitor TPS for Modulation / Code Rate */
|
||||
result = sony_demod_dvbt_monitor_TPSInfo (pInteg->pDemod, &tps);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Ensure correct TPS values. */
|
||||
if ((tps.constellation >= SONY_DVBT_CONSTELLATION_RESERVED_3) || (tps.rateHP >= SONY_DVBT_CODERATE_RESERVED_5)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_OTHER);
|
||||
}
|
||||
|
||||
/* prel = prec - pref */
|
||||
prel = rfLevel - pRefdBm1000[tps.constellation][tps.rateHP];
|
||||
|
||||
/* SSI (Signal Strength Indicator) is calculated from:
|
||||
*
|
||||
* if (prel < -15dB) SSI = 0
|
||||
* if (-15dB <= prel < 0dB) SSI = (2/3) * (prel + 15)
|
||||
* if (0dB <= prel < 20dB) SSI = (4 * prel) + 10
|
||||
* if (20dB <= prel < 35dB) SSI = (2/3) * (prel - 20) + 90
|
||||
* if (prel >= 35dB) SSI = 100
|
||||
*/
|
||||
if (prel < -15000) {
|
||||
tempSSI = 0;
|
||||
}
|
||||
else if (prel < 0) {
|
||||
/* Note : prel and 2/3 scaled by 10^3 so divide by 10^6 added */
|
||||
tempSSI = ((2 * (prel + 15000)) + 1500) / 3000;
|
||||
}
|
||||
else if (prel < 20000) {
|
||||
/* Note : prel scaled by 10^3 so divide by 10^3 added */
|
||||
tempSSI = (((4 * prel) + 500) / 1000) + 10;
|
||||
}
|
||||
else if (prel < 35000) {
|
||||
/* Note : prel and 2/3 scaled by 10^3 so divide by 10^6 added */
|
||||
tempSSI = (((2 * (prel - 20000)) + 1500) / 3000) + 90;
|
||||
}
|
||||
else {
|
||||
tempSSI = 100;
|
||||
}
|
||||
|
||||
/* Clip value to 100% */
|
||||
*pSSI = (tempSSI > 100)? 100 : (uint8_t)tempSSI;
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Static Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
static sony_result_t dvbt_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 ("dvbt_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_DVBT_WAIT_DEMOD_LOCK) {
|
||||
continueWait = 0;
|
||||
}
|
||||
|
||||
result = sony_demod_dvbt_CheckDemodLock (pInteg->pDemod, &lock);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Check Echo Optomization */
|
||||
result = sony_demod_dvbt_EchoOptimization(pInteg->pDemod);
|
||||
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_DVBT_WAIT_LOCK_INTERVAL);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
} else {
|
||||
result = SONY_RESULT_ERROR_TIMEOUT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
+205
@@ -0,0 +1,205 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2018 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2018/07/27
|
||||
Modification ID : ff73ffebff57618d6a5aa6e2aa9eb009b86060d1
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@file sony_integ_dvbt.h
|
||||
|
||||
This file provides the integration layer interface for DVB-T
|
||||
specific demodulator functions.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SONY_INTEG_DVBT_H
|
||||
#define SONY_INTEG_DVBT_H
|
||||
|
||||
#include "sony_demod.h"
|
||||
#include "sony_integ.h"
|
||||
#include "sony_demod_dvbt.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Defines
|
||||
------------------------------------------------------------------------------*/
|
||||
#define SONY_DVBT_WAIT_DEMOD_LOCK 1000 /**< 1s timeout for wait demodulator lock process for DVB-T channels */
|
||||
#define SONY_DVBT_WAIT_TS_LOCK 1000 /**< 1s timeout for wait TS lock process for DVB-T channels */
|
||||
#define SONY_DVBT_WAIT_LOCK_INTERVAL 10 /**< 10ms polling interval for demodulator and TS lock functions */
|
||||
/*------------------------------------------------------------------------------
|
||||
Structs
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief The parameters used for DVB-T scanning.
|
||||
*/
|
||||
typedef struct sony_integ_dvbt_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_dvbt_scan_param_t;
|
||||
|
||||
/**
|
||||
@brief The structure used to return a channel located or progress update
|
||||
as part of a DVB-T scan.
|
||||
*/
|
||||
typedef struct sony_integ_dvbt_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 the tuneParam structure contains
|
||||
the channel information.
|
||||
*/
|
||||
sony_result_t tuneResult;
|
||||
|
||||
/**
|
||||
@brief The tune params for a located DVB-T channel.
|
||||
*/
|
||||
sony_dvbt_tune_param_t dvbtTuneParam;
|
||||
|
||||
}sony_integ_dvbt_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 (DVB-T : TPS Lock).
|
||||
|
||||
@param pInteg The driver instance.
|
||||
@param pResult The current scan result.
|
||||
@param pScanParam The current scan parameters.
|
||||
*/
|
||||
typedef void (*sony_integ_dvbt_scan_callback_t) (sony_integ_t * pInteg,
|
||||
sony_integ_dvbt_scan_result_t * pResult,
|
||||
sony_integ_dvbt_scan_param_t * pScanParam);
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Performs acquisition to a DVB-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.
|
||||
|
||||
@note For non-hierarchical modes, the profile should be set to
|
||||
SONY_DVBT_PROFILE_HP. If SONY_DVBT_PROFILE_LP is requested, but the
|
||||
detected signal mode is non-hierarchical, the transport stream
|
||||
can be corrupted even if this API returns SONY_RESULT_OK.
|
||||
|
||||
@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_dvbt_Tune(sony_integ_t * pInteg,
|
||||
sony_dvbt_tune_param_t * pTuneParam);
|
||||
|
||||
/**
|
||||
@brief Attempts to acquire to the DVB-T channel at the center frequency provided.
|
||||
|
||||
SONY_DVBT_PROFILE_HP is used in performing the acquisition.
|
||||
|
||||
This function blocks the calling thread until the demod has locked or has
|
||||
timed out. Use ::sony_integ_Cancel to cancel the operation at any time.
|
||||
|
||||
For TS lock please call the wait TS lock function
|
||||
::sony_integ_dvbt_WaitTSLock.
|
||||
|
||||
@param pInteg The driver instance.
|
||||
@param centerFreqKHz The center frequency of the channel to attempt acquisition on
|
||||
@param bandwidth The bandwidth of the channel
|
||||
|
||||
@return SONY_RESULT_OK if tuned successfully to the channel.
|
||||
*/
|
||||
sony_result_t sony_integ_dvbt_BlindTune(sony_integ_t * pInteg,
|
||||
uint32_t centerFreqKHz,
|
||||
sony_dtv_bandwidth_t bandwidth);
|
||||
|
||||
/**
|
||||
@brief Performs a scan over the spectrum specified.
|
||||
|
||||
Perform a DVB-T system scan for DVB-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_dvbt_Scan(sony_integ_t * pInteg,
|
||||
sony_integ_dvbt_scan_param_t * pScanParam,
|
||||
sony_integ_dvbt_scan_callback_t callBack);
|
||||
|
||||
/**
|
||||
@brief Polls the demodulator waiting for TS lock at 10ms intervals up to a time-out of 1s.
|
||||
|
||||
Called internally and usually after ::sony_demod_TuneEnd. The usage can be found
|
||||
in ::sony_integ_dvbt_Tune.
|
||||
|
||||
@param pInteg The driver instance
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_integ_dvbt_WaitTSLock (sony_integ_t * pInteg);
|
||||
|
||||
/**
|
||||
@brief RF level monitor function.
|
||||
|
||||
This function returns the estimated RF level based on either the demodulator IFAGC
|
||||
level or a tuner internal RSSI monitor. If any compensation for external hardware
|
||||
such as, LNA, attenuators is required, then the user should make adjustment in the
|
||||
corresponding function.
|
||||
|
||||
@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_dvbt_monitor_RFLevel (sony_integ_t * pInteg, int32_t * pRFLeveldB);
|
||||
|
||||
/**
|
||||
@brief DVB-T monitor for SSI (Signal Strength Indicator), based on the RF Level monitor value
|
||||
::sony_integ_dvbt_monitor_RFLevel.
|
||||
|
||||
@note The RF Level monitor function should be optimised for your HW configuration before using
|
||||
this monitor.
|
||||
|
||||
@param pInteg The driver instance
|
||||
@param pSSI The Signal Strength Indicator value in %
|
||||
|
||||
@return SONY_RESULT_OK if successful
|
||||
*/
|
||||
sony_result_t sony_integ_dvbt_monitor_SSI (sony_integ_t * pInteg, uint8_t * pSSI);
|
||||
|
||||
#endif /* SONY_INTEG_DVBT_H */
|
||||
+934
@@ -0,0 +1,934 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2020 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2020/03/18
|
||||
Modification ID : a9cb698cf8e0a7d7b31004474dfa6164268519f1
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
#include "sony_integ.h"
|
||||
#include "sony_integ_dvbt2.h"
|
||||
#include "sony_demod.h"
|
||||
#include "sony_demod_dvbt2_monitor.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Local Function Prototypes
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Waits for demodulator lock, polling ::sony_demod_dvbt2_monitor_SyncStat
|
||||
at 10ms intervals. Called as part of the Tune process.
|
||||
*/
|
||||
static sony_result_t dvbt2_WaitDemodLock (sony_integ_t * pInteg, sony_dvbt2_profile_t profile);
|
||||
|
||||
/**
|
||||
@brief Waits for L1 Post to be valid to ensure that subsequent calls to
|
||||
L1 based monitors do not return HW State error. Polls
|
||||
::sony_demod_dvbt2_CheckL1PostValid at 10ms intervals. Called as
|
||||
part of the Tune, BlindTune and Scan processes.
|
||||
*/
|
||||
static sony_result_t dvbt2_WaitL1PostLock (sony_integ_t * pInteg);
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
sony_result_t sony_integ_dvbt2_Tune (sony_integ_t * pInteg,
|
||||
sony_dvbt2_tune_param_t * pTuneParam)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_dvbt2_Tune");
|
||||
|
||||
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_1_7_MHZ) && (pTuneParam->bandwidth != SONY_DTV_BW_5_MHZ) &&
|
||||
(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);
|
||||
}
|
||||
|
||||
/* Check for valid profile selection */
|
||||
if ((pTuneParam->profile != SONY_DVBT2_PROFILE_BASE) && (pTuneParam->profile != SONY_DVBT2_PROFILE_LITE)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
/* Configure for manual PLP selection. */
|
||||
result = sony_demod_dvbt2_SetPLPConfig (pInteg->pDemod, 0x00, pTuneParam->dataPlpId);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Configure the DVB-T2 profile without recovery */
|
||||
result = sony_demod_dvbt2_SetProfile(pInteg->pDemod, pTuneParam->profile);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Tune the demodulator */
|
||||
result = sony_demod_dvbt2_Tune (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_DVBT2, 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_TuneEnd (pInteg->pDemod);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Wait for demodulator lock */
|
||||
result = dvbt2_WaitDemodLock (pInteg, pTuneParam->profile);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Wait for TS lock */
|
||||
result = sony_integ_dvbt2_WaitTSLock (pInteg, pTuneParam->profile);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* In DVB-T2, L1 Post information may not immediately be valid after acquisition
|
||||
* (L1POST_OK bit != 1). This wait loop handles such cases. This issue occurs
|
||||
* only under clean signal lab conditions, and will therefore not extend acquistion
|
||||
* time under normal conditions.
|
||||
*/
|
||||
result = dvbt2_WaitL1PostLock (pInteg);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Confirm correct PLP selection in acquisition */
|
||||
{
|
||||
uint8_t plpNotFound;
|
||||
|
||||
result = sony_demod_dvbt2_monitor_DataPLPError (pInteg->pDemod, &plpNotFound);
|
||||
if (result == SONY_RESULT_ERROR_HW_STATE) {
|
||||
/* Demod lock is lost causing monitor to fail, return UNLOCK instead of HW STATE */
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_UNLOCK);
|
||||
}
|
||||
else if (result != SONY_RESULT_OK) {
|
||||
/* Serious error, so return result */
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
if (plpNotFound) {
|
||||
result = SONY_RESULT_OK_CONFIRM;
|
||||
pTuneParam->tuneInfo = SONY_DEMOD_DVBT2_TUNE_INFO_INVALID_PLP_ID;
|
||||
}
|
||||
else {
|
||||
pTuneParam->tuneInfo = SONY_DEMOD_DVBT2_TUNE_INFO_OK;
|
||||
}
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
|
||||
sony_result_t sony_integ_dvbt2_Scan (sony_integ_t * pInteg,
|
||||
sony_integ_dvbt2_scan_param_t * pScanParam,
|
||||
sony_integ_dvbt2_scan_callback_t callBack)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
sony_integ_dvbt2_scan_result_t scanResult;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_dvbt2_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_1_7_MHZ) && (pScanParam->bandwidth != SONY_DTV_BW_5_MHZ) &&
|
||||
(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.dvbt2TuneParam.centerFreqKHz = pScanParam->startFrequencyKHz;
|
||||
scanResult.dvbt2TuneParam.bandwidth = pScanParam->bandwidth;
|
||||
scanResult.dvbt2TuneParam.dataPlpId = 0;
|
||||
scanResult.dvbt2TuneParam.profile = SONY_DVBT2_PROFILE_BASE;
|
||||
scanResult.dvbt2TuneParam.tuneInfo = SONY_DEMOD_DVBT2_TUNE_INFO_OK;
|
||||
|
||||
/* Set scan mode enabled */
|
||||
result = sony_demod_terr_cable_SetScanMode(pInteg->pDemod, SONY_DTV_SYSTEM_DVBT2, 0x01);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Scan routine */
|
||||
while (scanResult.centerFreqKHz <= pScanParam->endFrequencyKHz) {
|
||||
sony_dvbt2_profile_t profileFound = SONY_DVBT2_PROFILE_ANY;
|
||||
uint8_t channelComplete = 0;
|
||||
sony_dvbt2_profile_t blindTuneProfile = pScanParam->t2Profile;
|
||||
|
||||
scanResult.dvbt2TuneParam.centerFreqKHz = scanResult.centerFreqKHz;
|
||||
|
||||
while (!channelComplete) {
|
||||
scanResult.tuneResult = sony_integ_dvbt2_BlindTune(pInteg, scanResult.centerFreqKHz, pScanParam->bandwidth, blindTuneProfile, &profileFound);
|
||||
switch (scanResult.tuneResult) {
|
||||
case SONY_RESULT_OK:
|
||||
{
|
||||
uint8_t numPLPs = 0;
|
||||
uint8_t plpIds[255];
|
||||
uint8_t mixed;
|
||||
uint8_t i;
|
||||
|
||||
scanResult.dvbt2TuneParam.profile = profileFound;
|
||||
|
||||
result = sony_integ_dvbt2_Scan_PrepareDataPLPLoop(pInteg, plpIds, &numPLPs, &mixed);
|
||||
if (result == SONY_RESULT_ERROR_HW_STATE) {
|
||||
/* Callback to application for progress updates */
|
||||
scanResult.tuneResult = SONY_RESULT_ERROR_UNLOCK;
|
||||
callBack (pInteg, &scanResult, pScanParam);
|
||||
|
||||
/* Error in monitored data, ignore current channel */
|
||||
channelComplete = 1;
|
||||
}
|
||||
else if (result != SONY_RESULT_OK) {
|
||||
/* Serious error occurred -> cancel operation. */
|
||||
sony_demod_terr_cable_SetScanMode(pInteg->pDemod, SONY_DTV_SYSTEM_DVBT2, 0x00);
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
else {
|
||||
/* Set PLP ID in tune parameter structure and provide callback for first PLP */
|
||||
scanResult.dvbt2TuneParam.dataPlpId = plpIds[0];
|
||||
callBack (pInteg, &scanResult, pScanParam);
|
||||
|
||||
/* Callback for each subsequent PLP in current profile */
|
||||
for (i = 1; i < numPLPs; i++) {
|
||||
result = sony_integ_dvbt2_Scan_SwitchDataPLP(pInteg, mixed, plpIds[i], profileFound);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
sony_demod_terr_cable_SetScanMode(pInteg->pDemod, SONY_DTV_SYSTEM_DVBT2, 0x00);
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
/* Set PLP ID in tune parameter structure and provide callback */
|
||||
scanResult.dvbt2TuneParam.dataPlpId = plpIds[i];
|
||||
callBack (pInteg, &scanResult, pScanParam);
|
||||
}
|
||||
|
||||
/* If profile is ANY, check for mixed profile channels */
|
||||
if (blindTuneProfile == SONY_DVBT2_PROFILE_ANY) {
|
||||
/* Check for mixed profiles available */
|
||||
if (mixed) {
|
||||
/* Set Blind Tune parameters to DVB-T2 only and the other profile
|
||||
* compared to that already located */
|
||||
if (profileFound == SONY_DVBT2_PROFILE_BASE) {
|
||||
blindTuneProfile = SONY_DVBT2_PROFILE_LITE;
|
||||
}
|
||||
else if (profileFound == SONY_DVBT2_PROFILE_LITE) {
|
||||
blindTuneProfile = SONY_DVBT2_PROFILE_BASE;
|
||||
}
|
||||
else {
|
||||
/* Serious error occurred -> cancel operation. */
|
||||
sony_demod_terr_cable_SetScanMode(pInteg->pDemod, SONY_DTV_SYSTEM_DVBT2, 0x00);
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Channel is not mixed profile so continue to next frequency */
|
||||
channelComplete = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Profile is fixed therefore this frequency is complete */
|
||||
channelComplete = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* Intentional fall-through. */
|
||||
case SONY_RESULT_ERROR_UNLOCK:
|
||||
case SONY_RESULT_ERROR_TIMEOUT:
|
||||
/* Channel not found, callback to application for progress updates */
|
||||
callBack (pInteg, &scanResult, pScanParam);
|
||||
|
||||
/* Go to next frequency */
|
||||
channelComplete = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
/* Serious error occurred -> cancel operation. */
|
||||
sony_demod_terr_cable_SetScanMode(pInteg->pDemod, SONY_DTV_SYSTEM_DVBT2, 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_DVBT2, 0x00);
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear scan mode */
|
||||
result = sony_demod_terr_cable_SetScanMode(pInteg->pDemod, SONY_DTV_SYSTEM_DVBT2, 0x00);
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
|
||||
sony_result_t sony_integ_dvbt2_Scan_PrepareDataPLPLoop (sony_integ_t * pInteg, uint8_t pPLPIds[], uint8_t *pNumPLPs, uint8_t *pMixed)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_dvbt2_Scan_PrepareDataPLPLoop");
|
||||
|
||||
if ((!pInteg) || (!pPLPIds) || (!pNumPLPs) || (!pMixed)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
if (pInteg->pDemod->state != SONY_DEMOD_STATE_ACTIVE) {
|
||||
/* This api is accepted in Active states only */
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
/* Obtain the T2 PLP list from Data PLP monitor */
|
||||
result = sony_demod_dvbt2_monitor_DataPLPs (pInteg->pDemod, pPLPIds, pNumPLPs);
|
||||
if (result == SONY_RESULT_OK) {
|
||||
/* Check for mixed profile channels */
|
||||
sony_dvbt2_ofdm_t ofdm;
|
||||
|
||||
result = sony_demod_dvbt2_monitor_OFDM (pInteg->pDemod, &ofdm);
|
||||
if (result == SONY_RESULT_OK) {
|
||||
*pMixed = ofdm.mixed;
|
||||
}
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
|
||||
sony_result_t sony_integ_dvbt2_Scan_SwitchDataPLP (sony_integ_t * pInteg, uint8_t mixed, uint8_t plpId, sony_dvbt2_profile_t profile)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
uint16_t plpAcquisitionTime = 0;
|
||||
sony_stopwatch_t timer;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_dvbt2_Scan_SwitchDataPLP");
|
||||
|
||||
if (!pInteg) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
if (profile == SONY_DVBT2_PROFILE_ANY) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
if (pInteg->pDemod->state != SONY_DEMOD_STATE_ACTIVE) {
|
||||
/* This api is accepted in Active states only */
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
result = sony_demod_dvbt2_SetPLPConfig (pInteg->pDemod, 0x00, plpId);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
/* Serious error occurred -> cancel operation. */
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
if ((profile == SONY_DVBT2_PROFILE_BASE) && (mixed)) {
|
||||
plpAcquisitionTime = 510;
|
||||
}
|
||||
else if ((profile == SONY_DVBT2_PROFILE_LITE) && (mixed)) {
|
||||
plpAcquisitionTime = 1260;
|
||||
}
|
||||
else {
|
||||
plpAcquisitionTime = 260;
|
||||
}
|
||||
|
||||
/* Start stopwatch to measure PLP acquisition time */
|
||||
result = sony_stopwatch_start (&timer);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
uint32_t elapsed;
|
||||
|
||||
/* Check cancellation. */
|
||||
result = sony_integ_CheckCancellation (pInteg);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
result = sony_stopwatch_elapsed(&timer, &elapsed);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
if (elapsed >= plpAcquisitionTime) {
|
||||
break; /* finish waiting */
|
||||
} else {
|
||||
result = sony_stopwatch_sleep (&timer, SONY_DVBT2_WAIT_LOCK_INTERVAL);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
|
||||
sony_result_t sony_integ_dvbt2_BlindTune (sony_integ_t * pInteg,
|
||||
uint32_t centerFreqKHz,
|
||||
sony_dtv_bandwidth_t bandwidth,
|
||||
sony_dvbt2_profile_t profile,
|
||||
sony_dvbt2_profile_t * pProfileTuned)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
sony_dvbt2_tune_param_t tuneParam;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_dvbt2_BlindTune");
|
||||
|
||||
if ((!pInteg) || (!pInteg->pDemod) || (!pProfileTuned)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
/* Confirm the demod is in a valid state to accept this API */
|
||||
if ((pInteg->pDemod->state != SONY_DEMOD_STATE_SLEEP) && (pInteg->pDemod->state != SONY_DEMOD_STATE_ACTIVE)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
/* Check bandwidth validity */
|
||||
if ((bandwidth != SONY_DTV_BW_1_7_MHZ) && (bandwidth != SONY_DTV_BW_5_MHZ) &&
|
||||
(bandwidth != SONY_DTV_BW_6_MHZ) && (bandwidth != SONY_DTV_BW_7_MHZ) &&
|
||||
(bandwidth != SONY_DTV_BW_8_MHZ)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_NOSUPPORT);
|
||||
}
|
||||
|
||||
/* Attempt DVB-T2 acquisition */
|
||||
tuneParam.bandwidth = bandwidth;
|
||||
tuneParam.centerFreqKHz = centerFreqKHz;
|
||||
tuneParam.dataPlpId = 0; /* Not used in blind acquisition */
|
||||
|
||||
/* Configure for automatic PLP selection. */
|
||||
result = sony_demod_dvbt2_SetPLPConfig (pInteg->pDemod, 0x01, 0x00);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Configure the DVB-T2 profile without recovery */
|
||||
result = sony_demod_dvbt2_SetProfile(pInteg->pDemod, profile);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Tune the demodulator */
|
||||
result = sony_demod_dvbt2_Tune (pInteg->pDemod, &tuneParam);
|
||||
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, tuneParam.centerFreqKHz, SONY_DTV_SYSTEM_DVBT2, tuneParam.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_TuneEnd (pInteg->pDemod);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Wait for demodulator lock */
|
||||
result = dvbt2_WaitDemodLock (pInteg, profile);
|
||||
switch (result) {
|
||||
case SONY_RESULT_OK:
|
||||
/* In DVB-T2, L1 Post information may not immediately be valid after acquisition
|
||||
* (L1POST_OK bit != 1). This wait loop handles such cases. This issue occurs
|
||||
* only under clean signal lab conditions, and will therefore not extend acquistion
|
||||
* time under normal conditions.
|
||||
*/
|
||||
result = dvbt2_WaitL1PostLock (pInteg);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
if (profile == SONY_DVBT2_PROFILE_ANY) {
|
||||
/* Obtain the current profile if detection was automatic. */
|
||||
result = sony_demod_dvbt2_monitor_Profile (pInteg->pDemod, pProfileTuned);
|
||||
if (result == SONY_RESULT_ERROR_HW_STATE) {
|
||||
/* Demod lock is lost causing monitor to fail, return UNLOCK instead of HW STATE */
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_UNLOCK);
|
||||
}
|
||||
else if (result != SONY_RESULT_OK) {
|
||||
/* Serious error, so return result */
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Else, set the tuned profile to the input parameter */
|
||||
*pProfileTuned = profile;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
/* Intentional fall-through */
|
||||
case SONY_RESULT_ERROR_TIMEOUT:
|
||||
case SONY_RESULT_ERROR_UNLOCK:
|
||||
break;
|
||||
|
||||
default:
|
||||
SONY_TRACE_RETURN(result);
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
|
||||
sony_result_t sony_integ_dvbt2_WaitTSLock (sony_integ_t * pInteg, sony_dvbt2_profile_t profile)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
sony_demod_lock_result_t lock = SONY_DEMOD_LOCK_RESULT_NOTDETECT;
|
||||
uint16_t timeout = 0;
|
||||
sony_stopwatch_t timer;
|
||||
uint8_t continueWait = 1;
|
||||
uint32_t elapsed = 0;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_dvbt2_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);
|
||||
}
|
||||
|
||||
if (profile == SONY_DVBT2_PROFILE_BASE) {
|
||||
timeout = SONY_DVBT2_BASE_WAIT_TS_LOCK;
|
||||
}
|
||||
else if (profile == SONY_DVBT2_PROFILE_LITE) {
|
||||
timeout = SONY_DVBT2_LITE_WAIT_TS_LOCK;
|
||||
}
|
||||
else {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
/* 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 >= timeout) {
|
||||
continueWait = 0;
|
||||
}
|
||||
|
||||
result = sony_demod_dvbt2_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_DVBT2_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_dvbt2_monitor_RFLevel (sony_integ_t * pInteg, int32_t * pRFLeveldB)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_dvbt2_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_DVBT2) {
|
||||
/* Not DVB-T2*/
|
||||
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_dvbt2_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);
|
||||
}
|
||||
|
||||
sony_result_t sony_integ_dvbt2_monitor_SSI (sony_integ_t * pInteg, uint8_t * pSSI)
|
||||
{
|
||||
int32_t rfLevel;
|
||||
sony_dvbt2_plp_constell_t qam;
|
||||
sony_dvbt2_plp_code_rate_t codeRate;
|
||||
int32_t prel;
|
||||
int32_t tempSSI = 0;
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
|
||||
static const int32_t pRefdBm1000[4][8] = {
|
||||
/* 1/2, 3/5, 2/3, 3/4, 4/5, 5/6, 1/3, 2/5 */
|
||||
{-96000, -95000, -94000, -93000, -92000, -92000, -98000, -97000}, /* QPSK */
|
||||
{-91000, -89000, -88000, -87000, -86000, -86000, -93000, -92000}, /* 16-QAM */
|
||||
{-86000, -85000, -83000, -82000, -81000, -80000, -89000, -88000}, /* 64-QAM */
|
||||
{-82000, -80000, -78000, -76000, -75000, -74000, -86000, -84000}, /* 256-QAM */
|
||||
};
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_dvbt2_monitor_SSI");
|
||||
|
||||
if ((!pInteg) || (!pInteg->pDemod) || (!pSSI)) {
|
||||
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_DVBT2) {
|
||||
/* Not DVB-T2*/
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
/* Get estimated RF Level */
|
||||
result = sony_integ_dvbt2_monitor_RFLevel (pInteg, &rfLevel);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Get PLP constellation */
|
||||
result = sony_demod_dvbt2_monitor_QAM (pInteg->pDemod, SONY_DVBT2_PLP_DATA, &qam);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Get PLP code rate */
|
||||
result = sony_demod_dvbt2_monitor_CodeRate (pInteg->pDemod, SONY_DVBT2_PLP_DATA, &codeRate);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Ensure correct plp info. */
|
||||
if ((codeRate > SONY_DVBT2_R2_5) || (qam > SONY_DVBT2_QAM256)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_OTHER);
|
||||
}
|
||||
|
||||
/* prel = prec - pref */
|
||||
prel = rfLevel - pRefdBm1000[qam][codeRate];
|
||||
|
||||
/* SSI (Signal Strength Indicator) is calculated from:
|
||||
*
|
||||
* if (prel < -15dB) SSI = 0
|
||||
* if (-15dB <= prel < 0dB) SSI = (2/3) * (prel + 15)
|
||||
* if (0dB <= prel < 20dB) SSI = 4 * prel + 10
|
||||
* if (20dB <= prel < 35dB) SSI = (2/3) * (prel - 20) + 90
|
||||
* if (prel >= 35dB) SSI = 100
|
||||
*/
|
||||
if (prel < -15000) {
|
||||
tempSSI = 0;
|
||||
}
|
||||
else if (prel < 0) {
|
||||
/* Note : prel and 2/3 scaled by 10^3 so divide by 10^6 added */
|
||||
tempSSI = ((2 * (prel + 15000)) + 1500) / 3000;
|
||||
}
|
||||
else if (prel < 20000) {
|
||||
/* Note : prel scaled by 10^3 so divide by 10^3 added */
|
||||
tempSSI = (((4 * prel) + 500) / 1000) + 10;
|
||||
}
|
||||
else if (prel < 35000) {
|
||||
/* Note : prel and 2/3 scaled by 10^3 so divide by 10^6 added */
|
||||
tempSSI = (((2 * (prel - 20000)) + 1500) / 3000) + 90;
|
||||
}
|
||||
else {
|
||||
tempSSI = 100;
|
||||
}
|
||||
|
||||
/* Clip value to 100% */
|
||||
*pSSI = (tempSSI > 100)? 100 : (uint8_t)tempSSI;
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Local Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
static sony_result_t dvbt2_WaitDemodLock (sony_integ_t * pInteg, sony_dvbt2_profile_t profile)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
sony_demod_lock_result_t lock = SONY_DEMOD_LOCK_RESULT_NOTDETECT;
|
||||
uint16_t timeout = 0;
|
||||
sony_stopwatch_t timer;
|
||||
uint8_t continueWait = 1;
|
||||
uint32_t elapsed = 0;
|
||||
|
||||
SONY_TRACE_ENTER ("dvbt2_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);
|
||||
}
|
||||
|
||||
if (profile == SONY_DVBT2_PROFILE_BASE) {
|
||||
timeout = SONY_DVBT2_BASE_WAIT_DEMOD_LOCK;
|
||||
}
|
||||
else if ((profile == SONY_DVBT2_PROFILE_LITE) || (profile == SONY_DVBT2_PROFILE_ANY)) {
|
||||
timeout = SONY_DVBT2_LITE_WAIT_DEMOD_LOCK;
|
||||
}
|
||||
else {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
/* 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 >= timeout) {
|
||||
continueWait = 0;
|
||||
}
|
||||
|
||||
result = sony_demod_dvbt2_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_DVBT2_WAIT_LOCK_INTERVAL);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
} else {
|
||||
result = SONY_RESULT_ERROR_TIMEOUT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
static sony_result_t dvbt2_WaitL1PostLock (sony_integ_t * pInteg)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
sony_stopwatch_t timer;
|
||||
uint8_t continueWait = 1;
|
||||
uint32_t elapsed = 0;
|
||||
uint8_t l1PostValid;
|
||||
|
||||
SONY_TRACE_ENTER ("dvbt2_WaitL1PostLock");
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/* Check for timeout condition */
|
||||
if (elapsed >= SONY_DVBT2_L1POST_TIMEOUT) {
|
||||
continueWait = 0;
|
||||
}
|
||||
|
||||
result = sony_demod_dvbt2_CheckL1PostValid (pInteg->pDemod, &l1PostValid);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* If L1 Post is valid, return from loop, else continue waiting */
|
||||
if (l1PostValid) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_OK);
|
||||
}
|
||||
|
||||
/* Check cancellation. */
|
||||
result = sony_integ_CheckCancellation (pInteg);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
if (continueWait) {
|
||||
result = sony_stopwatch_sleep (&timer, SONY_DVBT2_WAIT_LOCK_INTERVAL);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
else {
|
||||
result = SONY_RESULT_ERROR_TIMEOUT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
+270
@@ -0,0 +1,270 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2018 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2018/07/27
|
||||
Modification ID : ff73ffebff57618d6a5aa6e2aa9eb009b86060d1
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@file sony_integ_dvbt2.h
|
||||
|
||||
This file provides the integration layer interface for DVB-T and DVB-T2
|
||||
specific demodulator functions.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SONY_INTEG_DVBT2_H
|
||||
#define SONY_INTEG_DVBT2_H
|
||||
|
||||
#include "sony_demod.h"
|
||||
#include "sony_integ.h"
|
||||
#include "sony_demod_dvbt2.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Defines
|
||||
------------------------------------------------------------------------------*/
|
||||
#define SONY_DVBT2_BASE_WAIT_DEMOD_LOCK 3500 /**< 3.5s timeout for wait demodulator lock process for DVB-T2-Base channels */
|
||||
#define SONY_DVBT2_BASE_WAIT_TS_LOCK 1500 /**< 1.5s timeout for wait TS lock process for DVB-T2-Base channels */
|
||||
#define SONY_DVBT2_LITE_WAIT_DEMOD_LOCK 5000 /**< 5.0s timeout for wait demodulator lock process for DVB-T2-Lite channels */
|
||||
#define SONY_DVBT2_LITE_WAIT_TS_LOCK 2300 /**< 2.3s timeout for wait TS lock process for DVB-T2-Lite channels */
|
||||
#define SONY_DVBT2_WAIT_LOCK_INTERVAL 10 /**< 10ms polling interval for demodulator and TS lock functions */
|
||||
#define SONY_DVBT2_L1POST_TIMEOUT 500 /**< 500ms timeout for L1Post Valid loop */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Structs
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief The parameters used for DVB-T2 scanning.
|
||||
*/
|
||||
typedef struct sony_integ_dvbt2_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;
|
||||
|
||||
/**
|
||||
@brief The DVB-T2 profile to use for the blind tune. Use
|
||||
::SONY_DVBT2_PROFILE_ANY for mixed or Base and Lite spectrums.
|
||||
*/
|
||||
sony_dvbt2_profile_t t2Profile;
|
||||
}sony_integ_dvbt2_scan_param_t;
|
||||
|
||||
/**
|
||||
@brief The structure used to return a channel located or progress update
|
||||
as part of a DVB-T2 scan.
|
||||
*/
|
||||
typedef struct sony_integ_dvbt2_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 DVB-T2 channel.
|
||||
*/
|
||||
sony_dvbt2_tune_param_t dvbt2TuneParam;
|
||||
}sony_integ_dvbt2_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 (DVB-T2 : Demod Lock).
|
||||
|
||||
NOTE: for DVB-T2 this function is invoked for each PLP within the signal.
|
||||
|
||||
@param pInteg The driver instance.
|
||||
@param pResult The current scan result.
|
||||
@param pScanParam The current scan parameters.
|
||||
*/
|
||||
typedef void (*sony_integ_dvbt2_scan_callback_t) (sony_integ_t * pInteg,
|
||||
sony_integ_dvbt2_scan_result_t * pResult,
|
||||
sony_integ_dvbt2_scan_param_t * pScanParam);
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Performs acquisition to a DVB-T2 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.
|
||||
|
||||
During a tune the device will wait for a T2 P1 symbol in order to decode the
|
||||
L1 pre signaling and then begin demodulation. If the data PLP ID
|
||||
(::sony_dvbt2_tune_param_t::dataPlpId) or the associated common PLP is not
|
||||
found in the channel, the device will always select the first found PLP and
|
||||
output the associated TS. In this case, an indicator in the
|
||||
::sony_dvbt2_tune_param_t::tuneInfo will be set.
|
||||
|
||||
Note: If SONY_DVBT2_PROFILE_LITE is set to pTuneParam->profile,
|
||||
early unlock detection time and lock waiting timeout will be longer.
|
||||
|
||||
@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_dvbt2_Tune(sony_integ_t * pInteg,
|
||||
sony_dvbt2_tune_param_t * pTuneParam);
|
||||
|
||||
/**
|
||||
@brief Attempts to acquire to the DVB-T2 channel at the center frequency provided.
|
||||
|
||||
This function blocks the calling thread until the demod has locked or has
|
||||
timed out. Use ::sony_integ_Cancel to cancel the operation at any time.
|
||||
|
||||
For TS lock please call the wait TS lock function
|
||||
::sony_integ_dvbt2_WaitTSLock.
|
||||
|
||||
NOTE: For T2 the PLP selected will be the first found in the L1 pre signaling.
|
||||
Use ::sony_demod_dvbt2_monitor_DataPLPs to obtain a full list of PLPs contained
|
||||
in the T2 signal.
|
||||
|
||||
Note: For DVB-T2 the output selected if profile is set to ::SONY_DVBT2_PROFILE_ANY
|
||||
will be determined by the first frame received.
|
||||
|
||||
Note: If SONY_DVBT2_PROFILE_LITE or SONY_DVBT2_PROFILE_ANY are used for profile argument,
|
||||
early unlock detection time and lock waiting timeout will be longer.
|
||||
|
||||
@param pInteg The driver instance.
|
||||
@param centerFreqKHz The center frequency of the channel to attempt acquisition on
|
||||
@param bandwidth The bandwidth of the channel
|
||||
@param profile The DVB-T2 profile to detect, use ::SONY_DVBT2_PROFILE_ANY to detect Base
|
||||
or Lite.
|
||||
@param pProfileTuned The DVB-T2 profile tuned by the blind tune.
|
||||
|
||||
@return SONY_RESULT_OK if tuned successfully to the channel.
|
||||
*/
|
||||
sony_result_t sony_integ_dvbt2_BlindTune(sony_integ_t * pInteg,
|
||||
uint32_t centerFreqKHz,
|
||||
sony_dtv_bandwidth_t bandwidth,
|
||||
sony_dvbt2_profile_t profile,
|
||||
sony_dvbt2_profile_t * pProfileTuned);
|
||||
|
||||
/**
|
||||
@brief Performs a scan over the spectrum specified.
|
||||
|
||||
Perform a DVB-T2 system scan for DVB-T2 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_dvbt2_Scan(sony_integ_t * pInteg,
|
||||
sony_integ_dvbt2_scan_param_t * pScanParam,
|
||||
sony_integ_dvbt2_scan_callback_t callBack);
|
||||
|
||||
/**
|
||||
@brief Collect a list of data PLPs that the demodulator has detected.
|
||||
|
||||
Called internally as part of each DVBT2 scan.
|
||||
|
||||
Collect a list of data PLPs that the demodulator has detected after a successful
|
||||
DVBT2 tune acquisition. The detected data PLP IDs are stored in an array pointed
|
||||
to by pPLPIds.
|
||||
|
||||
@param pInteg The driver instance.
|
||||
@param pPLPIds Pointer to an array of at least 256 bytes in length
|
||||
that can receive the list of data PLPs carried..
|
||||
@param pNumPLPs The number of data PLPs detected (signlled in L1-post).
|
||||
@param pMixed An indicator which indicates if the received DVBT2 system contains BASE and LITE components
|
||||
|
||||
@return SONY_RESULT_OK if completed successfully.
|
||||
|
||||
*/
|
||||
sony_result_t sony_integ_dvbt2_Scan_PrepareDataPLPLoop(sony_integ_t * pInteg, uint8_t pPLPIds[], uint8_t *pNumPLPs, uint8_t *pMixed);
|
||||
|
||||
/**
|
||||
@brief Set the device PLP operation to manual and the requested Data PLP ID.
|
||||
|
||||
Called internally and usually after ::sony_integ_dvbt2_Scan_PrepareDataPLPLoop
|
||||
as part of each DVBT2 scan.
|
||||
|
||||
@param pInteg The driver instance.
|
||||
@param mixed A flag to indicates the received DVBT2 system contains BASE and LITE components
|
||||
@param plpId The PLD ID to set.
|
||||
@param profile The DVB-T2 profile.
|
||||
|
||||
@return SONY_RESULT_OK if completed successfully.
|
||||
|
||||
*/
|
||||
sony_result_t sony_integ_dvbt2_Scan_SwitchDataPLP(sony_integ_t * pInteg, uint8_t mixed, uint8_t plpId, sony_dvbt2_profile_t profile);
|
||||
|
||||
/**
|
||||
@brief Polls the demodulator waiting for TS lock at 10ms intervals up to a profile dependent
|
||||
timeout duration (DVB-T2_Base : 1.5s, DVB-T2-Lite : 2.3s).
|
||||
|
||||
SONY_DVBT2_PROFILE_ANY is invalid for this API.
|
||||
|
||||
@param pInteg The driver instance
|
||||
@param profile The DVB-T2 profile (base or lite)
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_integ_dvbt2_WaitTSLock (sony_integ_t * pInteg, sony_dvbt2_profile_t profile);
|
||||
|
||||
/**
|
||||
@brief RF level monitor function.
|
||||
|
||||
This function returns the estimated RF level based on either the demodulator IFAGC
|
||||
level or a tuner internal RSSI monitor. If any compensation for external hardware
|
||||
such as, LNA, attenuators is required, then the user should make adjustment in the
|
||||
corresponding function.
|
||||
|
||||
@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_dvbt2_monitor_RFLevel (sony_integ_t * pInteg, int32_t * pRFLeveldB);
|
||||
|
||||
/**
|
||||
@brief DVB-T2 monitor for SSI (Signal Strength Indicator), based on the RF Level monitor value
|
||||
::sony_integ_dvbt_t2_monitor_RFLevel.
|
||||
|
||||
@note The RF Level monitor function should be optimised for your HW configuration before using
|
||||
this monitor.
|
||||
|
||||
@param pInteg The driver instance
|
||||
@param pSSI The Signal Strength Indicator value in %
|
||||
|
||||
@return SONY_RESULT_OK if successful
|
||||
*/
|
||||
sony_result_t sony_integ_dvbt2_monitor_SSI (sony_integ_t * pInteg, uint8_t * pSSI);
|
||||
|
||||
#endif /* SONY_INTEG_DVBT2_H */
|
||||
+336
@@ -0,0 +1,336 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2018 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2018/08/30
|
||||
Modification ID : 902dae58eb5249e028ccc5d7f60bb66cca9b43a9
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
#include "sony_integ.h"
|
||||
#include "sony_integ_dvbt_t2.h"
|
||||
#include "sony_demod.h"
|
||||
#include "sony_demod_dvbt_monitor.h"
|
||||
#include "sony_demod_dvbt2_monitor.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
sony_result_t sony_integ_dvbt_t2_Scan(sony_integ_t * pInteg,
|
||||
sony_integ_dvbt_t2_scan_param_t * pScanParam,
|
||||
sony_integ_dvbt_t2_scan_callback_t callBack)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
sony_integ_dvbt_t2_scan_result_t scanResult;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_dvbt_t2_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_1_7_MHZ) && (pScanParam->bandwidth != SONY_DTV_BW_5_MHZ) &&
|
||||
(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);
|
||||
}
|
||||
|
||||
/* Check for invalid combination of 1.7MHz scanning with DVB-T/ANY. */
|
||||
if ((pScanParam->system != SONY_DTV_SYSTEM_DVBT2) && (pScanParam->bandwidth == SONY_DTV_BW_1_7_MHZ)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_NOSUPPORT);
|
||||
}
|
||||
|
||||
/* Set the start frequency */
|
||||
scanResult.centerFreqKHz = pScanParam->startFrequencyKHz;
|
||||
scanResult.tuneResult = SONY_RESULT_OK;
|
||||
scanResult.system = SONY_DTV_SYSTEM_DVBT;
|
||||
scanResult.dvbtTuneParam.centerFreqKHz = pScanParam->startFrequencyKHz;
|
||||
scanResult.dvbtTuneParam.bandwidth = pScanParam->bandwidth;
|
||||
scanResult.dvbtTuneParam.profile = SONY_DVBT_PROFILE_HP;
|
||||
scanResult.dvbt2TuneParam.centerFreqKHz = pScanParam->startFrequencyKHz;
|
||||
scanResult.dvbt2TuneParam.bandwidth = pScanParam->bandwidth;
|
||||
scanResult.dvbt2TuneParam.dataPlpId = 0;
|
||||
scanResult.dvbt2TuneParam.profile = SONY_DVBT2_PROFILE_BASE;
|
||||
scanResult.dvbt2TuneParam.tuneInfo = SONY_DEMOD_DVBT2_TUNE_INFO_OK;
|
||||
|
||||
/* Set scan mode enabled */
|
||||
result = sony_demod_terr_cable_SetScanMode(pInteg->pDemod, pScanParam->system, 0x01);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Scan routine */
|
||||
while (scanResult.centerFreqKHz <= pScanParam->endFrequencyKHz) {
|
||||
sony_dtv_system_t systemFound = SONY_DTV_SYSTEM_UNKNOWN;
|
||||
sony_dvbt2_profile_t profileFound = SONY_DVBT2_PROFILE_ANY;
|
||||
uint8_t channelComplete = 0;
|
||||
sony_dtv_system_t blindTuneSystem = pScanParam->system;
|
||||
sony_dvbt2_profile_t blindTuneProfile = pScanParam->t2Profile;
|
||||
|
||||
scanResult.dvbtTuneParam.centerFreqKHz = scanResult.centerFreqKHz;
|
||||
scanResult.dvbt2TuneParam.centerFreqKHz = scanResult.centerFreqKHz;
|
||||
|
||||
while (!channelComplete) {
|
||||
scanResult.tuneResult = sony_integ_dvbt_t2_BlindTune(pInteg, scanResult.centerFreqKHz, pScanParam->bandwidth, blindTuneSystem, blindTuneProfile, &systemFound, &profileFound);
|
||||
switch (scanResult.tuneResult) {
|
||||
case SONY_RESULT_OK:
|
||||
scanResult.system = systemFound;
|
||||
|
||||
/* Channel found, callback to application */
|
||||
if (systemFound == SONY_DTV_SYSTEM_DVBT){
|
||||
callBack (pInteg, &scanResult, pScanParam);
|
||||
|
||||
/* DVB-T detected, set channel complete to move to next frequency */
|
||||
channelComplete = 1;
|
||||
}
|
||||
else if (systemFound == SONY_DTV_SYSTEM_DVBT2) {
|
||||
uint8_t numPLPs = 0;
|
||||
uint8_t plpIds[255];
|
||||
uint8_t mixed;
|
||||
uint8_t i;
|
||||
|
||||
scanResult.dvbt2TuneParam.profile = profileFound;
|
||||
|
||||
result = sony_integ_dvbt2_Scan_PrepareDataPLPLoop(pInteg, plpIds, &numPLPs, &mixed);
|
||||
if (result == SONY_RESULT_ERROR_HW_STATE) {
|
||||
/* Callback to application for progress updates */
|
||||
scanResult.system = SONY_DTV_SYSTEM_UNKNOWN;
|
||||
scanResult.tuneResult = SONY_RESULT_ERROR_UNLOCK;
|
||||
callBack (pInteg, &scanResult, pScanParam);
|
||||
|
||||
/* Error in monitored data, ignore current channel */
|
||||
channelComplete = 1;
|
||||
}
|
||||
else if (result != SONY_RESULT_OK) {
|
||||
/* Serious error occurred -> cancel operation. */
|
||||
sony_demod_terr_cable_SetScanMode(pInteg->pDemod, pScanParam->system, 0x00);
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
else {
|
||||
/* Set PLP ID in tune parameter structure and provide callback for first PLP */
|
||||
scanResult.dvbt2TuneParam.dataPlpId = plpIds[0];
|
||||
callBack (pInteg, &scanResult, pScanParam);
|
||||
|
||||
/* Callback for each subsequent PLP in current profile */
|
||||
for (i = 1; i < numPLPs; i++) {
|
||||
result = sony_integ_dvbt2_Scan_SwitchDataPLP(pInteg, mixed, plpIds[i], profileFound);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
sony_demod_terr_cable_SetScanMode(pInteg->pDemod, pScanParam->system, 0x00);
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
/* Set PLP ID in tune parameter structure and provide callback */
|
||||
scanResult.dvbt2TuneParam.dataPlpId = plpIds[i];
|
||||
callBack (pInteg, &scanResult, pScanParam);
|
||||
}
|
||||
|
||||
/* If profile is ANY, check for mixed profile channels */
|
||||
if (blindTuneProfile == SONY_DVBT2_PROFILE_ANY) {
|
||||
/* Check for mixed profiles available */
|
||||
if (mixed) {
|
||||
/* Set Blind Tune parameters to DVB-T2 only and the other profile
|
||||
* compared to that already located */
|
||||
blindTuneSystem = SONY_DTV_SYSTEM_DVBT2;
|
||||
|
||||
if (profileFound == SONY_DVBT2_PROFILE_BASE) {
|
||||
blindTuneProfile = SONY_DVBT2_PROFILE_LITE;
|
||||
}
|
||||
else if (profileFound == SONY_DVBT2_PROFILE_LITE) {
|
||||
blindTuneProfile = SONY_DVBT2_PROFILE_BASE;
|
||||
}
|
||||
else {
|
||||
/* Serious error occurred -> cancel operation. */
|
||||
sony_demod_terr_cable_SetScanMode(pInteg->pDemod, pScanParam->system, 0x00);
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Channel is not mixed profile so continue to next frequency */
|
||||
channelComplete = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Profile is fixed therefore this frequency is complete */
|
||||
channelComplete = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
/* Intentional fall-through. */
|
||||
case SONY_RESULT_ERROR_UNLOCK:
|
||||
case SONY_RESULT_ERROR_TIMEOUT:
|
||||
/* Channel not found, callback to application for progress updates */
|
||||
scanResult.system = SONY_DTV_SYSTEM_UNKNOWN;
|
||||
callBack (pInteg, &scanResult, pScanParam);
|
||||
|
||||
/* Go to next frequency */
|
||||
channelComplete = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
/* Serious error occurred -> cancel operation. */
|
||||
sony_demod_terr_cable_SetScanMode(pInteg->pDemod, pScanParam->system, 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, pScanParam->system, 0x00);
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear scan mode */
|
||||
result = sony_demod_terr_cable_SetScanMode(pInteg->pDemod, pScanParam->system, 0x00);
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
sony_result_t sony_integ_dvbt_t2_BlindTune(sony_integ_t * pInteg,
|
||||
uint32_t centerFreqKHz,
|
||||
sony_dtv_bandwidth_t bandwidth,
|
||||
sony_dtv_system_t system,
|
||||
sony_dvbt2_profile_t profile,
|
||||
sony_dtv_system_t * pSystemTuned,
|
||||
sony_dvbt2_profile_t * pProfileTuned)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
uint8_t channelFound = 0;
|
||||
sony_dtv_system_t tuneSystems[2] = {SONY_DTV_SYSTEM_UNKNOWN , SONY_DTV_SYSTEM_UNKNOWN};
|
||||
uint8_t tuneIteration;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_dvbt_t2_BlindTune");
|
||||
|
||||
if ((!pInteg) || (!pInteg->pDemod) || (!pSystemTuned) || (!pProfileTuned)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
/* Confirm the demod is in a valid state to accept this API */
|
||||
if ((pInteg->pDemod->state != SONY_DEMOD_STATE_SLEEP) && (pInteg->pDemod->state != SONY_DEMOD_STATE_ACTIVE)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
/* Check bandwidth validity */
|
||||
if ((bandwidth != SONY_DTV_BW_1_7_MHZ) && (bandwidth != SONY_DTV_BW_5_MHZ) &&
|
||||
(bandwidth != SONY_DTV_BW_6_MHZ) && (bandwidth != SONY_DTV_BW_7_MHZ) &&
|
||||
(bandwidth != SONY_DTV_BW_8_MHZ)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_NOSUPPORT);
|
||||
}
|
||||
|
||||
/* Check for invalid system parameter */
|
||||
if ((system != SONY_DTV_SYSTEM_DVBT) && (system != SONY_DTV_SYSTEM_DVBT2) && (system != SONY_DTV_SYSTEM_ANY)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_NOSUPPORT);
|
||||
}
|
||||
|
||||
/* Check for invalid combination of 1.7MHz tune */
|
||||
if ((system != SONY_DTV_SYSTEM_DVBT2) && (bandwidth == SONY_DTV_BW_1_7_MHZ)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_NOSUPPORT);
|
||||
}
|
||||
|
||||
if (system == SONY_DTV_SYSTEM_ANY) {
|
||||
tuneSystems[0] = pInteg->pDemod->blindTuneDvbt2First? SONY_DTV_SYSTEM_DVBT2 : SONY_DTV_SYSTEM_DVBT;
|
||||
tuneSystems[1] = pInteg->pDemod->blindTuneDvbt2First? SONY_DTV_SYSTEM_DVBT : SONY_DTV_SYSTEM_DVBT2;
|
||||
}
|
||||
else {
|
||||
tuneSystems[0] = system;
|
||||
}
|
||||
|
||||
for (tuneIteration = 0; tuneIteration <=1; tuneIteration++) {
|
||||
#ifdef SAME_TUNER_CONFIG_DVBT_T2
|
||||
/* If SAME_TUNER_CONFIG_DVBT_T2 is defined the driver assumes
|
||||
that the tuner configuration used for DVBT tuning is identical to
|
||||
DVBT2, therefore the tuner does not need to be reconfigured. This will
|
||||
help to reduce blindtune and therefore scan duration. This is only
|
||||
valid if SONY_DTV_SYSTEM_ANY is used. */
|
||||
|
||||
/* Function pointer variable to store the pInteg->pTuner->TerrCableTune pointer temporary */
|
||||
sony_result_t (*SavedTuneFunc) (struct sony_tuner_t *, uint32_t,
|
||||
sony_dtv_system_t, sony_dtv_bandwidth_t) = NULL;
|
||||
|
||||
if (tuneIteration == 1)
|
||||
{
|
||||
SavedTuneFunc = pInteg->pTuner->TerrCableTune;
|
||||
/* Set to NULL to signal sony_integ_dvbt_BlindTune or sony_integ_dvbt2_BlindTune
|
||||
to use the same tuner configuration. */
|
||||
pInteg->pTuner->TerrCableTune = NULL;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* Attempt DVB-T acquisition */
|
||||
if ((tuneSystems[tuneIteration] == SONY_DTV_SYSTEM_DVBT) && (!channelFound)) {
|
||||
result = sony_integ_dvbt_BlindTune(pInteg, centerFreqKHz, bandwidth);
|
||||
if (result == SONY_RESULT_OK) {
|
||||
*pSystemTuned = SONY_DTV_SYSTEM_DVBT;
|
||||
channelFound = 1;
|
||||
}
|
||||
}
|
||||
/* Attempt DVB-T2 acquisition */
|
||||
if ((tuneSystems[tuneIteration] == SONY_DTV_SYSTEM_DVBT2) && (!channelFound)) {
|
||||
result = sony_integ_dvbt2_BlindTune(pInteg, centerFreqKHz, bandwidth, profile, pProfileTuned);
|
||||
if (result == SONY_RESULT_OK) {
|
||||
*pSystemTuned = SONY_DTV_SYSTEM_DVBT2;
|
||||
channelFound = 1;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SAME_TUNER_CONFIG_DVBT_T2
|
||||
/* If SAME_TUNER_CONFIG_DVBT_T2 is defined
|
||||
Restore Tune function pointer, if conditions are true.
|
||||
*/
|
||||
if ((tuneIteration == 1) && (SavedTuneFunc))
|
||||
{
|
||||
pInteg->pTuner->TerrCableTune = SavedTuneFunc;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
sony_result_t sony_integ_dvbt_t2_monitor_RFLevel (sony_integ_t * pInteg, int32_t * pRFLeveldB)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_dvbt_t2_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_DVBT) {
|
||||
result = sony_integ_dvbt_monitor_RFLevel (pInteg, pRFLeveldB);
|
||||
}
|
||||
else if (pInteg->pDemod->system == SONY_DTV_SYSTEM_DVBT2) {
|
||||
result = sony_integ_dvbt2_monitor_RFLevel (pInteg, pRFLeveldB);
|
||||
}
|
||||
else {
|
||||
/* Not DVB-T or DVB-T2*/
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
+209
@@ -0,0 +1,209 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2018 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2018/07/27
|
||||
Modification ID : ff73ffebff57618d6a5aa6e2aa9eb009b86060d1
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@file sony_integ_dvbt_t2.h
|
||||
|
||||
This file provides the integration layer interface for DVB-T and DVB-T2
|
||||
specific demodulator functions.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SONY_INTEG_DVBT_T2_H
|
||||
#define SONY_INTEG_DVBT_T2_H
|
||||
|
||||
#include "sony_demod.h"
|
||||
#include "sony_integ.h"
|
||||
#include "sony_integ_dvbt.h"
|
||||
#include "sony_integ_dvbt2.h"
|
||||
#include "sony_demod_dvbt.h"
|
||||
#include "sony_demod_dvbt2.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Defines
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Structs
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief The parameters used for DVB-T and DVB-T2 scanning.
|
||||
*/
|
||||
typedef struct sony_integ_dvbt_t2_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;
|
||||
|
||||
/**
|
||||
@brief The system to attempt to blind tune to at each step. Use
|
||||
::SONY_DTV_SYSTEM_ANY to run a multiple system scan (DVB-T and
|
||||
DVB-T2).
|
||||
*/
|
||||
sony_dtv_system_t system;
|
||||
|
||||
/**
|
||||
@brief The DVB-T2 profile to use for the blind tune. Use
|
||||
::SONY_DVBT2_PROFILE_ANY for mixed or Base and Lite spectrums.
|
||||
*/
|
||||
sony_dvbt2_profile_t t2Profile;
|
||||
}sony_integ_dvbt_t2_scan_param_t;
|
||||
|
||||
/**
|
||||
@brief The structure used to return a channel located or progress update
|
||||
as part of a DVB-T / DVB-T2 or combined scan.
|
||||
*/
|
||||
typedef struct sony_integ_dvbt_t2_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 system of the channel detected by the scan. This should be used to determine
|
||||
which of the following tune param structs are valid.
|
||||
*/
|
||||
sony_dtv_system_t system;
|
||||
|
||||
/**
|
||||
@brief The tune params for a located DVB-T channel.
|
||||
*/
|
||||
sony_dvbt_tune_param_t dvbtTuneParam;
|
||||
|
||||
/**
|
||||
@brief The tune params for a located DVB-T2 channel.
|
||||
*/
|
||||
sony_dvbt2_tune_param_t dvbt2TuneParam;
|
||||
}sony_integ_dvbt_t2_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 (DVB-T : TPS Lock,
|
||||
DVB-T2 : Demod Lock).
|
||||
|
||||
NOTE: for DVB-T2 this function is invoked for each PLP within the signal.
|
||||
|
||||
@param pInteg The driver instance.
|
||||
@param pResult The current scan result.
|
||||
@param pScanParam The current scan parameters.
|
||||
*/
|
||||
typedef void (*sony_integ_dvbt_t2_scan_callback_t) (sony_integ_t * pInteg,
|
||||
sony_integ_dvbt_t2_scan_result_t * pResult,
|
||||
sony_integ_dvbt_t2_scan_param_t * pScanParam);
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Attempts to acquire to the channel at the center frequency provided.
|
||||
|
||||
The system can be specified directly or set to ::SONY_DTV_SYSTEM_ANY to allow
|
||||
tuning to DVB-T or DVB-T2 for unknown cases.
|
||||
|
||||
This function blocks the calling thread until the demod has locked or has
|
||||
timed out. Use ::sony_integ_Cancel to cancel the operation at any time.
|
||||
|
||||
For TS lock please call the wait TS lock function
|
||||
::sony_integ_dvbt_WaitTSLock or ::sony_integ_dvbt2_WaitTSLock.
|
||||
|
||||
NOTE: For T2 the PLP selected will be the first found in the L1 pre signaling.
|
||||
Use ::sony_demod_dvbt2_monitor_DataPLPs to obtain a full list of PLPs contained
|
||||
in the T2 signal.
|
||||
|
||||
Note: For DVB-T2 the output selected if profile is set to ::SONY_DVBT2_PROFILE_ANY
|
||||
will be determined by the first frame received.
|
||||
|
||||
Note: If SONY_DVBT2_PROFILE_LITE or SONY_DVBT2_PROFILE_ANY are used for profile argument,
|
||||
DVB-T2 early unlock detection time and lock waiting timeout will be longer.
|
||||
|
||||
@param pInteg The driver instance.
|
||||
@param centerFreqKHz The center frequency of the channel to attempt acquisition on
|
||||
@param bandwidth The bandwidth of the channel
|
||||
@param system The system to attempt to tune to, use ::SONY_DTV_SYSTEM_ANY to attempt
|
||||
both DVB-T and DVB-T2
|
||||
@param profile The DVB-T2 profile to detect, use ::SONY_DVBT2_PROFILE_ANY to detect Base
|
||||
or Lite.
|
||||
@param pSystemTuned The system of the channel located by the blind tune.
|
||||
@param pProfileTuned The DVB-T2 profile tuned by the blind tune.
|
||||
|
||||
@return SONY_RESULT_OK if tuned successfully to the channel.
|
||||
*/
|
||||
sony_result_t sony_integ_dvbt_t2_BlindTune(sony_integ_t * pInteg,
|
||||
uint32_t centerFreqKHz,
|
||||
sony_dtv_bandwidth_t bandwidth,
|
||||
sony_dtv_system_t system,
|
||||
sony_dvbt2_profile_t profile,
|
||||
sony_dtv_system_t * pSystemTuned,
|
||||
sony_dvbt2_profile_t * pProfileTuned);
|
||||
|
||||
/**
|
||||
@brief Performs a scan over the spectrum specified.
|
||||
|
||||
The scan can perform a multiple system scan for DVB-T and DVB-T2 channels by
|
||||
setting the ::sony_integ_dvbt_t2_scan_param_t::system to ::SONY_DTV_SYSTEM_ANY
|
||||
and setting the.
|
||||
|
||||
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_dvbt_t2_Scan(sony_integ_t * pInteg,
|
||||
sony_integ_dvbt_t2_scan_param_t * pScanParam,
|
||||
sony_integ_dvbt_t2_scan_callback_t callBack);
|
||||
|
||||
/**
|
||||
@brief RF level monitor function.
|
||||
|
||||
This function returns the estimated RF level based on either the demodulator IFAGC
|
||||
level or a tuner internal RSSI monitor. If any compensation for external hardware
|
||||
such as, LNA, attenuators is required, then the user should make adjustment in the
|
||||
corresponding function.
|
||||
|
||||
@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_dvbt_t2_monitor_RFLevel (sony_integ_t * pInteg, int32_t * pRFLeveldB);
|
||||
|
||||
#endif /* SONY_INTEG_DVBT_T2_H */
|
||||
Reference in New Issue
Block a user