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

📄 fs_nav_upgrade.c

📁 dvd里面的一个文件系统的代码
💻 C
📖 第 1 页 / 共 2 页
字号:
        #ifdef USE_KOREAN_OSD		//clead korean 2003-10-23 
        psprintf(buf, "%s%s%s", &_OsdMessegeFont1[osd_font_mode][STR_OS_UPGRADE_TO][0], strVersion, Ch_question);
        #else
        psprintf(buf, "%s%s%s%s", &_OsdMessegeFont1[osd_font_mode][STR_OS_UPGRADE_TO][0], strVersion, Ch_ban, Ch_question);
        #endif
    else
        psprintf(buf, "%s%s%s", &_OsdMessegeFont1[osd_font_mode][STR_OS_UPGRADE_TO][0], strVersion, Ch_question);
	
    len = strlen(buf);
    
    //osd_DrawString(6, 5, buf, 2, 6); //2:font color, 6:background color
    osd_DrawString(4, 5, buf, UPGRADE_FONT_COLOR_INDEX, UPGRADE_BACKGROUND_COLOR_INDEX); //2:font color, 6:background color
#endif    //#ifdef QSI_SUPPORT_QSIVER_INFO_WHEN_UPGRADE
#else
    if (IsOSDChinese())
        #ifdef USE_KOREAN_OSD       //clead korean 2003-10-23 
        psprintf(buf, "%s%s%s", &_OsdMessegeFont1[osd_font_mode][STR_OS_UPGRADE_TO][0], strVersion, Ch_question);
        #else
        psprintf(buf, "%s%s%s%s", &_OsdMessegeFont1[osd_font_mode][STR_OS_UPGRADE_TO][0], strVersion, Ch_ban, Ch_question);
        #endif
    else
        psprintf(buf, "%s%s%s", &_OsdMessegeFont1[osd_font_mode][STR_OS_UPGRADE_TO][0], strVersion, Ch_question);
	
    len = strlen(buf);
    
    //osd_DrawString(6, 5, buf, 2, 6); //2:font color, 6:background color
    osd_DrawString(4, 5, buf, UPGRADE_FONT_COLOR_INDEX, UPGRADE_BACKGROUND_COLOR_INDEX); //2:font color, 6:background color
