@@ -84,11 +84,6 @@ struct testcase_data {
84
84
uint32_t received_data;
85
85
};
86
86
87
- void release_sem (Semaphore *sem)
88
- {
89
- sem->release ();
90
- }
91
-
92
87
testcase_data current_case;
93
88
94
89
Thread wdg_kicking_thread (osPriorityNormal, 768 );
@@ -156,8 +151,6 @@ void test_sleep_reset()
156
151
}
157
152
158
153
// Phase 1. -- run the test code.
159
- Semaphore sem (0 , 1 );
160
- Timeout timeout;
161
154
if (send_reset_notification (¤t_case, 2 * TIMEOUT_MS) == false ) {
162
155
TEST_ASSERT_MESSAGE (0 , " Dev-host communication error." );
163
156
return ;
@@ -167,16 +160,15 @@ void test_sleep_reset()
167
160
TEST_ASSERT_TRUE (watchdog.start (TIMEOUT_MS));
168
161
TEST_ASSERT_TRUE (watchdog.is_running ());
169
162
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));
172
163
if (sleep_manager_can_deep_sleep ()) {
173
164
TEST_ASSERT_MESSAGE (0 , " Deepsleep should be disallowed." );
174
165
return ;
175
166
}
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.
177
169
sleep_manager_unlock_deep_sleep ();
178
170
179
- // Watchdog reset should have occurred during sem.acquire() ( sleep) above.
171
+ // Watchdog reset should have occurred during the sleep above.
180
172
181
173
kick_wdg_during_test_teardown.release (); // For testsuite failure handling.
182
174
TEST_ASSERT_MESSAGE (0 , " Watchdog did not reset the device as expected." );
@@ -193,8 +185,6 @@ void test_deepsleep_reset()
193
185
}
194
186
195
187
// Phase 1. -- run the test code.
196
- Semaphore sem (0 , 1 );
197
- LowPowerTimeout lp_timeout;
198
188
if (send_reset_notification (¤t_case, 2 * TIMEOUT_MS + SERIAL_FLUSH_TIME_MS) == false ) {
199
189
TEST_ASSERT_MESSAGE (0 , " Dev-host communication error." );
200
190
return ;
@@ -204,14 +194,13 @@ void test_deepsleep_reset()
204
194
TEST_ASSERT_FALSE (watchdog.is_running ());
205
195
TEST_ASSERT_TRUE (watchdog.start (TIMEOUT_MS));
206
196
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));
209
197
if (!sleep_manager_can_deep_sleep ()) {
210
198
TEST_ASSERT_MESSAGE (0 , " Deepsleep should be allowed." );
211
199
}
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.
213
202
214
- // Watchdog reset should have occurred during sem.acquire() ( deepsleep) above.
203
+ // Watchdog reset should have occurred during the deepsleep above.
215
204
216
205
kick_wdg_during_test_teardown.release (); // For testsuite failure handling.
217
206
TEST_ASSERT_MESSAGE (0 , " Watchdog did not reset the device as expected." );
0 commit comments