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

📄 main.c

📁 MST720-DEMO程序
💻 C
字号:
/******************************************************************************
 Copyright (c) 2005 MStar Semiconductor, Inc.
 All rights reserved.

 [Module Name]: Main.c
 [Date]:        04-Jan-2005
 [Comment]:
   Main subroutines.
 [Reversion History]:
*******************************************************************************/

#define _MAIN_C_

/********************
* INCLUDE FILES     *
*********************/
#include "Typedef.h"
#include "Project.h"
#include "Debug.h"
#include "Mcu_reg.h"
#include "Mcu.h"
#include "Global.h"
#include "Define.h"
#include "Ms7X_reg.h"
#include "Ms_RWreg.h"
#include "I2C.h"
#include "Debug.h"
#include "SI2C.h"
#include "Mcu_reg.h"
#include "Misc.h"
#include "Mst7x.h"
#include "Sync.h"
#include "Ms_Func.h"
#include "OSDMenu.h"
#include "IR_Func.h"
#include "OSDKey.h"//20050920

#if ((MARIA_TYPE_SEL == MARIA_2) && ENABLE_VD_DSP)
#include "Maria2_dsp_lib.h"
#endif	// ENABLE_VD_DSP

////////////////////////////////
// Main program
////////////////////////////////
void main()
{
#if(ENABLE_VD_DSP)
	g_bEnableVDDSP = 0;
#endif

#if (BUS_TYPE_SEL == SERIAL_BUS)	//kevin
	mstBusInitial();
#endif

#if MCU_TYPE_SEL == MCU_MSTAR

	while( (mstReadByte(GEN_00_REGBK) & 0xC0) != 0x80);
	
	#if (MCU_XTAL_CLK_HZ == 18000000)
		mstWriteByte(BK0_EE_PDMD2, 0xC0);
	#endif
	
#else
	while( (mstReadByte(GEN_00_REGBK) & 0xC0) != 0xC0);
#endif

#if PANEL_TYPE_SEL == PNL_LG07_AT
	mstWriteByte(GEN_00_REGBK, REGBANKADC);	// switch to Bank 1
	mstWriteByte(BK1_4A, 0x00);			// Turn on VGL and VGH
	mstWriteByte(BK1_4B, 0x40);
	mstWriteByte(GEN_00_REGBK, REGBANKSCALER);	// Switch to Bank 0 for data output control
#endif

	sysMcuInit();					// initialize MCU

#if RS232DBG
	sysWriteString("-MCU Initialize final-\x0d\x0a");
	sysWriteUartOneWord(0x4142);
	sysWriteUartHex4(0x4455,0);
	sysWriteDec(6677);
	sysWriteUartDec6(8899);
	sysWriteString(tChangeLine); 
	sysWriteString(__DATE2__);
	sysWriteString(" - ");
	sysWriteString(__TIME__);
	sysWriteString(tChangeLine);
#endif	// RS232DBG

	//miscTurnOffPanel();	//20050908 kevin mask
	PANEL_BLIGHT_OFF();//20050908 kevin
	PANEL_VCC_OFF();//20050908 kevin
	SET_LED_OFF();

	mstMst7XInit();					// MST7XXX initialize



#if RS232DBG
	sysWriteString(tChangeLine);
	sysWriteString("-Maria Initial final-\x0d\x0a");
#endif	//RS232DBG

	sysVariableInit();				// Initialize global veriable and user settings

#if (BOARD_TYPE_SEL == BD_DEMO_7985M_IDP)
	sysI2CWriteByte(0xBA, 0x33, 0x40);			// Initial Ti5146 for CCIR656 input
	sysI2CWriteByte(0xBA, 0x34, 0x11);
#endif

	mstWriteByte(BK0_1E_INTSTD, 0x00);			// Clear Sync interrupt status D
	g_ucSystemFlag |= (INPUT_TIMING_CHANGE_FLAG + FIRST_AC_ON_FLAG);	//20050908 kevin
	
	//miscTurnOffPanel();	//kevin 20050908 mask
	//osdOSDDrawSourceLable();	//kevin 20050908 mask

	mstSyncSourceSwitch();


	// For video decoder work crazy
    	//miscDelay1ms(300); 	//20050908 mask			

#if RS232DBG
	sysWriteString("-Enter while LOOP-\x0d\x0a");
#endif	// RS232DBG

	while(1)
	{
	#if RS232DBG
    		sysCheckUartCmd();			// Rs232 debug command process
	#endif	// RS232DBG

	
	#if ((MARIA_TYPE_SEL == MARIA_2) && ENABLE_VD_DSP)
		if(tOSDSourcSELSequence[Display.ucSourceSEL] < VGA)
		{
			if(g_bEnableVDDSP)
			{
				VD_DSP_Int();
				VD_DSP();
			}
			//mstWriteByte(BK0_1E_INTSTD, 0x00);
		}
	#endif	// ENABLE_VD_DSP

	#if SI2C_ENABLE
		sysSlaveI2CCommand();			// SI2C command process
	#endif	// SI2C_ENABLE

	#if IR_ENABLE
		optIRDecodeCommand();			// IR command process
	#endif	// IR_ENABLE

		osdMenuHandler();			// OSD and Key process
		
	#if ((MARIA_TYPE_SEL == MARIA_2) && ENABLE_VD_DSP)
		if(tOSDSourcSELSequence[Display.ucSourceSEL] < VGA)
		{
			if(g_bEnableVDDSP)
			{
				VD_DSP_Int();
				VD_DSP();
			}
			//mstWriteByte(BK0_1E_INTSTD, 0x00);
		}
	#endif	// ENABLE_VD_DSP

		mstSyncCheckSignal();			// Check signal chang process
	
		mstSyncChangeHandler();		// Timing change process

	#if ((MARIA_TYPE_SEL == MARIA_2) && ENABLE_VD_DSP)
		if(tOSDSourcSELSequence[Display.ucSourceSEL] < VGA)
		{
			if(g_bEnableVDDSP)
			{
				VD_DSP_Int();
				VD_DSP();
			}
			//mstWriteByte(BK0_1E_INTSTD, 0x00);
		}
	#endif	// ENABLE_VD_DSP
	
		if ((g_ucSystemFlag & INPUT_TIMING_CHANGE_FLAG) == 0)
		{
			if ((g_ucSystemFlag & NO_INPUT_SIGNAL_FLAG) == 0)	// If have singnal input
			{
			
			#if(MARIA_TYPE_SEL == MARIA_1)
				mstSyncVDGainHandler(0);		// Vedio decoder AGC detect process
			#endif
			
			#if ENABLE_VD_COLOR_DETECT
				mstVDColorBurstHandler(0);
			#endif	// ENABLE_VD_COLOR_DETECT

			#if(MARIA_TYPE_SEL == MARIA_1)
				mstHTotalCalibrateHandle();		// 20050804 Antony
			#endif
			}

			if ((g_ucSystemFlag & SAVE_SETTING_FLAG) !=0)
			{
				mstSaveDisplayData();
				g_ucSystemFlag &= ~SAVE_SETTING_FLAG;
			}
		}

	#if (MCU_TYPE_SEL == MCU_W78E65)//20050920
		while ((bit)(g_ucSystemFlag & ENTER_SPI_DEBUG) == TRUE)
		{
			osdKeyScanKeypad();
		};
	#endif
	} // while loop
}

⌨️ 快捷键说明

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