summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-05-02 00:37:07 +0800
committerChromeBot <chrome-bot@google.com>2013-05-07 09:09:50 -0700
commit0a45fa17086d4556b7cb4ea0a9f53894197bc897 (patch)
treef2363f2a2320000404125bb36225e1420929d45d /include
parentb02c7b461740c457c6904a5d9d9f445afaa849cb (diff)
downloadchrome-ec-0a45fa17086d4556b7cb4ea0a9f53894197bc897.tar.gz
Pthread-based emulator for unit testingstabilize-4100.38.B
This is the first version of pthread-based RTOS emulator. With this, we will be able to test high-level modules entirely on the host machine. BUG=chrome-os-partner:19325 TEST='make runtests' and see tests passing. BRANCH=None Change-Id: I1f5fcd76aa84bdb46c7d35c5e60ae5d92fd3a319 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/49954 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/host_test.h15
-rw-r--r--include/link_defs.h63
-rw-r--r--include/task_id.h3
3 files changed, 81 insertions, 0 deletions
diff --git a/include/host_test.h b/include/host_test.h
new file mode 100644
index 0000000000..0c1b95d1fa
--- /dev/null
+++ b/include/host_test.h
@@ -0,0 +1,15 @@
+/* Copyright (c) 2013 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.
+ */
+
+/* Unit testing for Chrome EC */
+
+#ifndef __CROS_EC_HOST_TEST_H
+#define __CROS_EC_HOST_TEST_H
+
+/* Emulator exit codes */
+#define EXIT_CODE_RESET (1 << 6) /* Leave six bits for SYSTEM_RESET_* */
+#define EXIT_CODE_HIBERNATE (1 << 7)
+
+#endif /* __CROS_EC_HOST_TEST_H */
diff --git a/include/link_defs.h b/include/link_defs.h
new file mode 100644
index 0000000000..a8c54d4afe
--- /dev/null
+++ b/include/link_defs.h
@@ -0,0 +1,63 @@
+/* Copyright (c) 2013 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.
+ *
+ * Symbols from linker definitions
+ */
+
+#ifndef __CROS_EC_LINK_DEFS_H
+#define __CROS_EC_LINK_DEFS_H
+
+#include "console.h"
+#include "hooks.h"
+#include "host_command.h"
+#include "task.h"
+
+/* Console commands */
+extern const struct console_command __cmds[];
+extern const struct console_command __cmds_end[];
+
+/* Hooks */
+extern const struct hook_data __hooks_init[];
+extern const struct hook_data __hooks_init_end[];
+extern const struct hook_data __hooks_freq_change[];
+extern const struct hook_data __hooks_freq_change_end[];
+extern const struct hook_data __hooks_sysjump[];
+extern const struct hook_data __hooks_sysjump_end[];
+extern const struct hook_data __hooks_chipset_pre_init[];
+extern const struct hook_data __hooks_chipset_pre_init_end[];
+extern const struct hook_data __hooks_chipset_startup[];
+extern const struct hook_data __hooks_chipset_startup_end[];
+extern const struct hook_data __hooks_chipset_resume[];
+extern const struct hook_data __hooks_chipset_resume_end[];
+extern const struct hook_data __hooks_chipset_suspend[];
+extern const struct hook_data __hooks_chipset_suspend_end[];
+extern const struct hook_data __hooks_chipset_shutdown[];
+extern const struct hook_data __hooks_chipset_shutdown_end[];
+extern const struct hook_data __hooks_ac_change[];
+extern const struct hook_data __hooks_ac_change_end[];
+extern const struct hook_data __hooks_lid_change[];
+extern const struct hook_data __hooks_lid_change_end[];
+extern const struct hook_data __hooks_pwrbtn_change[];
+extern const struct hook_data __hooks_pwrbtn_change_end[];
+extern const struct hook_data __hooks_tick[];
+extern const struct hook_data __hooks_tick_end[];
+extern const struct hook_data __hooks_second[];
+extern const struct hook_data __hooks_second_end[];
+
+/* Deferrable functions */
+extern const struct deferred_data __deferred_funcs[];
+extern const struct deferred_data __deferred_funcs_end[];
+
+/* Host commands */
+extern const struct host_command __hcmds[];
+extern const struct host_command __hcmds_end[];
+
+/* IRQs (interrupt handlers) */
+extern const struct irq_priority __irqprio[];
+extern const struct irq_priority __irqprio_end[];
+
+/* Shared memory buffer. Use via shared_mem.h interface. */
+extern uint8_t __shared_mem_buf[];
+
+#endif /* __CROS_EC_LINK_DEFS_H */
diff --git a/include/task_id.h b/include/task_id.h
index 33445aee9c..985c39848c 100644
--- a/include/task_id.h
+++ b/include/task_id.h
@@ -47,6 +47,9 @@ enum {
CONFIG_TASK_LIST
/* CONFIG_TEST_TASK_LIST is a macro from the TEST_TASK_LIST file */
CONFIG_TEST_TASK_LIST
+#ifdef EMU_BUILD
+ TASK_ID_TEST_RUNNER,
+#endif
/* Number of tasks */
TASK_ID_COUNT,
/* Special task identifiers */