Skip to content

Commit 0fdfcf7

Browse files
authored
Merge pull request #7874 from ARMmbed/release-candidate
Release candidate for mbed-os-5.9.6
2 parents f8b140f + 13ac199 commit 0fdfcf7

File tree

180 files changed

+2073
-1696
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+2073
-1696
lines changed

TESTS/mbed_drivers/timeout/timeout_tests.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,10 @@ void test_single_call(void)
8181
int32_t sem_slots = sem.wait(0);
8282
TEST_ASSERT_EQUAL(0, sem_slots);
8383

84-
sem_slots = sem.wait(TEST_DELAY_MS + 1);
84+
sem_slots = sem.wait(TEST_DELAY_MS + 2);
8585
TEST_ASSERT_EQUAL(1, sem_slots);
8686

87-
sem_slots = sem.wait(TEST_DELAY_MS + 1);
87+
sem_slots = sem.wait(TEST_DELAY_MS + 2);
8888
TEST_ASSERT_EQUAL(0, sem_slots);
8989

9090
timeout.detach();
@@ -114,7 +114,7 @@ void test_cancel(void)
114114
TEST_ASSERT_EQUAL(0, sem_slots);
115115
timeout.detach();
116116

117-
sem_slots = sem.wait(TEST_DELAY_MS + 1);
117+
sem_slots = sem.wait(TEST_DELAY_MS + 2);
118118
TEST_ASSERT_EQUAL(0, sem_slots);
119119
}
120120

@@ -147,7 +147,7 @@ void test_override(void)
147147
TEST_ASSERT_EQUAL(0, sem_slots);
148148
timeout.attach_callback(mbed::callback(sem_callback, &sem2), 2.0f * TEST_DELAY_US);
149149

150-
sem_slots = sem2.wait(2 * TEST_DELAY_MS + 1);
150+
sem_slots = sem2.wait(2 * TEST_DELAY_MS + 2);
151151
TEST_ASSERT_EQUAL(1, sem_slots);
152152
sem_slots = sem1.wait(0);
153153
TEST_ASSERT_EQUAL(0, sem_slots);
@@ -177,7 +177,7 @@ void test_multiple(void)
177177
for (size_t i = 0; i < NUM_TIMEOUTS; i++) {
178178
timeouts[i].attach_callback(mbed::callback(cnt_callback, &callback_count), TEST_DELAY_US);
179179
}
180-
Thread::wait(TEST_DELAY_MS + 1);
180+
Thread::wait(TEST_DELAY_MS + 2);
181181
TEST_ASSERT_EQUAL(NUM_TIMEOUTS, callback_count);
182182
}
183183

TESTS/mbed_drivers/timer/main.cpp

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,20 @@ static Timer *p_timer = NULL;
6565
*/
6666
static uint32_t curr_ticker_ticks_val;
6767

68+
69+
/* Replacement for generic wait functions to avoid invoking OS scheduling stuff. */
70+
void busy_wait_us(int us)
71+
{
72+
const ticker_data_t *const ticker = get_us_ticker_data();
73+
uint32_t start = ticker_read(ticker);
74+
while ((ticker_read(ticker) - start) < (uint32_t)us);
75+
}
76+
77+
void busy_wait_ms(int ms)
78+
{
79+
busy_wait_us(ms * US_PER_MSEC);
80+
}
81+
6882
/* User ticker interface function. */
6983
static void stub_interface_init()
7084
{
@@ -196,7 +210,7 @@ void test_timer_creation_os_ticker()
196210

197211
/* Wait 10 ms.
198212
* After that operation timer read routines should still return 0. */
199-
wait_ms(10);
213+
busy_wait_ms(10);
200214

201215
/* Check results. */
202216
TEST_ASSERT_EQUAL_FLOAT(0, p_timer->read());
@@ -406,7 +420,7 @@ void test_timer_time_accumulation_os_ticker()
406420
p_timer->start();
407421

408422
/* Wait 10 ms. */
409-
wait_ms(10);
423+
busy_wait_ms(10);
410424

411425
/* Stop the timer. */
412426
p_timer->stop();
@@ -420,15 +434,15 @@ void test_timer_time_accumulation_os_ticker()
420434
/* Wait 50 ms - this is done to show that time elapsed when
421435
* the timer is stopped does not have influence on the
422436
* timer counted time. */
423-
wait_ms(50);
437+
busy_wait_ms(50);
424438

425439
/* ------ */
426440

427441
/* Start the timer. */
428442
p_timer->start();
429443

430444
/* Wait 20 ms. */
431-
wait_ms(20);
445+
busy_wait_ms(20);
432446

433447
/* Stop the timer. */
434448
p_timer->stop();
@@ -449,7 +463,7 @@ void test_timer_time_accumulation_os_ticker()
449463
p_timer->start();
450464

451465
/* Wait 30 ms. */
452-
wait_ms(30);
466+
busy_wait_ms(30);
453467

454468
/* Stop the timer. */
455469
p_timer->stop();
@@ -463,15 +477,15 @@ void test_timer_time_accumulation_os_ticker()
463477
/* Wait 50 ms - this is done to show that time elapsed when
464478
* the timer is stopped does not have influence on the
465479
* timer time. */
466-
wait_ms(50);
480+
busy_wait_ms(50);
467481

468482
/* ------ */
469483

470484
/* Start the timer. */
471485
p_timer->start();
472486

473487
/* Wait 1 sec. */
474-
wait_ms(1000);
488+
busy_wait_ms(1000);
475489

476490
/* Stop the timer. */
477491
p_timer->stop();
@@ -500,7 +514,7 @@ void test_timer_reset_os_ticker()
500514
p_timer->start();
501515

502516
/* Wait 10 ms. */
503-
wait_ms(10);
517+
busy_wait_ms(10);
504518

505519
/* Stop the timer. */
506520
p_timer->stop();
@@ -518,7 +532,7 @@ void test_timer_reset_os_ticker()
518532
p_timer->start();
519533

520534
/* Wait 20 ms. */
521-
wait_ms(20);
535+
busy_wait_ms(20);
522536

523537
/* Stop the timer. */
524538
p_timer->stop();
@@ -596,13 +610,13 @@ void test_timer_start_started_timer_os_ticker()
596610
p_timer->start();
597611

598612
/* Wait 10 ms. */
599-
wait_ms(10);
613+
busy_wait_ms(10);
600614

601615
/* Now start timer again. */
602616
p_timer->start();
603617

604618
/* Wait 20 ms. */
605-
wait_ms(20);
619+
busy_wait_ms(20);
606620

607621
/* Stop the timer. */
608622
p_timer->stop();
@@ -666,7 +680,7 @@ void test_timer_float_operator_os_ticker()
666680
p_timer->start();
667681

668682
/* Wait 10 ms. */
669-
wait_ms(10);
683+
busy_wait_ms(10);
670684

671685
/* Stop the timer. */
672686
p_timer->stop();
@@ -721,7 +735,7 @@ void test_timer_time_measurement()
721735
p_timer->start();
722736

723737
/* Wait <wait_val_us> us. */
724-
wait_us(wait_val_us);
738+
busy_wait_us(wait_val_us);
725739

726740
/* Stop the timer. */
727741
p_timer->stop();

0 commit comments

Comments
 (0)