summaryrefslogtreecommitdiff
path: root/test/interrupt.c
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2021-11-04 12:11:58 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-05 04:22:34 +0000
commit252457d4b21f46889eebad61d4c0a65331919cec (patch)
tree01856c4d31d710b20e85a74c8d7b5836e35c3b98 /test/interrupt.c
parent08f5a1e6fc2c9467230444ac9b582dcf4d9f0068 (diff)
downloadchrome-ec-release-R98-14388.B-ish.tar.gz
In the interest of making long-term branch maintenance incur as little technical debt on us as possible, we should not maintain any files on the branch we are not actually using. This has the added effect of making it extremely clear when merging CLs from the main branch when changes have the possibility to affect us. The follow-on CL adds a convenience script to actually pull updates from the main branch and generate a CL for the update. BUG=b:204206272 BRANCH=ish TEST=make BOARD=arcada_ish && make BOARD=drallion_ish Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I17e4694c38219b5a0823e0a3e55a28d1348f4b18 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262038 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'test/interrupt.c')
-rw-r--r--test/interrupt.c100
1 files changed, 0 insertions, 100 deletions
diff --git a/test/interrupt.c b/test/interrupt.c
deleted file mode 100644
index ca98309e1f..0000000000
--- a/test/interrupt.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* Copyright 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.
- *
- * Test interrupt support of EC emulator.
- */
-#include <stdio.h>
-
-#include "common.h"
-#include "console.h"
-#include "task.h"
-#include "test_util.h"
-#include "timer.h"
-#include "util.h"
-
-static int main_count;
-static int has_error;
-static int interrupt_count;
-
-/* period between 50us and 3.2ms */
-#define PERIOD_US(num) (((num % 64) + 1) * 50)
-
-void my_isr(void)
-{
- int i = main_count;
- udelay(3 * PERIOD_US(prng_no_seed()));
- if (i != main_count || !in_interrupt_context())
- has_error = 1;
- interrupt_count++;
-}
-
-static volatile uint32_t enable_ready_reg;
-
-static void set_ready_bit(void)
-{
- if (enable_ready_reg & BIT(0))
- enable_ready_reg |= BIT(1);
-}
-
-void interrupt_generator(void)
-{
- while (1) {
- udelay(3 * PERIOD_US(prng_no_seed()));
- task_trigger_test_interrupt(my_isr);
- task_trigger_test_interrupt(set_ready_bit);
- }
-}
-
-static int interrupt_test(void)
-{
- timestamp_t deadline = get_time();
- deadline.val += SECOND / 2;
- while (!timestamp_expired(deadline, NULL))
- ++main_count;
-
- ccprintf("Interrupt count: %d\n", interrupt_count);
- ccprintf("Main thread tick: %d\n", main_count);
-
- TEST_ASSERT(!has_error);
- TEST_ASSERT(!in_interrupt_context());
-
- return EC_SUCCESS;
-}
-
-static int interrupt_disable_test(void)
-{
- timestamp_t deadline = get_time();
- int start_int_cnt, end_int_cnt;
- deadline.val += SECOND / 2;
-
- interrupt_disable();
- start_int_cnt = interrupt_count;
- while (!timestamp_expired(deadline, NULL))
- ;
- end_int_cnt = interrupt_count;
- interrupt_enable();
-
- TEST_ASSERT(start_int_cnt == end_int_cnt);
-
- return EC_SUCCESS;
-}
-
-static int test_wait_for_ready(void)
-{
- wait_for_ready(&enable_ready_reg, BIT(0), BIT(1));
- TEST_EQ(enable_ready_reg, BIT(0) | BIT(1), "%x");
-
- return EC_SUCCESS;
-}
-
-void run_test(int argc, char **argv)
-{
- test_reset();
-
- RUN_TEST(interrupt_test);
- RUN_TEST(interrupt_disable_test);
- RUN_TEST(test_wait_for_ready);
-
- test_print_result();
-}