Skip to content

Commit 66180ba

Browse files
author
Liyou Zhou
committed
Various fixes
Remove mbed assert. Change location of warning so it only warn once Use MINAR_TEST_CLOCK_OVERFLOW as the timer mask
1 parent cb37a01 commit 66180ba

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

minar-platform/minar_platform_types.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ enum Constants{
2929
Time_Base = MINAR_PLATFORM_TIME_BASE,
3030

3131
#if YOTTA_CFG_MINAR_TEST_CLOCK_OVERFLOW
32-
#warning "testing clock overflow"
3332
// use only lower 16bits of timer for testing timer overflow
34-
Time_Mask = UINT32_MAX >> 16
33+
Time_Mask = YOTTA_CFG_MINAR_TEST_CLOCK_OVERFLOW
3534
#else
3635
// 32 bits of time for mbed platforms
3736
Time_Mask = 0xFFFFFFFFu

source/mbed_platform.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121
#include "mbed-hal/sleep_api.h"
2222
#include "cmsis-core/core_generic.h"
2323

24-
#if YOTTA_CFG_MINAR_TEST_CLOCK_OVERFLOW
25-
#include "mbed-drivers/test_env.h"
26-
#endif
27-
2824
/// @name Local Constants
2925
const static minar::platform::tick_t Minimum_Sleep = MINAR_PLATFORM_MINIMUM_SLEEP; // in Platform_Time_Base units
3026

@@ -58,6 +54,7 @@ void sleep(){
5854

5955
tick_t getTime() {
6056
#if YOTTA_CFG_MINAR_TEST_CLOCK_OVERFLOW
57+
#warning "testing clock overflow"
6158
return lp_ticker_read() & Time_Mask;
6259
#else
6360
return lp_ticker_read();
@@ -71,7 +68,6 @@ uint32_t getTimeOverflows(){
7168
void sleepFromUntil(tick_t now, tick_t until){
7269

7370
#if YOTTA_CFG_MINAR_TEST_CLOCK_OVERFLOW
74-
MBED_HOSTTEST_ASSERT(now <= Time_Mask && until <= Time_Mask);
7571
tick_t timer_top_bits = lp_ticker_read() & ~Time_Mask;
7672
now += timer_top_bits;
7773
until += timer_top_bits;
@@ -81,7 +77,6 @@ void sleepFromUntil(tick_t now, tick_t until){
8177
}
8278

8379
const tick_t real_now = timer_top_bits + getTime();
84-
//printf("sleepFromUntil %lx %lx real_now %lx\r\n", now, until, real_now);
8580
#else
8681
// use real-now for front-most end of do-not-sleep range check
8782
const tick_t real_now = getTime();

0 commit comments

Comments
 (0)