summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorsigsegv7 <ian@vegaa.systems>2023-09-20 02:25:06 -0400
committersigsegv7 <ian@vegaa.systems>2023-09-20 02:25:06 -0400
commit68e83a466a56ab7a446285fc110a4d27aea2702a (patch)
tree6da7e14a9179fafc381fc2d3af193c01403e0cc2 /sys
parent963f5a0c3b5c30d51a71c0dea654a5dbfab725d6 (diff)
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 <ian@vegaa.systems>
Diffstat (limited to 'sys')
-rw-r--r--sys/include/sys/timer.h11
1 files 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);