Skip to content
Snippets Groups Projects
Verified Commit fa3d5c34 authored by rahix's avatar rahix
Browse files

feat(dual-core): Use {sev,wfe} to synchronize cores


Signed-off-by: default avatarRahix <rahix@rahix.de>
parent 0df3f9d0
No related branches found
No related tags found
No related merge requests found
......@@ -6,14 +6,16 @@ static const gpio_cfg_t motor_pin = {PORT_0, PIN_8, GPIO_FUNC_OUT, GPIO_PAD_NONE
int main(void)
{
// Enable rxev on core1
MXC_GCR->evten |= 0x20;
for (int i = 0; 1; i++) {
printf("Hello from core 1! %d\n", i);
__asm volatile("wfe");
printf("core1: Hello! %d\n", i);
#if 0
GPIO_OutSet(&motor_pin);
mxc_delay(30000);
GPIO_OutClr(&motor_pin);
#endif
mxc_delay(970000);
}
}
......@@ -56,5 +56,12 @@ int main(void)
leds_update();
TMR_Delay(MXC_TMR0, MSEC(10), 0);
h++;
// Send a txev using `sev` every once in a while to wake up core1
// and let it do something
if (h % 100 == 0) {
printf("core0: Triggering core1 using SEV ...\n");
__asm volatile("sev");
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment