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

chore(core1-control): Split out core1_is_ready()

This function is useful on its own for more complex lifecycle management
in Epicardium.  Split it out of core1_wait_ready() so it can be used.
parent bc6d8102
No related branches found
No related tags found
1 merge request!474Disable core 1 interrupts during API calls
......@@ -214,24 +214,32 @@ void core1_trigger_reset(void)
interrupt_trigger_sync(EPIC_INT_RESET);
}
bool core1_is_ready(void)
{
bool ready;
while (SEMA_GetSema(_CONTROL_SEMAPHORE) == E_BUSY) {
}
/*
* core 1 will set the ready flag once it is spinning in the
* above loop, waiting for a new IVT.
*/
ready = core1_info.ready;
SEMA_FreeSema(_CONTROL_SEMAPHORE);
return ready;
}
void core1_wait_ready(void)
{
/* Wait for the core to accept */
while (1) {
while (SEMA_GetSema(_CONTROL_SEMAPHORE) == E_BUSY) {
}
/*
* core 1 will set the ready flag once it is spinning in the
* above loop, waiting for a new IVT.
*/
if (core1_info.ready) {
SEMA_FreeSema(_CONTROL_SEMAPHORE);
if (core1_is_ready()) {
break;
}
SEMA_FreeSema(_CONTROL_SEMAPHORE);
for (int i = 0; i < 10000; i++) {
}
}
......
......@@ -39,6 +39,9 @@ void core1_boot(void);
/* Reset core 1 into a state where it can accept a new payload */
void core1_trigger_reset(void);
/* Check if core 1 is ready for a new payload */
bool core1_is_ready(void);
/* Wait for core 1 to respond that it is ready for a new payload */
void core1_wait_ready(void);
......
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