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 37... | Line 37... | ||
37 | #include <genarch/drivers/ns16550/ns16550.h> |
37 | #include <genarch/drivers/ns16550/ns16550.h> |
38 | #include <ddi/irq.h> |
38 | #include <ddi/irq.h> |
39 | #include <arch/asm.h> |
39 | #include <arch/asm.h> |
40 | #include <console/chardev.h> |
40 | #include <console/chardev.h> |
41 | #include <mm/slab.h> |
41 | #include <mm/slab.h> |
- | 42 | #include <ddi/device.h> |
|
42 | 43 | ||
43 | #define LSR_DATA_READY 0x01 |
44 | #define LSR_DATA_READY 0x01 |
44 | 45 | ||
45 | static indev_operations_t kbrdin_ops = { |
46 | static indev_operations_t kbrdin_ops = { |
46 | .poll = NULL |
47 | .poll = NULL |
Line 77... | Line 78... | ||
77 | * @param cir_arg First argument to cir. |
78 | * @param cir_arg First argument to cir. |
78 | * |
79 | * |
79 | * @return Keyboard device pointer or NULL on failure. |
80 | * @return Keyboard device pointer or NULL on failure. |
80 | * |
81 | * |
81 | */ |
82 | */ |
82 | indev_t *ns16550_init(ns16550_t *dev, devno_t devno, inr_t inr, cir_t cir, void *cir_arg) |
83 | indev_t *ns16550_init(ns16550_t *dev, inr_t inr, cir_t cir, void *cir_arg) |
83 | { |
84 | { |
84 | ns16550_instance_t *instance |
85 | ns16550_instance_t *instance |
85 | = malloc(sizeof(ns16550_instance_t), FRAME_ATOMIC); |
86 | = malloc(sizeof(ns16550_instance_t), FRAME_ATOMIC); |
86 | if (!instance) |
87 | if (!instance) |
87 | return NULL; |
88 | return NULL; |
88 | 89 | ||
89 | indev_initialize("ns16550", &instance->kbrdin, &kbrdin_ops); |
90 | indev_initialize("ns16550", &instance->kbrdin, &kbrdin_ops); |
90 | 91 | ||
91 | instance->devno = devno; |
- | |
92 | instance->ns16550 = dev; |
92 | instance->ns16550 = dev; |
93 | 93 | ||
94 | irq_initialize(&instance->irq); |
94 | irq_initialize(&instance->irq); |
95 | instance->irq.devno = devno; |
95 | instance->irq.devno = device_assign_devno(); |
96 | instance->irq.inr = inr; |
96 | instance->irq.inr = inr; |
97 | instance->irq.claim = ns16550_claim; |
97 | instance->irq.claim = ns16550_claim; |
98 | instance->irq.handler = ns16550_irq_handler; |
98 | instance->irq.handler = ns16550_irq_handler; |
99 | instance->irq.instance = instance; |
99 | instance->irq.instance = instance; |
100 | instance->irq.cir = cir; |
100 | instance->irq.cir = cir; |