Changeset 97d42d5 in mainline
- Timestamp:
- 2011-05-17T15:10:16Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0a02653
- Parents:
- 0d8a304
- Location:
- kernel/generic
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/ipc/event.h
r0d8a304 r97d42d5 41 41 #include <ipc/ipc.h> 42 42 43 typedef void (*event_callback_t)(void); 44 43 45 /** Event notification structure. */ 44 46 typedef struct { … … 51 53 /** Counter. */ 52 54 size_t counter; 55 53 56 /** Masked flag. */ 54 57 bool masked; 55 58 /** Unmask callback. */ 56 void (*unmask_cb)(void);59 event_callback_t unmask_callback; 57 60 } event_t; 58 61 59 62 extern void event_init(void); 60 63 extern void event_cleanup_answerbox(answerbox_t *); 61 extern void event_set_unmask_callback(event_type_t, void (*)(void));64 extern void event_set_unmask_callback(event_type_t, event_callback_t); 62 65 63 66 #define event_notify_0(e, m) \ -
kernel/generic/src/console/console.c
r0d8a304 r97d42d5 55 55 #define KLOG_PAGES 8 56 56 #define KLOG_LENGTH (KLOG_PAGES * PAGE_SIZE / sizeof(wchar_t)) 57 #define KLOG_LATENCY 858 57 59 58 /** Kernel log cyclic buffer */ … … 165 164 sysinfo_set_item_val("klog.faddr", NULL, (sysarg_t) faddr); 166 165 sysinfo_set_item_val("klog.pages", NULL, KLOG_PAGES); 167 166 168 167 event_set_unmask_callback(EVENT_KLOG, klog_update); 169 168 … … 319 318 klog_uspace++; 320 319 321 /* Check notify uspace to update */322 bool update;323 if ((klog_uspace > KLOG_LATENCY) || (ch == '\n'))324 update = true;325 else326 update = false;327 328 320 spinlock_unlock(&klog_lock); 329 321 330 if (update) 322 /* Force notification on newline */ 323 if (ch == '\n') 331 324 klog_update(); 332 325 } -
kernel/generic/src/ipc/event.c
r0d8a304 r97d42d5 59 59 events[i].imethod = 0; 60 60 events[i].masked = false; 61 events[i].unmask_c b= NULL;61 events[i].unmask_callback = NULL; 62 62 } 63 63 } … … 86 86 /** Define a callback function for the event unmask event. 87 87 * 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 */ 93 void 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; 98 99 spinlock_unlock(&events[evno].lock); 99 100 } … … 206 207 static void event_unmask(event_type_t evno) 207 208 { 208 void (*cb)(void);209 209 ASSERT(evno < EVENT_END); 210 210 211 211 spinlock_lock(&events[evno].lock); 212 212 events[evno].masked = false; 213 cb = events[evno].unmask_cb;213 event_callback_t callback = events[evno].unmask_callback; 214 214 spinlock_unlock(&events[evno].lock); 215 215 216 216 /* 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. 218 219 */ 219 if (c b)220 cb();220 if (callback != NULL) 221 callback(); 221 222 } 222 223
Note:
See TracChangeset
for help on using the changeset viewer.