Subversion Repositories HelenOS

Rev

Rev 4348 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4348 Rev 4691
Line 62... Line 62...
62
        events[i].counter = 0;
62
        events[i].counter = 0;
63
        events[i].method = 0;
63
        events[i].method = 0;
64
    }
64
    }
65
}
65
}
66
 
66
 
67
static int
-
 
68
event_subscribe(event_type_t evno, unative_t method, answerbox_t *answerbox)
67
static int event_subscribe(event_type_t evno, unative_t method,
-
 
68
    answerbox_t *answerbox)
69
{
69
{
70
    if (evno >= EVENT_END)
70
    if (evno >= EVENT_END)
71
        return ELIMIT;
71
        return ELIMIT;
72
   
72
   
73
    spinlock_lock(&events[evno].lock);
73
    spinlock_lock(&events[evno].lock);
Line 120... Line 120...
120
        }
120
        }
121
        spinlock_unlock(&events[i].lock);
121
        spinlock_unlock(&events[i].lock);
122
    }
122
    }
123
}
123
}
124
 
124
 
125
void
-
 
126
event_notify(event_type_t evno, unative_t a1, unative_t a2, unative_t a3,
125
void event_notify(event_type_t evno, unative_t a1, unative_t a2, unative_t a3,
127
    unative_t a4, unative_t a5)
126
    unative_t a4, unative_t a5)
128
{
127
{
129
    ASSERT(evno < EVENT_END);
128
    ASSERT(evno < EVENT_END);
130
   
129
   
131
    spinlock_lock(&events[evno].lock);
130
    spinlock_lock(&events[evno].lock);
Line 139... Line 138...
139
            IPC_SET_ARG2(call->data, a2);
138
            IPC_SET_ARG2(call->data, a2);
140
            IPC_SET_ARG3(call->data, a3);
139
            IPC_SET_ARG3(call->data, a3);
141
            IPC_SET_ARG4(call->data, a4);
140
            IPC_SET_ARG4(call->data, a4);
142
            IPC_SET_ARG5(call->data, a5);
141
            IPC_SET_ARG5(call->data, a5);
143
           
142
           
-
 
143
            ipl_t ipl = interrupts_disable();
144
            spinlock_lock(&events[evno].answerbox->irq_lock);
144
            spinlock_lock(&events[evno].answerbox->irq_lock);
145
            list_append(&call->link, &events[evno].answerbox->irq_notifs);
145
            list_append(&call->link, &events[evno].answerbox->irq_notifs);
146
            spinlock_unlock(&events[evno].answerbox->irq_lock);
146
            spinlock_unlock(&events[evno].answerbox->irq_lock);
-
 
147
            interrupts_restore(ipl);
147
           
148
           
148
            waitq_wakeup(&events[evno].answerbox->wq, WAKEUP_FIRST);
149
            waitq_wakeup(&events[evno].answerbox->wq, WAKEUP_FIRST);
149
        }
150
        }
150
    }
151
    }
151
    spinlock_unlock(&events[evno].lock);
152
    spinlock_unlock(&events[evno].lock);