summaryrefslogtreecommitdiff
path: root/zephyr/shim/src/tasks.c
diff options
context:
space:
mode:
Diffstat (limited to 'zephyr/shim/src/tasks.c')
-rw-r--r--zephyr/shim/src/tasks.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/zephyr/shim/src/tasks.c b/zephyr/shim/src/tasks.c
index 68ebbbc482..35d4ab7c42 100644
--- a/zephyr/shim/src/tasks.c
+++ b/zephyr/shim/src/tasks.c
@@ -3,15 +3,15 @@
* found in the LICENSE file.
*/
+#include <zephyr/kernel.h>
+#include <zephyr/init.h>
+#include <zephyr/sys/atomic.h>
+#include <zephyr/shell/shell.h>
+
#include "common.h"
#include "host_command.h"
-#include "task.h"
#include "timer.h"
-
-#include <zephyr/init.h>
-#include <zephyr/kernel.h>
-#include <zephyr/shell/shell.h>
-#include <zephyr/sys/atomic.h>
+#include "task.h"
/* Ensure that the idle task is at lower priority than lowest priority task. */
BUILD_ASSERT(EC_TASK_PRIORITY(EC_TASK_PRIO_LOWEST) < K_IDLE_PRIO,
@@ -105,7 +105,7 @@ atomic_t *task_get_event_bitmap(task_id_t cros_task_id)
data = task_get_base_data(cros_task_id);
- return data == NULL ? NULL : &data->event_mask;
+ return &data->event_mask;
}
void task_set_event(task_id_t cros_task_id, uint32_t event)
@@ -114,10 +114,8 @@ void task_set_event(task_id_t cros_task_id, uint32_t event)
data = task_get_base_data(cros_task_id);
- if (data != NULL) {
- atomic_or(&data->event_mask, event);
- k_poll_signal_raise(&data->new_event, 0);
- }
+ atomic_or(&data->event_mask, event);
+ k_poll_signal_raise(&data->new_event, 0);
}
uint32_t task_wait_event(int timeout_us)
@@ -126,8 +124,6 @@ uint32_t task_wait_event(int timeout_us)
data = task_get_base_data(task_get_current());
- __ASSERT_NO_MSG(data != NULL);
-
const k_timeout_t timeout = (timeout_us == -1) ? K_FOREVER :
K_USEC(timeout_us);
const int64_t tick_deadline =
@@ -156,12 +152,12 @@ uint32_t task_wait_event(int timeout_us)
if (events == 0) {
const int64_t ticks_left = tick_deadline - k_uptime_ticks();
- events |= TASK_EVENT_TIMER;
-
if (ticks_left > 0) {
return task_wait_event(
k_ticks_to_us_near64(ticks_left));
}
+
+ events |= TASK_EVENT_TIMER;
}
return events;
@@ -313,26 +309,18 @@ int task_start_called(void)
{
return tasks_started;
}
-/*
- * TODO(b/190203712): Implement this
- * LCOV_EXCL_START
- */
+
void task_disable_task(task_id_t tskid)
{
+ /* TODO(b/190203712): Implement this */
}
-/* LCOV_EXCL_STOP */
-/*
- * This function cannot be tested since it is architecture specific.
- * LCOV_EXCL_START
- */
void task_clear_pending_irq(int irq)
{
#if CONFIG_ITE_IT8XXX2_INTC
ite_intc_isr_clear(irq);
#endif
}
-/* LCOV_EXCL_STOP */
void task_enable_irq(int irq)
{
@@ -351,3 +339,11 @@ inline bool in_deferred_context(void)
*/
return (k_current_get() == &k_sys_work_q.thread);
}
+
+#if IS_ENABLED(CONFIG_KERNEL_SHELL) && IS_ENABLED(CONFIG_THREAD_MONITOR)
+static int taskinfo(const struct shell *shell, size_t argc, char **argv)
+{
+ return shell_execute_cmd(shell, "kernel threads");
+}
+SHELL_CMD_REGISTER(taskinfo, NULL, "Threads statistics", taskinfo);
+#endif