Skip to content

Commit 7bee352

Browse files
committed
Update SysTick API usage for tickless mode
1 parent 2ea01ac commit 7bee352

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

rtos/TARGET_CORTEX/mbed_rtx_idle.cpp

+27-11
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class RtosTimer : private TimerEvent {
5858
// Ensure SysTick has the correct priority as it is still used
5959
// to trigger software interrupts on each tick. The period does
6060
// not matter since it will never start counting.
61-
SysTick_Setup(16);
61+
OS_Tick_Setup(osRtxConfig.tick_freq, OS_TICK_HANDLER);
6262
#endif
6363
};
6464

@@ -138,41 +138,57 @@ class RtosTimer : private TimerEvent {
138138
static RtosTimer *os_timer;
139139
static uint64_t os_timer_data[sizeof(RtosTimer) / 8];
140140

141-
/// Setup System Timer.
142-
int32_t osRtxSysTimerSetup (void)
141+
/// Enable System Timer.
142+
int32_t OS_Tick_Enable (void)
143143
{
144144
// Do not use SingletonPtr since this relies on the RTOS
145145
if (NULL == os_timer) {
146146
os_timer = new (os_timer_data) RtosTimer();
147147
}
148-
return -1;
149-
}
150148

151-
/// Enable System Timer.
152-
void osRtxSysTimerEnable (void)
153-
{
154149
// set to fire interrupt on next tick
155150
os_timer->schedule_tick();
151+
152+
return 0;
156153
}
157154

158155
/// Disable System Timer.
159-
void osRtxSysTimerDisable (void)
156+
int32_t OS_Tick_Disable (void)
160157
{
161158
os_timer->cancel_tick();
159+
160+
return 0;
162161
}
163162

164163
/// Acknowledge System Timer IRQ.
165-
void osRtxSysTimerAckIRQ (void)
164+
int32_t OS_Tick_AcknowledgeIRQ (void)
166165
{
167166
os_timer->schedule_tick();
167+
168+
return 0;
168169
}
169170

170171
/// Get System Timer count.
171-
uint32_t osRtxSysTimerGetCount (void)
172+
uint32_t OS_Tick_GetCount (void)
172173
{
173174
return os_timer->get_time() & 0xFFFFFFFF;
174175
}
175176

177+
// Get OS Tick IRQ number.
178+
int32_t OS_Tick_GetIRQn (void) {
179+
return -1;
180+
}
181+
182+
// Get OS Tick overflow status.
183+
uint32_t OS_Tick_GetOverflow (void) {
184+
return 0;
185+
}
186+
187+
// Get OS Tick interval.
188+
uint32_t OS_Tick_GetInterval (void) {
189+
return 1000;
190+
}
191+
176192
static void default_idle_hook(void)
177193
{
178194
uint32_t elapsed_ticks = 0;

0 commit comments

Comments
 (0)