⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 s5h1410_ver1.2.c

📁 mstar 776 开发的车载dvd
💻 C
📖 第 1 页 / 共 3 页
字号:
#define _S5H1410_C_

/**
*SFILE****************************************************************
* FILE NAME       : 1410x.cpp
* AUTHOR          : Mobile Solution Division, Channel Team, Channel.cs
* MODERATOR	  :
* ISSUED To	  :
* ISSUED Day      : September 15,2006
* VERSION         : 1.4
* Init.Version    : Init_Air1.2
* FILE DESCRIPTION: S5H1410 VSB/QAM Porting Code
* ABBREVIATION    :

* Copyright (c) 2006 Samsung Electronics, Inc.
* All rights reserved.
*
* This software is the confidential and proprietary information
* of Samsung Electronics, Inc("Confidential Information"). You
* Shall not disclose such Confidential Information and shall use
* it only in accordance with the terms of the license agreement
* you entered into SAMSUNG.
 **************************************************************EFILE*/

#include "S5H1410_Ver1.2.h"
#include "drviic.h"



/* *************************************************************** */
/*                                                                 */
/*              CODE PROVIDED BY Channel Team                      */
/*                                                                 */
/* *************************************************************** */

///////////////// ///////////////// ///////////////////
///////////////// SEMCO Tuner Function ////////////////
///////////////// ///////////////// ///////////////////

/*********************************************************************************************************
* S5H1410 Initialization Driver
* Conditions:
* Version:Init_Air 1.2
* Description:
* This function is called to initialize the register values.
* This function must be called once to run the system properly.
* After this function is called, the VSB mode is set as a default.
**********************************************************************************************************/
#define INIT_1410_TABLE_NUMS (sizeof(tDTVS5H1410Tbl)/sizeof(SamsungChipInit_t))
static SamsungChipInit_t code tDTVS5H1410Tbl[] =
{
    {0xd2, 0x3000}, // hw reset
    {0xfa, 0x0   },
    {0xd8, 0x11  },
    {0x46, 0x510 },
    {0x21, 0x20  },
    {0x2a, 0x31  },
    {0x30, 0x100 },
    {0x56, 0x2222},
    {0x61, 0x4a00},
    {0x63, 0x800 },    //digital saw filter on/off
    {0x5b, 0x370 },
    {0x5c, 0x296 },
    //{0x61, 0x4a00},   //auto recovery register set
    //{0x63, 0x800 },
    //{0x5b, 0x370 },
    //{0x5c, 0x296 },
    {0x5f, 0x10  },
    {0x72, 0x2004},
    {0xd9, 0x101  }, // {0xd9, 0x1   },
    {0xd0, 0x1010},
    {0xd1, 0x0   },
    {0x1e, 0x20  },
    {0x23, 0xe0b }, // bubbling channel tuning_Init 1.4
    {0x24, 0x1a14},
    {0x27, 0x909 },
    {0x60, 0x60  },
    {0x7a, 0xb902},
    {0x7f, 0x1111}, // QAM PTL on mode  for 1.2
    {0x80, 0x3   },
    {0x82, 0x2c38}, // QAM PTL on mode  for 1.2
    {0x83, 0x2a37}, // QAM PTL on mode  for 1.2
    {0x8d, 0xa   }, // QAM PTL on mode  for 1.2
    {0x90, 0x1101},
    {0x91, 0x0033},
    {0x93, 0x2e37},
    {0xa1, 0x1003},
    {0xa2, 0x103f},
    {0xa6, 0x0e00},
    {0x53, 0xa0a },
    {0x20, 0x2e  },
    {0x25, 0xe0c },
    {0x31, 0xc0d },
    {0x26, 0x1210},
    {0x32, 0x1011},
    {0x4e, 0x30e },
    {0x52, 0x104 },
    {0x57, 0x3161},
    {0x58, 0x6111},
    {0x73, 0x522 },
    {0x77, 0x55  },
    {0x7b, 0x2a38},
    {0x88, 0x312f},
    {0x8c, 0xa8b0},
    {0x95, 0x2d37},
    {0x8a, 0x102f},
    {0x8e, 0x103 },
    {0xf5, 0x0   },
    {0xf5, 0x1   }
};

