Changes in / [7785ebd7:3da166f0] in mainline
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
HelenOS.config
r7785ebd7 r3da166f0 472 472 473 473 % PC keyboard support 474 ! [ CONFIG_HID_IN=generic&(PLATFORM=ia32|PLATFORM=amd64)] CONFIG_PC_KBD (y/n)474 ! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=keyboard)&(PLATFORM=ia32|PLATFORM=amd64)] CONFIG_PC_KBD (y/n) 475 475 476 476 % PC keyboard support … … 498 498 ! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&PLATFORM=arm32&(MACHINE=integratorcp|MACHINE=raspberrypi)] CONFIG_PL011_UART (y/n) 499 499 500 % Support for NS16550 controller (kernel console) 501 ! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=serial|CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&(PLATFORM=ia32|PLATFORM=amd64)] CONFIG_NS16550_KCON (y/n) 502 503 % Use NS16550 controller as serial input (kernel console) 504 ! [(CONFIG_HID_IN=generic|CONFIG_HID_IN=serial)&(PLATFORM=ia32|PLATFORM=amd64)&CONFIG_NS16550_KCON=y] CONFIG_NS16550 (y) 505 506 % Use NS16550 controller as dummy serial output (kernel console) 507 ! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&(PLATFORM=ia32|PLATFORM=amd64)&CONFIG_NS16550_KCON=y] CONFIG_NS16550_OUT (y) 508 500 509 % Support for Samsung S3C24XX on-chip UART 501 510 ! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&PLATFORM=arm32&MACHINE=gta02] CONFIG_S3C24XX_UART (y/n) … … 538 547 539 548 % Serial line input module 540 ! [CONFIG_DSRLNIN=y|(PLATFORM=sparc32)|(PLATFORM=arm32&MACHINE=gta02)|(PLATFORM=arm32&MACHINE=integratorcp&CONFIG_PL011_UART=y)|(PLATFORM=arm32&MACHINE=beaglebone&CONFIG_OMAP_UART=y)|(PLATFORM=arm32&MACHINE=beagleboardxm&CONFIG_OMAP_UART=y)|(PLATFORM=ia64&MACHINE=i460GX&CONFIG_NS16550=y)|(PLATFORM=ia64&MACHINE=ski)|(PLATFORM=sparc64&PROCESSOR=sun4v)|(PLATFORM=arm32&MACHINE=raspberrypi&CONFIG_PL011_UART=y) ] CONFIG_SRLN (y)549 ! [CONFIG_DSRLNIN=y|(PLATFORM=sparc32)|(PLATFORM=arm32&MACHINE=gta02)|(PLATFORM=arm32&MACHINE=integratorcp&CONFIG_PL011_UART=y)|(PLATFORM=arm32&MACHINE=beaglebone&CONFIG_OMAP_UART=y)|(PLATFORM=arm32&MACHINE=beagleboardxm&CONFIG_OMAP_UART=y)|(PLATFORM=ia64&MACHINE=i460GX&CONFIG_NS16550=y)|(PLATFORM=ia64&MACHINE=ski)|(PLATFORM=sparc64&PROCESSOR=sun4v)|(PLATFORM=arm32&MACHINE=raspberrypi&CONFIG_PL011_UART=y)|(PLATFORM=ia32&CONFIG_NS16550=y)|(PLATFORM=amd64&CONFIG_NS16550=y)] CONFIG_SRLN (y) 541 550 542 551 % EGA support -
kernel/arch/amd64/include/arch/interrupt.h
r7785ebd7 r3da166f0 53 53 #define IRQ_KBD 1 54 54 #define IRQ_PIC1 2 55 /* NS16550 at COM1 */ 56 #define IRQ_NS16550 4 55 57 #define IRQ_PIC_SPUR 7 56 58 #define IRQ_MOUSE 12 -
kernel/arch/amd64/src/amd64.c
r7785ebd7 r3da166f0 49 49 #include <genarch/drivers/ega/ega.h> 50 50 #include <genarch/drivers/i8042/i8042.h> 51 #include <genarch/drivers/ns16550/ns16550.h> 51 52 #include <genarch/drivers/legacy/ia32/io.h> 52 53 #include <genarch/fb/bfb.h> 53 54 #include <genarch/kbrd/kbrd.h> 55 #include <genarch/srln/srln.h> 54 56 #include <genarch/multiboot/multiboot.h> 55 57 #include <genarch/multiboot/multiboot2.h> … … 212 214 } 213 215 #endif 216 217 #if (defined(CONFIG_NS16550) || defined(CONFIG_NS16550_OUT)) 218 /* 219 * Initialize the ns16550 controller. 220 */ 221 #ifdef CONFIG_NS16550_OUT 222 outdev_t *ns16550_out; 223 outdev_t **ns16550_out_ptr = &ns16550_out; 224 #else 225 outdev_t **ns16550_out_ptr = NULL; 226 #endif 227 ns16550_instance_t *ns16550_instance 228 = ns16550_init((ns16550_t *) NS16550_BASE, IRQ_NS16550, NULL, NULL, 229 ns16550_out_ptr); 230 if (ns16550_instance) { 231 #ifdef CONFIG_NS16550 232 srln_instance_t *srln_instance = srln_init(); 233 if (srln_instance) { 234 indev_t *sink = stdin_wire(); 235 indev_t *srln = srln_wire(srln_instance, sink); 236 ns16550_wire(ns16550_instance, srln); 237 trap_virtual_enable_irqs(1 << IRQ_NS16550); 238 } 239 #endif 240 #ifdef CONFIG_NS16550_OUT 241 if (ns16550_out) { 242 stdout_wire(ns16550_out); 243 } 244 #endif 245 } 246 #endif 214 247 215 248 if (irqs_info != NULL) -
kernel/arch/ia32/include/arch/interrupt.h
r7785ebd7 r3da166f0 53 53 #define IRQ_KBD 1 54 54 #define IRQ_PIC1 2 55 /* NS16550 at COM1 */ 56 #define IRQ_NS16550 4 55 57 #define IRQ_PIC_SPUR 7 56 58 #define IRQ_MOUSE 12 -
kernel/arch/ia32/src/ia32.c
r7785ebd7 r3da166f0 50 50 #include <genarch/drivers/ega/ega.h> 51 51 #include <genarch/drivers/i8042/i8042.h> 52 #include <genarch/drivers/ns16550/ns16550.h> 52 53 #include <genarch/drivers/legacy/ia32/io.h> 53 54 #include <genarch/fb/bfb.h> 54 55 #include <genarch/kbrd/kbrd.h> 56 #include <genarch/srln/srln.h> 55 57 #include <genarch/multiboot/multiboot.h> 56 58 #include <genarch/multiboot/multiboot2.h> … … 166 168 } 167 169 #endif 170 171 #if (defined(CONFIG_NS16550) || defined(CONFIG_NS16550_OUT)) 172 /* 173 * Initialize the ns16550 controller. 174 */ 175 #ifdef CONFIG_NS16550_OUT 176 outdev_t *ns16550_out; 177 outdev_t **ns16550_out_ptr = &ns16550_out; 178 #else 179 outdev_t **ns16550_out_ptr = NULL; 180 #endif 181 ns16550_instance_t *ns16550_instance 182 = ns16550_init((ns16550_t *) NS16550_BASE, IRQ_NS16550, NULL, NULL, 183 ns16550_out_ptr); 184 if (ns16550_instance) { 185 #ifdef CONFIG_NS16550 186 srln_instance_t *srln_instance = srln_init(); 187 if (srln_instance) { 188 indev_t *sink = stdin_wire(); 189 indev_t *srln = srln_wire(srln_instance, sink); 190 ns16550_wire(ns16550_instance, srln); 191 trap_virtual_enable_irqs(1 << IRQ_NS16550); 192 } 193 #endif 194 #ifdef CONFIG_NS16550_OUT 195 if (ns16550_out) { 196 stdout_wire(ns16550_out); 197 } 198 #endif 199 } 200 #endif 168 201 169 202 if (irqs_info != NULL) -
kernel/arch/ia64/src/ia64.c
r7785ebd7 r3da166f0 173 173 #ifdef CONFIG_NS16550 174 174 ns16550_instance_t *ns16550_instance 175 = ns16550_init((ns16550_t *) NS16550_BASE, NS16550_IRQ, NULL, NULL); 175 = ns16550_init((ns16550_t *) NS16550_BASE, NS16550_IRQ, NULL, NULL, 176 NULL); 176 177 if (ns16550_instance) { 177 178 srln_instance_t *srln_instance = srln_init(); -
kernel/arch/sparc64/src/drivers/kbd.c
r7785ebd7 r3da166f0 122 122 123 123 ns16550_instance_t *ns16550_instance = ns16550_init(ns16550, inr, cir, 124 cir_arg );124 cir_arg, NULL); 125 125 if (ns16550_instance) { 126 126 kbrd_instance_t *kbrd_instance = kbrd_init(); -
kernel/genarch/include/genarch/drivers/ns16550/ns16550.h
r7785ebd7 r3da166f0 38 38 #define KERN_NS16550_H_ 39 39 40 #include <ddi/ddi.h> 40 41 #include <ddi/irq.h> 41 42 #include <typedefs.h> … … 50 51 /** NS16550 registers. */ 51 52 typedef struct { 52 ioport8_t rbr; /**< Receiver Buffer Register. */ 53 union { 54 ioport8_t rbr; /**< Receiver Buffer Register (read). */ 55 ioport8_t thr; /**< Transmitter Holder Register (write). */ 56 } __attribute__ ((packed)); 53 57 ioport8_t ier; /**< Interrupt Enable Register. */ 54 58 union { … … 65 69 irq_t irq; 66 70 ns16550_t *ns16550; 67 indev_t *kbrdin; 71 indev_t *input; 72 outdev_t *output; 73 parea_t parea; 68 74 } ns16550_instance_t; 69 75 70 extern ns16550_instance_t *ns16550_init(ns16550_t *, inr_t, cir_t, void *); 76 extern ns16550_instance_t *ns16550_init(ns16550_t *, inr_t, cir_t, void *, 77 outdev_t **); 71 78 extern void ns16550_wire(ns16550_instance_t *, indev_t *); 72 79 -
kernel/genarch/src/drivers/ns16550/ns16550.c
r7785ebd7 r3da166f0 41 41 #include <mm/slab.h> 42 42 #include <ddi/device.h> 43 #include <str.h> 43 44 44 45 #define LSR_DATA_READY 0x01 46 #define LSR_TH_READY 0x20 45 47 46 48 static irq_ownership_t ns16550_claim(irq_t *irq) … … 62 64 if (pio_read_8(&dev->lsr) & LSR_DATA_READY) { 63 65 uint8_t data = pio_read_8(&dev->rbr); 64 indev_push_character(instance-> kbrdin, data);66 indev_push_character(instance->input, data); 65 67 } 66 68 } … … 73 75 } 74 76 77 static void ns16550_sendb(ns16550_t *dev, uint8_t byte) 78 { 79 while (!(pio_read_8(&dev->lsr) & LSR_TH_READY)) 80 ; 81 pio_write_8(&dev->thr, byte); 82 } 83 84 static void ns16550_putchar(outdev_t *dev, wchar_t ch) 85 { 86 ns16550_instance_t *instance = (ns16550_instance_t *) dev->data; 87 88 if ((!instance->parea.mapped) || (console_override)) { 89 if (ascii_check(ch)) 90 ns16550_sendb(instance->ns16550, (uint8_t) ch); 91 else 92 ns16550_sendb(instance->ns16550, U_SPECIAL); 93 } 94 } 95 96 static outdev_operations_t ns16550_ops = { 97 .write = ns16550_putchar, 98 .redraw = NULL 99 }; 100 75 101 /** Initialize ns16550. 76 102 * 77 103 * @param dev Addrress of the beginning of the device in I/O space. 78 * @param devno Device number.79 104 * @param inr Interrupt number. 80 105 * @param cir Clear interrupt function. 81 106 * @param cir_arg First argument to cir. 107 * @param output Where to store pointer to the output device 108 * or NULL if the caller is not interested in 109 * writing to the serial port. 82 110 * 83 111 * @return Keyboard instance or NULL on failure. 84 112 * 85 113 */ 86 ns16550_instance_t *ns16550_init(ns16550_t *dev, inr_t inr, cir_t cir, void *cir_arg) 114 ns16550_instance_t *ns16550_init(ns16550_t *dev, inr_t inr, cir_t cir, 115 void *cir_arg, outdev_t **output) 87 116 { 88 117 ns16550_instance_t *instance … … 90 119 if (instance) { 91 120 instance->ns16550 = dev; 92 instance->kbrdin = NULL; 121 instance->input = NULL; 122 instance->output = NULL; 123 124 if (output) { 125 instance->output = malloc(sizeof(outdev_t), 126 FRAME_ATOMIC); 127 if (!instance->output) { 128 free(instance); 129 return NULL; 130 } 131 132 outdev_initialize("ns16550", instance->output, 133 &ns16550_ops); 134 instance->output->data = instance; 135 *output = instance->output; 136 } 93 137 94 138 irq_initialize(&instance->irq); … … 100 144 instance->irq.cir = cir; 101 145 instance->irq.cir_arg = cir_arg; 146 147 instance->parea.pbase = (uintptr_t) dev; 148 instance->parea.frames = 1; 149 instance->parea.unpriv = false; 150 instance->parea.mapped = false; 151 ddi_parea_register(&instance->parea); 102 152 } 103 153 … … 105 155 } 106 156 107 void ns16550_wire(ns16550_instance_t *instance, indev_t * kbrdin)157 void ns16550_wire(ns16550_instance_t *instance, indev_t *input) 108 158 { 109 159 ASSERT(instance); 110 ASSERT( kbrdin);160 ASSERT(input); 111 161 112 instance-> kbrdin = kbrdin;162 instance->input = input; 113 163 irq_register(&instance->irq); 114 164
Note:
See TracChangeset
for help on using the changeset viewer.