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

📄 main_def.h

📁 keil c51平台,此代码可用于学习TFT LCD 之TCON,SCALER,OSD,(本人自己修改)
💻 H
字号:
#include "CHAR_DEF.H"
#include "MODE_DEF.H"
#include "RTD_DEF.H"
#include "CODE_DEF.H"


#define TRUE            1
#define FALSE           0
#define HIGH            1
#define LOW             0
///////////////////////////////////////////////////////////////////
// Definitions for debug
#define ISPACK          0   // Using ISPACK.                This definition must be disabled when not using ISPACK
#define KINGMICE        0   // Using KingMice for debug.    This definition must be disabled when not using KINGMICE
#define GETREGISTER     0   // Using ICE for debug.         This definition must be disabled when not using KINGMICE
#define GETSFR          0   // Get the Status of SFR.       This definition must be disabled when not using KINGMICE
#define RTDDEBUG        0   // Status check for debug.
#define SHOW_CHECK      0   // Show debug message on OSD.
#define RS232_DEBUG     0   // DEBUG enable through the rs232 & external MCU

//////////////////////////////////////////////////////////////////////
//Definitions for Auto Switch(Auto Switch to freerun and background when some event occur)
#define AS_DV_TOTAL      0   // When line number of Display HS is equal to Display Vertical Total
#define AS_PLL_NONLOCK   0   // When ADC-PLL non-lock
#define AS_NON_FRAMESYNC 0   // When overflow or underflow

// Issac :
// The definition of KINGMICE must be 0 when you want to use flash ROM instead of KINGMICE debug board

///////////////////////////////////////////////////////////////////
// Definitions for advance function
#define TUNE_APLL               0   // Do PLL fine-tune according to PE         1 : Enabled, 0 : Disabled
#define MORE_CLOCK              1   // Do Auto-clock in clock step 1            1 : Enabled, 0 : Disabled
#define FULL_LINE_BUFFER        1   // Enable full-line buffer                  1 : Enabled, 0 : Disabled
#define HIDDEN_PAGE             1   // Hidden OSD control page                  1 : Enabled, 0 : Disabled
#define SPREAD_SPECTRUM         0   // Turn on spread spectrum function         1 : Enabled, 0 : Disabled
#define NEW_PI_CODE             1   // PLL setting method                       1 : NEW    , 0 : Old
#define BURNIN_MODE             0   // Burn-In mode activation                  1 : Enable,  0 : Disable
#define SOURCE_AUTO_SCAN        0   // Auto scan input source                   1 : Enable,  0 : Disable
#define ANALOG_CONTRAST         1   // Adjust the contrast with analog gain     1 : Enable,  0 : Disable
#define FAST_AUTO		1   // Rapid auto algorithm                     1 : Enable   0 : Disable
#define ADC_DEFFERENTIAL        0   // ADC use the defferential mode            1 : Defferential   0: Single ended,only effect after ver C of 2522
                                        
/////////////////////////////////////////////////////////////////////////////////////////////
//Source search prioirty, just if SOURCE_AUTO_SCAN function enable, below definition is valid
#define MASTER_SOURCE   SOURCE_VGA
#define SLAVE_SOURCE    SOURCE_DVI
#define THIRD_SOURCE    SOURCE_SV


#define dv_star			1	// 1	0

///////////////////////////////////////////////////////////////////
// For PC AV TV  control
#define PC_ONLY			0
#define PC_AUDIO		1
#define AV_ONLY			2
#define TV_ONLY_6B1		3
#define TV_ONLY_6B2		4
#define TV_ONLY_6B3		5

#define PC_AV_TV		PC_ONLY



///////////////////////////////////////////////////////////////////
// For remote control
#define CUSTOM_CODE     0xff00

#define IR_ENTER_KEY    0x9f	//MENU
#define IR_RIGHT_KEY    0x5f	
#define IR_LEFT_KEY     0x85	
#define IR_POWER_KEY    0xd7

#define IR_FUNC_SOURCE  0x75
#define IR_FUNC_DISP    0x3f	
#define IR_FUNC_JUMP    0xad	
#define IR_FUNC_CHDEC   0x1f
#define IR_FUNC_CHINC   0x55
#define IR_FUNC_VOLINC  0xdd
#define IR_FUNC_VOLDEC  0xe7
#define IR_FUNC_MENU    0x0f	//option
#define IR_FUNC_CHNUM   0x65	
#define IR_FUNC_MUTE    0x9d

