summaryrefslogtreecommitdiff
path: root/zephyr/shim/include/ec_tasks.h
blob: 2b65b4f056e64c040fcc623c60f8918b1d879b56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* Copyright 2020 The ChromiumOS Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef __CROS_EC_EC_TASKS_H
#define __CROS_EC_EC_TASKS_H

#include "task.h"

#include <zephyr/kernel.h>

/** Starts all of the shimmed EC tasks. Requires CONFIG_SHIMMED_TASKS=y. */
void start_ec_tasks(void);

/**
 * Maps an EC task id to a Zephyr thread id.
 *
 * @returns Thread id OR NULL if mapping fails
 */
k_tid_t task_id_to_thread_id(task_id_t task_id);

/**
 * Maps a Zephyr thread id to an EC task id.
 *
 * @returns Task id OR TASK_ID_INVALID if mapping fails
 */
task_id_t thread_id_to_task_id(k_tid_t thread_id);

#ifdef TEST_BUILD
/**
 * Set TASK_ID_TEST_RUNNER to current thread tid. Some functions that are tested
 * require to run in any task context.
 */
void set_test_runner_tid(void);
#endif

#endif /* __CROS_EC_EC_TASKS_H */