diff --git a/epicardium/FreeRTOSConfig.h b/epicardium/FreeRTOSConfig.h index 76ae165a98e879ca655b8bf66093c78ebf054a40..95ddf835db5d8be0722db87ee6b80b1a97dfa9e6 100644 --- a/epicardium/FreeRTOSConfig.h +++ b/epicardium/FreeRTOSConfig.h @@ -25,8 +25,7 @@ #define configMAX_SYSCALL_INTERRUPT_PRIORITY ( ( unsigned char ) 5 << ( 8 - configPRIO_BITS) ) /* We want to use preemption to easier integrate components */ -/* TODO: Figure out why turning this on does not work ... */ -#define configUSE_PREEMPTION 0 +#define configUSE_PREEMPTION 1 /* * Tickless idle from the FreeRTOS port + our own hooks (defined further down in diff --git a/epicardium/main.c b/epicardium/main.c index cc2d0a4f38fff6e8d2d90bd5220f85eb3b861272..deda39b8bec170004d41f9f34d472a4a727ae205 100644 --- a/epicardium/main.c +++ b/epicardium/main.c @@ -31,8 +31,19 @@ void pre_idle_sleep(TickType_t xExpectedIdleTime) * WFE because the other core should be able to notify * epicardium if it wants to issue an API call. */ + + /* + * TODO: Ensure this is actually correct and does not have any + * race conditions. + */ + __asm volatile( "cpsie i" ::: "memory" ); __asm volatile( "dsb" ::: "memory" ); + __asm volatile( "isb" ); __asm volatile( "wfe" ); + __asm volatile( "dsb" ::: "memory" ); + __asm volatile( "isb" ); + __asm volatile( "cpsid i" ::: "memory" ); + __asm volatile( "dsb" ); __asm volatile( "isb" ); } }