@@ -90,18 +90,7 @@ struct testcase_data {
90
90
91
91
testcase_data current_case;
92
92
93
- Thread wdg_kicking_thread (osPriorityNormal, 768 );
94
- Semaphore kick_wdg_during_test_teardown (0 , 1 );
95
-
96
- void wdg_kicking_thread_fun ()
97
- {
98
- kick_wdg_during_test_teardown.acquire ();
99
- Watchdog &watchdog = Watchdog::get_instance ();
100
- while (true ) {
101
- watchdog.kick ();
102
- wait_us (20000 );
103
- }
104
- }
93
+ Ticker wdg_kicking_ticker;
105
94
106
95
bool send_reset_notification (testcase_data *tcdata, uint32_t delay_ms)
107
96
{
@@ -140,7 +129,8 @@ void test_simple_reset()
140
129
141
130
// Watchdog reset should have occurred during a wait above.
142
131
143
- kick_wdg_during_test_teardown.release (); // For testsuite failure handling.
132
+ hal_watchdog_kick ();
133
+ wdg_kicking_ticker.attach_us (mbed::callback (hal_watchdog_kick), 20000 ); // For testsuite failure handling.
144
134
TEST_ASSERT_MESSAGE (0 , " Watchdog did not reset the device as expected." );
145
135
}
146
136
@@ -174,7 +164,8 @@ void test_sleep_reset()
174
164
175
165
// Watchdog reset should have occurred during the sleep above.
176
166
177
- kick_wdg_during_test_teardown.release (); // For testsuite failure handling.
167
+ hal_watchdog_kick ();
168
+ wdg_kicking_ticker.attach_us (mbed::callback (hal_watchdog_kick), 20000 ); // For testsuite failure handling.
178
169
TEST_ASSERT_MESSAGE (0 , " Watchdog did not reset the device as expected." );
179
170
}
180
171
@@ -210,7 +201,8 @@ void test_deepsleep_reset()
210
201
211
202
// Watchdog reset should have occurred during the deepsleep above.
212
203
213
- kick_wdg_during_test_teardown.release (); // For testsuite failure handling.
204
+ hal_watchdog_kick ();
205
+ wdg_kicking_ticker.attach_us (mbed::callback (hal_watchdog_kick), 20000 ); // For testsuite failure handling.
214
206
TEST_ASSERT_MESSAGE (0 , " Watchdog did not reset the device as expected." );
215
207
}
216
208
#endif
@@ -255,7 +247,8 @@ void test_restart_reset()
255
247
256
248
// Watchdog reset should have occurred during a wait above.
257
249
258
- kick_wdg_during_test_teardown.release (); // For testsuite failure handling.
250
+ hal_watchdog_kick ();
251
+ wdg_kicking_ticker.attach_us (mbed::callback (hal_watchdog_kick), 20000 ); // For testsuite failure handling.
259
252
TEST_ASSERT_MESSAGE (0 , " Watchdog did not reset the device as expected." );
260
253
}
261
254
@@ -288,7 +281,8 @@ void test_kick_reset()
288
281
289
282
// Watchdog reset should have occurred during a wait above.
290
283
291
- kick_wdg_during_test_teardown.release (); // For testsuite failure handling.
284
+ hal_watchdog_kick ();
285
+ wdg_kicking_ticker.attach_us (mbed::callback (hal_watchdog_kick), 20000 ); // For testsuite failure handling.
292
286
TEST_ASSERT_MESSAGE (0 , " Watchdog did not reset the device as expected." );
293
287
}
294
288
@@ -323,10 +317,6 @@ int testsuite_setup(const size_t number_of_cases)
323
317
return utest::v1::STATUS_ABORT;
324
318
}
325
319
326
- // The thread is started here, but feeding the watchdog will start
327
- // when the semaphore is released during a test case teardown.
328
- wdg_kicking_thread.start (mbed::callback (wdg_kicking_thread_fun));
329
-
330
320
utest_printf (" This test suite is composed of %i test cases. Starting at index %i.\n " , number_of_cases,
331
321
current_case.start_index );
332
322
return current_case.start_index ;
0 commit comments