diff options
author | Dino Li <Dino.Li@ite.com.tw> | 2018-03-12 18:31:58 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-03-13 04:50:05 -0700 |
commit | 70a258a192787766289a2804a012337ad0bccc17 (patch) | |
tree | e7f959588c4f43bc741e1142ea76b0aabc1ecf5f /core/nds32/task.c | |
parent | 1dfe3193e7110888268c98e1e9339e79b0ee5025 (diff) | |
download | chrome-ec-70a258a192787766289a2804a012337ad0bccc17.tar.gz |
nds32: task: allow context switching if task_start() is called
We got a symptom that keyboard didn't work without connecting
servo board after this change (CL:897315) was merged.
This is because our uart RX will receive a data (0) with framing
error if RX level is low and trigger a re-scheduling request in
uart ISR (HOOKS task will be wake at later and then start the
task scheduling).
And that will cause we don't return to main() function to finish
all operations of initialization after uart_init() is called.
I think we will get the same symptom if GPIO/peripheral interrupts
are enabled and wake some task at initialization.
This change makes sure we will start the task scheduling if
task_start() is called.
BUG=none
BRANCH=none
TEST=With this change, keyboard works after EC reboot without
servo board connected.
Change-Id: I0bda84b1cb56ced6aad2a38b0786d1b336e77211
Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/956794
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'core/nds32/task.c')
-rw-r--r-- | core/nds32/task.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/nds32/task.c b/core/nds32/task.c index 788f0c66bf..2de4c78303 100644 --- a/core/nds32/task.c +++ b/core/nds32/task.c @@ -166,7 +166,7 @@ static uint32_t tasks_ready = (1 << TASK_ID_HOOKS); */ static uint32_t tasks_enabled = (1 << TASK_ID_HOOKS) | (1 << TASK_ID_IDLE); -static int start_called; /* Has task swapping started */ +int start_called; /* Has task swapping started */ /* interrupt number of sw interrupt */ static int sw_int_num; @@ -457,7 +457,8 @@ uint32_t __ram_code task_set_event(task_id_t tskid, uint32_t event, int wait) if (in_interrupt_context()) { /* The receiver might run again */ atomic_or(&tasks_ready, 1 << tskid); - need_resched = 1; + if (start_called) + need_resched = 1; } else { if (wait) return __wait_evt(-1, tskid); @@ -781,7 +782,6 @@ int task_start(void) #ifdef CONFIG_TASK_PROFILING task_start_time = exc_end_time = get_time().val; #endif - start_called = 1; return __task_start(); } |