BOOLEAN Sec_1410xInitialize(void)
{
	BOOLEAN result = FALSE;
    U8 u8Loop;

    for(u8Loop=0; u8Loop<INIT_1410_TABLE_NUMS; u8Loop++)
	    result |= MDrv_IIC_Write2Bytes(IIC_1410x_RegId, tDTVS5H1410Tbl[u8Loop].Reg, tDTVS5H1410Tbl[u8Loop].Value);

	return result;
}

/*********************************************************************************************************
* S5H1410 Soft reset Driver
* Conditions: When a channel is changed or LNA is on/off, this function is called.
* Description:
* This function is called in order to reset all software conditions.
* But it does not reset register values.

* Addr: 0xf5
* Value: 0x00 -> Chip Reset Start
* Value: 0x01 -> Chip Reset End
**********************************************************************************************************/
BOOLEAN Sec_1410xSoftReset(void)
{
	BOOLEAN result = FALSE;
	result |= MDrv_IIC_Write2Bytes(IIC_1410x_RegId, 0xf5, 0x0000);
	MDrv_Timer_Delayms(5); //leo_1218
	result |= MDrv_IIC_Write2Bytes(IIC_1410x_RegId, 0xf5, 0x0001);
	return result;
}

/*********************************************************************************************************
* S5H1410 Repeater Control Driver
* Conditions:
* Description:
* This function is used to set the bypass mode or normal mode. (Repeater Enable or Disable)
* In the bypass mode, the host PC controls a channel chip first and the channel chip controls
* a tuner using GPIO.
* Addr: 0xf3
* Value: 0x00 -> Tuner by pass close (Repeater Disable) ? Default mode
* Value: 0x01 -> Tuner by pass open (Repeater Enable)
**********************************************************************************************************/
BOOLEAN Sec_1410xRepeaterEnable(void)
{
	return MDrv_IIC_Write2Bytes(IIC_1410x_RegId, 0xf3, 0x0001);
}
BOOLEAN Sec_1410xRepeaterDisable(void)
{
	return MDrv_IIC_Write2Bytes(IIC_1410x_RegId, 0xf3, 0x0000);
}

/*********************************************************************************************************
* S5H1410 VSB, QAM mode change Driver
* Conditions:
* Description: These functions set an 8-VSB & QAM (64/256) mode
* Addr: 0xf4
* Value: 0x00 -> VSB mode (Default)
* Value: 0x01 -> QAM mode
* Addr: 0x7f
* Value: 0x1110 -> QAM (Detect 64/256 qam automatically)
* Value: 0x1100 -> 64 QAM (Manual mode)
* Value: 0x1101 -> 256 QAM (Manual mode)
**********************************************************************************************************/
BOOLEAN Sec_1410xVsbMode(void)
{
	BOOLEAN result = FALSE;
	result |= MDrv_IIC_Write2Bytes(IIC_1410x_RegId, 0xf4, 0x0000);
	//result |= Sec_1410xSoftReset();
	return result;
}
BOOLEAN Sec_1410xQamMode(void)
{
	BOOLEAN result = FALSE;
	result |= MDrv_IIC_Write2Bytes(IIC_1410x_RegId, 0xf4,0x0001);
	result |= MDrv_IIC_Write2Bytes(IIC_1410x_RegId, 0x7f,0x1110);
	//result |= Sec_1410xSoftReset();
    return result;
}
BOOLEAN Sec_1410x64QamMode(void)
{
	BOOLEAN result = FALSE;
	result |= MDrv_IIC_Write2Bytes(IIC_1410x_RegId, 0xf4,0x0001);
	result |= MDrv_IIC_Write2Bytes(IIC_1410x_RegId, 0x7f,0x1100);
	//result |= Sec_1410xSoftReset();
	return result;
}
BOOLEAN Sec_1410x256QamMode(void)
{
	BOOLEAN result = FALSE;
	result |= MDrv_IIC_Write2Bytes(IIC_1410x_RegId, 0xf4,0x0001);
	result |= MDrv_IIC_Write2Bytes(IIC_1410x_RegId, 0x7f,0x1101);
	//result |= Sec_1410xSoftReset();
	return result;
}

