Subversion Repositories HelenOS

Rev

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

Rev 2307 Rev 2456
Line 39... Line 39...
39
#include <console/chardev.h>
39
#include <console/chardev.h>
40
#include <arch/drivers/pic.h>
40
#include <arch/drivers/pic.h>
41
#include <sysinfo/sysinfo.h>
41
#include <sysinfo/sysinfo.h>
42
#include <interrupt.h>
42
#include <interrupt.h>
43
#include <stdarg.h>
43
#include <stdarg.h>
-
 
44
#include <synch/rcu.h>
44
 
45
 
45
#define CUDA_IRQ 10
46
#define CUDA_IRQ 10
46
#define SPECIAL     '?'
47
#define SPECIAL     '?'
47
 
48
 
48
#define PACKET_ADB  0x00
49
#define PACKET_ADB  0x00
Line 247... Line 248...
247
    return -1;
248
    return -1;
248
}
249
}
249
 
250
 
250
static void cuda_irq_handler(irq_t *irq, void *arg, ...)
251
static void cuda_irq_handler(irq_t *irq, void *arg, ...)
251
{
252
{
252
    if ((irq->notif_cfg.notify) && (irq->notif_cfg.answerbox))
253
    if ((rcu_dereference_pointer(irq->notif_cfg).notify) && (rcu_dereference_pointer(irq->notif_cfg).answerbox))
253
        ipc_irq_send_notif(irq);
254
        ipc_irq_send_notif(irq);
254
    else {
255
    else {
255
        int scan_code = cuda_get_scancode();
256
        int scan_code = cuda_get_scancode();
256
       
257
       
257
        if (scan_code != -1) {
258
        if (scan_code != -1) {
Line 270... Line 271...
270
 
271
 
271
/** Initialize keyboard and service interrupts using kernel routine */
272
/** Initialize keyboard and service interrupts using kernel routine */
272
void cuda_grab(void)
273
void cuda_grab(void)
273
{
274
{
274
    ipl_t ipl = interrupts_disable();
275
    ipl_t ipl = interrupts_disable();
275
    spinlock_lock(&cuda_irq.lock);
276
    //rcu_read_lock() is not needed, ints are disabled
276
    cuda_irq.notif_cfg.notify = false;
277
    //rcu: atomic update doesn't need reallocation
277
    spinlock_unlock(&cuda_irq.lock);
278
    rcu_dereference_pointer(cuda_irq.notif_cfg).notify = false;
278
    interrupts_restore(ipl);
279
    interrupts_restore(ipl);
279
}
280
}
280
 
281
 
281
 
282
 
282
/** Resume the former interrupt vector */
283
/** Resume the former interrupt vector */
283
void cuda_release(void)
284
void cuda_release(void)
284
{
285
{
285
    ipl_t ipl = interrupts_disable();
286
    ipl_t ipl = interrupts_disable();
-
 
287
    //rcu: atomic update doesn't need reallocation
286
    spinlock_lock(&cuda_irq.lock);
288
    spinlock_lock(&cuda_irq.lock);
287
    if (cuda_irq.notif_cfg.answerbox)
289
    if (rcu_dereference_pointer(cuda_irq.notif_cfg).answerbox)
288
        cuda_irq.notif_cfg.notify = true;
290
        rcu_dereference_pointer(cuda_irq.notif_cfg).notify = true;
289
    spinlock_unlock(&cuda_irq.unlock);
291
    spinlock_unlock(&cuda_irq.unlock);
290
    interrupts_restore(ipl);
292
    interrupts_restore(ipl);
291
}
293
}
292
 
294
 
293
 
295