Subversion Repositories HelenOS

Rev

Rev 2662 | Rev 3020 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2662 Rev 2802
Line 115... Line 115...
115
}
115
}
116
 
116
 
117
/** Initialize an answerbox structure.
117
/** Initialize an answerbox structure.
118
 *
118
 *
119
 * @param box       Answerbox structure to be initialized.
119
 * @param box       Answerbox structure to be initialized.
-
 
120
 * @param task      Task to which the answerbox belongs.
120
 */
121
 */
121
void ipc_answerbox_init(answerbox_t *box)
122
void ipc_answerbox_init(answerbox_t *box, task_t *task)
122
{
123
{
123
    spinlock_initialize(&box->lock, "ipc_box_lock");
124
    spinlock_initialize(&box->lock, "ipc_box_lock");
124
    spinlock_initialize(&box->irq_lock, "ipc_box_irqlock");
125
    spinlock_initialize(&box->irq_lock, "ipc_box_irqlock");
125
    waitq_initialize(&box->wq);
126
    waitq_initialize(&box->wq);
126
    list_initialize(&box->connected_phones);
127
    list_initialize(&box->connected_phones);
127
    list_initialize(&box->calls);
128
    list_initialize(&box->calls);
128
    list_initialize(&box->dispatched_calls);
129
    list_initialize(&box->dispatched_calls);
129
    list_initialize(&box->answers);
130
    list_initialize(&box->answers);
130
    list_initialize(&box->irq_notifs);
131
    list_initialize(&box->irq_notifs);
131
    list_initialize(&box->irq_head);
132
    list_initialize(&box->irq_head);
132
    box->task = TASK;
133
    box->task = task;
133
}
134
}
134
 
135
 
135
/** Connect a phone to an answerbox.
136
/** Connect a phone to an answerbox.
136
 *
137
 *
137
 * @param phone     Initialized phone structure.
138
 * @param phone     Initialized phone structure.
Line 170... Line 171...
170
 */
171
 */
171
void ipc_call_sync(phone_t *phone, call_t *request)
172
void ipc_call_sync(phone_t *phone, call_t *request)
172
{
173
{
173
    answerbox_t sync_box;
174
    answerbox_t sync_box;
174
 
175
 
175
    ipc_answerbox_init(&sync_box);
176
    ipc_answerbox_init(&sync_box, TASK);
176
 
177
 
177
    /* We will receive data in a special box. */
178
    /* We will receive data in a special box. */
178
    request->callerbox = &sync_box;
179
    request->callerbox = &sync_box;
179
 
180
 
180
    ipc_call(phone, request);
181
    ipc_call(phone, request);