From b4a2c87c111041a83a962a2c9f1cd3eb5b885a3b Mon Sep 17 00:00:00 2001 From: ch3 <ch3@mailbox.org> Date: Thu, 13 Jun 2019 11:58:18 +0200 Subject: [PATCH] DualCore: Wake up core0 from core1, too --- hw-tests/dual-core/core1.c | 4 ++++ hw-tests/dual-core/main.c | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/hw-tests/dual-core/core1.c b/hw-tests/dual-core/core1.c index 989c611a..adb31bf8 100644 --- a/hw-tests/dual-core/core1.c +++ b/hw-tests/dual-core/core1.c @@ -11,6 +11,10 @@ int main(void) for (int i = 0; 1; i++) { __asm volatile("wfe"); printf("core1: Hello! %d\n", i); + mxc_delay(3000000); + printf("core1: Waking up core0\n"); + __asm volatile("sev"); + __asm volatile("wfe"); #if 0 GPIO_OutSet(&motor_pin); diff --git a/hw-tests/dual-core/main.c b/hw-tests/dual-core/main.c index d8e94276..a13daa43 100644 --- a/hw-tests/dual-core/main.c +++ b/hw-tests/dual-core/main.c @@ -39,6 +39,7 @@ int main(void) } int h = 0; + MXC_GCR->evten |= 0x04; // Release core1 Core1_Start(); @@ -54,7 +55,7 @@ int main(void) } leds_update(); - TMR_Delay(MXC_TMR0, MSEC(10), 0); + TMR_Delay(MXC_TMR1, MSEC(10), 0); h++; // Send a txev using `sev` every once in a while to wake up core1 @@ -62,6 +63,9 @@ int main(void) if (h % 100 == 0) { printf("core0: Triggering core1 using SEV ...\n"); __asm volatile("sev"); + __asm volatile("wfe"); + __asm volatile("wfe"); + printf("core0 woke up\n"); } } } -- GitLab