File tree Expand file tree Collapse file tree 4 files changed +21
-14
lines changed
TESTS/mbedmicro-rtos-mbed/systimer Expand file tree Collapse file tree 4 files changed +21
-14
lines changed Original file line number Diff line number Diff line change 17
17
#error [NOT_SUPPORTED] Tickless mode not supported for this target.
18
18
#endif
19
19
20
- #if !DEVICE_LPTICKER
21
- #error [NOT_SUPPORTED] Current SysTimer implementation requires lp ticker support.
22
- #endif
23
-
24
20
#include " mbed.h"
25
21
#include " greentea-client/test_env.h"
26
22
#include " unity.h"
Original file line number Diff line number Diff line change 21
21
*/
22
22
#include " rtos/TARGET_CORTEX/SysTimer.h"
23
23
24
- #if DEVICE_LPTICKER
24
+ #if MBED_TICKLESS
25
25
26
+ #include " hal/us_ticker_api.h"
26
27
#include " hal/lp_ticker_api.h"
27
28
#include " mbed_critical.h"
28
29
#include " mbed_assert.h"
@@ -58,7 +59,12 @@ namespace rtos {
58
59
namespace internal {
59
60
60
61
SysTimer::SysTimer () :
61
- TimerEvent (get_lp_ticker_data()), _time_us(0 ), _tick(0 )
62
+ #if DEVICE_LPTICKER
63
+ TimerEvent (get_lp_ticker_data()),
64
+ #else
65
+ TimerEvent (get_us_ticker_data()),
66
+ #endif
67
+ _time_us (0 ), _tick(0 )
62
68
{
63
69
_time_us = ticker_read_us (_ticker_data);
64
70
_suspend_time_passed = true ;
@@ -69,6 +75,8 @@ SysTimer::SysTimer(const ticker_data_t *data) :
69
75
TimerEvent (data), _time_us(0 ), _tick(0 )
70
76
{
71
77
_time_us = ticker_read_us (_ticker_data);
78
+ _suspend_time_passed = true ;
79
+ _suspended = false ;
72
80
}
73
81
74
82
void SysTimer::setup_irq ()
@@ -194,4 +202,4 @@ void SysTimer::handler()
194
202
}
195
203
}
196
204
197
- #endif
205
+ #endif // MBED_TICKLESS
Original file line number Diff line number Diff line change 22
22
#ifndef MBED_SYS_TIMER_H
23
23
#define MBED_SYS_TIMER_H
24
24
25
- #if DEVICE_LPTICKER || defined(DOXYGEN_ONLY)
25
+ #if MBED_TICKLESS || defined(DOXYGEN_ONLY)
26
26
27
27
#include " platform/NonCopyable.h"
28
28
#include " drivers/TimerEvent.h"
Original file line number Diff line number Diff line change @@ -38,10 +38,13 @@ extern "C" {
38
38
39
39
#ifdef MBED_TICKLESS
40
40
41
- MBED_STATIC_ASSERT (!MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER || DEVICE_USTICKER,
42
- " Microsecond ticker required when MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER is true" );
43
- MBED_STATIC_ASSERT (MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER || DEVICE_LPTICKER,
44
- " Low power ticker required when MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER is false" );
41
+ #if MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER && !DEVICE_USTICKER
42
+ #error Microsecond ticker required when MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER is true
43
+ #endif
44
+
45
+ #if !MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER && !DEVICE_LPTICKER
46
+ #error Low power ticker required when MBED_CONF_TARGET_TICKLESS_FROM_US_TICKER is false
47
+ #endif
45
48
46
49
#include " rtos/TARGET_CORTEX/SysTimer.h"
47
50
@@ -137,7 +140,7 @@ extern "C" {
137
140
}
138
141
139
142
140
- #else
143
+ #else // MBED_TICKLESS
141
144
142
145
static void default_idle_hook (void )
143
146
{
@@ -149,7 +152,7 @@ extern "C" {
149
152
core_util_critical_section_exit ();
150
153
}
151
154
152
- #endif // (defined( MBED_TICKLESS) && DEVICE_LPTICKER)
155
+ #endif // MBED_TICKLESS
153
156
154
157
static void (*idle_hook_fptr)(void ) = &default_idle_hook;
155
158
You can’t perform that action at this time.
0 commit comments