| 161 | } |
| 162 | |
| 163 | static void test_static_timer_start_twice(void) |
| 164 | { |
| 165 | rt_err_t result; |
| 166 | |
| 167 | timer.callbacks = 0; |
| 168 | timer.is_static = RT_TRUE; |
| 169 | |
| 170 | /* timer start twice test */ |
| 171 | for (int time_out = 2; time_out < 10; time_out++) |
| 172 | { |
| 173 | for (int i = 0; i < sizeof(timer_flag_oneshot); i++) |
| 174 | { |
| 175 | rt_timer_init(&timer.static_timer, |
| 176 | "static_timer", |
| 177 | timer_oneshot, |
| 178 | &timer, |
| 179 | time_out, |
| 180 | timer_flag_oneshot[i]); |
| 181 | |
| 182 | /* calc expect tick */ |
| 183 | timer.expect_tick = rt_tick_get() + time_out; |
| 184 | |
| 185 | /* start timer */ |
| 186 | result = rt_timer_start(&timer.static_timer); |
| 187 | uassert_true(result == RT_EOK); |
| 188 | |
| 189 | rt_thread_delay(1); |
| 190 | |
| 191 | /* calc expect tick */ |
| 192 | timer.expect_tick = rt_tick_get() + time_out; |
| 193 | |
| 194 | /* start timer */ |
| 195 | result = rt_timer_start(&timer.static_timer); |
| 196 | uassert_true(result == RT_EOK); |
| 197 | |
| 198 | /* wait for timerout */ |
| 199 | rt_thread_delay(3 * time_out + 1); |
| 200 | |
| 201 | uassert_true(timer.callbacks == 1); |
| 202 | |
| 203 | /* detach timer */ |
| 204 | result = rt_timer_detach(&timer.static_timer); |
| 205 | uassert_true(result == RT_EOK); |
| 206 | timer.callbacks = 0; |
| 207 | } |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | static void timer_control(void *param) |
| 212 | { |
nothing calls this directly
no test coverage detected