Загрузка данных


#include "sm.h"
#include "rpc_scmi.h"
#include "dev_sm.h"

/* Local defines */

/* Local types */

/* Local variables */

static volatile uint32_t s_mSel;
static volatile uint32_t s_lmmInitFlags;
static volatile uint32_t s_bootLm;
static volatile uint8_t s_bootSkip;
static volatile int32_t s_bootStatus;
static uint64_t s_lmStartTime[SM_NUM_LM];

/*--------------------------------------------------------------------------*/
/* Init logical machine manager                                             */
/*--------------------------------------------------------------------------*/
// cppcheck-suppress constParameter
/* coverity[misra_c_2012_rule_8_13_violation] */
int32_t LMM_Init(uint32_t *mSel, uint32_t lmmInitFlags)
{
    int32_t status;
    uint32_t numClock;
    const uint32_t *clockList;

    /* Init LMM system management */
    status = LMM_SystemInit();

    /* Success? */
    if (status == SM_ERR_SUCCESS)
    {
        /* Get LM0 default resource state */
        DEV_SM_LmmInitGet(&numClock, &clockList);

        /* Init LMM clock management */
        status = LMM_ClockInit(numClock, clockList);
    }

    /* Init LMM voltage management */
    if (status == SM_ERR_SUCCESS)
    {
        status = LMM_VoltageInit();
    }

    /* Init LMM CPU management */
    if (status == SM_ERR_SUCCESS)
    {
        status = LMM_CpuInit();
    }

#ifdef USES_FUSA
    /* Init FuSa */
    if (status == SM_ERR_SUCCESS)
    {
        status = LMM_FusaInit(mSel);
    }
#endif

    /* Init LMs */
    if (status == SM_ERR_SUCCESS)
    {
        /* Loop over LMs */
        for (uint32_t lmId = 0U; lmId < SM_NUM_LM; lmId++)
        {
            /* Init RPC */
            switch (g_lmmConfig[lmId].rpcType)
            {
                case SM_RPC_NONE:
                    break;
                case SM_RPC_SCMI:
                    /* Init SCMI instance */
                    status = RPC_SCMI_Init(g_lmmConfig[lmId].rpcInst);
                    break;
                default:
                    status = SM_ERR_INVALID_PARAMETERS;
                    break;
            }

            /* Exit loop on error */
            if (status != SM_ERR_SUCCESS)
            {
                break;
            }
        }
    }

    /* Record init parms */
    s_mSel = *mSel;
    s_lmmInitFlags = lmmInitFlags;

    /* Return status */
    return status;
}