Rev 2098 | Rev 2106 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2098 | Rev 2105 | ||
|---|---|---|---|
| Line 156... | Line 156... | ||
| 156 | /* User methods */ |
156 | /* User methods */ |
| 157 | #define FIRST_USER_METHOD 1024 |
157 | #define FIRST_USER_METHOD 1024 |
| 158 | 158 | ||
| 159 | #ifdef KERNEL |
159 | #ifdef KERNEL |
| 160 | 160 | ||
| - | 161 | #define IPC_MAX_PHONES 16 |
|
| - | 162 | ||
| 161 | #include <proc/task.h> |
163 | #include <synch/waitq.h> |
| - | 164 | ||
| - | 165 | struct answerbox; |
|
| - | 166 | struct task; |
|
| - | 167 | ||
| - | 168 | typedef enum { |
|
| - | 169 | IPC_PHONE_FREE = 0, /**< Phone is free and can be allocated */ |
|
| - | 170 | IPC_PHONE_CONNECTING, /**< Phone is connecting somewhere */ |
|
| - | 171 | IPC_PHONE_CONNECTED, /**< Phone is connected */ |
|
| - | 172 | IPC_PHONE_HUNGUP, /**< Phone is hung up, waiting for answers to come */ |
|
| - | 173 | IPC_PHONE_SLAMMED /**< Phone was hungup from server */ |
|
| - | 174 | } ipc_phone_state_t; |
|
| - | 175 | ||
| - | 176 | /** Structure identifying phone (in TASK structure) */ |
|
| - | 177 | typedef struct { |
|
| - | 178 | SPINLOCK_DECLARE(lock); |
|
| - | 179 | link_t link; |
|
| - | 180 | struct answerbox *callee; |
|
| - | 181 | ipc_phone_state_t state; |
|
| - | 182 | atomic_t active_calls; |
|
| - | 183 | } phone_t; |
|
| - | 184 | ||
| - | 185 | typedef struct answerbox { |
|
| - | 186 | SPINLOCK_DECLARE(lock); |
|
| - | 187 | ||
| - | 188 | struct task *task; |
|
| - | 189 | ||
| - | 190 | waitq_t wq; |
|
| - | 191 | ||
| - | 192 | link_t connected_phones; /**< Phones connected to this answerbox */ |
|
| - | 193 | link_t calls; /**< Received calls */ |
|
| - | 194 | link_t dispatched_calls; /* Should be hash table in the future */ |
|
| - | 195 | ||
| - | 196 | link_t answers; /**< Answered calls */ |
|
| - | 197 | ||
| - | 198 | SPINLOCK_DECLARE(irq_lock); |
|
| - | 199 | link_t irq_notifs; /**< Notifications from IRQ handlers */ |
|
| - | 200 | link_t irq_head; /**< IRQs with notifications to this answerbox. */ |
|
| - | 201 | } answerbox_t; |
|
| 162 | 202 | ||
| 163 | typedef struct { |
203 | typedef struct { |
| 164 | unative_t args[IPC_CALL_LEN]; |
204 | unative_t args[IPC_CALL_LEN]; |
| 165 | phone_t *phone; |
205 | phone_t *phone; |
| 166 | } ipc_data_t; |
206 | } ipc_data_t; |
| Line 169... | Line 209... | ||
| 169 | link_t link; |
209 | link_t link; |
| 170 | 210 | ||
| 171 | int flags; |
211 | int flags; |
| 172 | 212 | ||
| 173 | /* Identification of the caller */ |
213 | /* Identification of the caller */ |
| 174 | task_t *sender; |
214 | struct task *sender; |
| 175 | /* The caller box is different from sender->answerbox |
215 | /* The caller box is different from sender->answerbox |
| 176 | * for synchronous calls |
216 | * for synchronous calls |
| 177 | */ |
217 | */ |
| 178 | answerbox_t *callerbox; |
218 | answerbox_t *callerbox; |
| 179 | 219 | ||