@@ -84,11 +84,6 @@ struct testcase_data {
8484 uint32_t received_data;
8585};
8686
87- void release_sem (Semaphore *sem)
88- {
89- sem->release ();
90- }
91-
9287testcase_data current_case;
9388
9489Thread wdg_kicking_thread (osPriorityNormal, 768 );
@@ -156,8 +151,6 @@ void test_sleep_reset()
156151 }
157152
158153 // Phase 1. -- run the test code.
159- Semaphore sem (0 , 1 );
160- Timeout timeout;
161154 if (send_reset_notification (¤t_case, 2 * TIMEOUT_MS) == false ) {
162155 TEST_ASSERT_MESSAGE (0 , " Dev-host communication error." );
163156 return ;
@@ -167,16 +160,15 @@ void test_sleep_reset()
167160 TEST_ASSERT_TRUE (watchdog.start (TIMEOUT_MS));
168161 TEST_ASSERT_TRUE (watchdog.is_running ());
169162 sleep_manager_lock_deep_sleep ();
170- // Watchdog should fire before twice the timeout value.
171- timeout.attach_us (mbed::callback (release_sem, &sem), 1000ULL * (2 * TIMEOUT_MS));
172163 if (sleep_manager_can_deep_sleep ()) {
173164 TEST_ASSERT_MESSAGE (0 , " Deepsleep should be disallowed." );
174165 return ;
175166 }
176- sem.acquire (); // Device reset expected.
167+ // Watchdog should fire before twice the timeout value.
168+ ThisThread::sleep_for (2 * TIMEOUT_MS); // Device reset expected.
177169 sleep_manager_unlock_deep_sleep ();
178170
179- // Watchdog reset should have occurred during sem.acquire() ( sleep) above.
171+ // Watchdog reset should have occurred during the sleep above.
180172
181173 kick_wdg_during_test_teardown.release (); // For testsuite failure handling.
182174 TEST_ASSERT_MESSAGE (0 , " Watchdog did not reset the device as expected." );
@@ -193,8 +185,6 @@ void test_deepsleep_reset()
193185 }
194186
195187 // Phase 1. -- run the test code.
196- Semaphore sem (0 , 1 );
197- LowPowerTimeout lp_timeout;
198188 if (send_reset_notification (¤t_case, 2 * TIMEOUT_MS + SERIAL_FLUSH_TIME_MS) == false ) {
199189 TEST_ASSERT_MESSAGE (0 , " Dev-host communication error." );
200190 return ;
@@ -204,14 +194,13 @@ void test_deepsleep_reset()
204194 TEST_ASSERT_FALSE (watchdog.is_running ());
205195 TEST_ASSERT_TRUE (watchdog.start (TIMEOUT_MS));
206196 TEST_ASSERT_TRUE (watchdog.is_running ());
207- // Watchdog should fire before twice the timeout value.
208- lp_timeout.attach_us (mbed::callback (release_sem, &sem), 1000ULL * (2 * TIMEOUT_MS));
209197 if (!sleep_manager_can_deep_sleep ()) {
210198 TEST_ASSERT_MESSAGE (0 , " Deepsleep should be allowed." );
211199 }
212- sem.acquire (); // Device reset expected.
200+ // Watchdog should fire before twice the timeout value.
201+ ThisThread::sleep_for (2 * TIMEOUT_MS); // Device reset expected.
213202
214- // Watchdog reset should have occurred during sem.acquire() ( deepsleep) above.
203+ // Watchdog reset should have occurred during the deepsleep above.
215204
216205 kick_wdg_during_test_teardown.release (); // For testsuite failure handling.
217206 TEST_ASSERT_MESSAGE (0 , " Watchdog did not reset the device as expected." );
0 commit comments