Skip to content

Commit

Permalink
[OIS] Platform improvements (#27291)
Browse files Browse the repository at this point in the history
* [OIS] Improve time to ticks conversion functions

Signed-off-by: ATmobica <[email protected]>

* [OIS] Improve PlatformManagerImpl

Use an atomic variable to control the event loop running.
Improve stack init - enable reinitialization.
Improve stack locking and evnet loop termination.

Signed-off-by: ATmobica <[email protected]>

---------

Signed-off-by: ATmobica <[email protected]>
  • Loading branch information
ATmobica authored and pull[bot] committed Aug 16, 2023
1 parent 6f5651f commit 88b8db6
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 133 deletions.
15 changes: 0 additions & 15 deletions src/platform/openiotsdk/OpenIoTSDKArchUtils.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,31 +46,16 @@ uint64_t GetTick(void)
/* Time to kernel ticks */
uint32_t sec2tick(uint32_t sec)
{
if (sec == 0U)
{
return (osWaitForever);
}

return (sec * osKernelGetTickFreq());
}

uint32_t ms2tick(uint32_t ms)
{
if (ms == 0U)
{
return (osWaitForever);
}

return (uint32_t)(((uint64_t) ms * (uint64_t) osKernelGetTickFreq()) / 1000U);
}

uint32_t us2tick(uint32_t usec)
{
if (usec == 0U)
{
return osWaitForever;
}

// round division up because our tick is so long this might become 0
// we need the timer to sleep at least one tick as it otherwise breaks expectations
return (uint32_t)(((uint64_t) usec * osKernelGetTickFreq() + (1000000 - 1)) / 1000000);
Expand Down
Loading

0 comments on commit 88b8db6

Please sign in to comment.