* Copyright 1999, 2001, 2003 Bernie Innocenti <bernie@codewiz.org>
* -->
*
+ * \addtogroup event_handling
+ *
* \brief Events handling
*
* This module implements a common system for executing
* a user defined action calling a hook function.
*
- * NOTE: Generic completion events
*
* Device drivers often need to wait the completion of some event, usually to
* allow the hardware to accomplish some asynchronous task.
* behaviour with or without the kernel.
*
* Example usage (wait for a generic device driver initialization):
- * \verbatim
+ * \code
* static Event e;
*
* static void irq_handler(void)
* // Wait for the completion of the event
* event_wait(&e);
* }
- * \endverbatim
+ * \endcode
*
* \author Bernie Innocenti <bernie@codewiz.org>
*/
struct Process;
#endif
+/**
+ * \defgroup event_handling Events handling module
+ * \{
+ */
+
/// User defined callback type
typedef void (*Hook)(void *);
/**
* Wait the completion of event \a e.
+ *
+ * This function releases the CPU the application is configured to use
+ * the kernel, otherwise it's just a busy wait.
+ * \note It's forbidden to use this function inside irq handling functions.
*/
INLINE void event_wait(Event *e)
{
/**
* Wait the completion of event \a e or \a timeout elapses.
+ *
+ * \note It's forbidden to use this function inside irq handling functions.
*/
INLINE bool event_waitTimeout(Event *e, ticks_t timeout)
{
}
#endif /* CONFIG_TIMER_EVENTS */
-/** Trigger an event */
+/**
+ * Trigger an event.
+ *
+ * Execute the callback function associated with event \a e.
+ *
+ * This function can be used also in interrupt routines, but only if the
+ * event was created as a signal or generic event.
+ */
INLINE void event_do(struct Event *e)
{
e->action(e);
}
+/** \} */
+
#endif /* KERN_EVENT_H */