00001 00009 /* (c) 2007 Technische Universitaet Dresden 00010 * This file is part of DROPS, which is distributed under the terms of the 00011 * GNU General Public License 2. Please see the COPYING file for details. 00012 */ 00013 00014 #ifndef __OMEGA0_SERVER_GLOBALS_H 00015 #define __OMEGA0_SERVER_GLOBALS_H 00016 00017 #include <l4/sys/types.h> 00018 #include <l4/util/lock_wq.h> 00019 #include <l4/omega0/client.h> 00020 #include "config.h" 00021 00022 #define IRQ_NUMS 18 // 16 at standard-x86-pc architecture 00023 #define STACKSIZE 4096 // 4KB of stack per irq handler 00024 00025 typedef struct client_chain{ 00026 l4_threadid_t client; 00027 int masked; // this client masked the irq 00028 int waiting; // client is in blocking state 00029 int in_service; // this irq is in service by this client 00030 unsigned last_irq_num; // last irq num handled by this client 00031 omega0_request_t last_request;/* last request of the client, successful 00032 * operations deleted */ 00033 struct client_chain*next; 00034 } client_chain; 00035 00036 typedef l4util_wq_lock_queue_base_t mutex_t; 00037 00038 typedef struct{ 00039 int available; // available to omega0 00040 int shared; // shared or not 00041 int masked; // counter for masks, no mask if 0 00042 int in_service; // 1 if not consumed yet 00043 #ifdef OMEGA0_STRATEGY_AUTO_CONSUME 00044 int clients_waiting; // # of clients waiting for this irq 00045 int clients_registered; // # of registered clients for this irq 00046 #endif 00047 client_chain *clients; // the clients 00048 mutex_t mutex; // mutex for client-chain 00049 unsigned counter; // last irq nr occured 00050 /* krishna: use dynamic stack allocation - please */ 00051 l4_umword_t * stack; // stack for irq handler 00052 /* krishna: lthread (= handle) information */ 00053 unsigned lthread; // l4_myself.id.lthread 00054 } irq_description_t; 00055 00056 extern irq_description_t irqs[IRQ_NUMS]; 00057 00058 static inline void aquire_mutex(mutex_t *wq, 00059 l4util_wq_lock_queue_elem_t *elem){ 00060 l4util_wq_lock_lock(wq, elem); 00061 } 00062 00063 static inline void release_mutex(mutex_t *wq, 00064 l4util_wq_lock_queue_elem_t *elem){ 00065 l4util_wq_lock_unlock(wq, elem); 00066 } 00067 00068 #endif