mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 17:11:42 +00:00
Interrupt test checks whether DUT can be interrupted by an interrupt and an interrupt handler can be invoked as expected. Note the previous interrupt test ported from test/interrupt.c runs in an emulated environment on the host, thus does not test the real interrupt capability of the chip. BUG=chromium:653195 BRANCH=none TEST=Run cts.py -m interrupt Change-Id: I21cecff07594f048633d1c1b699fb3a1876379e0 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/363943 Reviewed-by: Randall Spangler <rspangler@chromium.org>
68 lines
1.2 KiB
C
68 lines
1.2 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 "th_common.h"
|
|
#include "gpio.h"
|
|
#include "timer.h"
|
|
#include "watchdog.h"
|
|
|
|
static void trigger_interrupt(void)
|
|
{
|
|
usleep(CTS_INTERRUPT_TRIGGER_DELAY_US);
|
|
gpio_set_level(GPIO_OUTPUT_TEST, 0);
|
|
usleep(CTS_INTERRUPT_TRIGGER_DELAY_US);
|
|
}
|
|
|
|
enum cts_rc test_task_wait_event(void)
|
|
{
|
|
trigger_interrupt();
|
|
return CTS_RC_SUCCESS;
|
|
}
|
|
|
|
enum cts_rc test_task_disable_irq(void)
|
|
{
|
|
trigger_interrupt();
|
|
return CTS_RC_SUCCESS;
|
|
}
|
|
|
|
enum cts_rc test_interrupt_enable(void)
|
|
{
|
|
trigger_interrupt();
|
|
return CTS_RC_SUCCESS;
|
|
}
|
|
|
|
enum cts_rc test_interrupt_disable(void)
|
|
{
|
|
trigger_interrupt();
|
|
return CTS_RC_SUCCESS;
|
|
}
|
|
|
|
#include "cts_testlist.h"
|
|
|
|
void cts_task(void)
|
|
{
|
|
enum cts_rc rc;
|
|
int i;
|
|
|
|
gpio_set_flags(GPIO_OUTPUT_TEST, GPIO_ODR_HIGH);
|
|
|
|
for (i = 0; i < CTS_TEST_ID_COUNT; i++) {
|
|
gpio_set_level(GPIO_OUTPUT_TEST, 1);
|
|
sync();
|
|
rc = tests[i].run();
|
|
CPRINTF("\n%s %d\n", tests[i].name, rc);
|
|
cflush();
|
|
}
|
|
|
|
CPRINTS("Interrupt test suite finished");
|
|
cflush();
|
|
|
|
while (1) {
|
|
watchdog_reload();
|
|
sleep(1);
|
|
}
|
|
}
|