📄 pgfwupdt.c
字号:
/*
* Copyright (c) 1996, 2004 VIA Networking Technologies, Inc.
* All rights reserved.
*
* This software is copyrighted by and is the sole property of
* VIA Networking Technologies, Inc. This software may only be used
* in accordance with the corresponding license agreement. Any unauthorized
* use, duplication, transmission, distribution, or disclosure of this
* software is expressly forbidden.
*
* This software is provided by VIA Networking Technologies, Inc. "as is"
* and any express or implied warranties, including, but not limited to, the
* implied warranties of merchantability and fitness for a particular purpose
* are disclaimed. In no event shall VIA Networking Technologies, Inc.
* be liable for any direct, indirect, incidental, special, exemplary, or
* consequential damages.
*
*
* File: pgfwupdt.c
*
* Purpose: Firmware update menu UI definitions
*
* Author: Bear Hsiung
*
* Date: Feb 10, 2004
*
* Functions:
*
* Revision History:
*
*/
#if !defined(__DEVICE_H__)
#include "device.h"
#endif
#if !defined(__SOC_H__)
#include "soc.h"
#endif
#if !defined(__SWSYS_H__)
#include "swsys.h"
#endif
#if !defined(__SWPKT_H__)
#include "swpkt.h"
#endif
#if !defined(__NETIF_H__)
#include "netif.h"
#endif
#include "tty.h"
#include "eng_io.h"
#include "eng_act.h"
#include "allpages.h"
#include "gen_act.h"
#include "pigencfg.h"
#include "pimsg.h"
#include "pgfwupdt.h"
/*--------------------- Static Definitions ------------------------*/
/*--------------------- Static Types ------------------------------*/
/*--------------------- Static Macros -----------------------------*/
/*--------------------- Static Classes ----------------------------*/
/*--------------------- Static Variables --------------------------*/
SFixLabel aSFixLabelFwUpdate[] = {
{{ 2, 32}, g_strFwUpdate, 0},
{{ 3, 32}, "=", 15},
{{ 7, 26}, "Server IP Address:", 0},
{{ 9, 26}, "Remote File Name:", 0},
{{24, 2}, g_strHelpMsg, 0}
};
SItemString aSIStringFwUpdate[] = {
{g_pSFwUpdtPageCfg->aszTftpServeIp, IP_STRING_LEN},
{g_pSFwUpdtPageCfg->aszTftpFilename, IP_STRING_LEN}
};
SItem aSItemFwUpdate[] = {
{{ 7, 46}, aSIStringFwUpdate, "", ITEM_STRING, REPEAT_TYPE_NONE, LINK_TYPE_NONE},
{{ 9, 46}, aSIStringFwUpdate+1, "", ITEM_STRING, REPEAT_TYPE_NONE, LINK_TYPE_NONE}
};
// action
SActItem aSActionFwUpdate[] = {
{{22, 12}, g_strActionQuit, PAACT_bQuit},
{{22, 22}, g_strActionEdit, PAACT_bEdit},
{{22, 32}, g_strActionApply, PAFWUP_bStartUpdate}
};
/*--------------------- Static Functions --------------------------*/
/*--------------------- Export Variables --------------------------*/
//// write default
SPage g_SPageFwUpdate = {
aSFixLabelFwUpdate, 5,
NULL, 0,
aSItemFwUpdate, 2,
aSActionFwUpdate, 3,
PAFWUP_bLoadCfg
};
// load config
BOOL PAFWUP_bLoadCfg (void)
{
PIFWUPDT_vInitPage(g_pSFwUpdtPageCfg);
return DONT_RELOAD_PAGE;
}
BOOL PAFWUP_bStartUpdate (void)
{
UINT8 byErrCode;
byErrCode = PIFWUPDT_bySavePage(g_pSFwUpdtPageCfg);
if (byErrCode != OP_OK) {
PIMSG_vPutMsgThenPause(byErrCode);
return DONT_RELOAD_PAGE;
}
g_bDataDirty = 0;
ENGcPrintMessage("Update firmware now...", PRINT_THEN_RETURN);
PIFWUPDT_bFirmwareUpdate(g_u32TftpServeIpAddr, g_aszTftpFilename, TFTP_STA_REBOOT);
// wait until tftp complete
do {} while ((g_TftpState.uState != TFTP_STA_END) && (g_TftpState.uState != TFTP_STA_ERROR));
if (g_TftpState.uState == TFTP_STA_END) {
ENGcPrintMessage("Firmware updated, press any key to reboot.", PRINT_THEN_PAUSE);
// reboot
SWSYS_vBoardShutdown();
SWSYS_vBoardReboot();
}
ENGcPrintMessage("Update firmware error!", PRINT_THEN_PAUSE);
return RELOAD_PAGE;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -