Skip to content

Commit 736b2db

Browse files
committed
[docs][utest]:Add comments for smp_interrupt_pri
Add comments for smp_interrupt_pri. Signed-off-by: Mengchen Teng <teng_mengchen@163.com>
1 parent 39a52cd commit 736b2db

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/utest/smp/smp_interrupt_pri_tc.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,38 @@
1818
* @note Without turning off interrupts, interrupts respond in the order in which they are triggered.
1919
* With interrupts turned off, low and high priority interrupts are triggered sequentially,
2020
* and when interrupts are turned on, high priority interrupts respond first.
21+
*
22+
* Test Case Name: [smp_interrupt_pri_tc]
23+
*
24+
* Test Objectives:
25+
* - Test the correctness of the interrupt triggering order under two scenarios. Scenario 1: When interrupts
26+
* - are not masked, the interrupt handling order shall depend on the triggering sequence. Scenario 2: When
27+
* - interrupts are first masked, triggered, and then enabled, the interrupt handling order shall depend on
28+
* - the interrupt priority.
29+
*
30+
* Test Scenarios:
31+
* - First, two interrupts are registered, namely the low-priority interrupt RT_SPI_1 and the high-priority
32+
* - interrupt RT_SPI_2.
33+
* - Scenario 1 (int_pri1_tc, mode=0): RT_SPI_1 and RT_SPI_2 are triggered sequentially without interrupt masking.
34+
* - At this point, the interrupt service routine (ISR) of RT_SPI_1 executes first to set ipi_val[0] = SET_VAL;
35+
* - since the RT_SPI_2 interrupt has not been triggered yet, ipi_val[1] remains at the initial value RES_VAL,
36+
* - making the judgment ipi_val[0] > ipi_val[1] hold true. When the RT_SPI_2 interrupt is triggered, both ipi_val[0]
37+
* - and ipi_val[1] are reset to the initial value RES_VAL.
38+
* - Scenario 2 (int_pri2_tc, mode=1): RT_SPI_1 and RT_SPI_2 are triggered under interrupt masking, and the interrupt
39+
* - mask is lifted afterward. In this case, the interrupts are handled in the order of their priorities: the RT_SPI_2
40+
* - interrupt is triggered first, followed by the RT_SPI_1 interrupt. At this point, the ISR of RT_SPI_2 first sets
41+
* - ipi_val[1] = SET_VAL, and the judgment that ipi_val[1] is greater than ipi_val[0] (which remains RES_VAL) is
42+
* - successfully validated. Subsequently, the ISR of RT_SPI_1 resets both ipi_val[0] and ipi_val[1] to the initial
43+
* - value RES_VAL.
44+
*
45+
* Verification Metrics:
46+
* - Output message: [ PASSED ] [ result ] testcase (core.smp_interrupt_pri_tc)
47+
*
48+
* Dependencies:
49+
* - RT_USING_SMP needs to be enabled.
50+
*
51+
* Expected Results:
52+
* - You will see the pass information of int_pri1_tc and int_pri2_tc, as well as the PASS message of smp_interrupt_pri_tc.
2153
*/
2254

2355
#define RES_VAL 0X0

0 commit comments

Comments
 (0)