Rev 1086 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1086 | Rev 1088 | ||
---|---|---|---|
Line 35... | Line 35... | ||
35 | 35 | ||
36 | /** Maximum active async calls per thread */ |
36 | /** Maximum active async calls per thread */ |
37 | #define IPC_MAX_ASYNC_CALLS 4 |
37 | #define IPC_MAX_ASYNC_CALLS 4 |
38 | 38 | ||
39 | /* Flags for calls */ |
39 | /* Flags for calls */ |
40 | #define IPC_CALL_ANSWERED (1<<0) /**< This is answer to a call */ |
40 | #define IPC_CALL_ANSWERED (1<<0) /**< This is answer to a call */ |
41 | #define IPC_CALL_STATIC_ALLOC (1<<1) /**< This call will not be freed on error */ |
41 | #define IPC_CALL_STATIC_ALLOC (1<<1) /**< This call will not be freed on error */ |
42 | #define IPC_CALL_DISPATCHED (1<<2) /**< Call is in dispatch queue */ |
42 | #define IPC_CALL_DISPATCHED (1<<2) /**< Call is in dispatch queue */ |
43 | #define IPC_CALL_DISCARD_ANSWER (1<<3) /**< Answer will not be passed to |
43 | #define IPC_CALL_DISCARD_ANSWER (1<<3) /**< Answer will not be passed to |
44 | * userspace, will be discarded */ |
44 | * userspace, will be discarded */ |
- | 45 | #define IPC_CALL_FORWARDED (1<<4) /* Call was forwarded */ |
|
45 | 46 | ||
46 | /* Flags for ipc_wait_for_call */ |
47 | /* Flags for ipc_wait_for_call */ |
47 | #define IPC_WAIT_NONBLOCKING 1 |
48 | #define IPC_WAIT_NONBLOCKING 1 |
48 | 49 | ||
49 | /* Flags of callid (the addresses are aligned at least to 4, |
50 | /* Flags of callid (the addresses are aligned at least to 4, |
Line 153... | Line 154... | ||
153 | link_t dispatched_calls; /* Should be hash table in the future */ |
154 | link_t dispatched_calls; /* Should be hash table in the future */ |
154 | 155 | ||
155 | link_t answers; /**< Answered calls */ |
156 | link_t answers; /**< Answered calls */ |
156 | }; |
157 | }; |
157 | 158 | ||
- | 159 | typedef enum { |
|
- | 160 | IPC_BUSY_FREE = 0, |
|
- | 161 | IPC_BUSY_CONNECTING, |
|
- | 162 | IPC_BUSY_CONNECTED |
|
- | 163 | } ipc_busy_t; |
|
- | 164 | ||
158 | struct phone_s { |
165 | struct phone_s { |
159 | SPINLOCK_DECLARE(lock); |
166 | SPINLOCK_DECLARE(lock); |
160 | link_t list; |
167 | link_t list; |
161 | answerbox_t *callee; |
168 | answerbox_t *callee; |
162 | int busy; |
169 | ipc_busy_t busy; |
163 | atomic_t active_calls; |
170 | atomic_t active_calls; |
164 | }; |
171 | }; |
165 | 172 | ||
166 | typedef struct { |
173 | typedef struct { |
167 | link_t list; |
174 | link_t list; |
Line 179... | Line 186... | ||
179 | }call_t; |
186 | }call_t; |
180 | 187 | ||
181 | extern void ipc_init(void); |
188 | extern void ipc_init(void); |
182 | extern call_t * ipc_wait_for_call(answerbox_t *box, int flags); |
189 | extern call_t * ipc_wait_for_call(answerbox_t *box, int flags); |
183 | extern void ipc_answer(answerbox_t *box, call_t *request); |
190 | extern void ipc_answer(answerbox_t *box, call_t *request); |
184 | extern void ipc_call(phone_t *phone, call_t *request); |
191 | extern int ipc_call(phone_t *phone, call_t *call); |
185 | extern void ipc_call_sync(phone_t *phone, call_t *request); |
192 | extern void ipc_call_sync(phone_t *phone, call_t *request); |
186 | extern void ipc_phone_init(phone_t *phone); |
193 | extern void ipc_phone_init(phone_t *phone); |
187 | extern void ipc_phone_connect(phone_t *phone, answerbox_t *box); |
194 | extern void ipc_phone_connect(phone_t *phone, answerbox_t *box); |
188 | extern void ipc_call_free(call_t *call); |
195 | extern void ipc_call_free(call_t *call); |
189 | extern call_t * ipc_call_alloc(void); |
196 | extern call_t * ipc_call_alloc(void); |
190 | extern void ipc_answerbox_init(answerbox_t *box); |
197 | extern void ipc_answerbox_init(answerbox_t *box); |
191 | extern void ipc_call_static_init(call_t *call); |
198 | extern void ipc_call_static_init(call_t *call); |
192 | extern void task_print_list(void); |
199 | extern void task_print_list(void); |
193 | extern void ipc_forward(call_t *call, phone_t *newphone, answerbox_t *oldbox); |
200 | extern int ipc_forward(call_t *call, phone_t *newphone, answerbox_t *oldbox); |
194 | 201 | ||
195 | extern answerbox_t *ipc_phone_0; |
202 | extern answerbox_t *ipc_phone_0; |
196 | extern void ipc_cleanup(task_t *task); |
203 | extern void ipc_cleanup(task_t *task); |
197 | extern int ipc_phone_hangup(phone_t *phone); |
204 | extern int ipc_phone_hangup(phone_t *phone); |
198 | 205 |