@@ -87,14 +87,13 @@ void SysTimer::setup_irq()
87
87
88
88
void SysTimer::suspend (uint32_t ticks)
89
89
{
90
- core_util_critical_section_enter ();
91
-
90
+ // Remove ensures serialized access to SysTimer by stopping timer interrupt
92
91
remove ();
93
- schedule_tick (ticks);
92
+
94
93
_suspend_time_passed = false ;
95
94
_suspended = true ;
96
95
97
- core_util_critical_section_exit ( );
96
+ schedule_tick (ticks );
98
97
}
99
98
100
99
bool SysTimer::suspend_time_passed ()
@@ -104,11 +103,11 @@ bool SysTimer::suspend_time_passed()
104
103
105
104
uint32_t SysTimer::resume ()
106
105
{
107
- core_util_critical_section_enter ();
106
+ // Remove ensures serialized access to SysTimer by stopping timer interrupt
107
+ remove ();
108
108
109
109
_suspended = false ;
110
110
_suspend_time_passed = true ;
111
- remove ();
112
111
113
112
uint64_t elapsed_ticks = (ticker_read_us (_ticker_data) - _time_us) / US_IN_TICK;
114
113
if (elapsed_ticks > 0 ) {
@@ -121,7 +120,6 @@ uint32_t SysTimer::resume()
121
120
_time_us += elapsed_ticks * US_IN_TICK;
122
121
_tick += elapsed_ticks;
123
122
124
- core_util_critical_section_exit ();
125
123
return elapsed_ticks;
126
124
}
127
125
@@ -136,11 +134,9 @@ void SysTimer::schedule_tick(uint32_t delta)
136
134
137
135
void SysTimer::cancel_tick ()
138
136
{
139
- core_util_critical_section_enter ();
137
+ // Underlying call is interrupt safe
140
138
141
139
remove ();
142
-
143
- core_util_critical_section_exit ();
144
140
}
145
141
146
142
uint32_t SysTimer::get_tick ()
@@ -150,6 +146,8 @@ uint32_t SysTimer::get_tick()
150
146
151
147
us_timestamp_t SysTimer::get_time ()
152
148
{
149
+ // Underlying call is interrupt safe
150
+
153
151
return ticker_read_us (_ticker_data);
154
152
}
155
153
0 commit comments