提交SMOD ATSC IMX APP版本 V122
This commit is contained in:
+477
@@ -0,0 +1,477 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2018 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2018/07/27
|
||||
Modification ID : ff73ffebff57618d6a5aa6e2aa9eb009b86060d1
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
#include "sony_demod_isdbs.h"
|
||||
#include "sony_demod_isdbs_monitor.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Static Function Prototypes
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief TSID setting and the other is relative TS setting.
|
||||
*/
|
||||
static sony_result_t SetTSID(sony_demod_t * pDemod, uint16_t tsid, sony_isdbs_tsid_type_t tsidType);
|
||||
|
||||
/**
|
||||
@brief Configure the demodulator from Sleep to Active ISDB-S.
|
||||
*/
|
||||
static sony_result_t SLtoAIS (sony_demod_t * pDemod);
|
||||
|
||||
/**
|
||||
@brief Configure the demodulator from Active ISDB-S to Sleep.
|
||||
*/
|
||||
static sony_result_t AIStoSL (sony_demod_t * pDemod);
|
||||
|
||||
/**
|
||||
@brief Configure the demodulator from Active ISDB-S to Active ISDB-S.
|
||||
*/
|
||||
static sony_result_t AIStoAIS (sony_demod_t * pDemod);
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
sony_result_t sony_demod_isdbs_Tune (sony_demod_t * pDemod,
|
||||
sony_isdbs_tune_param_t * pTuneParam)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
SONY_TRACE_ENTER ("sony_demod_isdbs_Tune");
|
||||
|
||||
if ((!pDemod) || (!pTuneParam)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
if ((pDemod->state == SONY_DEMOD_STATE_ACTIVE) && (pDemod->system == SONY_DTV_SYSTEM_ISDBS)) {
|
||||
/* Demodulator Active and set to ISDB-S mode */
|
||||
/* Set TSID */
|
||||
result = SetTSID (pDemod, pTuneParam->tsid, pTuneParam->tsidType);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
result = AIStoAIS (pDemod);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
else if ((pDemod->state == SONY_DEMOD_STATE_ACTIVE) && (pDemod->system != SONY_DTV_SYSTEM_ISDBS)) {
|
||||
/* Demodulator Active but not ISDB-S mode */
|
||||
result = sony_demod_Sleep (pDemod);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
pDemod->system = SONY_DTV_SYSTEM_ISDBS;
|
||||
/* Set TSID */
|
||||
result = SetTSID (pDemod, pTuneParam->tsid, pTuneParam->tsidType);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
result = SLtoAIS (pDemod);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
else if (pDemod->state == SONY_DEMOD_STATE_SLEEP){
|
||||
/* Demodulator in Sleep mode */
|
||||
pDemod->system = SONY_DTV_SYSTEM_ISDBS;
|
||||
/* Set TSID */
|
||||
result = SetTSID (pDemod, pTuneParam->tsid, pTuneParam->tsidType);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
result = SLtoAIS (pDemod);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
else {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
pDemod->state = SONY_DEMOD_STATE_ACTIVE;
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
sony_result_t sony_demod_isdbs_Sleep (sony_demod_t * pDemod)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_demod_isdbs_Sleep");
|
||||
|
||||
if (!pDemod) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
if ((pDemod->state != SONY_DEMOD_STATE_SLEEP) && (pDemod->state != SONY_DEMOD_STATE_ACTIVE)) {
|
||||
/* This api is accepted in Sleep and Active states only */
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
if ((pDemod->state == SONY_DEMOD_STATE_ACTIVE) && (pDemod->system == SONY_DTV_SYSTEM_ISDBS)) {
|
||||
result = AIStoSL (pDemod);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
|
||||
pDemod->state = SONY_DEMOD_STATE_SLEEP;
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
sony_result_t sony_demod_isdbs_CheckTSLock (sony_demod_t * pDemod,
|
||||
sony_demod_lock_result_t * pLock)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
uint8_t agcLock = 0;
|
||||
uint8_t tsLock = 0;
|
||||
uint8_t tmccLock = 0;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_demod_isdbs_CheckTSLock");
|
||||
|
||||
if ((!pDemod) || (!pLock)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
if (pDemod->state != SONY_DEMOD_STATE_ACTIVE) {
|
||||
/* This api is accepted in Active state only */
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
result = sony_demod_isdbs_monitor_SyncStat(pDemod, &agcLock, &tsLock, &tmccLock);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
if(tsLock){
|
||||
*pLock = SONY_DEMOD_LOCK_RESULT_LOCKED;
|
||||
} else {
|
||||
*pLock = SONY_DEMOD_LOCK_RESULT_NOTDETECT;
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Static Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
static sony_result_t SetTSID(sony_demod_t * pDemod, uint16_t tsid, sony_isdbs_tsid_type_t tsidType)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
uint8_t data[3];
|
||||
|
||||
SONY_TRACE_ENTER("SetTSID");
|
||||
|
||||
/* Null check */
|
||||
if(!pDemod){
|
||||
SONY_TRACE_RETURN(SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
/* Range check */
|
||||
if((tsidType == SONY_ISDBS_TSID_TYPE_RELATIVE_TS_NUMBER) && (tsid >= 8)){
|
||||
SONY_TRACE_RETURN(SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
/* Set SLV-T Bank : 0xC0 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0xC0) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Set TSID or Relative TS number */
|
||||
data[0] = (uint8_t)((tsid >> 8) & 0xFF);
|
||||
data[1] = (uint8_t)(tsid & 0xFF);
|
||||
|
||||
/* Select TSID setting mode or relative TS setting mode */
|
||||
switch(tsidType)
|
||||
{
|
||||
case SONY_ISDBS_TSID_TYPE_TSID:
|
||||
/* TSID(16bit) */
|
||||
data[2] = 0x00;
|
||||
break;
|
||||
case SONY_ISDBS_TSID_TYPE_RELATIVE_TS_NUMBER:
|
||||
/* Relative TS number */
|
||||
data[2] = 0x01;
|
||||
break;
|
||||
default:
|
||||
SONY_TRACE_RETURN(SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
/*
|
||||
* slave Bank Addr Bit Default Setting Signal name
|
||||
* -------------------------------------------------------------------------------------------------
|
||||
* <SLV-T> C0h E9h [7:0] 8'h40 tsid[15:8] OTMTS1TSDT[15:8]
|
||||
* <SLV-T> C0h EAh [7:0] 8'hf2 tsid[7:0] OTMTS1TSDT[7:0]
|
||||
* <SLV-T> C0h EBh [0] 1'b0 1'b0: TSID setting mode OTMSELTSID_ARK
|
||||
* 1'b1: relative TS setting mode
|
||||
*/
|
||||
|
||||
if (pDemod->pI2c->WriteRegister(pDemod->pI2c, pDemod->i2cAddressSLVT, 0xE9, data, 3) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN(result);
|
||||
}
|
||||
|
||||
static sony_result_t SLtoAIS (sony_demod_t * pDemod)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
SONY_TRACE_ENTER ("SLtoAIS");
|
||||
|
||||
if (!pDemod) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
/* Configure TS clock Mode and Frequency. */
|
||||
result = sony_demod_SetTSClockModeAndFreq (pDemod, SONY_DTV_SYSTEM_ISDBS);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Set SLV-X Bank : 0x00 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVX, 0x00, 0x00) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Set demod mode */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVX, 0x17, 0x0C) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Set SLV-T Bank : 0x00 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0x00) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Disable S/S2 auto detection */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x2D, 0x00) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Set TS/TLV mode */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0xA9, 0x00) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Enable demod clock */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x2C, 0x01) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* SADC setting */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVX, 0x28, 0x31) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* SADC setting */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x4B, 0x31) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* SADC setting */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x6A, 0x00) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* SADC setting */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVX, 0x18, 0x00) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* ISDB-S initial setting
|
||||
*
|
||||
* slave Bank Addr Bit Default Value Signal name
|
||||
* --------------------------------------------------------------------------------
|
||||
* <SLV-T> 00h 20h [0] 8'h00 8'h01 OREG_RFAGC_SRST_OFF
|
||||
* <SLV-T> 00h CEh [0] 8'h01 8'h00 ONOPARITY
|
||||
* <SLV-T> 00h CFh [0] 8'h01 8'h00 ONOPARITY_MANUAL_ON
|
||||
* <SLV-T> AEh 20h [3:0] 8'h07 8'h07 OSYMBOLRATE[19:16]
|
||||
* <SLV-T> AEh 21h [7:0] 8'h37 8'h37 OSYMBOLRATE[15:8]
|
||||
* <SLV-T> AEh 22h [7:0] 8'h0A 8'h0A OSYMBOLRATE[7:0]
|
||||
*/
|
||||
/* Set SLV-T Bank : 0x00 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0x00) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x20, 0x01) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
{
|
||||
const uint8_t data[] = { 0x00, 0x00 };
|
||||
|
||||
if (pDemod->pI2c->WriteRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0xCE, data, sizeof (data)) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set SLV-T Bank : 0xAE */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0xAE) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
{
|
||||
const uint8_t data[] = {0x07, 0x37, 0x0A};
|
||||
|
||||
if (pDemod->pI2c->WriteRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x20, data, sizeof (data)) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
}
|
||||
|
||||
/* IQ Spectrum inversion
|
||||
* slave Bank Addr Bit Default Setting Signal name
|
||||
* --------------------------------------------------------------------------------
|
||||
* <SLV-T> A0h D7h [0] 8'h00 8'h01 OTUIF_POLAR
|
||||
*/
|
||||
/* Set SLV-T Bank : 0xA0 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0xA0) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0xD7,
|
||||
(uint8_t)((pDemod->satTunerIqSense == SONY_DEMOD_SAT_IQ_SENSE_INV)? 0x01 : 0x00)) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Set SLV-T Bank : 0x00 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0x00) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Disable HiZ Setting 1 (TAGC(Hi-Z), SAGC, TSVALID, TSSYNC, TSCLK) */
|
||||
if (sony_i2c_SetRegisterBits (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x80, 0x10, 0x1F) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* disable Hi-Z setting 2 */
|
||||
result = sony_demod_SetTSDataPinHiZ (pDemod, 0);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (SONY_RESULT_OK);
|
||||
}
|
||||
|
||||
static sony_result_t AIStoSL (sony_demod_t * pDemod)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
SONY_TRACE_ENTER ("AIStoSL");
|
||||
|
||||
if (!pDemod) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
/* Disable TS output */
|
||||
result = sony_demod_SetStreamOutput (pDemod, 0);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Set SLV-T Bank : 0x00 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0x00) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Enable Hi-Z setting 1 (TAGC, SAGC, TSVALID, TSSYNC, TSCLK) */
|
||||
if (sony_i2c_SetRegisterBits (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x80, 0x1F, 0x1F) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Enable Hi-Z setting 2 */
|
||||
result = sony_demod_SetTSDataPinHiZ (pDemod, 1);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* ---- */
|
||||
|
||||
/* Set SLV-X Bank : 0x00 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVX, 0x00, 0x00) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* SADC setting */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVX, 0x18, 0x01) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Set SLV-T Bank : 0x00 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0x00) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* SADC setting */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x6A, 0x11) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* SADC setting */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x4B, 0x21) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* SADC setting */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVX, 0x28, 0x13) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Demodulator SW reset */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0xFE, 0x01) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Disable demodulator clock */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x2C, 0x00) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Set tstlv mode to default */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0xA9, 0x00) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Disable S/S2 auto detection */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x2D, 0x00) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Set demodulator mode to default */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVX, 0x17, 0x01) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* ---- */
|
||||
|
||||
/* Set SLV-T Bank : 0xA0 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0xA0) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
/* OTUIF_POLAR[0] */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0xD7, 0x00) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (SONY_RESULT_OK);
|
||||
}
|
||||
|
||||
static sony_result_t AIStoAIS (sony_demod_t * pDemod)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
SONY_TRACE_ENTER ("AIStoAIS");
|
||||
|
||||
if (!pDemod) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
/* Disable TS output */
|
||||
result = sony_demod_SetStreamOutput (pDemod, 0);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (SONY_RESULT_OK);
|
||||
}
|
||||
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2018 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2018/07/27
|
||||
Modification ID : ff73ffebff57618d6a5aa6e2aa9eb009b86060d1
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@file sony_demod_isdbs.h
|
||||
|
||||
This file provides the demodulator control interface specific to ISDB-S.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SONY_DEMOD_ISDBS_H
|
||||
#define SONY_DEMOD_ISDBS_H
|
||||
|
||||
#include "sony_common.h"
|
||||
#include "sony_demod.h"
|
||||
#include "sony_isdbs.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Structs
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief The tune parameters for a ISDB-S signal
|
||||
*/
|
||||
typedef struct sony_isdbs_tune_param_t {
|
||||
uint32_t centerFreqKHz; /**< Center frequency(kHz) of the ISDB-S channel */
|
||||
uint16_t tsid; /**< TSID */
|
||||
sony_isdbs_tsid_type_t tsidType; /**< TSID Type */
|
||||
} sony_isdbs_tune_param_t;
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Enable acquisition on the demodulator for ISDB-S channels.
|
||||
|
||||
Called from the integration layer ::sony_integ_isdbs_Tune API.
|
||||
|
||||
@param pDemod The demodulator instance
|
||||
@param pTuneParam The tune parameters.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs_Tune (sony_demod_t * pDemod,
|
||||
sony_isdbs_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_demod_Sleep API.
|
||||
|
||||
@param pDemod The demodulator instance
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs_Sleep (sony_demod_t * pDemod);
|
||||
|
||||
/**
|
||||
@brief Check ISDB-S TS lock status.
|
||||
|
||||
@note This API is for checking lock status in tuning stage.
|
||||
After tuning (while receiving the signal),
|
||||
please use sony_demod_isdbs_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_isdbs_CheckTSLock (sony_demod_t * pDemod,
|
||||
sony_demod_lock_result_t * pLock);
|
||||
|
||||
#endif /* SONY_DEMOD_ISDBS_H */
|
||||
+793
@@ -0,0 +1,793 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2019 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2019/10/04
|
||||
Modification ID : ae1245fdaf66401838902e7214d8494b0f5e5a76
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
#include "sony_demod_isdbs3.h"
|
||||
#include "sony_demod_isdbs3_monitor.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Static Function Prototypes
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Configure the demodulator from Sleep to Active ISDB-S3.
|
||||
*/
|
||||
static sony_result_t SLtoAIS3 (sony_demod_t * pDemod);
|
||||
|
||||
/**
|
||||
@brief Configure the demodulator from Active ISDB-S3 to Sleep.
|
||||
*/
|
||||
static sony_result_t AIS3toSL (sony_demod_t * pDemod);
|
||||
|
||||
/**
|
||||
@brief Configure the demodulator from Active ISDB-S3 to Active ISDB-S3.
|
||||
*/
|
||||
static sony_result_t AIS3toAIS3 (sony_demod_t * pDemod);
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
sony_result_t sony_demod_isdbs3_Tune (sony_demod_t * pDemod,
|
||||
sony_isdbs3_tune_param_t * pTuneParam)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
SONY_TRACE_ENTER ("sony_demod_isdbs3_Tune");
|
||||
|
||||
if ((!pDemod) || (!pTuneParam)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
if ((pDemod->state == SONY_DEMOD_STATE_ACTIVE) && (pDemod->system == SONY_DTV_SYSTEM_ISDBS3)) {
|
||||
/* Demodulator Active and set to ISDB-S3 mode */
|
||||
/* Set StreamID */
|
||||
result = sony_demod_isdbs3_SetStreamID (pDemod, pTuneParam->streamid, pTuneParam->streamidType);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
result = AIS3toAIS3 (pDemod);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
else if ((pDemod->state == SONY_DEMOD_STATE_ACTIVE) && (pDemod->system != SONY_DTV_SYSTEM_ISDBS3)) {
|
||||
/* Demodulator Active but not ISDB-S3 mode */
|
||||
result = sony_demod_Sleep (pDemod);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
pDemod->system = SONY_DTV_SYSTEM_ISDBS3;
|
||||
/* Set StreamID */
|
||||
result = sony_demod_isdbs3_SetStreamID (pDemod, pTuneParam->streamid, pTuneParam->streamidType);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
result = SLtoAIS3 (pDemod);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
else if (pDemod->state == SONY_DEMOD_STATE_SLEEP){
|
||||
/* Demodulator in Sleep mode */
|
||||
pDemod->system = SONY_DTV_SYSTEM_ISDBS3;
|
||||
/* Set StreamID */
|
||||
result = sony_demod_isdbs3_SetStreamID (pDemod, pTuneParam->streamid, pTuneParam->streamidType);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
result = SLtoAIS3 (pDemod);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
else {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
pDemod->state = SONY_DEMOD_STATE_ACTIVE;
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
sony_result_t sony_demod_isdbs3_Sleep (sony_demod_t * pDemod)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_demod_isdbs3_Sleep");
|
||||
|
||||
if (!pDemod) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
if ((pDemod->state != SONY_DEMOD_STATE_SLEEP) && (pDemod->state != SONY_DEMOD_STATE_ACTIVE)) {
|
||||
/* This api is accepted in Sleep and Active states only */
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
if ((pDemod->state == SONY_DEMOD_STATE_ACTIVE) && (pDemod->system == SONY_DTV_SYSTEM_ISDBS3)) {
|
||||
result = AIS3toSL (pDemod);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
|
||||
pDemod->state = SONY_DEMOD_STATE_SLEEP;
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
sony_result_t sony_demod_isdbs3_CheckTMCCLock (sony_demod_t * pDemod,
|
||||
sony_demod_lock_result_t * pLock)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
uint8_t agcLock = 0;
|
||||
uint8_t tstlvLock = 0;
|
||||
uint8_t tmccLock = 0;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_demod_isdbs3_CheckTMCCLock");
|
||||
|
||||
if ((!pDemod) || (!pLock)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
if (pDemod->state != SONY_DEMOD_STATE_ACTIVE) {
|
||||
/* This api is accepted in Active state only */
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
result = sony_demod_isdbs3_monitor_SyncStat(pDemod, &agcLock, &tstlvLock, &tmccLock);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
if(tmccLock){
|
||||
*pLock = SONY_DEMOD_LOCK_RESULT_LOCKED;
|
||||
} else {
|
||||
*pLock = SONY_DEMOD_LOCK_RESULT_NOTDETECT;
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
sony_result_t sony_demod_isdbs3_CheckTSTLVLock (sony_demod_t * pDemod,
|
||||
sony_demod_lock_result_t * pLock)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
uint8_t agcLock = 0;
|
||||
uint8_t tstlvLock = 0;
|
||||
uint8_t tmccLock = 0;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_demod_isdbs3_CheckTSTLVLock");
|
||||
|
||||
if ((!pDemod) || (!pLock)) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
if (pDemod->state != SONY_DEMOD_STATE_ACTIVE) {
|
||||
/* This api is accepted in Active state only */
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
result = sony_demod_isdbs3_monitor_SyncStat (pDemod, &agcLock, &tstlvLock, &tmccLock);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
if (tstlvLock) {
|
||||
*pLock = SONY_DEMOD_LOCK_RESULT_LOCKED;
|
||||
} else {
|
||||
*pLock = SONY_DEMOD_LOCK_RESULT_NOTDETECT;
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
sony_result_t sony_demod_isdbs3_SetStreamID (sony_demod_t * pDemod,
|
||||
uint16_t streamid,
|
||||
sony_isdbs3_streamid_type_t streamidType)
|
||||
{
|
||||
uint8_t data[2];
|
||||
|
||||
SONY_TRACE_ENTER ("sony_demod_isdbs3_SetStreamID");
|
||||
|
||||
/* Null check */
|
||||
if (!pDemod) {
|
||||
SONY_TRACE_RETURN(SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
/* Set SLV-T Bank : 0xD0 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0xD0) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
if (SONY_DEMOD_CHIP_ID_2878_FAMILY (pDemod->chipId)) {
|
||||
if (streamidType == SONY_ISDBS3_STREAMID_TYPE_RELATIVE_STREAM_NUMBER) {
|
||||
/*
|
||||
* slave Bank Addr Bit Default Setting Signal name
|
||||
* -------------------------------------------------------------------------
|
||||
* <SLV-T> D0h 8Ah [3:0] 8'h00 8'hXX OREGD_RELEVANT_STREAM_ID_ARK2[3:0]
|
||||
* <SLV-T> D0h 8Ah [4] 8'h00 8'h01 OREGD_RELEVANT_MODE_ON_ARK2
|
||||
*/
|
||||
if (streamid > 15) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x8A, (uint8_t)(0x10 | streamid)) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (SONY_RESULT_OK);
|
||||
} else {
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x8A, 0x00) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* slave Bank Addr Bit Default Setting Signal name
|
||||
* -------------------------------------------------------------------------
|
||||
* <SLV-T> D0h 87h [7:0] 8'h00 8'h40 OSTREAM_ID[15:8]
|
||||
* <SLV-T> D0h 88h [7:0] 8'h00 8'hF2 OSTREAM_ID[7:0]
|
||||
*/
|
||||
/* Set StreamID */
|
||||
data[0] = (uint8_t)((streamid >> 8) & 0xFF);
|
||||
data[1] = (uint8_t)(streamid & 0xFF);
|
||||
|
||||
if (pDemod->pI2c->WriteRegister(pDemod->pI2c, pDemod->i2cAddressSLVT, 0x87, data, 2) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (SONY_RESULT_OK);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Static Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
static sony_result_t SLtoAIS3 (sony_demod_t * pDemod)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
SONY_TRACE_ENTER ("SLtoAIS3");
|
||||
|
||||
if (!pDemod) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
#ifdef SONY_DEMOD_SUPPORT_TLV
|
||||
if (pDemod->isdbs3Output == SONY_DEMOD_OUTPUT_ISDBS3_TLV) {
|
||||
/* Configure TLV clock Mode and Frequency. */
|
||||
result = sony_demod_SetTLVClockModeAndFreq (pDemod, SONY_DTV_SYSTEM_ISDBS3);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
/* Configure TS clock Mode and Frequency. */
|
||||
result = sony_demod_SetTSClockModeAndFreq (pDemod, SONY_DTV_SYSTEM_ISDBS3);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set SLV-X Bank : 0x00 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVX, 0x00, 0x00) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Set demod mode */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVX, 0x17, 0x0D) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Set SLV-T Bank : 0x00 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0x00) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Disable S/S2 auto detection */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x2D, 0x00) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Set TS/TLV mode */
|
||||
{
|
||||
uint8_t data = 0;
|
||||
|
||||
if (pDemod->isdbs3Output == SONY_DEMOD_OUTPUT_ISDBS3_TLV) {
|
||||
data = 0x01;
|
||||
} else {
|
||||
data = 0x00;
|
||||
}
|
||||
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0xA9, data) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
}
|
||||
|
||||
/* Enable demod clock */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x2C, 0x01) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* SADC setting */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVX, 0x28, 0x31) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* SADC setting */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x4B, 0x31) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* SADC setting */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x6A, 0x00) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* SADC setting */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVX, 0x18, 0x00) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* ISDB-S3 initial setting
|
||||
*
|
||||
* slave Bank Addr Bit Default Value Signal name
|
||||
* --------------------------------------------------------------------------------
|
||||
* <SLV-T> 00h 20h [0] 8'h00 8'h01 OREG_RFAGC_SRST_OFF
|
||||
* <SLV-T> DAh BCh [1:0] 8'h00 8'h02 OTMCCCHGTRK[1:0]
|
||||
*/
|
||||
/* Set SLV-T Bank : 0x00 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0x00) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x20, 0x01) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Set SLV-T Bank : 0xDA */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0xDA) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0xBC, 0x02) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
if (SONY_DEMOD_CHIP_ID_2856_FAMILY (pDemod->chipId)) {
|
||||
/* ISDB-S3 initial setting (CXD2856 family)
|
||||
*
|
||||
* slave Bank Addr Bit Default Value Signal name
|
||||
* --------------------------------------------------------------------------------
|
||||
* <SLV-T> A3h 43h [3:0] 8'h0A 8'h0B OBBAGC_LPGAINBF[3:0]
|
||||
* <SLV-T> A3h 44h [3:0] 8'h0A 8'h0B OBBAGC_LPGAINAF[3:0]
|
||||
* <SLV-T> AEh 46h [7:0] 8'h05 8'h04 OM_C_TH[15:8]
|
||||
* <SLV-T> AEh 47h [7:0] 8'h78 8'h91 OM_C_TH[7:0]
|
||||
* <SLV-T> B6h 74h [7:0] 8'h4A 8'h59 OM_K_A[15:8]
|
||||
* <SLV-T> D5h 61h [7:0] 8'h38 8'h48 OH_K_A[7:0]
|
||||
* <SLV-T> D5h 62h [7:0] 8'h6E 8'hFE OH_K_C[7:0]
|
||||
* <SLV-T> D5h 63h [7:0] 8'hCE 8'h4E OH_K_F1[7:0]
|
||||
* <SLV-T> D5h 64h [7:0] 8'hCE 8'h6E OH_K_F2[7:0]
|
||||
* <SLV-T> D5h 65h [7:0] 8'hAE 8'hFE OH_B_A[7:0]
|
||||
* <SLV-T> D5h 67h [7:0] 8'hFE 8'h4E OH_B_F1[7:0]
|
||||
* <SLV-T> D5h 68h [7:0] 8'hCE 8'h6E OH_B_F2[7:0]
|
||||
* <SLV-T> D5h 90h [7:0] 8'h08 8'h10 OH_T_A[7:0]
|
||||
* <SLV-T> D5h 91h [7:0] 8'h02 8'h03 OH_T_C[7:0]
|
||||
* <SLV-T> D5h 92h [7:0] 8'h12 8'h10 OH_T_F1[7:0]
|
||||
* <SLV-T> D6h 18h [7:0] 8'h2E 8'h33 OL_C_TH[15:8]
|
||||
* <SLV-T> D6h 19h [7:0] 8'hE0 8'hEB OL_C_TH[7:0]
|
||||
* <SLV-T> D6h 1Ch [7:0] 8'h5B 8'h59 OL_K_A[7:0]
|
||||
* <SLV-T> D6h 1Eh [7:0] 8'hCE 8'h6E OL_K_F1[7:0]
|
||||
* <SLV-T> D6h 21h [7:0] 8'hFE 8'h4E OL_B_F1[7:0]
|
||||
* <SLV-T> D6h 22h [7:0] 8'hFF 8'h80 OL_T_A[7:0]
|
||||
* <SLV-T> D6h 23h [7:0] 8'h95 8'h80 OL_T_C[7:0]
|
||||
* <SLV-T> D6h 24h [7:0] 8'h7C 8'h10 OL_T_F1[7:0]
|
||||
* <SLV-T> D6h 51h [7:0] 8'hB1 8'hB3 OCPRL_G1MAX_K_ARK2[3:0],OCPRL_G1MIN_K_ARK2[3:0]
|
||||
* <SLV-T> D6h 52h [7:0] 8'hB1 8'hB3 OCPRL_G1MAX_B_ARK2[3:0],OCPRL_G1MIN_B_ARK2[3:0]
|
||||
* <SLV-T> D6h 53h [7:0] 8'hC2 8'hC3 OCPRL_G1MAX_D_ARK2[3:0],OCPRL_G1MIN_D_ARK2[3:0]
|
||||
* <SLV-T> DAh D6h [7:4] 8'h90 8'h60 OTSLK_GOODIDX_B_ARK2[3:0]
|
||||
* <SLV-T> DAh D7h [7:4] 8'h90 8'h70 OTSLK_GOODIDX_Q_ARK2[3:0]
|
||||
*/
|
||||
|
||||
/* Set SLV-T Bank : 0xA3 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0xA3) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
{
|
||||
const uint8_t data[] = {0x0B, 0x0B};
|
||||
|
||||
if (pDemod->pI2c->WriteRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x43, data, sizeof (data)) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set SLV-T Bank : 0xAE */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0xAE) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
{
|
||||
const uint8_t data[] = {0x04, 0x91};
|
||||
|
||||
if (pDemod->pI2c->WriteRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x46, data, sizeof (data)) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set SLV-T Bank : 0xB6 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0xB6) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x74, 0x59) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Set SLV-T Bank : 0xD5 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0xD5) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
{
|
||||
const uint8_t data[] = {0x48, 0xFE, 0x4E, 0x6E, 0xFE};
|
||||
|
||||
if (pDemod->pI2c->WriteRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x61, data, sizeof (data)) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const uint8_t data[] = {0x4E, 0x6E};
|
||||
|
||||
if (pDemod->pI2c->WriteRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x67, data, sizeof (data)) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const uint8_t data[] = {0x10, 0x03, 0x10};
|
||||
|
||||
if (pDemod->pI2c->WriteRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x90, data, sizeof (data)) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set SLV-T Bank : 0xD6 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0xD6) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
{
|
||||
const uint8_t data[] = {0x33, 0xEB};
|
||||
|
||||
if (pDemod->pI2c->WriteRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x18, data, sizeof (data)) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
}
|
||||
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x1C, 0x59) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x1E, 0x6E) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
{
|
||||
const uint8_t data[] = {0x4E, 0x80, 0x80, 0x10};
|
||||
|
||||
if (pDemod->pI2c->WriteRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x21, data, sizeof (data)) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const uint8_t data[] = {0xB3, 0xB3, 0xC3};
|
||||
|
||||
if (pDemod->pI2c->WriteRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x51, data, sizeof (data)) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set SLV-T Bank : 0xDA */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0xDA) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
{
|
||||
const uint8_t data[] = {0x60, 0x70};
|
||||
|
||||
if (pDemod->pI2c->WriteRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0xD6, data, sizeof (data)) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
}
|
||||
} else if (SONY_DEMOD_CHIP_ID_2878_FAMILY (pDemod->chipId)) {
|
||||
/* ISDB-S3 initial setting (CXD2878 family)
|
||||
*
|
||||
* slave Bank Addr Bit Default Value Signal name
|
||||
* --------------------------------------------------------------------------------
|
||||
* <SLV-T> D3h F9h [2:0] 8'h05 8'h06 OFMTD_SYNCVALSTATE_ARK2[2:0]
|
||||
* <SLV-T> B6h 84h [3:0] 8'h03 8'h04 OCPRL_FALSELOCK2_DETTH[11:8]
|
||||
* <SLV-T> B6h 85h [7:0] 8'hE8 8'hB0 OCPRL_FALSELOCK2_DETTH[7:0]
|
||||
* <SLV-T> D4h C1h [0] 8'h00 8'h01 OTRL_TEDCHANGE_AR2P
|
||||
* <SLV-T> A4h 90h [0] 8'h01 8'h00 ORFAGC_ATGON_ARK2
|
||||
*/
|
||||
|
||||
/* Set SLV-T Bank : 0xD3 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0xD3) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0xF9, 0x06) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Set SLV-T Bank : 0xB6 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0xB6) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
{
|
||||
const uint8_t data[] = {0x04, 0xB0};
|
||||
|
||||
if (pDemod->pI2c->WriteRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x84, data, sizeof (data)) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
}
|
||||
|
||||
/* Set SLV-T Bank : 0xD4 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0xD4) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0xC1, 0x01) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Set SLV-T Bank : 0xA4 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0xA4) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x90, 0x00) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
} else {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_OTHER);
|
||||
}
|
||||
|
||||
/* ISDB-S3 symbol rate setting
|
||||
* slave Bank Addr Bit Default Value Signal name
|
||||
* --------------------------------------------------------------------------------
|
||||
* <SLV-T> AEh 20h [3:0] 8'h07 8'h08 OSYMBOLRATE[19:16]
|
||||
* <SLV-T> AEh 21h [7:0] 8'h37 8'h70 OSYMBOLRATE[15:8]
|
||||
* <SLV-T> AEh 22h [7:0] 8'h0A 8'h64 OSYMBOLRATE[7:0]
|
||||
*/
|
||||
/* Set SLV-T Bank : 0xAE */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0xAE) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
{
|
||||
const uint8_t data[] = {0x08, 0x70, 0x64};
|
||||
|
||||
if (pDemod->pI2c->WriteRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x20, data, sizeof (data)) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
}
|
||||
|
||||
/* TLV error packet setting (CXD2856 family)
|
||||
* slave Bank Addr Bit default Value Name
|
||||
* ---------------------------------------------------------------------------------
|
||||
* <SLV-T> DAh CBh [0] 8'h00 8'h01 OERRPKT_ON
|
||||
* <SLV-T> DAh C1h [0] 8'h00 8'h01 OLENDIVERRPKT
|
||||
*/
|
||||
if (SONY_DEMOD_CHIP_ID_2856_FAMILY (pDemod->chipId)) {
|
||||
/* Set SLV-T Bank : 0xDA */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0xDA) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0xCB, 0x01) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0xC1, 0x01) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
}
|
||||
|
||||
/* TLV output setting (CXD2878 family)
|
||||
* slave Bank Addr Bit default Value Name
|
||||
* ---------------------------------------------------------------------------------
|
||||
* <SLV-T> 01h E8h [0] 8'h00 8'h01 OTLV_WFMT_TIMER_OFF
|
||||
*/
|
||||
if (SONY_DEMOD_CHIP_ID_2878_FAMILY (pDemod->chipId)) {
|
||||
/* Set SLV-T Bank : 0x01 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0x01) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0xE8, 0x01) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
}
|
||||
|
||||
/* IQ Spectrum inversion
|
||||
* slave Bank Addr Bit Default Setting Signal name
|
||||
* --------------------------------------------------------------------------------
|
||||
* <SLV-T> A0h D7h [0] 8'h00 8'h01 OTUIF_POLAR
|
||||
*/
|
||||
/* Set SLV-T Bank : 0xA0 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0xA0) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0xD7,
|
||||
(uint8_t)((pDemod->satTunerIqSense == SONY_DEMOD_SAT_IQ_SENSE_INV)? 0x01 : 0x00)) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Set SLV-T Bank : 0x00 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0x00) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Disable HiZ Setting 1 (TAGC(Hi-Z), SAGC, TSVALID, TSSYNC, TSCLK) */
|
||||
if (sony_i2c_SetRegisterBits (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x80, 0x10, 0x1F) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* disable Hi-Z setting 2 */
|
||||
result = sony_demod_SetTSDataPinHiZ (pDemod, 0);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (SONY_RESULT_OK);
|
||||
}
|
||||
|
||||
static sony_result_t AIS3toSL (sony_demod_t * pDemod)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
SONY_TRACE_ENTER ("AIS3toSL");
|
||||
|
||||
if (!pDemod) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
/* Disable TS/TLV output */
|
||||
result = sony_demod_SetStreamOutput (pDemod, 0);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Set SLV-T Bank : 0x00 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0x00) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Enable Hi-Z setting 1 (TAGC, SAGC, TSVALID, TSSYNC, TSCLK) */
|
||||
if (sony_i2c_SetRegisterBits (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x80, 0x1F, 0x1F) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Enable Hi-Z setting 2 */
|
||||
result = sony_demod_SetTSDataPinHiZ (pDemod, 1);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* ISDB-S3 Cancel Setting
|
||||
* slave Bank Addr Bit Default Value Signal name
|
||||
* --------------------------------------------------------------------------------
|
||||
* <SLV-T> A3h 43h [3:0] 8'h0A 8'h0A OBBAGC_LPGAINBF[3:0]
|
||||
* <SLV-T> A3h 44h [3:0] 8'h0A 8'h0A OBBAGC_LPGAINAF[3:0]
|
||||
*/
|
||||
/* Set SLV-T Bank : 0xA3 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0xA3) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
{
|
||||
const uint8_t data[] = {0x0A, 0x0A};
|
||||
|
||||
if (pDemod->pI2c->WriteRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x43, data, sizeof (data)) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
}
|
||||
|
||||
/* ---- */
|
||||
|
||||
/* Set SLV-X Bank : 0x00 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVX, 0x00, 0x00) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* SADC setting */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVX, 0x18, 0x01) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Set SLV-T Bank : 0x00 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0x00) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* SADC setting */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x6A, 0x11) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* SADC setting */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x4B, 0x21) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* SADC setting */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVX, 0x28, 0x13) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Demodulator SW reset */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0xFE, 0x01) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Disable demodulator clock */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x2C, 0x00) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Set tstlv mode to default */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0xA9, 0x00) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Disable S/S2 auto detection */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x2D, 0x00) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* Set demodulator mode to default */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVX, 0x17, 0x01) != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
/* ---- */
|
||||
|
||||
/* Set SLV-T Bank : 0xA0 */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0x00, 0xA0) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
/* OTUIF_POLAR[0] */
|
||||
if (pDemod->pI2c->WriteOneRegister (pDemod->pI2c, pDemod->i2cAddressSLVT, 0xD7, 0x00) != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_I2C);
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (SONY_RESULT_OK);
|
||||
}
|
||||
|
||||
static sony_result_t AIS3toAIS3 (sony_demod_t * pDemod)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
SONY_TRACE_ENTER ("AIS3toAIS3");
|
||||
|
||||
if (!pDemod) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
/* Disable TS/TLV output */
|
||||
result = sony_demod_SetStreamOutput (pDemod, 0);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (SONY_RESULT_OK);
|
||||
}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2019 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2019/02/14
|
||||
Modification ID : 83dbabba2734697e67e3d44647acf57b272c2caf
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@file sony_demod_isdbs3.h
|
||||
|
||||
This file provides the demodulator control interface specific to ISDB-S3.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SONY_DEMOD_ISDBS3_H
|
||||
#define SONY_DEMOD_ISDBS3_H
|
||||
|
||||
#include "../sony_common.h"
|
||||
#include "../sony_demod.h"
|
||||
#include "sony_isdbs3.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Structs
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief The tune parameters for a ISDB-S3 signal
|
||||
*/
|
||||
typedef struct sony_isdbs3_tune_param_t {
|
||||
uint32_t centerFreqKHz; /**< Center frequency(kHz) of the ISDB-S3 channel */
|
||||
uint16_t streamid; /**< StreamID */
|
||||
sony_isdbs3_streamid_type_t streamidType; /**< StreamID Type */
|
||||
} sony_isdbs3_tune_param_t;
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Enable acquisition on the demodulator for ISDB-S3 channels. Called from
|
||||
the integration layer ::sony_integ_isdbs3_Tune API.
|
||||
|
||||
@param pDemod The demodulator instance
|
||||
@param pTuneParam The tune parameters.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_Tune (sony_demod_t * pDemod,
|
||||
sony_isdbs3_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_demod_Sleep API.
|
||||
|
||||
@param pDemod The demodulator instance
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_Sleep (sony_demod_t * pDemod);
|
||||
|
||||
/**
|
||||
@brief Check ISDB-S3 TMCC lock status.
|
||||
|
||||
@note This API is for checking lock status in tuning stage.
|
||||
After tuning (while receiving the signal),
|
||||
please use sony_demod_isdbs3_monitor_SyncStat instead
|
||||
to check current lock status.
|
||||
|
||||
@param pDemod The demodulator instance
|
||||
@param pLock TMCC lock state
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_CheckTMCCLock (sony_demod_t * pDemod,
|
||||
sony_demod_lock_result_t * pLock);
|
||||
|
||||
/**
|
||||
@brief Check ISDB-S3 TSTLV lock status.
|
||||
|
||||
@note This API is for checking lock status in tuning stage.
|
||||
After tuning (while receiving the signal),
|
||||
please use sony_demod_isdbs3_monitor_SyncStat instead
|
||||
to check current lock status.
|
||||
|
||||
@param pDemod The demodulator instance
|
||||
@param pLock TSTLV lock state
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_CheckTSTLVLock (sony_demod_t * pDemod,
|
||||
sony_demod_lock_result_t * pLock);
|
||||
|
||||
|
||||
/**
|
||||
@brief Set ISDB-S3 Stream ID.
|
||||
|
||||
Only CXD2878 family has feature to set relative stream number.
|
||||
CXD2856 family ignores streamidType.
|
||||
|
||||
@param pDemod The demodulator instance
|
||||
@param streamid Stream ID
|
||||
@param streamidType Stream ID type. (16bit stream ID or relative stream number)
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_SetStreamID (sony_demod_t * pDemod,
|
||||
uint16_t streamid,
|
||||
sony_isdbs3_streamid_type_t streamidType);
|
||||
|
||||
#endif /* SONY_DEMOD_ISDBS3_H */
|
||||
+2294
File diff suppressed because it is too large
Load Diff
+311
@@ -0,0 +1,311 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2019 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2019/02/14
|
||||
Modification ID : 83dbabba2734697e67e3d44647acf57b272c2caf
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@file sony_demod_isdbs3_monitor.h
|
||||
|
||||
This file provides the ISDB-S3 demodulator monitor interface.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SONY_DEMOD_ISDBS3_MONITOR_H
|
||||
#define SONY_DEMOD_ISDBS3_MONITOR_H
|
||||
|
||||
#include "../sony_demod.h"
|
||||
#include "sony_isdbs3.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Defines
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
#define SONY_DEMOD_ISDBS3_MONITOR_PRELDPCBER_INVALID 0xFFFFFFFF /**< BER value if the BER value is invalid */
|
||||
#define SONY_DEMOD_ISDBS3_MONITOR_PREBCHBER_INVALID 0xFFFFFFFF /**< BER value if the BER value is invalid */
|
||||
#define SONY_DEMOD_ISDBS3_MONITOR_POSTBCHFER_INVALID 0xFFFFFFFF /**< FER value if the FER value is invalid */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Monitors the synchronisation state of the demodulator.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pAGCLockStat Indicates the AGC lock condition.
|
||||
- 0: AGC not locked.
|
||||
- 1: AGC locked.
|
||||
@param pTSTLVLockStat Indicates the TSTLV lock condition.
|
||||
- 0: TSTLV not locked.
|
||||
- 1: TSTLV locked.
|
||||
@param pTMCCLockStat Indicates TMCC lock condition.
|
||||
- 0: TMCC not locked.
|
||||
- 1: TMCC locked.
|
||||
|
||||
@return SONY_RESULT_OK if pAGCLockStat, pTSTLVLockStat and pTMCCLockStat is valid,
|
||||
otherwise an error is returned..
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_monitor_SyncStat (sony_demod_t * pDemod,
|
||||
uint8_t * pAGCLockStat,
|
||||
uint8_t * pTSTLVLockStat,
|
||||
uint8_t * pTMCCLockStat);
|
||||
|
||||
/**
|
||||
@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 The detected carrier offset in KHz.
|
||||
|
||||
@return SONY_RESULT_OK if pOffset is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_monitor_CarrierOffset (sony_demod_t * pDemod,
|
||||
int32_t * pOffset);
|
||||
|
||||
/**
|
||||
@brief Monitor the IFAGC value of ISDB-S3 demodulator.
|
||||
|
||||
Actual dB gain dependent on attached tuner.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pIFAGCOut The IFAGC output register value. Range 0 - 0x1FFF. Unitless.
|
||||
|
||||
@return SONY_RESULT_OK if pIFAGC is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_monitor_IFAGCOut (sony_demod_t * pDemod,
|
||||
uint32_t * pIFAGCOut);
|
||||
|
||||
/**
|
||||
@brief Monitor the I/Q sense of ISDB-S3 demodulator.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pSense The detected I/Q sense.
|
||||
|
||||
@return SONY_RESULT_OK if pSense is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_monitor_IQSense (sony_demod_t * pDemod,
|
||||
sony_demod_sat_iq_sense_t * pSense);
|
||||
|
||||
/**
|
||||
@brief Monitor the CNR estimation made by the demodulator.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pCNR The returned CNR in dB x 1000.
|
||||
|
||||
@return SONY_RESULT_OK if pCNR is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_monitor_CNR (sony_demod_t * pDemod,
|
||||
int32_t * pCNR);
|
||||
|
||||
/**
|
||||
@brief Monitor pre LDPC BER for each layer.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pBERH The estimated high hierarchy BER * 10^7.
|
||||
@param pBERL The estimated low hierarchy BER * 10^7.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_monitor_PreLDPCBER (sony_demod_t * pDemod,
|
||||
uint32_t * pBERH, uint32_t * pBERL);
|
||||
|
||||
/**
|
||||
@brief Monitor pre BCH BER for each layer.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pBERH The estimated high hierarchy BER * 10^9.
|
||||
@param pBERL The estimated low hierarchy BER * 10^9.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_monitor_PreBCHBER (sony_demod_t * pDemod,
|
||||
uint32_t * pBERH, uint32_t * pBERL);
|
||||
|
||||
/**
|
||||
@brief Monitor post BCH FER for each layer.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pFERH The estimated high hierarchy FER * 10^6.
|
||||
@param pFERL The estimated low hierarchy FER * 10^6.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_monitor_PostBCHFER (sony_demod_t * pDemod,
|
||||
uint32_t * pFERH, uint32_t * pFERL);
|
||||
|
||||
/**
|
||||
@brief Monitor the TMCC information
|
||||
|
||||
@param pDemod The demod instance.
|
||||
@param pTMCCInfo TMCC information struct instance.
|
||||
|
||||
@return SONY_RESULT_OK if successful and pTMCCInfo is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_monitor_TMCCInfo (sony_demod_t * pDemod,
|
||||
sony_isdbs3_tmcc_info_t * pTMCCInfo);
|
||||
|
||||
/**
|
||||
@brief Monitor the modulation, code rate of high/low hierarchies in currently tuned stream.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pModH The high hierarchy modulation.
|
||||
@param pModL The low hierarchy modulation.
|
||||
@param pCodH The high hierarchy code rate.
|
||||
@param pCodL The low hierarchy code rate.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_monitor_ModCod (sony_demod_t * pDemod,
|
||||
sony_isdbs3_mod_t * pModH, sony_isdbs3_mod_t * pModL,
|
||||
sony_isdbs3_cod_t * pCodH, sony_isdbs3_cod_t * pCodL);
|
||||
|
||||
/**
|
||||
@brief Monitor the valid slot number of high/low hierarchies in currently tuned stream.
|
||||
|
||||
@note This API is supported in CXD2878 family only.
|
||||
|
||||
This API returns *valid slot number*.
|
||||
For example, 16APSK case, if allocated slot number is 40, the returned valid slot number is 32.
|
||||
|
||||
Modulation | Slot unit | Valid slot number
|
||||
-----------|-----------|-------------------
|
||||
16APSK | 5 | 4
|
||||
8PSK | 5 | 3
|
||||
QPSK | 5 | 2
|
||||
BPSK | 5 | 1
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pSlotNumH The high hierarchy valid slot number.
|
||||
@param pSlotNumL The low hierarchy valid slot number.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_monitor_ValidSlotNum (sony_demod_t * pDemod,
|
||||
uint8_t * pSlotNumH, uint8_t * pSlotNumL);
|
||||
|
||||
/**
|
||||
@brief Monitor the modulation, code rate and slot number of high/low hierarchies in currently tuned stream.
|
||||
|
||||
@note This monitor uses TMCC information by ::sony_demod_isdbs3_monitor_TMCCInfo.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pTmccInfo TMCC information struct instance.
|
||||
@param pModH The high hierarchy modulation.
|
||||
@param pModL The low hierarchy modulation.
|
||||
@param pCodH The high hierarchy code rate.
|
||||
@param pCodL The low hierarchy code rate.
|
||||
@param pSlotNumH The high hierarchy slot number.
|
||||
@param pSlotNumL The low hierarchy slot number.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_monitor_CurrentStreamModCodSlotNum (sony_demod_t *pDemod, sony_isdbs3_tmcc_info_t * pTmccInfo,
|
||||
sony_isdbs3_mod_t * pModH, sony_isdbs3_mod_t * pModL,
|
||||
sony_isdbs3_cod_t * pCodH, sony_isdbs3_cod_t * pCodL,
|
||||
uint8_t * pSlotNumH, uint8_t * pSlotNumL);
|
||||
|
||||
/**
|
||||
@brief Monitor the site diversity information in TMCC information.
|
||||
|
||||
ISDB-S3 TMCC information includes 3 bit length uplink control information.
|
||||
This monitor returns MSB of the unlink control information.
|
||||
(Instructions for site diversity performing frame. Please refer to STD-B44.)
|
||||
If whole uplink control information is necessary,
|
||||
please use ::sony_demod_isdbs3_monitor_TMCCInfo.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pSiteDiversityInfo The site diversity information in TMCC. (0 or 1)
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_monitor_SiteDiversityInfo (sony_demod_t * pDemod,
|
||||
uint8_t * pSiteDiversityInfo);
|
||||
|
||||
|
||||
/**
|
||||
@brief Monitor the Emergency Warning Broadcasting System (EWS) detection flag.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pEWSChange The value of EWS change detection flag.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_monitor_EWSChange (sony_demod_t * pDemod,
|
||||
uint8_t * pEWSChange);
|
||||
|
||||
/**
|
||||
@brief Monitor the TMCC information change detection flag.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pTMCCChange The value of TMCC change detection flag.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_monitor_TMCCChange (sony_demod_t * pDemod,
|
||||
uint8_t * pTMCCChange);
|
||||
|
||||
/**
|
||||
@brief Clear the Emergency Warning Broadcasting System (EWS) detection flag.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_ClearEWSChange (sony_demod_t * pDemod);
|
||||
|
||||
|
||||
/**
|
||||
@brief Clear the TMCC Change detection flag.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_ClearTMCCChange (sony_demod_t * pDemod);
|
||||
|
||||
/**
|
||||
@brief Monitor the unmatch flag between specified StreamID and recieved StreamID.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pStreamIDError The value of StreamID unmatch flag.
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_monitor_StreamIDError (sony_demod_t * pDemod,
|
||||
uint8_t * pStreamIDError);
|
||||
|
||||
/**
|
||||
@brief Monitor the Low CN condition.
|
||||
|
||||
@note This API is supported in CXD2878 family only.
|
||||
|
||||
This API can be used for hierarchical modulated stream to select
|
||||
high hierarchy program or low hierarchy program to be displayed.
|
||||
|
||||
The behavior of this monitor can be configured by
|
||||
::sony_demod_SetConfig(SONY_DEMOD_CONFIG_ISDBS3_LOWCN_XXX).
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pLowCN Low CN(1) or not.
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_monitor_LowCN (sony_demod_t * pDemod,
|
||||
uint8_t * pLowCN);
|
||||
|
||||
/**
|
||||
@brief Clear the Low CN condition.
|
||||
|
||||
@note This API is supported in CXD2878 family only.
|
||||
|
||||
This API is available if Low CN monitor is configured as hold type.
|
||||
(SONY_DEMOD_ISDBS3_CONFIG_LOWCN_HOLD)
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs3_ClearLowCN (sony_demod_t * pDemod);
|
||||
|
||||
#endif /* SONY_DEMOD_ISDBS3_MONITOR_H */
|
||||
+1416
File diff suppressed because it is too large
Load Diff
+251
@@ -0,0 +1,251 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2019 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2019/02/14
|
||||
Modification ID : 83dbabba2734697e67e3d44647acf57b272c2caf
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@file sony_demod_isdbs_monitor.h
|
||||
|
||||
This file provides the ISDB-S demodulator monitor interface.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SONY_DEMOD_ISDBS_MONITOR_H
|
||||
#define SONY_DEMOD_ISDBS_MONITOR_H
|
||||
|
||||
#include "sony_demod.h"
|
||||
#include "sony_isdbs.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Defines
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
#define SONY_DEMOD_ISDBS_MONITOR_PRERSBER_INVALID 0xFFFFFFFF /**< BER value if the BER value is invalid */
|
||||
#define SONY_DEMOD_ISDBS_MONITOR_PER_INVALID 0xFFFFFFFF /**< PER value if the PER value is invalid */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Monitors the synchronisation state of the demodulator.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pAGCLockStat Indicates the AGC lock condition.
|
||||
- 0: AGC not locked.
|
||||
- 1: AGC locked.
|
||||
@param pTSLockStat Indicates the TS lock condition.
|
||||
- 0: TS not locked.
|
||||
- 1: TS locked.
|
||||
@param pTMCCLockStat Indicates TMCC lock condition.
|
||||
- 0: TMCC not locked.
|
||||
- 1: TMCC locked.
|
||||
|
||||
@return SONY_RESULT_OK if pAGCLockStat, pTSLockStat and pTMCCLockStat is valid,
|
||||
otherwise an error is returned..
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs_monitor_SyncStat (sony_demod_t * pDemod,
|
||||
uint8_t * pAGCLockStat,
|
||||
uint8_t * pTSLockStat,
|
||||
uint8_t * pTMCCLockStat);
|
||||
|
||||
/**
|
||||
@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 The detected carrier offset in KHz.
|
||||
|
||||
@return SONY_RESULT_OK if pOffset is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs_monitor_CarrierOffset (sony_demod_t * pDemod,
|
||||
int32_t * pOffset);
|
||||
|
||||
/**
|
||||
@brief Monitor the IFAGC value of ISDB-S demodulator.
|
||||
|
||||
Actual dB gain dependent on attached tuner.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pIFAGCOut The IFAGC output register value. Range 0 - 0x1FFF. Unitless.
|
||||
|
||||
@return SONY_RESULT_OK if pIFAGC is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs_monitor_IFAGCOut (sony_demod_t * pDemod,
|
||||
uint32_t * pIFAGCOut);
|
||||
|
||||
/**
|
||||
@brief Monitor the pre-RS BER for each hierarchies and TMCC.
|
||||
|
||||
If the target BER is invalid, SONY_DEMOD_ISDBS_MONITOR_PRERSBER_INVALID (0xFFFFFFFF) is set.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pBERH The estimated high hierarchy BER x 1e7.
|
||||
@param pBERL The estimated low hierarchy BER x 1e7.
|
||||
@param pBERTMCC The estimated TMCC BER x 1e7.
|
||||
|
||||
@return SONY_RESULT_OK if pBER is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs_monitor_PreRSBER (sony_demod_t * pDemod,
|
||||
uint32_t * pBERH, uint32_t * pBERL, uint32_t * pBERTMCC);
|
||||
|
||||
/**
|
||||
@brief Monitor the CNR estimation made by the demodulator.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pCNR The returned CNR in dB x 1000.
|
||||
|
||||
@return SONY_RESULT_OK if pCNR is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs_monitor_CNR (sony_demod_t * pDemod,
|
||||
int32_t * pCNR);
|
||||
|
||||
|
||||
/**
|
||||
@brief Monitor the ISDB-S PER (Packet Error Rate).
|
||||
|
||||
If the target PER is invalid, SONY_DEMOD_ISDBS_MONITOR_PER_INVALID (0xFFFFFFFF) is set.
|
||||
|
||||
@param pDemod The demod instance.
|
||||
@param pPERH The estimated high hierarchy PER value (Post reed solomon decoder) x 1e6.
|
||||
@param pPERL The estimated low hierarchy PER value (Post reed solomon decoder) x 1e6.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs_monitor_PER (sony_demod_t * pDemod,
|
||||
uint32_t * pPERH, uint32_t * pPERL);
|
||||
|
||||
/**
|
||||
@brief Monitor the TMCC information
|
||||
|
||||
@param pDemod The demod instance.
|
||||
@param pTMCCInfo TMCC information struct instance.
|
||||
|
||||
@return SONY_RESULT_OK if successful and pTMCCInfo is valid.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs_monitor_TMCCInfo (sony_demod_t* pDemod,
|
||||
sony_isdbs_tmcc_info_t * pTMCCInfo);
|
||||
|
||||
/**
|
||||
@brief Monitor the modulation, code rate in TMCC information.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pModCodH The high hierarchy modulation and the code rate.
|
||||
@param pModCodL The low hierarchy modulation and the code rate.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs_monitor_ModCod (sony_demod_t * pDemod,
|
||||
sony_isdbs_modcod_t * pModCodH, sony_isdbs_modcod_t * pModCodL);
|
||||
|
||||
/**
|
||||
@brief Monitor the slot number in TMCC information.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pSlotNumH The high hierarchy slot number.
|
||||
@param pSlotNumL The low hierarchy slot number.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs_monitor_SlotNum (sony_demod_t * pDemod,
|
||||
uint8_t * pSlotNumH, uint8_t * pSlotNumL);
|
||||
|
||||
/**
|
||||
@brief Monitor the site diversity infomation in TMCC information.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pSiteDiversityInfo The site diversity infomation in TMCC.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs_monitor_SiteDiversityInfo (sony_demod_t * pDemod,
|
||||
uint8_t * pSiteDiversityInfo);
|
||||
|
||||
|
||||
/**
|
||||
@brief Monitor the Emergency Warning Broadcasting System(EWS) detection flag.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pEWSChange The value of EWS change detection flag.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs_monitor_EWSChange (sony_demod_t * pDemod,
|
||||
uint8_t * pEWSChange);
|
||||
|
||||
/**
|
||||
@brief Monitor the TMCC information change detection flag.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pTMCCChange The value of TMCC change detection flag.
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs_monitor_TMCCChange (sony_demod_t * pDemod,
|
||||
uint8_t * pTMCCChange);
|
||||
|
||||
/**
|
||||
@brief Clear the Emergency Warning Broadcasting System(EWS) detection flag.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs_ClearEWSChange (sony_demod_t * pDemod);
|
||||
|
||||
|
||||
/**
|
||||
@brief Clear the TMCC Change detection flag.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs_ClearTMCCChange (sony_demod_t * pDemod);
|
||||
|
||||
/**
|
||||
@brief Monitor the unmatch flag between specified TSID and recieved TSIDs.
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pTSIDError The value of TSID unmatch flag.
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs_monitor_TSIDError (sony_demod_t * pDemod,
|
||||
uint8_t * pTSIDError);
|
||||
|
||||
/**
|
||||
@brief Monitor the Low CN condition.
|
||||
|
||||
@note This API is supported in CXD2878 family only.
|
||||
|
||||
This API can be used for hierarchical modulated stream to select
|
||||
high hierarchy program or low hierarchy program to be displayed.
|
||||
|
||||
The behavior of this monitor can be configured by
|
||||
::sony_demod_SetConfig(SONY_DEMOD_CONFIG_ISDBS_LOWCN_XXX).
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@param pLowCN Low CN(1) or not.
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs_monitor_LowCN (sony_demod_t * pDemod,
|
||||
uint8_t * pLowCN);
|
||||
|
||||
/**
|
||||
@brief Clear the Low CN condition.
|
||||
|
||||
@note This API is supported in CXD2878 family only.
|
||||
|
||||
This API is available if Low CN monitor is configured as hold type.
|
||||
(SONY_DEMOD_ISDBS_CONFIG_LOWCN_HOLD)
|
||||
|
||||
@param pDemod The demodulator instance.
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_demod_isdbs_ClearLowCN (sony_demod_t * pDemod);
|
||||
|
||||
#endif /* SONY_DEMOD_ISDBS_MONITOR_H */
|
||||
+205
@@ -0,0 +1,205 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2018 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2018/07/05
|
||||
Modification ID : c7c68d70868a4a9fb9e0f480d8b940e8a1e8f651
|
||||
------------------------------------------------------------------------------*/
|
||||
#include "sony_integ.h"
|
||||
#include "sony_integ_isdbs.h"
|
||||
#include "sony_demod.h"
|
||||
#include "sony_demod_isdbs.h"
|
||||
#include "sony_demod_isdbs_monitor.h"
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
sony_result_t sony_integ_isdbs_Tune (sony_integ_t * pInteg,
|
||||
sony_isdbs_tune_param_t * pTuneParam)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_isdbs_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);
|
||||
}
|
||||
|
||||
result = sony_demod_isdbs_Tune (pInteg->pDemod, pTuneParam);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
if ((pInteg->pTuner) && (pInteg->pTuner->SatTune)) {
|
||||
/* Enable the I2C repeater */
|
||||
result = sony_demod_I2cRepeaterEnable (pInteg->pDemod, 0x01);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
result = pInteg->pTuner->SatTune (pInteg->pTuner, pTuneParam->centerFreqKHz, SONY_DTV_SYSTEM_ISDBS, 28860);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
result = sony_demod_TuneEnd(pInteg->pDemod);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Wait for TS lock */
|
||||
result = sony_integ_isdbs_WaitTSLock (pInteg);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
sony_result_t sony_integ_isdbs_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_isdbs_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_ISDBS_WAIT_TS_LOCK) {
|
||||
continueWait = 0;
|
||||
}
|
||||
|
||||
result = sony_demod_isdbs_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_ISDBS_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_isdbs_monitor_RFLevel (sony_integ_t * pInteg, int32_t * pRFLeveldB)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_isdbs_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_ISDBS) {
|
||||
/* Not ISDB-S */
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
if (!pInteg->pTuner) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_NOSUPPORT);
|
||||
}
|
||||
|
||||
if (pInteg->pTuner->rfLevelFuncSat == 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->rfLevelFuncSat == SONY_TUNER_RFLEVEL_FUNC_CALCFROMAGC
|
||||
&& pInteg->pTuner->CalcRFLevelFromAGC) {
|
||||
uint32_t ifAgc;
|
||||
|
||||
result = sony_demod_isdbs_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);
|
||||
}
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2018 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2018/07/27
|
||||
Modification ID : ff73ffebff57618d6a5aa6e2aa9eb009b86060d1
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@file sony_integ_isdbs.h
|
||||
|
||||
This file provides the integration layer interface for ISDB-S
|
||||
specific demodulator functions.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SONY_INTEG_ISDBS_H
|
||||
#define SONY_INTEG_ISDBS_H
|
||||
|
||||
#include "sony_demod.h"
|
||||
#include "sony_integ.h"
|
||||
#include "sony_demod_isdbs.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Defines
|
||||
------------------------------------------------------------------------------*/
|
||||
#define SONY_ISDBS_WAIT_TS_LOCK 1000 /**< 1s timeout for wait TS lock process for ISDB-S channels */
|
||||
#define SONY_ISDBS_WAIT_LOCK_INTERVAL 10 /**< 10ms polling interval for demodulator and TS lock functions */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Structs
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Function Pointers
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Performs acquisition to an ISDB-S channel.
|
||||
|
||||
Blocks the calling thread until the TS has locked or has timed out.
|
||||
Use ::sony_integ_Cancel to cancel the operation at any time.
|
||||
|
||||
|
||||
@param pInteg The driver instance.
|
||||
@param pTuneParam The parameters required for the tune.
|
||||
|
||||
@return SONY_RESULT_OK if tuned successfully to the channel.
|
||||
*/
|
||||
sony_result_t sony_integ_isdbs_Tune (sony_integ_t * pInteg,
|
||||
sony_isdbs_tune_param_t * pTuneParam);
|
||||
|
||||
|
||||
/**
|
||||
@brief Polls the demodulator waiting for TS lock at 10ms intervals up to a timeout of 1s.
|
||||
|
||||
@param pInteg The driver instance
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_integ_isdbs_WaitTSLock (sony_integ_t * pInteg);
|
||||
|
||||
|
||||
/**
|
||||
@brief RF level monitor function.
|
||||
|
||||
This function returns the estimated RF level based on demodulator gain measurements
|
||||
and a tuner dependent conversion calculation. The calculation provided in this monitor
|
||||
may require modifications for your own HW integration.
|
||||
|
||||
@param pInteg The driver instance
|
||||
@param pRFLeveldB The RF Level estimation in dB * 1000
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_integ_isdbs_monitor_RFLevel (sony_integ_t * pInteg, int32_t * pRFLeveldB);
|
||||
|
||||
#endif /* SONY_INTEG_ISDBS_H */
|
||||
+356
@@ -0,0 +1,356 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2019 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2019/02/14
|
||||
Modification ID : 83dbabba2734697e67e3d44647acf57b272c2caf
|
||||
------------------------------------------------------------------------------*/
|
||||
#include "sony_integ.h"
|
||||
#include "sony_integ_isdbs3.h"
|
||||
#include "sony_demod.h"
|
||||
#include "sony_demod_isdbs3.h"
|
||||
#include "sony_demod_isdbs3_monitor.h"
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Static Functions
|
||||
----------------------------------------------------------------------------*/
|
||||
/*
|
||||
@brief Polls the demodulator waiting for TSTLV lock at 10ms intervals up to a timeout of 3s.
|
||||
*/
|
||||
static sony_result_t isdbs3_WaitTSTLVLock (sony_integ_t * pInteg);
|
||||
|
||||
/*
|
||||
@brief Polls the demodulator waiting for TMCC lock at 10ms intervals up to a timeout of 2s.
|
||||
*/
|
||||
static sony_result_t isdbs3_WaitTMCCLock (sony_integ_t * pInteg);
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
sony_result_t sony_integ_isdbs3_Tune (sony_integ_t * pInteg,
|
||||
sony_isdbs3_tune_param_t * pTuneParam)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
sony_isdbs3_tmcc_info_t tmccInfo;
|
||||
sony_isdbs3_tune_param_t tuneParamRelativeStream;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_isdbs3_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);
|
||||
}
|
||||
|
||||
if (SONY_DEMOD_CHIP_ID_2856_FAMILY (pInteg->pDemod->chipId)
|
||||
&& pTuneParam->streamidType == SONY_ISDBS3_STREAMID_TYPE_RELATIVE_STREAM_NUMBER) {
|
||||
if (pTuneParam->streamid > 15) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_ARG);
|
||||
}
|
||||
|
||||
/* Create tune_param for relative stream number */
|
||||
tuneParamRelativeStream.centerFreqKHz = pTuneParam->centerFreqKHz;
|
||||
tuneParamRelativeStream.streamid = 0xFFFF;
|
||||
tuneParamRelativeStream.streamidType = SONY_ISDBS3_STREAMID_TYPE_STREAMID;
|
||||
|
||||
result = sony_demod_isdbs3_Tune (pInteg->pDemod, &tuneParamRelativeStream);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
} else {
|
||||
result = sony_demod_isdbs3_Tune (pInteg->pDemod, pTuneParam);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
}
|
||||
|
||||
if ((pInteg->pTuner) && (pInteg->pTuner->SatTune)) {
|
||||
/* Enable the I2C repeater */
|
||||
result = sony_demod_I2cRepeaterEnable (pInteg->pDemod, 0x01);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
result = pInteg->pTuner->SatTune (pInteg->pTuner, pTuneParam->centerFreqKHz, SONY_DTV_SYSTEM_ISDBS3, 33756);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
result = sony_demod_TuneEnd(pInteg->pDemod);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
/* Wait for TMCC lock */
|
||||
result = isdbs3_WaitTMCCLock (pInteg);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
if (SONY_DEMOD_CHIP_ID_2856_FAMILY (pInteg->pDemod->chipId)
|
||||
&& pTuneParam->streamidType == SONY_ISDBS3_STREAMID_TYPE_RELATIVE_STREAM_NUMBER) {
|
||||
/* Get StreamID from TMCC information */
|
||||
result = sony_demod_isdbs3_monitor_TMCCInfo(pInteg->pDemod, &tmccInfo);
|
||||
if (result == SONY_RESULT_ERROR_HW_STATE) {
|
||||
/* TMCC 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) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
if (tmccInfo.streamTypeForEachRelativeStream[pTuneParam->streamid] == SONY_ISDBS3_STREAM_TYPE_NO_TYPE_ALLOCATED) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_UNLOCK);
|
||||
}
|
||||
|
||||
/* Set Stream ID */
|
||||
result = sony_demod_isdbs3_SetStreamID (pInteg->pDemod, tmccInfo.streamidForEachRelativeStream[pTuneParam->streamid],
|
||||
SONY_ISDBS3_STREAMID_TYPE_STREAMID);
|
||||
if (result != SONY_RESULT_OK){
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
} else {
|
||||
uint8_t streamIDError = 0;
|
||||
|
||||
/* Check Stream ID */
|
||||
result = sony_demod_isdbs3_monitor_StreamIDError (pInteg->pDemod, &streamIDError);
|
||||
if (result == SONY_RESULT_ERROR_HW_STATE) {
|
||||
/* TMCC 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) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
if (streamIDError) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_UNLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
/* Wait for TSTLV lock */
|
||||
result = isdbs3_WaitTSTLVLock (pInteg);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
sony_result_t sony_integ_isdbs3_monitor_RFLevel (sony_integ_t * pInteg, int32_t * pRFLeveldB)
|
||||
{
|
||||
sony_result_t result = SONY_RESULT_OK;
|
||||
|
||||
SONY_TRACE_ENTER ("sony_integ_isdbs3_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_ISDBS3) {
|
||||
/* Not ISDB-S3 */
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_SW_STATE);
|
||||
}
|
||||
|
||||
if (!pInteg->pTuner) {
|
||||
SONY_TRACE_RETURN (SONY_RESULT_ERROR_NOSUPPORT);
|
||||
}
|
||||
|
||||
if (pInteg->pTuner->rfLevelFuncSat == 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->rfLevelFuncSat == SONY_TUNER_RFLEVEL_FUNC_CALCFROMAGC
|
||||
&& pInteg->pTuner->CalcRFLevelFromAGC) {
|
||||
uint32_t ifAgc;
|
||||
|
||||
result = sony_demod_isdbs3_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);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
Static Functions
|
||||
----------------------------------------------------------------------------*/
|
||||
static sony_result_t isdbs3_WaitTSTLVLock (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 ("isdbs3_WaitTSTLVLock");
|
||||
|
||||
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 TSTLV 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_ISDBS3_WAIT_TSTLV_LOCK) {
|
||||
continueWait = 0;
|
||||
}
|
||||
|
||||
result = sony_demod_isdbs3_CheckTSTLVLock (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_ISDBS3_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 isdbs3_WaitTMCCLock (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 ("isdbs3_WaitTMCCLock");
|
||||
|
||||
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 TMCC 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_ISDBS3_WAIT_TMCC_LOCK) {
|
||||
continueWait = 0;
|
||||
}
|
||||
|
||||
result = sony_demod_isdbs3_CheckTMCCLock (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_ISDBS3_WAIT_LOCK_INTERVAL);
|
||||
if (result != SONY_RESULT_OK) {
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
} else {
|
||||
result = SONY_RESULT_ERROR_TIMEOUT;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SONY_TRACE_RETURN (result);
|
||||
}
|
||||
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2018 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2018/07/27
|
||||
Modification ID : ff73ffebff57618d6a5aa6e2aa9eb009b86060d1
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@file sony_integ_isdbs3.h
|
||||
|
||||
This file provides the integration layer interface for ISDB-S3
|
||||
specific demodulator functions.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef SONY_INTEG_ISDBS3_H
|
||||
#define SONY_INTEG_ISDBS3_H
|
||||
|
||||
#include "sony_demod.h"
|
||||
#include "sony_integ.h"
|
||||
#include "sony_demod_isdbs3.h"
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Defines
|
||||
------------------------------------------------------------------------------*/
|
||||
#define SONY_ISDBS3_WAIT_TMCC_LOCK 2000 /**< 2s timeout for wait TMCC lock process for ISDB-S3 channels */
|
||||
#define SONY_ISDBS3_WAIT_TSTLV_LOCK 3000 /**< 3s timeout for wait TSTLV lock process for ISDB-S3 channels */
|
||||
#define SONY_ISDBS3_WAIT_LOCK_INTERVAL 10 /**< 10ms polling interval for demodulator and TSTLV lock functions */
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Structs
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Function Pointers
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Functions
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Performs acquisition to an ISDB-S3 channel.
|
||||
|
||||
Blocks the calling thread until the TS has locked or has timed out.
|
||||
Use ::sony_integ_Cancel to cancel the operation at any time.
|
||||
|
||||
|
||||
@param pInteg The driver instance.
|
||||
@param pTuneParam The parameters required for the tune.
|
||||
|
||||
@return SONY_RESULT_OK if tuned successfully to the channel.
|
||||
*/
|
||||
sony_result_t sony_integ_isdbs3_Tune (sony_integ_t * pInteg,
|
||||
sony_isdbs3_tune_param_t * pTuneParam);
|
||||
|
||||
|
||||
/**
|
||||
@brief RF level monitor function.
|
||||
|
||||
This function returns the estimated RF level based on demodulator gain measurements
|
||||
and a tuner dependent conversion calculation. The calculation provided in this monitor
|
||||
may require modifications for your own HW integration.
|
||||
|
||||
@param pInteg The driver instance
|
||||
@param pRFLeveldB The RF Level estimation in dB * 1000
|
||||
|
||||
@return SONY_RESULT_OK if successful.
|
||||
*/
|
||||
sony_result_t sony_integ_isdbs3_monitor_RFLevel (sony_integ_t * pInteg, int32_t * pRFLeveldB);
|
||||
|
||||
#endif /* SONY_INTEG_ISDBS3_H */
|
||||
Executable
+74
@@ -0,0 +1,74 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2016/06/24
|
||||
Modification ID : 3b74e280b7ad8ce430b6a9419ac53e8f2e3737f9
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@file sony_isdbs.h
|
||||
|
||||
This file provides ISDB-S related type definitions.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
#ifndef SONY_ISDBS_H
|
||||
#define SONY_ISDBS_H
|
||||
|
||||
#include "sony_common.h"
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Enumerations
|
||||
--------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Type of TSID.
|
||||
*/
|
||||
typedef enum sony_isdbs_tsid_type_t {
|
||||
SONY_ISDBS_TSID_TYPE_TSID, /**< TSID(16bit) */
|
||||
SONY_ISDBS_TSID_TYPE_RELATIVE_TS_NUMBER, /**< Relative TS number */
|
||||
} sony_isdbs_tsid_type_t;
|
||||
|
||||
/**
|
||||
@brief The modulation and code rate.
|
||||
*/
|
||||
typedef enum sony_isdbs_modcod_t {
|
||||
SONY_ISDBS_MODCOD_RESERVED_0, /**< Reserved 0 */
|
||||
SONY_ISDBS_MODCOD_BPSK_1_2, /**< BPSK Code Rate 1/2 */
|
||||
SONY_ISDBS_MODCOD_QPSK_1_2, /**< QPSK Code Rate 1/2 */
|
||||
SONY_ISDBS_MODCOD_QPSK_2_3, /**< QPSK Code Rate 2/3 */
|
||||
SONY_ISDBS_MODCOD_QPSK_3_4, /**< QPSK Code Rate 3/4 */
|
||||
SONY_ISDBS_MODCOD_QPSK_5_6, /**< QPSK Code Rate 5/6 */
|
||||
SONY_ISDBS_MODCOD_QPSK_7_8, /**< QPSK Code Rate 7/8 */
|
||||
SONY_ISDBS_MODCOD_TC8PSK_2_3, /**< TC8PSK Code Rate 2/3 */
|
||||
SONY_ISDBS_MODCOD_RESERVED_8, /**< Reserved 8 */
|
||||
SONY_ISDBS_MODCOD_RESERVED_9, /**< Reserved 9 */
|
||||
SONY_ISDBS_MODCOD_RESERVED_10, /**< Reserved 10 */
|
||||
SONY_ISDBS_MODCOD_RESERVED_11, /**< Reserved 11 */
|
||||
SONY_ISDBS_MODCOD_RESERVED_12, /**< Reserved 12 */
|
||||
SONY_ISDBS_MODCOD_RESERVED_13, /**< Reserved 13 */
|
||||
SONY_ISDBS_MODCOD_RESERVED_14, /**< Reserved 14 */
|
||||
SONY_ISDBS_MODCOD_UNUSED_15 /**< unused (1111) */
|
||||
} sony_isdbs_modcod_t;
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Structs
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Transmission mode and slot information.
|
||||
*/
|
||||
typedef struct sony_isdbs_tmcc_modcod_slot_info_t {
|
||||
sony_isdbs_modcod_t modCod; /**< Modulation scheme and Code rate */
|
||||
uint8_t slotNum; /**< Slot number */
|
||||
} sony_isdbs_tmcc_modcod_slot_info_t;
|
||||
|
||||
/**
|
||||
@brief TMCC information.
|
||||
*/
|
||||
typedef struct sony_isdbs_tmcc_info_t {
|
||||
uint8_t changeOrder; /**< Incremented each time TMCC is renewed */
|
||||
sony_isdbs_tmcc_modcod_slot_info_t modcodSlotInfo[4]; /**< Transmission mode and slot information */
|
||||
uint8_t relativeTSForEachSlot[48]; /**< Relative TS ID for each slot */
|
||||
uint16_t tsidForEachRelativeTS[8]; /**< Corresponding table between relative TS and TSID */
|
||||
uint8_t ewsFlag; /**< Emergency Warning Broadcasting */
|
||||
uint8_t uplinkInfo; /**< Site diversity warning */
|
||||
} sony_isdbs_tmcc_info_t;
|
||||
|
||||
#endif /* SONY_ISDBS_H */
|
||||
Executable
+112
@@ -0,0 +1,112 @@
|
||||
/*------------------------------------------------------------------------------
|
||||
Copyright 2016-2019 Sony Semiconductor Solutions Corporation
|
||||
|
||||
Last Updated : 2019/02/14
|
||||
Modification ID : 83dbabba2734697e67e3d44647acf57b272c2caf
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@file sony_isdbs3.h
|
||||
|
||||
This file provides ISDB-S3 related type definitions.
|
||||
*/
|
||||
/*----------------------------------------------------------------------------*/
|
||||
#ifndef SONY_ISDBS3_H
|
||||
#define SONY_ISDBS3_H
|
||||
|
||||
#include "../sony_common.h"
|
||||
|
||||
/*--------------------------------------------------------------------
|
||||
Enumerations
|
||||
--------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Type of StreamID.
|
||||
*/
|
||||
typedef enum sony_isdbs3_streamid_type_t {
|
||||
SONY_ISDBS3_STREAMID_TYPE_STREAMID, /**< StreamID(16bit) */
|
||||
SONY_ISDBS3_STREAMID_TYPE_RELATIVE_STREAM_NUMBER, /**< Relative stream number */
|
||||
} sony_isdbs3_streamid_type_t;
|
||||
|
||||
/**
|
||||
@brief Modulation
|
||||
*/
|
||||
typedef enum sony_isdbs3_mod_t {
|
||||
SONY_ISDBS3_MOD_RESERVED_0, /**< Reserved 0 */
|
||||
SONY_ISDBS3_MOD_BPSK, /**< BPSK */
|
||||
SONY_ISDBS3_MOD_QPSK, /**< QPSK */
|
||||
SONY_ISDBS3_MOD_8PSK, /**< 8PSK */
|
||||
SONY_ISDBS3_MOD_16APSK, /**< 16APSK */
|
||||
SONY_ISDBS3_MOD_32APSK, /**< 32APSK */
|
||||
SONY_ISDBS3_MOD_RESERVED_6, /**< Reserved 6 */
|
||||
SONY_ISDBS3_MOD_RESERVED_7, /**< Reserved 7 */
|
||||
SONY_ISDBS3_MOD_RESERVED_8, /**< Reserved 8 */
|
||||
SONY_ISDBS3_MOD_RESERVED_9, /**< Reserved 9 */
|
||||
SONY_ISDBS3_MOD_RESERVED_10, /**< Reserved 10 */
|
||||
SONY_ISDBS3_MOD_RESERVED_11, /**< Reserved 11 */
|
||||
SONY_ISDBS3_MOD_RESERVED_12, /**< Reserved 12 */
|
||||
SONY_ISDBS3_MOD_RESERVED_13, /**< Reserved 13 */
|
||||
SONY_ISDBS3_MOD_RESERVED_14, /**< Reserved 14 */
|
||||
SONY_ISDBS3_MOD_UNUSED_15 /**< unused (1111) */
|
||||
} sony_isdbs3_mod_t;
|
||||
|
||||
/**
|
||||
@brief Code Rate
|
||||
*/
|
||||
typedef enum sony_isdbs3_cod_t {
|
||||
SONY_ISDBS3_COD_RESERVED_0, /**< Reserved 0 */
|
||||
SONY_ISDBS3_COD_41_120, /**< 41/120 (1/3) */
|
||||
SONY_ISDBS3_COD_49_120, /**< 49/120 (2/5) */
|
||||
SONY_ISDBS3_COD_61_120, /**< 61/120 (1/2) */
|
||||
SONY_ISDBS3_COD_73_120, /**< 73/120 (3/5) */
|
||||
SONY_ISDBS3_COD_81_120, /**< 81/120 (2/3) */
|
||||
SONY_ISDBS3_COD_89_120, /**< 89/120 (3/4) */
|
||||
SONY_ISDBS3_COD_93_120, /**< 93/120 (7/9) */
|
||||
SONY_ISDBS3_COD_97_120, /**< 97/120 (4/5) */
|
||||
SONY_ISDBS3_COD_101_120, /**< 101/120 (5/6) */
|
||||
SONY_ISDBS3_COD_105_120, /**< 105/120 (7/8) */
|
||||
SONY_ISDBS3_COD_109_120, /**< 109/120 (9/10) */
|
||||
SONY_ISDBS3_COD_RESERVED_12, /**< Reserved 12 */
|
||||
SONY_ISDBS3_COD_RESERVED_13, /**< Reserved 13 */
|
||||
SONY_ISDBS3_COD_RESERVED_14, /**< Reserved 14 */
|
||||
SONY_ISDBS3_COD_UNUSED_15 /**< unused (1111) */
|
||||
} sony_isdbs3_cod_t;
|
||||
|
||||
/**
|
||||
@brief Stream Type
|
||||
*/
|
||||
typedef enum sony_isdbs3_stream_type_t {
|
||||
SONY_ISDBS3_STREAM_TYPE_RESERVED_0, /**< Reserved 0 */
|
||||
SONY_ISDBS3_STREAM_TYPE_MPEG2_TS, /**< MPEG-2 TS */
|
||||
SONY_ISDBS3_STREAM_TYPE_TLV, /**< TLV */
|
||||
SONY_ISDBS3_STREAM_TYPE_NO_TYPE_ALLOCATED = 0xFF, /**< No type allocated (11111111) */
|
||||
} sony_isdbs3_stream_type_t;
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Structs
|
||||
------------------------------------------------------------------------------*/
|
||||
/**
|
||||
@brief Transmission mode, slot and backoff information.
|
||||
*/
|
||||
typedef struct sony_isdbs3_tmcc_modcod_slot_info_t {
|
||||
sony_isdbs3_mod_t mod; /**< Modulation */
|
||||
sony_isdbs3_cod_t cod; /**< Code rate */
|
||||
uint8_t slotNum; /**< Slot number */
|
||||
uint8_t backoff; /**< Backoff */
|
||||
} sony_isdbs3_tmcc_modcod_slot_info_t;
|
||||
|
||||
/**
|
||||
@brief TMCC information.
|
||||
*/
|
||||
typedef struct sony_isdbs3_tmcc_info_t {
|
||||
uint8_t changeOrder; /**< Incremented each time TMCC is renewed */
|
||||
sony_isdbs3_tmcc_modcod_slot_info_t modcodSlotInfo[8]; /**< Transmission mode and slot information */
|
||||
sony_isdbs3_stream_type_t streamTypeForEachRelativeStream[16]; /**< Stream type and relative stream number information */
|
||||
uint16_t packetLengthForEachRelativeStream[16]; /**< Packet length */
|
||||
uint8_t syncPatternBitLengthForEachRelativeStream[16]; /**< Sync pattern bit length */
|
||||
uint32_t syncPatternForEachRelativeStream[16]; /**< Sync pattern */
|
||||
uint8_t relativeStreamForEachSlot[120]; /**< Relative stream number and slot information */
|
||||
uint16_t streamidForEachRelativeStream[16]; /**< Corresponding table between relative StreamID */
|
||||
uint8_t ewsFlag; /**< Emergency Warning Broadcasting */
|
||||
uint8_t uplinkInfo; /**< Site diversity warning */
|
||||
} sony_isdbs3_tmcc_info_t;
|
||||
|
||||
#endif /* SONY_ISDBS3_H */
|
||||
Reference in New Issue
Block a user