mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-01 12:52:26 +00:00
This patch makes each test print start marker before sync. This will allow us to distinguish the failure before even sync is attempted (CTS_RC_DID_NOT_START, thus probably caused by the previous test) and the failure caused by the hanging partner, in which case the one good and alive will be stuck in sync (and should return _DID_NOT_END or even better _BAD_SYNC once we implement timeout in sync). This patch also: * Adds did_not_start_test to and removes debug_test from meta suite * Consolidates test runner loops into common cts_main_loop * Removes dut_common.h and th_common.h * Removes debug print macro and CTS_DEBUG * Replaces all infinite loops after tests with task_wait_event(-1) * Removes meaningless comments and debug printfs * Removes CTS_TEST_ID_* * Adds sync() to task suite BUG=chromium:736104 BRANCH=none TEST=Run run_ects.sh and verify all tests pass Change-Id: I6ccdf26afac6b8e8cb16483c5d75e4e77e7962f4 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/545176
79 lines
1.5 KiB
C
79 lines
1.5 KiB
C
/* Copyright 2016 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.
|
|
*/
|
|
|
|
#include "common.h"
|
|
#include "cts_common.h"
|
|
#include "gpio.h"
|
|
#include "task.h"
|
|
#include "timer.h"
|
|
#include "watchdog.h"
|
|
|
|
void clean_state(void)
|
|
{
|
|
gpio_set_level(GPIO_OUTPUT_TEST, 1);
|
|
gpio_set_level(GPIO_CTS_IRQ2, 1);
|
|
}
|
|
|
|
static void trigger_interrupt1(void)
|
|
{
|
|
usleep(CTS_INTERRUPT_TRIGGER_DELAY_US);
|
|
gpio_set_level(GPIO_OUTPUT_TEST, 0);
|
|
usleep(CTS_INTERRUPT_TRIGGER_DELAY_US);
|
|
}
|
|
|
|
static void trigger_interrupt2(void)
|
|
{
|
|
usleep(CTS_INTERRUPT_TRIGGER_DELAY_US);
|
|
gpio_set_level(GPIO_CTS_IRQ2, 0);
|
|
usleep(CTS_INTERRUPT_TRIGGER_DELAY_US);
|
|
}
|
|
|
|
enum cts_rc test_task_wait_event(void)
|
|
{
|
|
trigger_interrupt1();
|
|
return CTS_RC_SUCCESS;
|
|
}
|
|
|
|
enum cts_rc test_task_disable_irq(void)
|
|
{
|
|
trigger_interrupt1();
|
|
return CTS_RC_SUCCESS;
|
|
}
|
|
|
|
enum cts_rc test_interrupt_enable(void)
|
|
{
|
|
trigger_interrupt1();
|
|
return CTS_RC_SUCCESS;
|
|
}
|
|
|
|
enum cts_rc test_interrupt_disable(void)
|
|
{
|
|
trigger_interrupt1();
|
|
return CTS_RC_SUCCESS;
|
|
}
|
|
|
|
enum cts_rc test_nested_interrupt_low_high(void)
|
|
{
|
|
trigger_interrupt2();
|
|
trigger_interrupt1();
|
|
return CTS_RC_SUCCESS;
|
|
}
|
|
|
|
enum cts_rc test_nested_interrupt_high_low(void)
|
|
{
|
|
trigger_interrupt1();
|
|
trigger_interrupt2();
|
|
return CTS_RC_SUCCESS;
|
|
}
|
|
|
|
#include "cts_testlist.h"
|
|
|
|
void cts_task(void)
|
|
{
|
|
gpio_set_flags(GPIO_OUTPUT_TEST, GPIO_ODR_HIGH);
|
|
cts_main_loop(tests, "Interrupt");
|
|
task_wait_event(-1);
|
|
}
|