Загрузка данных
/*--------------------------------------------------------------------------*/
/* Full system shutdown */
/*--------------------------------------------------------------------------*/
int32_t LMM_SystemShutdown(uint32_t lmId, uint32_t agentId,
bool graceful, const lmm_rst_rec_t *shutdownRec)
{
int32_t status = SM_ERR_SUCCESS;
lmm_rpc_trigger_t trigger =
{
.rpcInst = 0U,
.event = LMM_TRIGGER_SYSTEM,
.parm[0] = LMM_TRIGGER_PARM_SHUTDOWN,
.parm[1] = agentId,
.parm[2] = 0U,
.parm[3] = graceful ? 1U : 0U
};
/* Notify LMs via system */
for (uint32_t dstLm = 0U; dstLm < SM_NUM_LM; dstLm++)
{
if (graceful || (lmId != dstLm))
{
(void) LMM_RpcNotificationTrigger(dstLm, &trigger);
}
}
/* Force shutdown? */
if (!graceful)
{
lmm_rst_rec_t newShutdownRec = *shutdownRec;
/* Update record */
if (newShutdownRec.reason == g_swReason.reason)
{
newShutdownRec.origin = lmId;
newShutdownRec.validOrigin = true;
newShutdownRec.errId = agentId;
newShutdownRec.validErr = true;
}
/* Save reason */
DEV_SM_SystemShutdownRecSet(newShutdownRec);
#ifdef USES_FUSA
/* Report to FuSa */
LMM_FusaExit(shutdownRec);
#endif
/* Request system shutdown */
status = SM_SYSTEMSHUTDOWN();
}
SM_TEST_MODE_ERR(SM_TEST_MODE_LMM_LVL1, SM_ERR_TEST)
/* Return status */
return status;
}
/*--------------------------------------------------------------------------*/
/* Full system reset */
/*--------------------------------------------------------------------------*/
int32_t LMM_SystemReset(uint32_t lmId, uint32_t agentId, bool graceful,
const lmm_rst_rec_t *resetRec)
{
int32_t status = SM_ERR_SUCCESS;
lmm_rpc_trigger_t trigger =
{
.rpcInst = 0U,
.event = LMM_TRIGGER_SYSTEM,
.parm[0] = LMM_TRIGGER_PARM_RESET,
.parm[1] = agentId,
.parm[2] = 0U,
.parm[3] = graceful ? 1U : 0U,
};
/* Notify LMs via system */
for (uint32_t dstLm = 0U; dstLm < SM_NUM_LM; dstLm++)
{
if (graceful || (lmId != dstLm))
{
(void) LMM_RpcNotificationTrigger(dstLm, &trigger);
}
}
/* Force reset? */
if (!graceful)
{
lmm_rst_rec_t newResetRec = *resetRec;
/* Update record */
if (newResetRec.reason == g_swReason.reason)
{
newResetRec.origin = lmId;
newResetRec.validOrigin = true;
newResetRec.errId = agentId;
newResetRec.validErr = true;
}
/* Save reason */
newResetRec.reset = true;
DEV_SM_SystemShutdownRecSet(newResetRec);
#ifdef USES_FUSA
/* Report to FuSa */
LMM_FusaExit(resetRec);
#endif
/* Request system reset */
status = SM_SYSTEMRESET();
}
SM_TEST_MODE_ERR(SM_TEST_MODE_LMM_LVL1, SM_ERR_TEST)
/* Return status */
return status;
}
/*--------------------------------------------------------------------------*/
/* Full system suspend */
/*--------------------------------------------------------------------------*/
int32_t LMM_SystemSuspend(uint32_t lmId, uint32_t agentId)
{
int32_t status = SM_ERR_SUCCESS;
lmm_rpc_trigger_t trigger =
{
.rpcInst = 0U,
.event = LMM_TRIGGER_SYSTEM,
.parm[0] = LMM_TRIGGER_PARM_SUSPEND,
.parm[1] = agentId,
.parm[2] = 0U,
.parm[3] = 1U
};
/* Notify LMs via system */
for (uint32_t dstLm = 0U; dstLm < SM_NUM_LM; dstLm++)
{
(void) LMM_RpcNotificationTrigger(dstLm, &trigger);
}
SM_TEST_MODE_ERR(SM_TEST_MODE_LMM_LVL1, SM_ERR_TEST)
/* Return status */
return status;
}