#include #include #include "dsthalcommon.h" #include "HDMI_TX_DRV.h" #include "HDMI_TX_System_Config.h" #include "ANX8560.h" #if USE_HDMI_RX #include #endif ///////////////////////////////////////////////////////////////////////////// // Local Functions / Variables ///////////////////////////////////////////////////////////////////////////// static int g_ExistDevice; extern int g_SyncLockDelay; //typedef void (*CbSyncLockFunc_t)(int, int, int); const struct Video_Timing Video_Timing_720p[] = { {1650, 1280, 750, 720, 147, 40, 183, 5, 5, 20, 0, 0, 0, 1}, /* For 480i */ {1650, 1280, 750, 720, 147, 40, 183, 5, 5, 20, 0, 0, 0, 1}, /* For 480p */ {1650, 1280, 750, 720, 147, 40, 183, 5, 5, 20, 0, 0, 0, 1}, /* For 720p */ {1650, 1280, 749, 722, 147, 40, 183, 5, 5, 20, 0, 0, 0, 1}, /* For 1080i */ {1650, 1280, 750, 720, 147, 40, 183, 5, 5, 20, 0, 0, 0, 1}, /* For 1080p */ {1650, 1280, 750, 720, 147, 40, 183, 5, 5, 20, 0, 0, 0, 1}, /* For VGA */ {1650, 1280, 750, 720, 147, 40, 183, 5, 5, 20, 0, 0, 0, 1}, /* For others */ }; ///////////////////////////////////////////////////////////////////////////// // Global Functions / Variables ///////////////////////////////////////////////////////////////////////////// int g_BIST_OnOff = 0, g_BIST_Resolution = 0, g_BIST_Pattern = 0; int g_HDMI_TX_FormatChange = 1; void HDMI_TX_SyncLockCallback(int ucMode, int bDTV, int ucSignal, int inVFreq); ///////////////////////////////////////////////////////////////////////////// // Extern Functions / Variables ///////////////////////////////////////////////////////////////////////////// BIT restart_system; static int EnableDebug = 0; static int g_DelaySyncLock = 0; int HDMI_TX_Debug(int enable) { EnableDebug = enable; return EnableDebug; } int HDMI_TX_DebugPrintf(char const *str, ...) { int length = 0; if (EnableDebug == 1) { va_list v; va_start(v, str); vprintf(str, v); } return length; } int preset_hdcp = 1; void HDMI_TX_PreSetHDCP(int value) { preset_hdcp = value; } void HDMI_TX_SetEXTSwing(int NewExtSwing) { extern BYTE bExtSwing; bExtSwing = NewExtSwing; if ( HDMI_TX_Get_System_State() >= HDMI_TX_WAIT_HOTPLUG ) { if ( NewExtSwing == 1 ) DHL_SYS_ANXWrite(0, HDMI_TX_ANA_BLK_CTRL0_REG, HDMI_TX_ANA_BLK_CTRL0_ST_EN | 0x05); // for video blinking problem... else DHL_SYS_ANXWrite(0, HDMI_TX_ANA_BLK_CTRL0_REG, HDMI_TX_ANA_BLK_CTRL0_ST_EN | 0x01); // for video blinking problem... } } int HDMI_TX_Initialize(void) { int ret = -1; g_ExistDevice = 0; restart_system = 0; if (HDMI_TX_API_DetectDevice() == 1) { HDMI_TX_API_Initial(); HDMI_TX_API_ShutDown(0); HDMI_TX_API_HDCP_ONorOFF(preset_hdcp); // HDMI_TX_API_HoldSystemConfig(0); HDMI_TX_Debug(1); g_ExistDevice = 1; ret = 0; } return ret; } int HDMI_TX_IsExistDevice(void) { return g_ExistDevice; } void HDMI_TX_SetFormatChange(int En) { g_HDMI_TX_FormatChange = En; fprintf(stderr, "|%s, %d| HDMI Tx Format change = %x\n", __FUNCTION__, __LINE__, g_HDMI_TX_FormatChange); } int HDMI_TX_IsFormatChange(void) { return g_HDMI_TX_FormatChange; } static int lastLockMode = 0; static int lastIsDTV = 0; static int lastSignal = 0; static int lastInVFreq = 60; void HDMI_TX_SyncLockCallback(int ucMode, int bDTV, int ucSignal, int inVFreq) { if ( DHL_CAP_GetSyncLockEnable() == 0 ) return; if ( HDMI_TX_Get_System_State() < HDMI_TX_PLAY_BACK ) ucMode = -1; switch(ucMode) { } } int HDMI_TX_MonitorThread(void) { #define null 0 if (g_ExistDevice != 1) { HDMI_TX_DebugPrintf("|%s| LINE=%d, Cannot run monitor thread : anx8560 not found.\n", __FUNCTION__, __LINE__); return -1; } while (1) { if (restart_system) { HDMI_TX_DebugPrintf("Restart System...\n"); restart_system = 0; HDMI_TX_API_Initial(); } if(!hdmi_tx_shutdown) { if (g_BIST_OnOff == 0) { HDMI_TX_Task(); } else { HDMI_TX_BIST_Task(); } HDMI_TX_SyncLockCallback( lastLockMode, lastIsDTV, lastSignal, lastInVFreq ); } OS_mDelay(300); } return 0; } void HDMI_TX_BIST_OnOff(int onoff) { g_BIST_OnOff = onoff; } void HDMI_TX_BIST_Resolution(int i) { g_BIST_Resolution = i; } void HDMI_TX_BIST_Pattern(int i) { g_BIST_Pattern = i; } void HDMI_TX_EnableMonitorThread(int En) { hdmi_tx_shutdown = !En; } void HDMI_TX_EnableDelaySynclock(int En) { printf("DelaySyncLock: %d -> %d\n", g_DelaySyncLock, En ); g_DelaySyncLock = En; }