Subversion Repositories HelenOS

Rev

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

Rev 4346 Rev 4347
Line 39... Line 39...
39
#include <genarch/drivers/i8042/i8042.h>
39
#include <genarch/drivers/i8042/i8042.h>
40
#include <genarch/drivers/legacy/ia32/io.h>
40
#include <genarch/drivers/legacy/ia32/io.h>
41
#include <arch/asm.h>
41
#include <arch/asm.h>
42
#include <console/chardev.h>
42
#include <console/chardev.h>
43
#include <mm/slab.h>
43
#include <mm/slab.h>
-
 
44
#include <ddi/device.h>
44
 
45
 
45
static indev_operations_t kbrdin_ops = {
46
static indev_operations_t kbrdin_ops = {
46
    .poll = NULL
47
    .poll = NULL
47
};
48
};
48
 
49
 
Line 74... Line 75...
74
        indev_push_character(&instance->kbrdin, data);
75
        indev_push_character(&instance->kbrdin, data);
75
    }
76
    }
76
}
77
}
77
 
78
 
78
/** Initialize i8042. */
79
/** Initialize i8042. */
79
indev_t *i8042_init(i8042_t *dev, devno_t devno, inr_t inr)
80
indev_t *i8042_init(i8042_t *dev, inr_t inr)
80
{
81
{
81
    i8042_instance_t *instance
82
    i8042_instance_t *instance
82
        = malloc(sizeof(i8042_instance_t), FRAME_ATOMIC);
83
        = malloc(sizeof(i8042_instance_t), FRAME_ATOMIC);
83
    if (!instance)
84
    if (!instance)
84
        return NULL;
85
        return NULL;
85
   
86
   
86
    indev_initialize("i8042", &instance->kbrdin, &kbrdin_ops);
87
    indev_initialize("i8042", &instance->kbrdin, &kbrdin_ops);
87
   
88
   
88
    instance->devno = devno;
-
 
89
    instance->i8042 = dev;
89
    instance->i8042 = dev;
90
   
90
   
91
    irq_initialize(&instance->irq);
91
    irq_initialize(&instance->irq);
92
    instance->irq.devno = devno;
92
    instance->irq.devno = device_assign_devno();
93
    instance->irq.inr = inr;
93
    instance->irq.inr = inr;
94
    instance->irq.claim = i8042_claim;
94
    instance->irq.claim = i8042_claim;
95
    instance->irq.handler = i8042_irq_handler;
95
    instance->irq.handler = i8042_irq_handler;
96
    instance->irq.instance = instance;
96
    instance->irq.instance = instance;
97
    irq_register(&instance->irq);
97
    irq_register(&instance->irq);