Changeset 0496c17 in mainline for kernel/generic/src/ipc/event.c


Ignore:
Timestamp:
2011-05-16T19:58:02Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0d8a304
Parents:
bec0219
Message:

Allow events to define unmask callback. Make klog_update() the unmask
callback for KLOG_EVENT. This makes sure that klog receives all data
from the kernel console even after the kernel stops printing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/event.c

    rbec0219 r0496c17  
    5959                events[i].imethod = 0;
    6060                events[i].masked = false;
     61                events[i].unmask_cb = NULL;
    6162        }
    6263}
     
    8384}
    8485
     86/** Define a callback function for the event unmask event.
     87 *
     88 * @param evno Event type.
     89 * @param cb   Callback function to be called when the event is unmasked.
     90 *
     91 */
     92void event_set_unmask_callback(event_type_t evno, void (*cb)(void))
     93{
     94        ASSERT(evno < EVENT_END);
     95       
     96        spinlock_lock(&events[evno].lock);
     97        events[evno].unmask_cb = cb;
     98        spinlock_unlock(&events[evno].lock);
     99}
     100
    85101/** Send kernel notification event
    86102 *
     
    190206static void event_unmask(event_type_t evno)
    191207{
     208        void (*cb)(void);
    192209        ASSERT(evno < EVENT_END);
    193210       
    194211        spinlock_lock(&events[evno].lock);
    195212        events[evno].masked = false;
    196         spinlock_unlock(&events[evno].lock);
     213        cb = events[evno].unmask_cb;
     214        spinlock_unlock(&events[evno].lock);
     215       
     216        /*
     217         * Check if there is an unmask callback function defined for this event.
     218         */
     219        if (cb)
     220            cb();
    197221}
    198222
Note: See TracChangeset for help on using the changeset viewer.