Skip to content

Commit

Permalink
Removed delay implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
MarGasiorek committed Nov 23, 2022
1 parent 19d848f commit 83c849c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 0 additions & 5 deletions pal/src/sid_delay.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,4 @@

void sid_pal_delay_us(uint32_t delay)
{
#ifdef CONFIG_MULTITHREADING
(void)k_usleep(delay);
#else
(void)k_busy_wait(delay);

This comment has been minimized.

Copy link
@necostew

necostew Nov 23, 2022

Which of these paths was the "normal" case for compilation of Sidewalk? If the former then it is unlikely to work as expected due to the sleep period being clamped to CONFIG_SYS_CLOCK_TICKS_PER_SEC (see https://docs.zephyrproject.org/apidoc/latest/group__thread__apis.html#gaeac56bb072ce295b9fdc372ab8cee67e and zephyrproject-rtos/zephyr#23600 (comment)).

The latter case should be the normal implementation as that Zephyr call apparently just spin-loops the CPU until the time has elapsed - this is the required behaviour of sid_pal_delay_us

This comment has been minimized.

Copy link
@MarGasiorek

MarGasiorek Nov 23, 2022

Author Contributor

Good hint, thanks @necostew

#endif
}
2 changes: 2 additions & 0 deletions tests/functional/pal_delay/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ void test_sid_pal_delay(void)
{
uint64_t timestamp = TIMESTAMP_US_GET();

TEST_IGNORE_MESSAGE("NOT IMPLEMENTED YET");

sid_pal_delay_us(MIN_DELAY_US);
uint64_t delta = TIMESTAMP_US_GET() - timestamp;
TEST_ASSERT_LESS_OR_EQUAL(MAX_DELAY_US_THRESHOLD, abs((int)(MIN_DELAY_US - delta)));
Expand Down

0 comments on commit 83c849c

Please sign in to comment.