From 68e83a466a56ab7a446285fc110a4d27aea2702a Mon Sep 17 00:00:00 2001 From: sigsegv7 Date: Wed, 20 Sep 2023 02:25:06 -0400 Subject: kernel: Update timer routine return types This commit makes msleep(), usleep(), etc, return an error code of either EXIT_SUCCESS or EXIT_FAILURE for error handling. This commit also makes the calibrate() routine return a frequency (ideally in Hz), however, it is optional and can return 0 as a way of saying it doesn't return one. Signed-off-by: sigsegv7 --- sys/include/sys/timer.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sys/include/sys/timer.h b/sys/include/sys/timer.h index 0e10e05..fa8aa59 100644 --- a/sys/include/sys/timer.h +++ b/sys/include/sys/timer.h @@ -60,12 +60,17 @@ typedef int tmrr_status_t; * a NULL value. Fields should be NULL if the timer * driver implementation doesn't implement support * for a functionality. + * + * XXX: The msleep, usleep, ... functions must return + * either EXIT_SUCCESS and EXIT_FAILURE from sys/errno.h + * ONLY. */ struct timer { const char *name; /* e.g "HPET" */ - void(*msleep)(size_t ms); - void(*usleep)(size_t us); - void(*nsleep)(size_t ns); + size_t(*calibrate)(void); /* Returns frequency, 0 for unspecified */ + int(*msleep)(size_t ms); + int(*usleep)(size_t us); + int(*nsleep)(size_t ns); void(*periodic_ms)(size_t ms); void(*oneshot_ms)(size_t ms); void(*stop)(void); -- cgit v1.2.3