!695 开启cpup后启动挂死

Merge pull request !695 from wangchen/0526_up
This commit is contained in:
openharmony_ci 2022-05-26 11:55:22 +00:00 committed by Gitee
commit 28c1529e2f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 43 additions and 24 deletions

View File

@ -117,7 +117,24 @@ LITE_OS_SEC_TEXT_INIT UINT32 OsCpupGuardCreator(VOID)
return LOS_OK;
}
#endif
/*****************************************************************************
Function : OsCpupDaemonInit
Description: initialization of CPUP Daemon
Input : None
Return : LOS_OK or Error Information
*****************************************************************************/
LITE_OS_SEC_TEXT_INIT UINT32 OsCpupDaemonInit()
{
#if (LOSCFG_BASE_CORE_SWTMR == 1)
(VOID)OsCpupGuardCreator();
g_irqCpupInitFlg = 1;
#endif
return LOS_OK;
}
#endif
/*****************************************************************************
Function : OsCpupInit
Description: initialization of CPUP
@ -127,32 +144,25 @@ Return : LOS_OK or Error Information
LITE_OS_SEC_TEXT_INIT UINT32 OsCpupInit()
{
UINT32 size;
CHAR *cpupMem = NULL;
size = g_taskMaxNum * sizeof(OsCpupCB);
g_cpup = (OsCpupCB *)LOS_MemAlloc(m_aucSysMem0, size);
if (g_cpup == NULL) {
return LOS_ERRNO_CPUP_NO_MEMORY;
}
// Ignore the return code when matching CSEC rule 6.6(3).
(VOID)memset_s(g_cpup, size, 0, size);
g_cpupInitFlg = 1;
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
size = LOSCFG_PLATFORM_HWI_LIMIT * sizeof(OsIrqCpupCB);
g_irqCpup = (OsIrqCpupCB *)LOS_MemAlloc(m_aucSysMem0, size);
if (g_irqCpup == NULL) {
size += LOSCFG_PLATFORM_HWI_LIMIT * sizeof(OsIrqCpupCB);
#endif
cpupMem = LOS_MemAlloc(m_aucSysMem0, size);
if (cpupMem == NULL) {
return LOS_ERRNO_CPUP_NO_MEMORY;
}
(VOID)memset_s(cpupMem, size, 0, size);
(VOID)memset_s(g_irqCpup, size, 0, size);
#if (LOSCFG_BASE_CORE_SWTMR == 1)
(VOID)OsCpupGuardCreator();
g_irqCpupInitFlg = 1;
g_cpup = (OsCpupCB *)cpupMem;
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
g_irqCpup = (OsIrqCpupCB *)(cpupMem + g_taskMaxNum * sizeof(OsCpupCB));
#endif
#endif
g_cpupInitFlg = 1;
return LOS_OK;
}

View File

@ -171,6 +171,7 @@ typedef struct {
*/
extern UINT32 OsCpupInit(VOID);
extern UINT32 OsCpupDaemonInit(VOID);
/**
* @ingroup los_cpup
* @brief Start task to get cycles count in current task ending.

View File

@ -181,6 +181,14 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
OsTaskMonInit();
#endif
#if (LOSCFG_BASE_CORE_CPUP == 1)
ret = OsCpupInit();
if (ret != LOS_OK) {
PRINT_ERR("OsCpupInit error\n");
return ret;
}
#endif
#if (LOSCFG_BASE_IPC_SEM == 1)
ret = OsSemInit();
if (ret != LOS_OK) {
@ -211,10 +219,10 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
}
#endif
#if (LOSCFG_BASE_CORE_CPUP == 1)
ret = OsCpupInit();
#if (LOSCFG_CPUP_INCLUDE_IRQ == 1)
ret = OsCpupDaemonInit();
if (ret != LOS_OK) {
PRINT_ERR("OsCpupInit error\n");
PRINT_ERR("OsCpupDaemonInit error\n");
return ret;
}
#endif