summaryrefslogtreecommitdiff
path: root/include/task_id.h
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2011-12-07 18:58:43 +0000
committerVincent Palatin <vpalatin@chromium.org>2011-12-07 19:10:02 +0000
commite24fa592d2a215d8ae67917c1d89e68cdf847a03 (patch)
tree47fbe4c55e7f4089cad7d619eded337da3bae999 /include/task_id.h
parent6396911897e4cd40f52636d710cee2865acf15e3 (diff)
downloadchrome-ec-e24fa592d2a215d8ae67917c1d89e68cdf847a03.tar.gz
Initial sources import 3/3
source files mainly done by Vincent. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Change-Id: Ic2d1becd400c9b4b4a14d4a243af1bdf77d9c1e2
Diffstat (limited to 'include/task_id.h')
-rw-r--r--include/task_id.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/include/task_id.h b/include/task_id.h
new file mode 100644
index 0000000000..8b6e14721f
--- /dev/null
+++ b/include/task_id.h
@@ -0,0 +1,41 @@
+/* Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* define the task identifier of all compiled tasks */
+
+#ifndef __TASK_ID_H
+#define __TASK_ID_H
+
+/* define the name of the header containing the list of tasks */
+#define STRINGIFY0(name) #name
+#define STRINGIFY(name) STRINGIFY0(name)
+#define TASK_LIST STRINGIFY(TASKFILE)
+
+/* Task identifier (8 bits) */
+typedef uint8_t task_id_t;
+
+/**
+ * enumerate all tasks in the priority order
+ *
+ * the identifier of a task can be retrieved using the following constant:
+ * TASK_ID_<taskname> where <taskname> is the first parameter passed to the
+ * TASK macro in the TASK_LIST file.
+ */
+#define TASK(n, r, d) TASK_ID_##n,
+#include TASK_LIST
+enum {
+ TASK_ID_IDLE,
+ /* CONFIG_TASK_LIST is a macro coming from the TASK_LIST file */
+ CONFIG_TASK_LIST
+ /* Number of tasks */
+ TASK_ID_COUNT,
+ /* Special task identifiers */
+ TASK_ID_TIMER = 0x1f, /* message from an expired timer */
+ TASK_ID_CURRENT = 0xfe, /* the currently running task */
+ TASK_ID_INVALID = 0xff /* unable to find the task */
+};
+#undef TASK
+
+#endif /* __TASK_ID_H */