The period shouldn't be less than timer resolution. If it's less
there is no guarantee about timeout accuracy, it can be executed
right after setting it or after up to timer resolution timeout or
even be set late, in which case application will be stopped with
error. So it's better to warn user that timeout is less then
resolution instead of silence.

Signed-off-by: Ivan Khoronzhuk <[email protected]>
---
 example/timer/odp_timer_test.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c
index 94619e4..aee01c8 100644
--- a/example/timer/odp_timer_test.c
+++ b/example/timer/odp_timer_test.c
@@ -311,6 +311,9 @@ static void parse_args(int argc, char *argv[], test_args_t 
*args)
                        break;
                }
        }
+
+       if (args->period_us < args->resolution_us)
+               printf("\n\tWarn: timeout is set less then resolution\n");
 }
 
 
-- 
1.9.1

_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to