eCTS: Add nested interrupt test (High->Low)

Add a nested interrupt test to eCTS. Higher priority IRQ is fired,
followed by lower priority IRQ. Handlers should be executed
sequentially.

P1               *-----*
                /       \
P2             /         *-----*
              /                 \
task_cts ----*                   *----
                 B     C A     D

BUG=chromium:653195
BRANCH=none
TEST=cts.py -m interrupt; make buildall

Change-Id: Ia9f1bf4205cefe8bdc11cc0aa3ad2057359b73ef
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/409611
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This commit is contained in:
Daisuke Nojiri
2016-10-18 09:27:34 -07:00
committed by chrome-bot
parent b2f14a26b9
commit 5488976a20
4 changed files with 45 additions and 5 deletions

View File

@@ -33,7 +33,7 @@ CTS_COLOR_RED = '#fb7d7d'
CTS_COLOR_GREEN = '#7dfb9f'
DEFAULT_TH = 'stm32l476g-eval'
DEFAULT_DUT = 'nucleo-f072rb'
MAX_SUITE_TIME_SEC = 3
MAX_SUITE_TIME_SEC = 5
CTS_DEBUG_START = '[DEBUG]'
CTS_DEBUG_END = '[DEBUG_END]'
CTS_TEST_RESULT_DIR = '/tmp/cts'

View File

@@ -25,6 +25,18 @@ CTS_TEST(test_task_disable_irq)
*/
CTS_TEST(test_nested_interrupt_low_high)
/* Test nested interrupt. Higher priority IRQ is fired, followed by
* lower priority IRQ. Handlers should be executed sequentially.
*
* P1 *-----*
* / \
* P2 / *-----*
* / \
* task_cts ----* *----
* B C A D
*/
CTS_TEST(test_nested_interrupt_high_low)
/*
* Other ideas
*

View File

@@ -45,12 +45,15 @@ static int busy_loop(void)
void cts_irq1(enum gpio_signal signal)
{
state[state_index++] = 'B';
/* test some APIs */
got_interrupt = in_interrupt_context();
/* Wake up the CTS task */
if (wake_me_up)
task_wake(TASK_ID_CTS);
busy_loop();
state[state_index++] = 'C';
}
@@ -82,7 +85,7 @@ enum cts_rc test_task_wait_event(void)
/* Sleep and wait for interrupt. This shouldn't time out. */
event = task_wait_event(CTS_INTERRUPT_TRIGGER_DELAY_US * 2);
if (event != TASK_EVENT_WAKE) {
CPRINTS("Woke up by 0x%08x", event);
CPRINTS("Woken up by unexpected event: 0x%08x", event);
return CTS_RC_FAILURE;
}
if (!got_interrupt) {
@@ -103,7 +106,7 @@ enum cts_rc test_task_disable_irq(void)
/* Sleep and wait for interrupt. This should time out. */
event = task_wait_event(CTS_INTERRUPT_TRIGGER_DELAY_US * 2);
if (event != TASK_EVENT_TIMER) {
CPRINTS("Woke up by 0x%08x", event);
CPRINTS("Woken up by unexpected event: 0x%08x", event);
return CTS_RC_FAILURE;
}
task_enable_irq(CTS_IRQ_NUMBER);
@@ -136,7 +139,7 @@ enum cts_rc test_nested_interrupt_low_high(void)
event = task_wait_event(CTS_INTERRUPT_TRIGGER_DELAY_US * 4);
if (event != TASK_EVENT_TIMER) {
CPRINTS("Woke up by 0x%08x", event);
CPRINTS("Woken up by unexpected event: 0x%08x", event);
return CTS_RC_FAILURE;
}
if (!got_interrupt) {
@@ -151,6 +154,24 @@ enum cts_rc test_nested_interrupt_low_high(void)
return CTS_RC_SUCCESS;
}
enum cts_rc test_nested_interrupt_high_low(void)
{
uint32_t event;
event = task_wait_event(CTS_INTERRUPT_TRIGGER_DELAY_US * 4);
if (event != TASK_EVENT_TIMER) {
CPRINTS("Woken up by unexpected event: 0x%08x", event);
return CTS_RC_FAILURE;
}
if (memcmp(state, "BCAD", sizeof(state))) {
CPRINTS("State transition differs from expectation");
return CTS_RC_FAILURE;
}
return CTS_RC_SUCCESS;
}
#include "cts_testlist.h"
void cts_task(void)

View File

@@ -54,6 +54,13 @@ enum cts_rc test_nested_interrupt_low_high(void)
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)