mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-28 10:45:22 +00:00
zinger: remove race condition in event handling
In the micro runtime for Zinger, wait for events with interrupt disabled to avoid race conditions where the event interrupt happens just after we tested it and before going to sleep. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=make BOARD=zinger, test Zinger PD communication from Firefly. Change-Id: I10b919450a61fac7ea50e84dd73bcc568150e179 Reviewed-on: https://chromium-review.googlesource.com/197051 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Vic Yang <victoryang@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
564fced7b8
commit
5aeff69cdc
@@ -63,11 +63,13 @@ uint32_t task_wait_event(int timeout_us)
|
||||
{
|
||||
uint32_t evt;
|
||||
|
||||
asm volatile("cpsid i");
|
||||
/* the event already happened */
|
||||
if (last_event || !timeout_us) {
|
||||
evt = last_event;
|
||||
last_event = 0;
|
||||
|
||||
asm volatile("cpsie i ; isb");
|
||||
return evt;
|
||||
}
|
||||
|
||||
@@ -84,6 +86,7 @@ uint32_t task_wait_event(int timeout_us)
|
||||
STM32_TIM_DIER(2) = 0; /* disable match interrupt */
|
||||
evt = last_event;
|
||||
last_event = 0;
|
||||
asm volatile("cpsie i ; isb");
|
||||
|
||||
return evt;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user