Subversion Repositories HelenOS-historic

Rev

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

Rev 1141 Rev 1568
Line 156... Line 156...
156
    int i;
156
    int i;
157
 
157
 
158
    spinlock_lock(&TASK->lock);
158
    spinlock_lock(&TASK->lock);
159
   
159
   
160
    for (i=0; i < IPC_MAX_PHONES; i++) {
160
    for (i=0; i < IPC_MAX_PHONES; i++) {
-
 
161
        if (TASK->phones[i].state == IPC_PHONE_HUNGUP && \
161
        if (TASK->phones[i].busy==IPC_BUSY_FREE && !atomic_get(&TASK->phones[i].active_calls)) {
162
            atomic_get(&TASK->phones[i].active_calls) == 0)
-
 
163
            TASK->phones[i].state = IPC_PHONE_FREE;
-
 
164
 
-
 
165
        if (TASK->phones[i].state == IPC_PHONE_FREE) {
162
            TASK->phones[i].busy = IPC_BUSY_CONNECTING;
166
            TASK->phones[i].state = IPC_PHONE_CONNECTING;
163
            break;
167
            break;
164
        }
168
        }
165
    }
169
    }
166
    spinlock_unlock(&TASK->lock);
170
    spinlock_unlock(&TASK->lock);
167
 
171
 
Line 170... Line 174...
170
    return i;
174
    return i;
171
}
175
}
172
 
176
 
173
static void phone_deallocp(phone_t *phone)
177
static void phone_deallocp(phone_t *phone)
174
{
178
{
175
    ASSERT(phone->busy == IPC_BUSY_CONNECTING);
179
    ASSERT(phone->state == IPC_PHONE_CONNECTING);
176
    ASSERT(! phone->callee);
180
    ASSERT(! phone->callee);
177
   
181
   
178
    /* atomic operation */
182
    /* atomic operation */
179
    phone->busy = IPC_BUSY_FREE;
183
    phone->state = IPC_PHONE_FREE;
180
}
184
}
181
 
185
 
182
/** Free slot from a disconnected phone
186
/** Free slot from a disconnected phone
183
 *
187
 *
184
 * All already sent messages will be correctly processed
188
 * All already sent messages will be correctly processed
Line 198... Line 202...
198
 */
202
 */
199
void phone_connect(int phoneid, answerbox_t *box)
203
void phone_connect(int phoneid, answerbox_t *box)
200
{
204
{
201
    phone_t *phone = &TASK->phones[phoneid];
205
    phone_t *phone = &TASK->phones[phoneid];
202
   
206
   
203
    ASSERT(phone->busy == IPC_BUSY_CONNECTING);
207
    ASSERT(phone->state == IPC_PHONE_CONNECTING);
204
    ipc_phone_connect(phone, box);
208
    ipc_phone_connect(phone, box);
205
}
209
}