File tree Expand file tree Collapse file tree 2 files changed +62
-1
lines changed
tests/recipes/single-baremetal Expand file tree Collapse file tree 2 files changed +62
-1
lines changed Original file line number Diff line number Diff line change 4040 inherit toolchain ;
4141 guest_name = "baremetal" ;
4242 list_tests = "" ;
43- list_suites = "CPU_BOOT_CHECK" ;
43+ list_suites = "CPU_BOOT_CHECK IRQ_CHECK " ;
4444 inherit log_level ;
4545 }
4646 )
Original file line number Diff line number Diff line change 1+ #include "testf.h"
2+ // #include <plat.h>
3+ // #include <irq.h>
4+ // #include <timer.h>
5+ // #include <uart.h>
6+ // #include <core.h>
7+ #include <core.h>
8+ #include <stdlib.h>
9+ #include <stdio.h>
10+ #include <string.h>
11+ #include <cpu.h>
12+ #include <wfi.h>
13+ #include <spinlock.h>
14+ #include <plat.h>
15+ #include <irq.h>
16+ #include <uart.h>
17+ #include <timer.h>
18+
19+ void test_interrupt_timer_callback ();
20+ void uart_rx_handler ();
21+
22+
23+ bool irq_en_timer = false;
24+ bool irq_en_uart = false;
25+
26+ #define TIMER_INTERVAL (TIME_MS(100))
27+ #define TEST_TIMEOUT (TIME_S(1))
28+
29+ BAO_TEST (IRQ_CHECK , TIMER )
30+ {
31+ irq_set_handler (TIMER_IRQ_ID , test_interrupt_timer_callback );
32+ irq_enable (TIMER_IRQ_ID );
33+ timer_set (TIMER_INTERVAL );
34+ irq_set_prio (TIMER_IRQ_ID , IRQ_MAX_PRIO );
35+
36+ timer_wait (TEST_TIMEOUT );
37+
38+ EXPECTED_TRUE (irq_en_timer );
39+ }
40+
41+ BAO_TEST (IRQ_CHECK , UART )
42+ {
43+ irq_set_handler (33 , uart_rx_handler );
44+ uart_enable_rxirq ();
45+ irq_enable (33 );
46+ irq_set_prio (33 , IRQ_MAX_PRIO );
47+
48+ timer_wait (TEST_TIMEOUT );
49+ EXPECTED_TRUE (irq_en_uart );
50+ }
51+
52+ void test_interrupt_timer_callback ()
53+ {
54+ irq_en_timer = true;
55+ timer_set (TIMER_INTERVAL );
56+ }
57+
58+ void uart_rx_handler (){
59+ uart_clear_rxirq ();
60+ irq_en_uart = true;
61+ }
You can’t perform that action at this time.
0 commit comments