📄 dual_align.c
字号:
//**********************************************************************************************************
// The Software is proprietary, confidential, and valuable to Realtek Semiconductor
// Corporation ("Realtek"). All rights, including but not limited to copyrights,
// patents, trademarks, trade secrets, mask work rights, and other similar rights and interests,
// are reserved to Realtek. Without prior written consent from Realtek, copying, reproduction,
// modification, distribution, or otherwise is strictly prohibited. The Software shall be
// kept strictly in confidence, and shall not be disclosed to or otherwise accessed by
// any third party. @ <2003> - <2008> The Software is provided "AS IS" without any warranty of any kind,
// express, implied, statutory or otherwise.
//**********************************************************************************************************
//----------------------------------------------------------------------------------------------------
// ID Code : Align.c No.0000
// Update Note :
//
//----------------------------------------------------------------------------------------------------
#define __DUAL_ALIGN__
#include "Common\Header\Include.h"
//#if(_OSD_TYPE == _DUAL_OSD)
//-- COMMAND 1 --------------------------------------------//
#define _ALIGN1_WRITE_RAM 0xCA
#define _ALIGN1_READ_RAM 0xC3
#define _ALIGN1_WRITE_EEPROM 0xAA
#define _ALIGN1_READ_EEPROM 0xA3
#define _ALIGN1_COLORTEMP 0xCC
//-- COMMAND 2 -(RAM)--------------------------------------//
#define _ALIGN2_RAM_CONTRAST 0x55
#define _ALIGN2_RAM_BRIGHT 0x56
#define _ALIGN2_RAM_RGAIN 0x57
#define _ALIGN2_RAM_GGAIN 0x58
#define _ALIGN2_RAM_BGAIN 0x59
#define _ALIGN2_RAM_SRGB_BRIGHT 0x9C
//----COMMAND 2 -(EEPROM)----------------------------------//
//9300
#define _ALIGN2_EE_C1R 0x3C
#define _ALIGN2_EE_C1G 0x3D
#define _ALIGN2_EE_C1B 0x3E
//6500
#define _ALIGN2_EE_C2R 0x4C
#define _ALIGN2_EE_C2G 0x4D
#define _ALIGN2_EE_C2B 0x4E
//7500
#define _ALIGN2_EE_C3R 0x5C
#define _ALIGN2_EE_C3G 0x5D
#define _ALIGN2_EE_C3B 0x5E
//USER
#define _ALIGN2_EE_C4R 0x6C
#define _ALIGN2_EE_C4G 0x6D
#define _ALIGN2_EE_C4B 0x6E
#define _ALIGN2_EE_SRGBR 0x7C
#define _ALIGN2_EE_SRGBG 0x7D
#define _ALIGN2_EE_SRGBB 0x7E
#define _ALIGN2_EE_CONTRAST 0x92
#define _ALIGN2_EE_BRIGHT 0x93
#define _ALIGN2_EE_CT_INDEX 0x94
#define _ALIGN2_EE_OSD_H 0x95
#define _ALIGN2_EE_OSD_V 0x96
#define _ALIGN2_EE_LANGUAGE 0x97
#define _ALIGN2_EE_OSD_TIMER 0x98
#define _ALIGN2_EE_VOLUME 0x99
#define _ALIGN2_EE_SRGB_BRIGHT 0x9C
#define _ALIGN2_EE_LANGUAGE_TYPE 0xD1
//-------COMMAND 3-(RAM+EEPROM)----------------//
#define _ALIGN3_RAM_EE_ADC_PLUS 0xAC
#define _ALIGN3_RAM_EE_ADC_MINUS 0xAD
#define _ALIGN3_READ_EE_ADC 0xAE
/*******************************************************************************/
#if _HDCP_KEY_RW
#define _ALIGN_EE_HDCP_READ_BANK0 0xE0
#define _ALIGN_EE_HDCP_READ_BANK1 0xE1
#define _ALIGN_EE_HDCP_WRITE_BANK0 0xE8
#define _ALIGN_EE_HDCP_WRITE_BANK1 0xE9
#endif
#if (_COLOR_TRACK == _ON)
#define _CT_WRITE 0xDD
#endif
/*******************************************************************************/
#if(_OSD_TYPE == _BENQ_OSD)
BYTE code LanguageIndexExchangeBenq[]=
{
_GERMAN_BENQ,
_ENGLISH_BENQ,
_SPANISH_BENQ,
_FRENCH_BENQ,
_ITALIAN_BENQ,
_JAPAN_BENQ,
_CHINESE_T_BENQ,
_CHINESE_S_BENQ,
_MAGYAR_BENQ,
_SICG_BENQ,
_PYCCKNN_BENQ,
_DUTCH_BENQ,
_POLSKI_BENQ,
_CZESKY_BENQ,
_SVENSKA_BENQ,
_PORTUGUESE_BENQ,
_ROMANA_BENQ,
};
BYTE code ColorIndexExchangeBenq[]=
{
_USER_COLOR,
_BLUISH_COLOR,
_NORMAL_COLOR,
_REDDISH_COLOR,
_USER_COLOR,
_SRGB_COLOR,
_SENSEYE_COLOR,
};
#else//_GENERIC_OSD
BYTE code LanguageIndexExchangeGeneric[]=
{
_GERMAN_GENERIC,
_ENGLISH_GENERIC,
_SPANISH_GENERIC,
_FRENCH_GENERIC,
_ITALIAN_GENERIC,
_JAPAN_GENERIC,
_DUTCH_GENERIC,
_CHINESE_S_GENERIC,
};
BYTE code ColorIndexExchangeGeneric[]=
{
_USER_COLOR,
_9300_COLOR,
_6500_COLOR,
_7500_COLOR,//ryan 081218
_USER_COLOR,
};
#endif
WORD AlignGetEEAddress(void)
{
WORD Address=0x7FF;
#if(_OSD_TYPE == _BENQ_OSD)
if(RamI2cCommandData[1]==_ALIGN2_EE_CONTRAST)
Address= _EEPROM_CONTRAST_ADDRESS;
else if(RamI2cCommandData[1]==_ALIGN2_EE_BRIGHT)
Address= _EEPROM_BRIGHT_ADDRESS;
else if(RamI2cCommandData[1]==_ALIGN2_EE_CT_INDEX)
Address= _EEPROM_COLORTEMP_ADDRESS;
else if(RamI2cCommandData[1]==_ALIGN2_EE_OSD_TIMER)
Address=_EEPROM_MENUTIMEOUT_BENQ_ADDRESS;
else if(RamI2cCommandData[1]==_ALIGN2_EE_VOLUME)
Address=_EEPROM_VOLUME_BENQ_ADDRESS;
if((RamI2cCommandData[1]&0xF0)==0x30) // Get Bluddish Address
Address= (_EEPROM_9300_ADDRESS+((RamI2cCommandData[1]&0x0F)-0x0C));
else if((RamI2cCommandData[1]&0xF0)==0x40) // Get Normal Address
Address= (_EEPROM_6500_ADDRESS+((RamI2cCommandData[1]&0x0F)-0x0C));
else if((RamI2cCommandData[1]&0xF0)==0x50) // Get Reddish Address
Address= (_EEPROM_7500_ADDRESS+((RamI2cCommandData[1]&0x0F)-0x0C));
else if((RamI2cCommandData[1]&0xF0)==0x60) // Get User Color Address
Address= (_EEPROM_USER_ADDRESS+((RamI2cCommandData[1]&0x0F)-0x0C));
else if((RamI2cCommandData[1]&0xF0)==0x70) // Get SRGB Color Address
Address= (_EEPROM_SRGB_ADDRESS+((RamI2cCommandData[1]&0x0F)-0x0C));
else if(RamI2cCommandData[1]==_ALIGN2_EE_LANGUAGE) //Get Language Address
Address= _EEPROM_LANGUAGE_ADDRESS;
else if(RamI2cCommandData[1]==_ALIGN2_EE_SRGB_BRIGHT)
Address= _SRGB_DEFAULT_DATA_ADDRESS;
else if(RamI2cCommandData[1]==_ALIGN2_EE_OSD_TIMER)
Address=_EEPROM_MENUTIMEOUT_BENQ_ADDRESS;
#else//_GENERIC_OSD
if(RamI2cCommandData[1]==_ALIGN2_EE_CONTRAST)
Address= _EEPROM_CONTRAST_ADDRESS;
else if(RamI2cCommandData[1]==_ALIGN2_EE_BRIGHT)
Address= _EEPROM_BRIGHT_ADDRESS;
else if(RamI2cCommandData[1]==_ALIGN2_EE_CT_INDEX)
Address= _EEPROM_COLORTEMP_ADDRESS;
else if(RamI2cCommandData[1]==_ALIGN2_EE_OSD_TIMER)
Address=_EEPROM_MENUTIMEOUT_GENERIC_ADDRESS;
else if(RamI2cCommandData[1]==_ALIGN2_EE_VOLUME)
Address=_EEPROM_VOLUME_GENERIC_ADDRESS;
if((RamI2cCommandData[1]&0xF0)==0x30) // Get Bluddish Address
Address= (_EEPROM_9300_ADDRESS+((RamI2cCommandData[1]&0x0F)-0x0C));
else if((RamI2cCommandData[1]&0xF0)==0x40)
Address= (_EEPROM_6500_ADDRESS+((RamI2cCommandData[1]&0x0F)-0x0C));
else if((RamI2cCommandData[1]&0xF0)==0x50)
Address= (_EEPROM_7500_ADDRESS+((RamI2cCommandData[1]&0x0F)-0x0C));
/*
else if((RamI2cCommandData[1]&0xF0)==0x60)
Address= (_EEPROM_SRGB_ADDRESS+((RamI2cCommandData[1]&0x0F)-0x0C));
else if((RamI2cCommandData[1]&0xF0)==0x70)
Address= (_EEPROM_USER_ADDRESS+((RamI2cCommandData[1]&0x0F)-0x0C));
*/
else if((RamI2cCommandData[1]&0xF0)==0x60)
Address= (_EEPROM_USER_ADDRESS+((RamI2cCommandData[1]&0x0F)-0x0C));
else if(RamI2cCommandData[1]==_ALIGN2_EE_LANGUAGE) //Get Language Address
Address= _EEPROM_LANGUAGE_ADDRESS;
else if(RamI2cCommandData[1]==_ALIGN2_EE_SRGB_BRIGHT)
Address= _SRGB_DEFAULT_DATA_ADDRESS;
#endif
return(Address);
}
/*******************************************************************************/
void Alignment(void)
{
BYTE i;
if(bAlignmentDo==_TRUE)
{
bAlignmentDo=_FALSE;
switch(RamI2cCommandData[0])
{
#if (_COLOR_TRACK == _ON)
case(_CT_WRITE):
{
if(((RamI2cCommandData[1] &0xF0) <= 0xA0) && ((RamI2cCommandData[1] &0xF0) >= 0x80))
{
//CAdjustDither(tDITHER_SEQ_TABLE_0, tDITHER_TABLE_10_TO_8_1); // Enable dithering
CScalerSetByte(0x67,RamI2cCommandData[1] &0xF0 ); //split color CH
CScalerSetByte(_GAMMA_PORT_66, RamI2cCommandData[2]);
CScalerSetByte(_GAMMA_PORT_66, (RamI2cCommandData[1] & 0x03)<<6);
CScalerSetByte(0x67,0x40);
}
}
break;
#elif (_COLOR_TRACK == _OFF)
case(_ALIGN1_WRITE_RAM):
{
if(RamI2cCommandData[1]==_ALIGN2_RAM_CONTRAST)
{
stPictureData.Contrast=AlignMapToReal(RamI2cCommandData[2],_CONTRAST_MAX,_CONTRAST_MIN);
CAdjustContrast();
}
else if(RamI2cCommandData[1]==_ALIGN2_RAM_BRIGHT)
{
stPictureData.BackLight=AlignMapToReal(RamI2cCommandData[2],_BACKLIGHT_MAX,_BACKLIGHT_MIN);
CAdjustBacklight();
}
else if(RamI2cCommandData[1]==_ALIGN2_RAM_SRGB_BRIGHT)
{/* //ryan abandon
if(stGlobalData4.PictureMode==_SRGB_PICTURE)
{
ucSrgbDefaultBrightReal=AlignMapToReal(RamI2cCommandData[2],_BACKLIGHT_MAX,_BACKLIGHT_MIN);
CAdjustBacklight();
}*/
}
else if((RamI2cCommandData[1]>=_ALIGN2_RAM_RGAIN)&&(RamI2cCommandData[1]<=_ALIGN2_RAM_BGAIN))
{
if(RamI2cCommandData[2]>=_COLOR_MAX) RamI2cCommandData[2]=_COLOR_MAX;
if(RamI2cCommandData[2]<=_COLOR_MIN) RamI2cCommandData[2]=_COLOR_MIN;
stColorData.Contrast[RamI2cCommandData[1]-_ALIGN2_RAM_RGAIN]=RamI2cCommandData[2];
CAdjustContrast();
}
}
break;
case(_ALIGN1_READ_RAM):
{
if(RamI2cCommandData[1]==_ALIGN2_RAM_CONTRAST)
RamI2cCommandData[2]=AlignMapToPercent(stPictureData.Contrast,_CONTRAST_MAX,_CONTRAST_MIN);
else if(RamI2cCommandData[1]==_ALIGN2_RAM_BRIGHT)
RamI2cCommandData[2]=AlignMapToPercent(stPictureData.BackLight,_BACKLIGHT_MAX,_BACKLIGHT_MIN);
else if(RamI2cCommandData[1]==_ALIGN2_RAM_SRGB_BRIGHT)
{/* //ryan abandon
if(stGlobalData4.PictureMode==_SRGB_PICTURE)
RamI2cCommandData[2]=AlignMapToPercent(ucSrgbDefaultBrightReal,_BACKLIGHT_MAX,_BACKLIGHT_MIN); //ARKIN 1227*/
}
else if((RamI2cCommandData[1]>=_ALIGN2_RAM_RGAIN)&&(RamI2cCommandData[1]<=_ALIGN2_RAM_BGAIN))
{
RamI2cCommandData[2]=stColorData.Contrast[RamI2cCommandData[1]-_ALIGN2_RAM_RGAIN];
}
else if(RamI2cCommandData[1]==0x5A)
RamI2cCommandData[2]= 0x01; //BQZ Firmware Version
}
break;
//ADC
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -