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 36... Line 36...
36
 
36
 
37
#include <genarch/drivers/dsrln/dsrlnin.h>
37
#include <genarch/drivers/dsrln/dsrlnin.h>
38
#include <console/chardev.h>
38
#include <console/chardev.h>
39
#include <mm/slab.h>
39
#include <mm/slab.h>
40
#include <arch/asm.h>
40
#include <arch/asm.h>
-
 
41
#include <ddi/device.h>
41
 
42
 
42
static indev_operations_t kbrdin_ops = {
43
static indev_operations_t kbrdin_ops = {
43
    .poll = NULL
44
    .poll = NULL
44
};
45
};
45
 
46
 
Line 54... Line 55...
54
    dsrlnin_t *dev = instance->dsrlnin;
55
    dsrlnin_t *dev = instance->dsrlnin;
55
   
56
   
56
    indev_push_character(&instance->kbrdin, pio_read_8(&dev->data));
57
    indev_push_character(&instance->kbrdin, pio_read_8(&dev->data));
57
}
58
}
58
 
59
 
59
indev_t *dsrlnin_init(dsrlnin_t *dev, devno_t devno, inr_t inr)
60
indev_t *dsrlnin_init(dsrlnin_t *dev, inr_t inr)
60
{
61
{
61
    dsrlnin_instance_t *instance
62
    dsrlnin_instance_t *instance
62
        = malloc(sizeof(dsrlnin_instance_t), FRAME_ATOMIC);
63
        = malloc(sizeof(dsrlnin_instance_t), FRAME_ATOMIC);
63
    if (!instance)
64
    if (!instance)
64
        return NULL;
65
        return NULL;
65
   
66
   
66
    indev_initialize("dsrlnin", &instance->kbrdin, &kbrdin_ops);
67
    indev_initialize("dsrlnin", &instance->kbrdin, &kbrdin_ops);
67
   
68
   
68
    instance->devno = devno;
-
 
69
    instance->dsrlnin = dev;
69
    instance->dsrlnin = dev;
70
   
70
   
71
    irq_initialize(&instance->irq);
71
    irq_initialize(&instance->irq);
72
    instance->irq.devno = devno;
72
    instance->irq.devno = device_assign_devno();
73
    instance->irq.inr = inr;
73
    instance->irq.inr = inr;
74
    instance->irq.claim = dsrlnin_claim;
74
    instance->irq.claim = dsrlnin_claim;
75
    instance->irq.handler = dsrlnin_irq_handler;
75
    instance->irq.handler = dsrlnin_irq_handler;
76
    instance->irq.instance = instance;
76
    instance->irq.instance = instance;
77
    irq_register(&instance->irq);
77
    irq_register(&instance->irq);