Skip to content

Commit ce95e03

Browse files
Kent Hallnashif
authored andcommitted
tests: drivers: counter: Update tests for STM32F4 timer counter driver
Updates counter driver test suite to support STM32F4 timers. Signed-off-by: Kent Hall <[email protected]>
1 parent ba37d59 commit ce95e03

File tree

2 files changed

+104
-0
lines changed

2 files changed

+104
-0
lines changed
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
&timers2 {
2+
st,prescaler = <83>;
3+
counter {
4+
status = "okay";
5+
};
6+
};
7+
8+
&timers3 {
9+
st,prescaler = <83>;
10+
counter {
11+
status = "okay";
12+
};
13+
};
14+
15+
&timers4 {
16+
st,prescaler = <83>;
17+
counter {
18+
status = "okay";
19+
};
20+
};
21+
22+
&timers5 {
23+
st,prescaler = <83>;
24+
counter {
25+
status = "okay";
26+
};
27+
};
28+
29+
&timers6 {
30+
st,prescaler = <83>;
31+
counter {
32+
status = "okay";
33+
};
34+
};
35+
36+
&timers7 {
37+
st,prescaler = <83>;
38+
counter {
39+
status = "okay";
40+
};
41+
};
42+
43+
&timers9 {
44+
st,prescaler = <167>;
45+
counter {
46+
status = "okay";
47+
};
48+
};
49+
50+
&timers10 {
51+
st,prescaler = <167>;
52+
counter {
53+
status = "okay";
54+
};
55+
};
56+
57+
&timers11 {
58+
st,prescaler = <167>;
59+
counter {
60+
status = "okay";
61+
};
62+
};
63+
64+
&timers12 {
65+
st,prescaler = <83>;
66+
counter {
67+
status = "okay";
68+
};
69+
};
70+
71+
&timers13 {
72+
st,prescaler = <83>;
73+
counter {
74+
status = "okay";
75+
};
76+
};
77+
78+
&timers14 {
79+
st,prescaler = <83>;
80+
counter {
81+
status = "okay";
82+
};
83+
};
84+
85+
&rtc {
86+
status = "disabled";
87+
};

tests/drivers/counter/counter_basic_api/src/test_counter.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ static const char * const devices[] = {
6161
#ifdef CONFIG_COUNTER_RTC2
6262
DT_LABEL(DT_NODELABEL(rtc2)),
6363
#endif
64+
#ifdef CONFIG_COUNTER_TIMER_STM32
65+
#define STM32_COUNTER_LABEL(idx) \
66+
DT_LABEL(DT_INST(idx, st_stm32_counter)),
67+
#define DT_DRV_COMPAT st_stm32_counter
68+
DT_INST_FOREACH_STATUS_OKAY(STM32_COUNTER_LABEL)
69+
#undef DT_DRV_COMPAT
70+
#undef STM32_COUNTER_LABEL
71+
#endif
6472
#ifdef CONFIG_COUNTER_NATIVE_POSIX
6573
DT_LABEL(DT_NODELABEL(counter0)),
6674
#endif
@@ -762,6 +770,10 @@ static bool late_detection_capable(const char *dev_name)
762770
return false;
763771
}
764772

773+
if (single_channel_alarm_capable(dev_name) == false) {
774+
return false;
775+
}
776+
765777
return true;
766778
}
767779

@@ -978,6 +990,11 @@ static bool reliable_cancel_capable(const char *dev_name)
978990
return true;
979991
}
980992
#endif
993+
#ifdef CONFIG_COUNTER_TIMER_STM32
994+
if (single_channel_alarm_capable(dev_name)) {
995+
return true;
996+
}
997+
#endif
981998
#ifdef CONFIG_COUNTER_NATIVE_POSIX
982999
if (strcmp(dev_name, DT_LABEL(DT_NODELABEL(counter0))) == 0) {
9831000
return true;

0 commit comments

Comments
 (0)