feat(esp_hw_support): support esp32p4 & esp32h4 RV FPU context retention in pd_cpu sleep

This commit is contained in:
wuzhenghui
2026-03-12 11:06:43 +08:00
parent 9df5d023bc
commit 659dbbe5f8
14 changed files with 392 additions and 13 deletions
@@ -6,7 +6,7 @@
*
* SPDX-License-Identifier: MIT
*
* SPDX-FileContributor: 2023-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2023-2026 Espressif Systems (Shanghai) CO LTD
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
@@ -747,6 +747,21 @@ extern volatile UBaseType_t xPortSwitchFlag[portNUM_PROCESSORS];
#define os_task_switch_is_pended(_cpu_) (false)
#endif
// -------------- FPU softerware retention ------------------
#if (SOC_CPU_COPROC_NUM > 0) && SOC_CPU_HAS_FPU && SOC_PM_FPU_RETENTION_BY_SW
/**
* @brief Whether the FPU context is dirty on the given core.
*
* Returns non-zero if any task has used the FPU, such context should be
* saved during sleep retention.
*
* @param core_id Core id
* @return pdTRUE FPU context is dirty
* @return pdFALSE FPU was not used
*/
BaseType_t xPortFPUContextIsDirty(BaseType_t core_id);
#endif
#ifdef __cplusplus
}
#endif
@@ -6,7 +6,7 @@
*
* SPDX-License-Identifier: MIT
*
* SPDX-FileContributor: 2023-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2023-2026 Espressif Systems (Shanghai) CO LTD
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
@@ -895,3 +895,9 @@ configRUN_TIME_COUNTER_TYPE xPortGetRunTimeCounterValue( void )
/* ---------------------------------------------- Misc Implementations -------------------------------------------------
*
* ------------------------------------------------------------------------------------------------------------------ */
#if (SOC_CPU_COPROC_NUM > 0) && SOC_CPU_HAS_FPU && SOC_PM_FPU_RETENTION_BY_SW
BaseType_t xPortFPUContextIsDirty(BaseType_t core_id)
{
return (BaseType_t)(port_uxCoprocOwner[core_id][FPU_COPROC_IDX] != NULL);
}
#endif /* (SOC_CPU_COPROC_NUM > 0) && SOC_CPU_HAS_FPU && SOC_PM_FPU_RETENTION_BY_SW */
+2
View File
@@ -176,6 +176,8 @@ entries:
port:xPortInIsrContext (noflash_text)
port:vPortAssertIfInISR (noflash_text)
port:xPortInterruptedFromISRContext (noflash_text)
if (SOC_CPU_COPROC_NUM > 0) && SOC_CPU_HAS_FPU && SOC_PM_FPU_RETENTION_BY_SW:
port:xPortFPUContextIsDirty (noflash_text)
# --------------------------------------------------------------------------------------------------------------
# portasm.S