Skip to content

Commit 8833501

Browse files
raiden00plxiaoxiang781216
authored andcommitted
arch/stm32h7/dualcore: don't use stm32_hsem interface for cores synchronisation
stm32_hsem functions can use debug messages but cores synchronisation is done when the OS is not yet fully initialized
1 parent 0e01836 commit 8833501

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

arch/arm/src/stm32h7/stm32_dualcore.c

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include "arm_internal.h"
3232

3333
#include "stm32_dualcore.h"
34-
#include "stm32_hsem.h"
3534

3635
/****************************************************************************
3736
* Pre-processor Definitions
@@ -77,6 +76,16 @@ static bool stm32_cm4_boot(void)
7776
#endif
7877

7978
#ifdef CONFIG_ARCH_CHIP_STM32H7_CORTEXM4
79+
80+
/****************************************************************************
81+
* Name: stm32_cm4_busywait_lock_sem
82+
****************************************************************************/
83+
84+
void stm32_cm4_busywait_lock_sem(uint8_t id)
85+
{
86+
while ((getreg32(STM32_HSEM_RX(id)) & HSEM_SEMX_LOCK) == 0);
87+
}
88+
8089
/****************************************************************************
8190
* Name: stm32_cpu2sem_wait
8291
****************************************************************************/
@@ -89,13 +98,23 @@ static void stm32_cpu2sem_wait(void)
8998

9099
/* Wait for CPU1 */
91100

92-
stm32_hsem_busywait_lock(CPU2_HOLD_HSEM);
101+
stm32_cm4_busywait_lock_sem(CPU2_HOLD_HSEM);
93102
}
94103
#endif
95104

96105
#if defined(CONFIG_ARCH_CHIP_STM32H7_CORTEXM7) && \
97106
defined(CONFIG_STM32H7_CORTEXM4_ENABLED)
98107

108+
/****************************************************************************
109+
* Name: stm32_cm7_take_sem
110+
****************************************************************************/
111+
112+
static bool stm32_cm7_take_sem(uint8_t id)
113+
{
114+
return (getreg32(STM32_HSEM_RLRX(id)) ==
115+
((HSEM_COREID_CPU1 << HSEM_SEMX_COREID_SHIFT) | HSEM_SEMX_LOCK));
116+
}
117+
99118
/****************************************************************************
100119
* Name: stm32_cpu2sem_take
101120
****************************************************************************/
@@ -104,7 +123,7 @@ static void stm32_cpu2sem_take(void)
104123
{
105124
/* Take semaphore */
106125

107-
while (stm32_hsem_take(CPU2_HOLD_HSEM) == 0);
126+
while (stm32_cm7_take_sem(CPU2_HOLD_HSEM) == 0);
108127
}
109128
#endif
110129

0 commit comments

Comments
 (0)