//---------------------------------- // Display/Clear PCInfo // // win: PCINFO_OSDWIN //---------------------------------- void DisplayPCInfo(BYTE CODE *ptr) { WORD xstart, ystart; BYTE len; //#ifdef DEBUG_PC //Printf("\r\n==== DisplayPCInfo (%s) ====", ptr); //#endif len = TWstrlen(ptr); xstart = ( PANEL_H - len*PCINFO_ZOOM*FONT_DEF_WIDTH ) / 2; ystart = PANEL_V / 3; InitFOsdMenuWindow(Init_Osd_DisplayPCInfo); FOsdWinScreenXY(PCINFO_OSDWIN, xstart,ystart); FOsdWinSetW(PCINFO_OSDWIN, len); FOsdRamMemset(PCMEASUREINFO_ADDR,0x020, FG_COLOR_RED, len); WriteStringToAddr(PCMEASUREINFO_ADDR, (BYTE CODE *)ptr, len); FOsdWinEnable(PCINFO_OSDWIN,TRUE); FOsdOnOff(ON, 1); //with vdelay 1 DisplayedOSD |=FOSD_PCINFO; }
void DisplayVol(void) { BYTE CODE *Str ; BYTE len; //#ifdef DEBUG_OSD //dPuts("\r\n++(DisplayVol)"); //#endif if(( DisplayedOSD & FOSD_TVVOL ) == 0 ) { ClearOSDInfo(); FOsdDefaultLUT(); delay1ms(100); InitFOsdMenuWindow(Init_Osd_BarWindow); FOsdRamMemset(FOSDMENU_BARADDR, 0x020, BG_COLOR_CYAN | FG_COLOR_WHITE, 25 ); // Total 25*2 Char. FOsdRamMemset(FOSDMENU_BARADDR+25, 0x020, BG_COLOR_WHITE | FG_COLOR_CYAN, 25 ); Str = StrVolume[OSDLang]; len=TWstrlen(Str); WriteStringToAddr(FOSDMENU_BARADDR, Str, len); FOsdWinEnable(FOSDMENU_BARWIN,TRUE); FOsdOnOff(ON, 1); //with vdelay 1 } DisplayVolumebar(AudioVol); DisplayedOSD |= FOSD_TVVOL; OSDDisplayedTime = GetTime_ms(); }
//------------------------------------------------------------------- // Display/Clear Mute Info //------------------------------------------------------------------- void DisplayMuteInfo(void) { BYTE CODE *Str ; BYTE len; ClearOSDInfo(); InitFOsdMenuWindow(Init_Osd_DisplayMuteInfo); Str = MuteOnStr[OSDLang]; len = TWstrlen(Str); WriteStringToAddr(MUTEINFO_ADDR, Str, len); FOsdRamMemsetAttr(MUTEINFO_ADDR, BACK_COLOR|FG_COLOR_RED, len ); FOsdWinEnable(TVINFO_OSDWIN,TRUE); FOsdOnOff(ON, 1); //with vdelay 1 DisplayedOSD |= FOSD_MUTE; }
//============================================================================= // //============================================================================= void MonitorMCU(void) { BYTE ret, i, j; BYTE idx; BYTE argv_num1, argv_num2; //, argv_num3; //if ( argc>2) { BKFYI: It will hurt a speed // argv_num1 = a2h( argv[2] ); // if ( argc>3 ) { // argv_num2 = a2h( argv[3] ); // if (argc > 4) { // argv_num3 = a2h( argv[4] ); // } // } //} //---------------------- Write SFR ----------------------- if( !stricmp( argv[1], "Ws" ) ) { if( argc < 4 ) { Printf(" ----> Missing parameter !!!"); return; } argv_num1 = a2h( argv[2] ); argv_num2 = a2h( argv[3] ); ret = WriteSFR(argv_num1, argv_num2); if( echo ) { Printf("\nMCU SFR Write: %02bx=%02bx (%02bx) ", argv_num1, argv_num2, ret); for(i=0; i<8; i++) { if( ret & 0x80 ) Puts("1"); else Puts("0"); ret <<=1; } } } //---------------------- Read SFR ------------------------ else if( !stricmp( argv[1], "Rs" ) ) { if( argc < 3 ) { Printf(" ----> Missing parameter !!!"); return; } argv_num1 = a2h( argv[2] ); ret = ReadSFR(argv_num1); if( echo ) { Printf("\nMCU SFR Read: %02bx=%02bx ", argv_num1, ret); for(i=0; i<8; i++) { if( ret & 0x80 ) Puts("1"); else Puts("0"); ret <<=1; } } } //---------------------- Dump SFR ------------------------ else if( !stricmp( argv[1], "Ds" ) ) { Printf("\nDump DP8051 SFR"); for (j=0x8; j<=0x0f; j++) { Printf("\nSFR %02bx: ", j*0x10); for(i=0; i<8; i++) Printf("%02bx ", ReadSFR(j*0x10+i) ); Printf("- "); for(; i<16; i++) Printf("%02bx ", ReadSFR(j*0x10+i) ); } } //---------------------- Bitwise SFR control--------------------- else if( !stricmp( argv[1], "Bs" ) ) { Printf("\nSorry!!"); } //---------------------- Dump SFR map--------------------- else if( !stricmp( argv[1], "SFR" ) ) { BYTE len; DWORD UsedTime; UsedTime = SystemClock; Printf("\nDump DP80390 SFR"); for(j=0x00; j < 0x80; j++) { idx = j+0x80; for(i=0; i < 0x80; i++) { if(SFR_map[i].idx == idx) break; //success if(SFR_map[i].idx == 0) { i = 0x80; break; //fail } } if((j&0x07) == 0) Puts("\n"); if(i != 0x80) { Printf("%02bx:%05s",SFR_map[i].idx, SFR_map[i].name); len = TWstrlen(SFR_map[i].name); len = 5-len; //max 5. for(i=0; i < len; i++) Puts(" "); Printf(":%02bx ",ReadSFR(idx)); } else { //Printf("--:-----:--_"); //Printf(" "); Printf(" ..... "); } } UsedTime = SystemClock - UsedTime; Printf("\nUsedTime:%ld.%ldsec", UsedTime/100, UsedTime%100 ); } //---------------------- Dump xdata ---------------------- else if( !stricmp( argv[1], "Wx" ) ) { WORD addr; if( argc < 4 ) { Printf(" ----> Missing parameter !!!"); return; } addr = a2h( argv[2] ); argv_num2 = a2h( argv[3] ); *(BYTE xdata *)(addr) = argv_num2; ret = *(BYTE xdata *)(addr); if( echo ) { Printf("\nMCU XDATA Write: %04x=%02bx (%02bx) ", addr, argv_num2, ret); } } //---------------------- Dump xdata ---------------------- else if( !stricmp( argv[1], "Rx" ) ) { WORD addr; if( argc < 3 ) { Printf(" ----> Missing parameter !!!"); return; } addr = a2h(argv[2]); ret = *(BYTE xdata *)(addr); if( echo ) { Printf("\nMCU XDATA Read: %04x=%02bx ", addr, ret); } } //---------------------- Dump xdata ---------------------- else if( !stricmp( argv[1], "Dx" ) ) { //data BYTE xdata *osddata = (BYTE xdata *)0xc002; WORD addr=0x0000, len=0x100; if( argc>=3 ) addr = a2h(argv[2]); if( argc>=4 ) len = a2h(argv[3]); Printf("\nDump DP8051 XDATA 0x%04x ", addr); for (j=0; j<len/0x10; j++) { Printf("\nXDATA %04x: ", (WORD)(addr+j*0x10) ); for(i=0; i<8; i++) Printf("%02bx ", *(BYTE xdata *)(addr + j*0x10+i) ); Printf("- "); for(; i<16; i++) Printf("%02bx ", *(BYTE xdata *)(addr + j*0x10+i) ); } } //---------------------- Enable WDT ------------------------ #if defined(SUPPORT_WATCHDOG) || defined(DEBUG_WATCHDOG) else if( !stricmp( argv[1], "WDT" ) ) { if(argc > 2) { if( argv[2][0]=='1' ) { BYTE mode; if(argc > 3) mode=a2h(argv[3]); else mode = 0; EnableWatchdog(mode); Printf("\nWatchdog Timer is enabled. mode:%bx", mode); } else if( argv[2][0]=='2' ) { Puts("Watchdog test...."); RestartWatchdog(); Puts("start...."); SFR_EWDI = 0; delay1s(1,__LINE__); delay1s(1,__LINE__); delay1s(1,__LINE__); delay1s(1,__LINE__); delay1s(1,__LINE__); delay1s(1,__LINE__); delay1s(1,__LINE__); //system reset before you here. Puts("..FAIL"); } else { DisableWatchdog(); Printf("\nWatchdog Timer is disabled."); } } else { Puts("\nWatchdog "); if(SFR_WDCON & 0x02) Puts("On"); else Puts("Off"); #ifdef SUPPORT_WATCHDOG Puts(" with SUPPORT_WATCH"); #endif #ifdef DEBUG_WATCHDOG Puts(" with DEBUG_WATCH"); #endif } } #endif //---------------------- Enable INT ------------------------ else if( !stricmp( argv[1], "IE" ) ) { if ( argc < 3 ) { Puts("\nMCU IE n 1/0 - MCU interrupt en/disable #n "); return; } argv_num1 = a2h( argv[2] ); if( argv[3][0]=='1' ) { EnableExtInterrupt( argv_num1 ); Printf("\nInterrupt #%d is enabled.", argv_num1); } else { DisableExtInterrupt( argv_num1 ); Printf("\nInterrupt #%d is disabled.", argv_num1); } } //---------------------- Extended INT ------------------------ else if( !stricmp( argv[1], "DE" ) ) { Printf("\nEnable DE-end Interrupt"); SFR_IE1 = 0; // Clear Pending Interrupt SFR_EX1 = 1; // Enable Interrupt } //---------------------- Extended INT ------------------------ else if( !stricmp( argv[1], "EI" ) ) { extern DWORD ExtIntCount; if( argc < 3 ) { Printf("\nMCU extend Interrupt Status: %02bx, count: %ld", EXINT_STATUS, ExtIntCount ); ExtIntCount = 0; #ifdef DEBUG_ISR Printf(" MCU %04x", MCU_INT_STATUS); MCU_INT_STATUS = 0; #endif return; } argv_num1 = a2h( argv[2] ); EXINT_STATUS &= argv_num1; } //---------------------- INTERRUPT Counter--------------------- #ifdef DEBUG_ISR else if( !stricmp( argv[1], "INTC" ) ) { BYTE i; WORD counter; for(i=0; i <= 20; i++) { SFR_EA=0; counter = INTR_counter[i]; //read INTR_counter[i]=0; //clear SFR_EA=1; if(counter) { Printf("\n%02bd:%d",i,counter); } } } #endif #ifdef DEBUG_UART else if( !stricmp( argv[1], "UART" ) ) DEBUG_dump_uart0(); #if 0 { BYTE i; if(UART0_OVERFLOW_counter) { Printf("\nUART0 Overflow:%bd",UART0_OVERFLOW_counter); UART0_OVERFLOW_counter = 0; //clear } if(UART0_MAX_counter) { Printf("\nUART0 Max:%bd",UART0_MAX_counter); UART0_MAX_counter = 0; //clear } Printf("\nRS_buf[%bd], RS_in:%bd RS_out:%bd",RS_BUF_MAX,RS_in,RS_out); for(i=0; i < RS_BUF_MAX; i++) Printf(" %02bx", RS_buf[i]); } #endif #endif //---------------------- Interrupt Help ------------------------ else if( !stricmp( argv[1], "INT" ) ) {
//------------------------------------------------------------------- // Display/Clear DisplayInput //------------------------------------------------------------------- void FOsdDisplayInput(void) { BYTE inputs, len1, len2,i, SystemAddr; #ifdef SUPPORT_COMPONENT BYTE CODE *Str; #endif SystemAddr=INPUTINFO1_ADDR; if( (DisplayedOSD & FOSD_INPUTINFO ) && DisplayInputHold ) return; ClearOSDInfo(); inputs = InputMain; #ifdef DEBUG_OSD dPrintf("\r\n++(DisplayInput) : %d", (WORD)inputs); #endif #if 0 #if defined( SUPPORT_PC ) || defined( SUPPORT_BT656 ) if( inputs==PC || inputs==DTV ) len2 = TWstrlen( GetPCInputSourceName() ); else #endif #endif #ifdef SUPPORT_COMPONENT if( inputs==INPUT_COMP ){ WriteTW88Page(1 ); i = ReadTW88(REG1C1) & 7; Str = COMPONENT_STR[i]; len2 = TWstrlen(Str); } else #endif len2 = TWstrlen( struct_VInputStd[GetVInputStdInx()].Name ); for (i=1; ;i++) if( struct_InputSelection[i].Id==inputs ) break; len1 = TWstrlen(struct_InputSelection[i].Name); InitFOsdMenuWindow(Init_Osd_DisplayInput); #ifdef ADD_ANALOGPANEL if(IsAnalogOn()) InitFOsdMenuWindow(Init_Osd_DisplayInput_A); #endif FOsdRamMemset(INPUTINFO_ADDR, 0x020, DEFAULT_COLOR, 51 ); // Total 42 Char. WriteStringToAddr(INPUTINFO_ADDR, struct_InputSelection[i].Name, len1); #if 0 #if defined( SUPPORT_PC ) || defined( SUPPORT_BT656 ) if( inputs==PC || inputs==DTV ) WriteStringToAddr(SystemAddr, GetPCInputSourceName(), len2); else #endif #endif #ifdef SUPPORT_COMPONENT if( inputs==INPUT_COMP ){ //i = DecoderIsNoInput(); //Printf("\r\n Display Info==> Component Noinutcheck: %d ", (WORD)i ); //if( DecoderIsNoInput() == 0 ) WriteStringToAddr(SystemAddr, Str, len2); WriteStringToAddr(SystemAddr, Str, len2); } else #endif { if( DecoderIsNoInput() == 0 ) WriteStringToAddr(SystemAddr, struct_VInputStd[GetVInputStdInx()].Name, len2); } FOsdWinEnable(OSD_Win_Num(INPUTINFO_OSDWIN),TRUE); FOsdWinEnable(OSD_Win_Num(INPUTINFO_OSDWIN+1),TRUE); FOsdOnOff(ON, 1); //with vdelay 1 DisplayedOSD |= FOSD_INPUTINFO; OSDDisplayedTime = GetTime_ms(); }