summaryrefslogtreecommitdiff
path: root/firmware/export/kernel.h
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-07-29 04:49:19 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-07-29 04:49:19 +0000
commite64f7e3a6f3019be855469373920198ac19ee654 (patch)
treedf75ceff98beb6d4eff222fa18de74b155d33ddc /firmware/export/kernel.h
parent4f08483b3992d0d66300fd2109529965301ee880 (diff)
downloadrockbox-e64f7e3a6f3019be855469373920198ac19ee654.zip
rockbox-e64f7e3a6f3019be855469373920198ac19ee654.tar.gz
rockbox-e64f7e3a6f3019be855469373920198ac19ee654.tar.bz2
rockbox-e64f7e3a6f3019be855469373920198ac19ee654.tar.xz
Add a new timeout API to the kernel. Enable only for e200 right now since it's the only user. Use that as the one-shot delay for SD card inserts.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14049 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export/kernel.h')
-rw-r--r--firmware/export/kernel.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h
index b40d602..bf5a9d1 100644
--- a/firmware/export/kernel.h
+++ b/firmware/export/kernel.h
@@ -126,6 +126,28 @@ extern void sleep(int ticks);
int tick_add_task(void (*f)(void));
int tick_remove_task(void (*f)(void));
+struct timeout;
+
+/* timeout callback type
+ * tmo - pointer to struct timeout associated with event
+ */
+typedef bool (* timeout_cb_type)(struct timeout *tmo);
+
+struct timeout
+{
+ /* for use by callback/internal - read/write */
+ timeout_cb_type callback;/* callback - returning false cancels */
+ int ticks; /* timeout period in ticks */
+ intptr_t data; /* data passed to callback */
+ /* internal use - read-only */
+ const struct timeout * const next; /* next timeout in list */
+ const long expires; /* expiration tick */
+};
+
+void timeout_register(struct timeout *tmo, timeout_cb_type callback,
+ int ticks, intptr_t data);
+void timeout_cancel(struct timeout *tmo);
+
extern void queue_init(struct event_queue *q, bool register_queue);
#if NUM_CORES > 1
extern void queue_set_irq_safe(struct event_queue *q, bool state);