80 lines
1.9 KiB
C
Executable File
80 lines
1.9 KiB
C
Executable File
/*
|
|
System Power Callback
|
|
|
|
System Callback for Power Module.
|
|
|
|
@file SysPower_Exe.c
|
|
@ingroup mIPRJSYS
|
|
|
|
@note
|
|
|
|
Copyright Novatek Microelectronics Corp. 2010. All rights reserved.
|
|
*/
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "PrjInc.h"
|
|
#include "FwSrvApi.h"
|
|
#include "SysFW_Upgrade_Strg_Obj.h"
|
|
#include "SysFW_Upgrade.h"
|
|
|
|
//local debug level: THIS_DBGLVL
|
|
#define THIS_DBGLVL 2 // 0=FATAL, 1=ERR, 2=WRN, 3=UNIT, 4=FUNC, 5=IND, 6=MSG, 7=VALUE, 8=USER
|
|
#define __MODULE__ SysPwrExe
|
|
#define __DBGLVL__ ((THIS_DBGLVL>=PRJ_DBG_LVL)?THIS_DBGLVL:PRJ_DBG_LVL)
|
|
#define __DBGFLT__ "*" //*=All, [mark]=CustomClass
|
|
#include <kwrap/debug.h>
|
|
|
|
INT32 SysFW_Upgrade_Init(void)
|
|
{
|
|
FWSRV_INIT Init = {0};
|
|
FWSRV_ER err;
|
|
|
|
Init.uiApiVer = FWSRV_API_VERSION;
|
|
Init.StrgMap.pStrgFdt = FWSRV_EMB_GETSTRGOBJ(FDT);
|
|
Init.StrgMap.pStrgApp = FWSRV_EMB_GETSTRGOBJ(APP);
|
|
Init.StrgMap.pStrgUboot = FWSRV_EMB_GETSTRGOBJ(UBOOT);
|
|
Init.StrgMap.pStrgRtos = FWSRV_EMB_GETSTRGOBJ(RTOS);
|
|
Init.StrgMap.pStrgKernel = FWSRV_EMB_GETSTRGOBJ(KERNEL);
|
|
Init.StrgMap.pStrgRootfs = FWSRV_EMB_GETSTRGOBJ(ROOTFS);
|
|
Init.StrgMap.pStrgRootfs1 = FWSRV_EMB_GETSTRGOBJ(ROOTFS1);
|
|
Init.StrgMap.pStrgAppfs = FWSRV_EMB_GETSTRGOBJ(APPFS);
|
|
err = FwSrv_Init(&Init);
|
|
if(err != FWSRV_ER_OK){
|
|
goto exit;
|
|
}
|
|
|
|
err = FwSrv_Open();
|
|
if(err != FWSRV_ER_OK){
|
|
goto exit;
|
|
}
|
|
|
|
exit:
|
|
|
|
return (err == FWSRV_ER_OK) ? E_OK : E_SYS;
|
|
}
|
|
|
|
INT32 SysFW_Upgrade(UINT32 buf, UINT32 buf_size)
|
|
{
|
|
FWSRV_ER err;
|
|
FWSRV_BIN_UPDATE_ALL_IN_ONE Desc = {0};
|
|
Desc.uiSrcBufAddr = buf;
|
|
Desc.uiSrcBufSize = buf_size;
|
|
Desc.fpCheckSumCb = NULL;
|
|
|
|
FWSRV_CMD Cmd = {0};
|
|
Cmd.Idx = FWSRV_CMD_IDX_BIN_UPDATE_ALL_IN_ONE; //continue load
|
|
Cmd.In.pData = &Desc;
|
|
Cmd.In.uiNumByte = sizeof(Desc);
|
|
Cmd.Prop.bExitCmdFinish = TRUE;
|
|
|
|
err = FwSrv_Cmd(&Cmd);
|
|
if(err != FWSRV_ER_OK){
|
|
goto exit;
|
|
}
|
|
|
|
exit:
|
|
|
|
return (err == FWSRV_ER_OK) ? E_OK : E_SYS;
|
|
}
|