#define IR_FUNC_NUM0    0xb7
#define IR_FUNC_NUM1    0x6f
#define IR_FUNC_NUM2    0x47
#define IR_FUNC_NUM3    0x07
#define IR_FUNC_NUM4    0x4f
#define IR_FUNC_NUM5    0x67
#define IR_FUNC_NUM6    0x27
#define IR_FUNC_NUM7    0x77
#define IR_FUNC_NUM8    0x57
#define IR_FUNC_NUM9    0x17


///////////////////////////////////////////////////////////////////
// Definitions for Vedio Decoder

#define VDC_NONE        0   // 0:No vedio decoder available
#define VDC_SAA7111     1   // 1:SAA7111 chip
#define VDC_SAA7113     3   // 3:SAA7113 chip
#define VDC_SAA7114     4   // 4:SAA7114 chip
#define VDC_SAA7115     5   // 4:SAA7115 chip
#define VDC_SAA7118     8   // 5:SAA7118 chip

#define TW_9903         13   //TECHWELL  VIDECODER
#define TW_9905         15   //TECHWELL  VIDECODER
#define TW_9908         18   //TECHWELL  VIDECODER

#define TVP_5150        20   //TI VIDECODER
#define TVP_5146        26   //TI VIDECODER


#define VIDEO_NORMAL      0
#define VIDEO_ONLY        1
#define INPUTSOURCE      VIDEO_NORMAL

#define ADDR_7111A      0x48    // Video decoder SAA7111A
#define ADDR_7114       0x42    // Video decoder SAA7114
#define ADDR_7115       0x42    // Video decoder SAA7115
#define ADDR_7118       0x42    // Video decoder SAA7118


#define VDC_BRIGHT_CTRL     0x0a
#define VDC_CONTRAST_CTRL   0x0b
#define VDC_SATURATION_CTRL 0x0c
#define VDC_HUE_CTRL        0x0d
#define VDC_BRIGHT_YUV_CTRL 0x2a


#if(PC_AV_TV > PC_AUDIO)
#define IRPOLLING       1   // Remote control function                  1 : Enabled, 0 : Disabled
#define VIDEO_CHIP      TW_9905
#else
#define IRPOLLING       0   // Remote control function                  1 : Enabled, 0 : Disabled
#define VIDEO_CHIP      VDC_NONE
#endif		//#if(PC_AV_TV > PC_AUDIO)


////////////////////////////////////////////////////////////////////////////////
// Definitions for audio device
#define AUDIO_NONE      0
#define AUDIO_SC7313    1
#define AUDIO_62429     2

#if(PC_AV_TV == PC_ONLY)
#define AUDIO_TYPE      AUDIO_NONE
#endif
#if(PC_AV_TV == PC_AUDIO)
#define AUDIO_TYPE      AUDIO_62429
#endif
#if(PC_AV_TV > PC_AUDIO)
#define AUDIO_TYPE      AUDIO_SC7313
#endif


///////////////////////////////////////////////////////////////////
// Definitions for TV system and tuner
#define TV_NTSC         0
#define TV_PAL          1
#define TV_SECAM        2

#define TV_SYSTEM       TV_PAL

#define TV_NONE         0       // 0:No TV tuner available
#define TV_6B1          1       // 1:for PAL & NTSC
#define TV_6B2          2       // 2:for PAL & SECAM
#define TV_6B3          3       // 2:for PAL & NTSC & SECAM

#if(PC_AV_TV < TV_ONLY_6B1)
#define TV_CHIP         TV_NONE
#endif
#if(PC_AV_TV == TV_ONLY_6B1)
#define TV_CHIP         TV_6B1
#endif
#if(PC_AV_TV == TV_ONLY_6B2)
#define TV_CHIP         TV_6B2
#endif
#if(PC_AV_TV == TV_ONLY_6B3)
#define TV_CHIP         TV_6B3
#endif









///////////////////////////////////////////////////////////////////
// Definitions for IC reversion
#define REV_A           0

#define IC_VERSION      REV_A

///////////////////////////////////////////////////////////////////
// Definition for MCU type
#define MCU_WINBOND     0
#define MCU_MTV512      1

#define MCU_TYPE        MCU_MTV512

#if (GETSFR)
sfr  DPL1           = 0x84;
sfr  DPH1           = 0x85;
sfr  DPS            = 0x86;
sfr  CKCON          = 0x8e;
sfr  SPC_FNC        = 0x8f;
sfr  EXIF           = 0x91;
sfr  MPAGE          = 0x92;
sfr  SBUF0          = 0x99;
sfr  SCON1          = 0xc0;
sfr  SBUF1          = 0xc1;
#endif

