File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change 20
20
#include " ticker_api_tests.h"
21
21
#include " hal/us_ticker_api.h"
22
22
#include " hal/lp_ticker_api.h"
23
+ #include " hal/mbed_lp_ticker_wrapper.h"
23
24
24
25
#ifdef __cplusplus
25
26
extern " C" {
@@ -469,6 +470,15 @@ utest::v1::status_t us_ticker_setup(const Case *const source, const size_t index
469
470
470
471
OS_Tick_Disable ();
471
472
473
+ #if DEVICE_LPTICKER && (LPTICKER_DELAY_TICKS > 0)
474
+ // After the OS is disabled wait until the microsecond timer
475
+ // is no longer in use by the lp ticker wrapper code.
476
+ // This prevents the low power ticker wrapper code from
477
+ // getting stuck in a state where it is waiting for
478
+ // the microsecond Timeout to run.
479
+ while (lp_ticker_get_timeout_pending ());
480
+ #endif
481
+
472
482
intf->init ();
473
483
474
484
prev_irq_handler = set_us_ticker_irq_handler (ticker_event_handler_stub);
@@ -497,6 +507,15 @@ utest::v1::status_t lp_ticker_setup(const Case *const source, const size_t index
497
507
498
508
OS_Tick_Disable ();
499
509
510
+ #if DEVICE_LPTICKER && (LPTICKER_DELAY_TICKS > 0)
511
+ // After the OS is disabled wait until the microsecond timer
512
+ // is no longer in use by the lp ticker wrapper code.
513
+ // This prevents the low power ticker wrapper code from
514
+ // getting stuck in a state where it is waiting for
515
+ // the microsecond Timeout to run.
516
+ while (lp_ticker_get_timeout_pending ());
517
+ #endif
518
+
500
519
intf->init ();
501
520
502
521
prev_irq_handler = set_lp_ticker_irq_handler (ticker_event_handler_stub);
Original file line number Diff line number Diff line change 23
23
#include " utest/utest.h"
24
24
#include " unity/unity.h"
25
25
#include " greentea-client/test_env.h"
26
+ #include " mbed_lp_ticker_wrapper.h"
26
27
27
28
#include " sleep_api_tests.h"
28
29
@@ -256,12 +257,23 @@ utest::v1::status_t greentea_failure_handler(const Case * const source, const fa
256
257
utest::v1::status_t greentea_test_setup (const size_t number_of_cases)
257
258
{
258
259
GREENTEA_SETUP (60 , " default_auto" );
260
+ /* Suspend RTOS Kernel to enable sleep modes. */
261
+ osKernelSuspend ();
262
+
263
+ #if DEVICE_LPTICKER && (LPTICKER_DELAY_TICKS > 0)
264
+ // After the OS is disabled wait until the microsecond timer
265
+ // is no longer in use by the lp ticker wrapper code.
266
+ // This prevents the low power ticker wrapper code from
267
+ // getting stuck in a state where it is waiting for
268
+ // the microsecond Timeout to run.
269
+ while (lp_ticker_get_timeout_pending ());
270
+ #endif
271
+
259
272
us_ticker_init ();
260
273
#if DEVICE_LPTICKER
261
274
lp_ticker_init ();
262
275
#endif
263
- /* Suspend RTOS Kernel to enable sleep modes. */
264
- osKernelSuspend ();
276
+
265
277
return greentea_test_setup_handler (number_of_cases);
266
278
}
267
279
You can’t perform that action at this time.
0 commit comments