#endif  //#ifdef QSI_PLATFORM
    //Draw O-X selection
    DrawOSD_XO(1);

    set_rtc_val(0);
    iCount = COUNTDOWN_MAX;
    FSNav_UpgradeCountDown(iCount);

    do
    {
        UINT32  rx;
        UINT32  iTime;
#ifndef OLD_VFD_DRV
        UINT32  nVFDkey = 0;
		
		//nVFDkey = CheckVFDkey();
#endif
				watchdog_renew(WATCHDOG_RENEW_TIME);    //for usb upgrade no reset after 11s hongfeng 2005-07-11 
        iTime = get_rtc_val();
        
        #ifdef SUPPORT_SPI
        if(!(iTime%50))
          polling_spi();
        #endif
        iTime = COUNTDOWN_MAX - (iTime/100);

        if (iCount==0) {
        #ifndef UPGRADE_NOT_COUNT//libing 2005-6-30 23:06
            if (bOK == 1)   bOK=2;
            break;
        #endif
        } else {
            if (iTime != iCount) {
                iCount = iTime;
                FSNav_UpgradeCountDown(iCount);
            }
        }

        extern UINT16 GetIRCode();  // 2004/10/01 yltseng, move to ir_parser.c GetIRCode()
        rx = GetIRCode();

        if( rx != IR_CODE_MAX_NUM )
        {            
            if (rx == IRC_LEFT)
            {
                if (bOK == 1)
                {
                    bOK = 0;
                    DrawOSD_XO(0);
                    set_rtc_val(0);
                    iCount = COUNTDOWN_MAX;
                    FSNav_UpgradeCountDown(iCount);
                }
            }
            else if (rx == IRC_RIGHT)
            {
                if (bOK == 0)
                {
                    bOK = 1;
                    DrawOSD_XO(1);
                    set_rtc_val(0);
                    iCount = COUNTDOWN_MAX;
                    FSNav_UpgradeCountDown(iCount);
                }
            }
#ifdef DVD_AUDIO
            else if ((rx == IRC_0) || (rx == IRC_1) || (rx == IRC_2) ||
					 (rx == IRC_3) || (rx == IRC_4) || (rx == IRC_5) ||
					 (rx == IRC_6) || (rx == IRC_7) || (rx == IRC_8) ||
					 (rx == IRC_9))
            {
				set_rtc_val(0);
				iCount = COUNTDOWN_MAX;
				FSNav_UpgradeCountDown(iCount);

				if (g_nAKeyFileLoc != 0)
				{
					BYTE bVal;
					bVal = rx - IRC_0;

					psprintf(buf, "%d", bVal);
					osd_DrawString(23 + nPos, 6, buf, 2, 4);

					// write to nPos position
					switch (nPos)
					{
					case 0: 
						b0 = bVal;
						psprintf(buf, "%d", b1);
						nPos = 1;
						break;

					case 1:
						b1 = bVal;
						psprintf(buf, "%d", b2);
						nPos = 2;
						break;

					case 2:
						b2 = bVal;
						psprintf(buf, "%d", b3);
						nPos = 3;
						break;

					case 3:
						b3 = bVal;
						psprintf(buf, "%d", b4);
						nPos = 4;
						break;
					
					case 4:
						b4 = bVal;
						psprintf(buf, "%d", b0);
						nPos = 0;
						break;
					}
					osd_DrawString(23 + nPos, 6, buf, 2, 5);
				}
            }
#endif
            else if ((rx == IRC_SELECT) || (rx == IRC_PLAY_SELECT))
            {
                if (bOK == 1)
                {
		#ifdef DVD_AUDIO
					if (g_nAKeyFileLoc != 0)
					{
						// get user selected number
						nEnterNum = 10000 * b0 + 1000 * b1 + 100 * b2 + 10 * b3 + b4;

						if (nEnterNum > nKeyAmount)
						{

							b4 = b3 = b2 = b1 = b0 = 0;
							nPos = 0;

							// show a region to enter number
							psprintf(buf, "%d", b4);
							osd_DrawString(23, 6, buf, 2, 5);
							psprintf(buf, "%d", b3);
							osd_DrawString(24, 6, buf, 2, 4);
							psprintf(buf, "%d", b2);
							osd_DrawString(25, 6, buf, 2, 4);
							psprintf(buf, "%d", b1);
							osd_DrawString(26, 6, buf, 2, 4);
							psprintf(buf, "%d", b0);
							osd_DrawString(27, 6, buf, 2, 4);
						}
						else
						{
							bOK = 2;
						}
					}
					else
						bOK = 2;
		#else
					bOK = 2;
		#endif
                }
				if (bOK == 0)
					break;
            }
        } //end of if (rx & IR_RDY)
		
#ifndef OLD_VFD_DRV     // 2004/10/14 yltseng
        if (nVFDkey != IR_CODE_MAX_NUM)
        {
            if (nVFDkey == IRC_LEFT)
            {
                if (bOK == 1)
                {
                    bOK = 0;
                    DrawOSD_XO(0);
                }
            }
            else if (nVFDkey == IRC_RIGHT)
            {
                if (bOK == 0)
                {
                    bOK = 1;
                    DrawOSD_XO(1);
                }
            }
            else if ((nVFDkey == IRC_PLAY) || (nVFDkey == IRC_PAUSEPLAY))
            {
                if (bOK == 1)
                {
		#ifdef DVD_AUDIO
					if (g_nAKeyFileLoc != 0)
					{
						// get user selected number
						nEnterNum = 10000 * b0 + 1000 * b1 + 100 * b2 + 10 * b3 + b4;

						if (nEnterNum > nKeyAmount)
						{

							b4 = b3 = b2 = b1 = b0 = 0;
							
							// show a region to enter number
							psprintf(buf, "%d", b4);
							osd_DrawString(23, 6, buf, 2, 5);
							psprintf(buf, "%d", b3);
							osd_DrawString(24, 6, buf, 2, 4);
							psprintf(buf, "%d", b2);
							osd_DrawString(25, 6, buf, 2, 4);
							psprintf(buf, "%d", b1);
							osd_DrawString(26, 6, buf, 2, 4);
							psprintf(buf, "%d", b0);
							osd_DrawString(27, 6, buf, 2, 4);
						}
						else
						{
							bOK = 2;
						}
					}
					else
						bOK = 2;
		#else
					bOK = 2;
		#endif
                }
				if (bOK == 0)
					break;
            }
        }
#endif//#ifndef OLD_VFD_DRV     // 2004/10/01 yltseng
    } while (bOK != 2);
	
    if (bOK == 2)
    {        
        //write system image to flash
        osd_init_setup();
        
        if (IsOSDChinese())
            psprintf(buf, "         %s           ", &_OsdMessegeFont1[osd_font_mode][STR_OS_SMART_UPGRADE][0]);
        else
            psprintf(buf, "        %s       ", &_OsdMessegeFont1[osd_font_mode][STR_OS_SMART_UPGRADE][0]);
		
        len = strlen(buf);
		
        osd_draw_rect(4*16, 3*26, 28*16, 7*26, 6);
        //top
        osd_DrawLine(4*16, 3*26, 4*16+28*16, 3*26, 2, 1);
        //left
        osd_DrawLine(4*16-2, 3*26, 4*16-2, 3*26+7*26, 2, 1);
        //bottom
        osd_DrawLine(4*16, 3*26+7*26, 4*16+28*16, 3*26+7*26, 11, 1);
        //right
        osd_DrawLine(4*16+28*16, 3*26, 4*16+7*26, 3*26+28*16, 11, 1);
		
        osd_DrawString(4, 3, buf, UPGRADE_FONT_COLOR_INDEX, UPGRADE_BACKGROUND_COLOR_INDEX); //2:font color, 6:background color
		
        //psprintf(buf, "%s...", &_OsdMessegeFont1[STR_OS_UPGRADING][osd_font_mode][0]);
        psprintf(buf, "%s...", &_OsdMessegeFont1[osd_font_mode][STR_OS_UPGRADING][0]);
        osd_DrawString(6, 5, buf, UPGRADE_FONT_COLOR_INDEX, UPGRADE_BACKGROUND_COLOR_INDEX); //2:font color, 6:background color
		
        //psprintf(buf, "%s", &_OsdMessegeFont1[STR_OS_NOT_POWEROFF][osd_font_mode][0]);
        psprintf(buf, "%s", &_OsdMessegeFont1[osd_font_mode][STR_OS_NOT_POWEROFF][0]);
        osd_DrawString(6, 6, buf, UPGRADE_FONT_COLOR_INDEX, UPGRADE_BACKGROUND_COLOR_INDEX); //2:font color, 6:background color
        
    #if defined(PORTABLE_DVD)||defined(ALCO_PORTABLE_DVD_8202D_DVB)       
        osd_DrawString(6, 7, "DISC CAN BE REMOVED", UPGRADE_FONT_COLOR_INDEX, UPGRADE_BACKGROUND_COLOR_INDEX);
    #endif
              

#ifdef DVD_AUDIO
		// copy key data to pDVDROM
		if ((g_nAKeyFileLoc != 0) && (nEnterNum > 0))
		{
			//psprintf(buf, "%d ", nEnterNum);
			//osd_DrawString(27, 3, buf, 2, 6);
			UINT32 nSelectedSector, nOffset;
			nSelectedSector = 13 + nKeySize * (nEnterNum - 1);
			nOffset = (nSelectedSector & 0x7ff);
			nSelectedSector >>= 11;
			g_nAKeyFileLoc = addmsf(g_nAKeyFileLoc, nSelectedSector);

			ran_read(pKeyFile, g_nAKeyFileLoc, nKeySize + 2048);

			*((BYTE*)(pDVDROM + 0x100)) = 0x44;
			*((BYTE*)(pDVDROM + 0x101)) = 0x45;
			*((BYTE*)(pDVDROM + 0x102)) = 0x56;
			*((BYTE*)(pDVDROM + 0x103)) = 0x4B;
			memcpy((BYTE*)(pDVDROM + 0x104), (BYTE*)(pKeyFile + nOffset), nKeySize);
		}
#endif                
        //joshua, 20050811, modified for clearing all I2C data when disc smart upgrade
        #ifndef SAME_DISC_RESUME    //if data keep in flash, erasing chip will clear all data, so omit this function here
        FSNav_clear_I2C_data();
        #endif
                
		#ifdef SUPPORT_28X_FLASH	//yaowh add 2006-1-17 9:54
			
		system_flash_id = FlashReadID();
		idM = system_flash_id & 0xff;
		idD = ( (system_flash_id & 0xff00) >> 8);
			
		if ( ((system_flash_id & 0xf0ff) == 0x1089) || ((idM == 0xB0)&&(idD == 0x58)) || ((idM == 0xB0)&&(idD == 0x5A))
				|| ((idM == 0xB0)&&(idD == 0xED)) || ((idM == 0xB0)&&(idD == 0xEC)) )
		{ 
			#ifdef UART0_DBG
			UART0_puts("28-series Flash Upgrade");
			#endif
			
			Parallel_FlashEraseUpgrade_28X(pDVDROM, pFsJpeg->gifsDVDRomSize);
		}
		else
		{
			#ifdef UART0_DBG
			UART0_puts("29/39-series Flash Upgrade");
			#endif
			
        FlashEraseUpgrade(pDVDROM, pFsJpeg->gifsDVDRomSize);
		}
		
		#else//#ifdef SUPPORT_28X_FLASH	//yaowh add 2006-1-17 9:54

		FlashEraseUpgrade(pDVDROM, pFsJpeg->gifsDVDRomSize);
		
		#endif//#ifdef SUPPORT_28X_FLASH	//yaowh add 2006-1-17 9:54
        
        ircmd_callback_check = fs_callback_check;

        //while (1);
    }
#if defined(SUPPORT_CARD_STORAGE) || defined(SUPPORT_USB)||defined(SPHE8202_CARD_STORAGE)
    watchdog_onoff(1);   //fengjl add 2004-05-20 09:39  for usb upgrade
#endif
    return iRes;
}

void FSNav_GetRomVersion(BYTE* strVersion)//jhuang 2004/9/3 11:29

⌨️ 快捷键说明

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