diff options
author | Rob Barnes <robbarnes@google.com> | 2023-02-01 10:59:47 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-03-02 16:32:50 +0000 |
commit | 1e8199a5dfdaa7973c41579b2262d7a36b54634d (patch) | |
tree | a7c84b64d595db36999bd5b08b6b050f3eab02f6 /zephyr/shim/src | |
parent | 21dad832cc379794a9e3000c2ffb576b6fdf1bf9 (diff) | |
download | chrome-ec-1e8199a5dfdaa7973c41579b2262d7a36b54634d.tar.gz |
tasks: Add extra SHELL task id
Add TASK_ID_SHELL to extra non-shimmed tasks list. get_shell_thread
method also added to allow mapping between shell task id and shell
thread.
BUG=b:267470086
BRANCH=None
TEST=Task unit tests
Change-Id: Id49f983e2ae8b9e7359d5e5887f128985ea87786
Signed-off-by: Rob Barnes <robbarnes@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4214559
Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
Diffstat (limited to 'zephyr/shim/src')
-rw-r--r-- | zephyr/shim/src/console.c | 8 | ||||
-rw-r--r-- | zephyr/shim/src/tasks.c | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/zephyr/shim/src/console.c b/zephyr/shim/src/console.c index ce5c801069..2a82571065 100644 --- a/zephyr/shim/src/console.c +++ b/zephyr/shim/src/console.c @@ -308,6 +308,14 @@ const struct shell *get_ec_shell(void) } #endif +k_tid_t get_shell_thread(void) +{ + if (shell_zephyr == NULL) { + return NULL; + } + return shell_zephyr->thread; +} + void uart_tx_start(void) { } diff --git a/zephyr/shim/src/tasks.c b/zephyr/shim/src/tasks.c index d283671f98..8d00475fd1 100644 --- a/zephyr/shim/src/tasks.c +++ b/zephyr/shim/src/tasks.c @@ -8,6 +8,7 @@ #include "host_command.h" #include "task.h" #include "timer.h" +#include "zephyr_console_shim.h" #include <zephyr/init.h> #include <zephyr/kernel.h> @@ -141,6 +142,9 @@ k_tid_t task_id_to_thread_id(task_id_t task_id) case TASK_ID_IDLE: return get_idle_thread(); + + case TASK_ID_SHELL: + return get_shell_thread(); } } __ASSERT(false, "Failed to map task %d to thread", task_id); @@ -174,6 +178,10 @@ task_id_t thread_id_to_task_id(k_tid_t thread_id) return TASK_ID_IDLE; } + if (get_shell_thread() == thread_id) { + return TASK_ID_SHELL; + } + for (size_t i = 0; i < TASK_ID_COUNT; ++i) { if (task_to_k_tid[i] == thread_id) { return i; |