// Note :
// When using KingMice on PCB Rev-C for debugging, power-key must be disabled.
// That is, KEY_DISABLED must be POWER_KEY_MASK, and POWER_KEY_TYPE must be TYPE_ONE_TOUCH.

#define KEY_DISABLED        0//POWER_KEY_MASK   // Disabled key must be in the range of ALL_KEY_MASK

#define TYPE_TWO_STATE      0x00
#define TYPE_ONE_TOUCH      0x01

#define POWER_KEY_TYPE      TYPE_ONE_TOUCH


#define PANEL_CHIMEI          0
#define PANEL_ACER            1
#define PANEL_HYUNDAI         2
#define PANEL_QDI             3
#define PANEL_CPT_R           4
#define PANEL_INNOUX_R        5

#define PANEL_TYPE          PANEL_CHIMEI


#define TMDS_ENABLE         0           //  TRUE  : Enable TMDS function
                                           //  FALSE : Disable TMDS function
#define HDCP_ENABLE         0          //  TRUE  : Enable HDCP function
                                           //  FALSE : Disable HDCP fucntion
////////////////////////////////////////////////////////////////////////////////
// Definitions for Brightness and ADC Color
//#define MAX_BRIGHTNESS  128     // Maximum Setting of Brightness  light
//#define MIN_BRIGHTNESS  0      // Minimum Setting of Brightness   light
#define MAX_BRIGHTNESS  170     // Maximum Setting of Brightness
#define MIN_BRIGHTNESS  85      // Minimum Setting of Brightness
#define INV_BRIGHTNESS  0       // 0 : Normal; 1 : Invert.
//#define SWAP_RED_BLUE   0       // 0 : Normal; 1 : Swap Red and Blue


///////////////////////////////////////////////////////////////////
// Definitions for EEPROM 2404

#define ADDR_EROM0      0xAC    // EEPROM 2401 (Page 0)
#define ADDR_EROM1      0xAE    // EEPROM 2401 (Page 1)
#define ADDR_EROM2      0xA8    // EEPROM 2408 (Page 2)
#define ADDR_EROM3      0xAA    // EEPROM 2408 (Page 3)
#define SET_2404_DELAY  0x10    // Delay in ms for EEPROM R/W



#define ADDR_SC7313     0x88    // Volume device SC7313

#define INV_VOLUME      0       // 0 : Normal; 1 : Invert. Only useful for PWM volume control



#define ADDR_TUNER      0xC0    // Philips FI1236/FQ1216 TV tuner

#define ADDR_9886	0x86    // Philips TDA9886 address select

#define JS_6B1_VHF_LOW  4005    // Fosc * 20
#define JS_6B1_VHF_HIGH 10085

#define VHF_LOW_BAND    JS_6B1_VHF_LOW    
#define VHF_HIGH_BAND   JS_6B1_VHF_HIGH

///////////////////////////////////////////////////////////////////
// Definitions for MENU MODE
#define MENU_REL        0
#define MENU_KTC        1
#define MENU_DELL       2 

#define MENU_TYPE       MENU_REL

#define LOGO_SZSM       0
#define LOGO_FZDN       1
#define LOGO_FZCJ       2
#define LOGO_COM        3

#define LOGO_TYPE       LOGO_COM


#define KOREA		1	//V208
#define CHINA		0


///////////////////////////////////////////////////////////////////
// Definitions for KEY MODE
#define KEY_5           0		// 5 key  & 7 key
#define KEY_6           1		// 6 key  & 8 key

#define KEY_TYPE        KEY_5


///////////////////////////////////////////////////////////////////
// Definitions for BRIGHT MODE
#define LIGHT           0
#define GAIN            1
#define GAIN_LIGHT      2

#define BRIGHT_TYPE     GAIN


///////////////////////////////////////////////////////////////////
// Definitions for demo board version
#define TTL_M02          0	//TTL
#define TTL_M02B4        1
#define TTL_M02B6        2	//M02A
#define TTL_M02C         3

#define LVDS_M05B1       10	//TTL TV AV
#define LVDS_M05B2       11

#define LVDS_M01B2       20	//LVDS
#define LVDS_M01B4       21

#define LVDS_M03B1       30	//LVDS TV AV
#define LVDS_M03B2       31
#define LVDS_M03B3       32

#define LVDS_M04B1       40

#define BOARD_TYPE       TTL_M02B6




⌨️ 快捷键说明

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