Changeset 97d42d5 in mainline


Ignore:
Timestamp:
2011-05-17T15:10:16Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0a02653
Parents:
0d8a304
Message:

get rid of KLOG_LATENCY (thanks to the event notification unmask callback this is no longer needed)

Location:
kernel/generic
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/ipc/event.h

    r0d8a304 r97d42d5  
    4141#include <ipc/ipc.h>
    4242
     43typedef void (*event_callback_t)(void);
     44
    4345/** Event notification structure. */
    4446typedef struct {
     
    5153        /** Counter. */
    5254        size_t counter;
     55       
    5356        /** Masked flag. */
    5457        bool masked;
    5558        /** Unmask callback. */
    56         void (*unmask_cb)(void);
     59        event_callback_t unmask_callback;
    5760} event_t;
    5861
    5962extern void event_init(void);
    6063extern void event_cleanup_answerbox(answerbox_t *);
    61 extern void event_set_unmask_callback(event_type_t, void (*)(void));
     64extern void event_set_unmask_callback(event_type_t, event_callback_t);
    6265
    6366#define event_notify_0(e, m) \
  • kernel/generic/src/console/console.c

    r0d8a304 r97d42d5  
    5555#define KLOG_PAGES    8
    5656#define KLOG_LENGTH   (KLOG_PAGES * PAGE_SIZE / sizeof(wchar_t))
    57 #define KLOG_LATENCY  8
    5857
    5958/** Kernel log cyclic buffer */
     
    165164        sysinfo_set_item_val("klog.faddr", NULL, (sysarg_t) faddr);
    166165        sysinfo_set_item_val("klog.pages", NULL, KLOG_PAGES);
    167 
     166       
    168167        event_set_unmask_callback(EVENT_KLOG, klog_update);
    169168       
     
    319318                klog_uspace++;
    320319       
    321         /* Check notify uspace to update */
    322         bool update;
    323         if ((klog_uspace > KLOG_LATENCY) || (ch == '\n'))
    324                 update = true;
    325         else
    326                 update = false;
    327        
    328320        spinlock_unlock(&klog_lock);
    329321       
    330         if (update)
     322        /* Force notification on newline */
     323        if (ch == '\n')
    331324                klog_update();
    332325}
  • kernel/generic/src/ipc/event.c

    r0d8a304 r97d42d5  
    5959                events[i].imethod = 0;
    6060                events[i].masked = false;
    61                 events[i].unmask_cb = NULL;
     61                events[i].unmask_callback = NULL;
    6262        }
    6363}
     
    8686/** Define a callback function for the event unmask event.
    8787 *
    88  * @param evno Event type.
    89  * @param cb   Callback function to be called when the event is unmasked.
    90  *
    91  */
    92 void 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;
     88 * @param evno     Event type.
     89 * @param callback Callback function to be called when
     90 *                 the event is unmasked.
     91 *
     92 */
     93void event_set_unmask_callback(event_type_t evno, event_callback_t callback)
     94{
     95        ASSERT(evno < EVENT_END);
     96       
     97        spinlock_lock(&events[evno].lock);
     98        events[evno].unmask_callback = callback;
    9899        spinlock_unlock(&events[evno].lock);
    99100}
     
    206207static void event_unmask(event_type_t evno)
    207208{
    208         void (*cb)(void);
    209209        ASSERT(evno < EVENT_END);
    210210       
    211211        spinlock_lock(&events[evno].lock);
    212212        events[evno].masked = false;
    213         cb = events[evno].unmask_cb;
     213        event_callback_t callback = events[evno].unmask_callback;
    214214        spinlock_unlock(&events[evno].lock);
    215215       
    216216        /*
    217          * Check if there is an unmask callback function defined for this event.
     217         * Check if there is an unmask callback
     218         * function defined for this event.
    218219         */
    219         if (cb)
    220             cb();
     220        if (callback != NULL)
     221                callback();
    221222}
    222223
Note: See TracChangeset for help on using the changeset viewer.