/****************************************************************************************************
* S5H1410 Sleep mode change Driver
* Conditions:
* Description:
* The software-based power down function is as follows.
* This function is called in order to set a sleep on mode or sleep off mode.

* Addr: 0xf2
* Value: 0x01 -> Sleep mode
* Value: 0x00 -> Running mode ? Default mode
****************************************************************************************************/
BOOLEAN Sec_1410xSleepOn(void)
{
	return MDrv_IIC_Write2Bytes(IIC_1410x_RegId, 0xf2,0x0001);
}
BOOLEAN Sec_1410xSleepOff(void)
{
	BOOLEAN result = FALSE;
	result |= MDrv_IIC_Write2Bytes(IIC_1410x_RegId, 0xf2,0x0000);
	result |= Sec_1410xSoftReset();
	return result;
}
BOOLEAN  Sec_1410xCheckIsSleep(void)
{
   return (BOOLEAN)(MDrv_IIC_Read2Bytes(IIC_1410x_RegId, 0xf2)==0x0001);
}
/****************************************************************************************************
* S5H1410 VSB/QAM Master Lock Check Driver
* Conditions:
* Description: This function is used to check whether the channel chip is lock or not in VSB/QAM mode.
* Addr: 0xf1
* Value: 15bit -> 1:Lock , 0: Unlock

****************************************************************************************************/
BOOLEAN Sec_1410xVsb_Sync_Lock(void)
{
	U16 value;

	value = MDrv_IIC_Read2Bytes(IIC_1410x_RegId, 0x42);
	return ((BOOLEAN)(value & 0x01));   // 1 -->Sync lock
}

#define QAM_CHECK_LOCK_TIME_SLICE           100
#define QAM_WAIT_LOCK_TOTAL_TIME            400//800
#define QAM_CHECK_LOCK_COUNTER              (QAM_WAIT_LOCK_TOTAL_TIME/QAM_CHECK_LOCK_TIME_SLICE)
#define QAM_WAIT_AGC_LOCK_TOTAL_TIME        300
#define QAM_CHECK_AGC_LOCK_TIME_SLICE       50
#define QAM_CHECK_AGC_LOCK_COUNTER          (QAM_WAIT_AGC_LOCK_TOTAL_TIME/QAM_CHECK_AGC_LOCK_TIME_SLICE)

BOOLEAN Sec_1410xQam_Master_Lock(void)
{
	U16 value;

	value = MDrv_IIC_Read2Bytes(IIC_1410x_RegId,0xf1);
	return (BOOLEAN)((value >>15)& 0x01);             //1 -->Master lock
}
BOOLEAN Sec_1410xQAMCheckLock(void)
{
    U8 i;

    for(i=0; i<QAM_CHECK_LOCK_COUNTER; i++)
    {
        MDrv_Timer_Delayms(QAM_CHECK_LOCK_TIME_SLICE);

        if(Sec_1410xQam_Master_Lock())
        {
            AMHUM_SetDriver();
            return TRUE;
        }
    }

    return FALSE;
}

static BOOLEAN Sec_1410xQAM_IsAGC_Lock(void)
{
    U16 value;

    value = MDrv_IIC_Read2Bytes(IIC_1410x_RegId, 0x97);
    if(value>0xf870)//&&(value<0xfd10))
        return FALSE;       //AGC Unlock
    else
        return TRUE;
}
BOOLEAN Sec_1410xAGCCheckLock(void)
{
    U8 i;

    for(i=0; i<QAM_CHECK_AGC_LOCK_COUNTER; i++)
    {
        MDrv_Timer_Delayms(QAM_CHECK_AGC_LOCK_TIME_SLICE);

        if(Sec_1410xQAM_IsAGC_Lock())

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -