diff options
author | Vic Yang <victoryang@chromium.org> | 2013-05-20 00:00:27 +0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-01-06 12:40:45 +0000 |
commit | cdcaf6ed8a1d18bdedb72fb665263c0dbff0ac8e (patch) | |
tree | ab01862ee3a4114e43ec974fbbbdd615e1e61d63 /include/test_util.h | |
parent | 7c673390aecdd35da01ddf446a23667d95dccef1 (diff) | |
download | chrome-ec-cdcaf6ed8a1d18bdedb72fb665263c0dbff0ac8e.tar.gz |
Add interrupt support for emulator
This provides us a way to inject interrupts during a test. If a test has
interrupt_generator() defined, it will run in a separate thread. The
generator can then trigger interrupts when it decides to. The current
running task is suspended while emulator is executing ISR.
Also fixes a bug that tasks run without scheduler notifying them during
emulator start-up.
BUG=chrome-os-partner:19235
TEST=Repeatedly run all tests.
BRANCH=None
Change-Id: I0f921c47c0f848a9626da6272d9040e2b7c5ac86
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/55671
Diffstat (limited to 'include/test_util.h')
-rw-r--r-- | include/test_util.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/test_util.h b/include/test_util.h index a6b110f6d1..182ad9d233 100644 --- a/include/test_util.h +++ b/include/test_util.h @@ -109,6 +109,28 @@ int test_get_error_count(void); int test_send_host_command(int command, int version, const void *params, int params_size, void *resp, int resp_size); +/* Optionally defined interrupt generator entry point */ +void interrupt_generator(void); + +/* + * Trigger an interrupt. This function must only be called by interrupt + * generator. + */ +void task_trigger_test_interrupt(void (*isr)(void)); + +/* + * Special implementation of udelay() for interrupt generator. Calls + * to udelay() from interrupt generator are delegated to this function + * automatically. + */ +void interrupt_generator_udelay(unsigned us); + +#ifdef EMU_BUILD +void wait_for_task_started(void); +#else +static inline void wait_for_task_started(void) { } +#endif + uint32_t prng(uint32_t seed); uint32_t prng_no_seed(void); |