@@ -220,7 +220,7 @@ bool stk_kernel_is_schedulable(const stk_kernel_t *k)
220220 STK_ASSERT (k != nullptr );
221221
222222 return SchedulabilityCheck::IsSchedulableWCRT<STK_C_KERNEL_MAX_TASKS>(
223- reinterpret_cast <stk::IKernel *>(const_cast <stk_kernel_t *>(k))->GetSwitchStrategy ());
223+ reinterpret_cast <stk::IKernel *>(const_cast <stk_kernel_t *>(k))->GetSwitchStrategy ());
224224}
225225
226226void stk_kernel_add_task (stk_kernel_t *k, stk_task_t *task)
@@ -293,6 +293,37 @@ size_t stk_kernel_enumerate_tasks(stk_kernel_t *k, stk_task_t **tasks, size_t ma
293293 return n;
294294}
295295
296+ int32_t stk_kernel_suspend (stk_kernel_t *k)
297+ {
298+ STK_ASSERT (k != nullptr );
299+
300+ return static_cast <int32_t >(
301+ reinterpret_cast <stk::IKernel *>(k)->GetPlatform ()->Suspend ());
302+ }
303+
304+ void stk_kernel_resume (stk_kernel_t *k, int32_t elapsed_ticks)
305+ {
306+ STK_ASSERT (k != nullptr );
307+ STK_ASSERT (elapsed_ticks >= 0 );
308+
309+ reinterpret_cast <stk::IKernel *>(k)->GetPlatform ()->Resume (
310+ static_cast <stk::Timeout>(elapsed_ticks));
311+ }
312+
313+ void stk_kernel_process_tick (stk_kernel_t *k)
314+ {
315+ STK_ASSERT (k != nullptr );
316+
317+ reinterpret_cast <stk::IKernel *>(k)->GetPlatform ()->ProcessTick ();
318+ }
319+
320+ void stk_kernel_process_hard_fault (stk_kernel_t *k)
321+ {
322+ STK_ASSERT (k != nullptr );
323+
324+ reinterpret_cast <stk::IKernel *>(k)->GetPlatform ()->ProcessHardFault ();
325+ }
326+
296327void stk_kernel_add_task_hrt (stk_kernel_t *k,
297328 stk_task_t *task,
298329 int32_t periodicity_ticks,
@@ -358,6 +389,20 @@ void stk_task_set_name(stk_task_t *task, const char *tname)
358389 task->handle .SetName (tname);
359390}
360391
392+ const char *stk_task_get_name (const stk_task_t *task)
393+ {
394+ STK_ASSERT (task != nullptr );
395+
396+ return task->handle .GetTraceName ();
397+ }
398+
399+ stk_tid_t stk_task_get_id (const stk_task_t *task)
400+ {
401+ STK_ASSERT (task != nullptr );
402+
403+ return task->handle .GetId ();
404+ }
405+
361406void stk_task_destroy (stk_task_t *task)
362407{
363408 STK_ASSERT (task != nullptr );
@@ -368,22 +413,23 @@ void stk_task_destroy(stk_task_t *task)
368413// ---------------------------------------------------------------------------
369414// Kernel services (available inside tasks)
370415// ---------------------------------------------------------------------------
371- stk_tid_t stk_tid (void ) { return stk::GetTid (); }
372- int64_t stk_ticks (void ) { return stk::GetTicks (); }
373- int32_t stk_tick_resolution (void ) { return stk::GetTickResolution (); }
374- int64_t stk_time_now_ms (void ) { return stk::GetTimeNowMs (); }
416+ stk_tid_t stk_tid (void ) { return stk::GetTid (); }
417+ int64_t stk_ticks (void ) { return stk::GetTicks (); }
418+ int32_t stk_tick_resolution (void ) { return stk::GetTickResolution (); }
419+ int64_t stk_time_now_ms (void ) { return stk::GetTimeNowMs (); }
375420int64_t stk_ticks_from_ms (int64_t msec) { return stk_ticks_from_ms_r (msec, stk::GetTickResolution ()); }
376- uint64_t stk_sys_timer_count (void ) { return stk::GetSysTimerCount (); }
377- uint32_t stk_sys_timer_frequency (void ) { return stk::GetSysTimerFrequency (); }
378- uint64_t stk_hires_cycles (void ) { return stk::hw::HiResClock::GetCycles (); }
379- uint32_t stk_hires_frequency (void ) { return stk::hw::HiResClock::GetFrequency (); }
380- int64_t stk_hires_time_us (void ) { return stk::hw::HiResClock::GetTimeUs (); }
381- void stk_delay (uint32_t ticks) { stk::Delay (ticks); }
382- void stk_sleep (uint32_t ticks) { stk::Sleep (ticks); }
383- void stk_delay_ms (uint32_t ms) { stk::DelayMs (ms); }
384- void stk_sleep_ms (uint32_t ms) { stk::SleepMs (ms); }
385- void stk_sleep_until (int64_t ts) { stk::SleepUntil (ts); }
386- void stk_yield (void ) { stk::Yield (); }
421+ uint64_t stk_sys_timer_count (void ) { return stk::GetSysTimerCount (); }
422+ uint32_t stk_sys_timer_frequency (void ) { return stk::GetSysTimerFrequency (); }
423+ uint64_t stk_hires_cycles (void ) { return stk::hw::HiResClock::GetCycles (); }
424+ uint32_t stk_hires_frequency (void ) { return stk::hw::HiResClock::GetFrequency (); }
425+ int64_t stk_hires_time_us (void ) { return stk::hw::HiResClock::GetTimeUs (); }
426+ void stk_delay (uint32_t ticks) { stk::Delay (ticks); }
427+ void stk_sleep (uint32_t ticks) { stk::Sleep (ticks); }
428+ void stk_delay_ms (uint32_t ms) { stk::DelayMs (ms); }
429+ void stk_sleep_ms (uint32_t ms) { stk::SleepMs (ms); }
430+ void stk_sleep_until (int64_t ts) { stk::SleepUntil (ts); }
431+ void stk_sleep_cancel (stk_tid_t tid) { stk::SleepCancel (tid); }
432+ void stk_yield (void ) { stk::Yield (); }
387433
388434// ---------------------------------------------------------------------------
389435// Thread-Local Storage (TLS) API
0 commit comments