The unified diff between revisions [68c54ace..] and [dc88787e..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'event.c'
# # old_revision [68c54ace6787b0823a233e780455f7371665a228] # new_revision [dc88787ecd1d574feba045763baed2a7651ff33d] # # patch "event.c" # from [36ab52fd83585734fc7b199852099d76470bf398] # to [0931d041137bc29648c8785b0198b3712fda631e] # ============================================================ --- event.c 36ab52fd83585734fc7b199852099d76470bf398 +++ event.c 0931d041137bc29648c8785b0198b3712fda631e @@ -1,6 +1,7 @@ #include "event.h" #include "interrupt.h" #include "types.h" +#include "log.h" event_handler *event_handler_table[EVENT_MAX+1]; @@ -13,14 +14,18 @@ unsigned int event_pending[EVENT_WORDS]; #define EVENT_BIT(x) (x%EVENT_WORDLEN) #define EVENT_MASK(x) (1<<EVENT_BIT(x)) +/* + * This function must be called with interrupts disabled. + * This will normally be the case as it is typically called from within + * an interrupt handler anyway. + */ + void event_set(unsigned int event) { if (event > EVENT_MAX) return; - interrupt_block(); event_pending[EVENT_WORD(event)] |= EVENT_MASK(event); - interrupt_unblock(); } static int bitset(unsigned int x) @@ -56,14 +61,21 @@ void event_clear(unsigned int event) interrupt_unblock(); } -void event_dispatch(void) +bool event_dispatch(void) { unsigned int event; if (event_get(&event)) { event_clear(event); - (event_handler_table[event])(); + if (event_handler_table[event] != NULL) { + log_mark_busy(); + (event_handler_table[event])(); + log_mark_idle(); + } + return TRUE; } + + return FALSE; } void event_register(unsigned int event, event_handler *handler)