Changeset 411b6a6 in mainline
- Timestamp:
- 2009-03-07T16:08:40Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4c84368e
- Parents:
- e06da7e
- Files:
-
- 1 added
- 1 deleted
- 12 edited
- 12 moved
Legend:
- Unmodified
- Added
- Removed
-
HelenOS.config
re06da7e r411b6a6 261 261 ! [PLATFORM=ia64|PLATFORM=sparc64] CONFIG_PAGE_HT (y) 262 262 263 % Software integer division support 264 ! [PLATFORM=ia32|PLATFORM=arm32|PLATFORM=ia64|PLATFORM=mips32|PLATFORM=ppc32] CONFIG_SOFTINT (y) 265 266 % ASID support 267 ! [PLATFORM=ia64|PLATFORM=mips32|PLATFORM=ppc32|PLATFORM=sparc64] CONFIG_ASID (y) 268 269 % ASID FIFO support 270 ! [PLATFORM=ia64|PLATFORM=mips32|PLATFORM=ppc32|PLATFORM=sparc64] CONFIG_ASID_FIFO (y) 271 272 % OpenFirmware tree support 273 ! [PLATFORM=sparc64] CONFIG_OFW_TREE (y) 274 275 % Multiboot standard support 276 ! [PLATFORM=ia32|PLATFORM=amd64] CONFIG_MULTIBOOT (y) 277 278 % FPU support 279 ! [PLATFORM=ia32|PLATFORM=amd64|PLATFORM=ia64|PLATFORM=sparc64] CONFIG_FPU (y) 280 281 % FPU support 282 ! [PLATFORM=mips32&(MACHINE=lgxemul|MACHINE=bgxemul)] CONFIG_FPU (y) 283 284 285 ## Kernel features options 286 287 % Support for SMP 288 ! [(PLATFORM=ia32&MACHINE!=athlon_xp)|PLATFORM=amd64|PLATFORM=sparc64|PLATFORM=ia64|(PLATFORM=mips32&MACHINE=msim)] CONFIG_SMP (y/n) 289 290 % Improved support for hyperthreading 291 ! [PLATFORM=amd64&CONFIG_SMP=y] CONFIG_HT (y/n) 292 293 % Improved support for hyperthreading 294 ! [PLATFORM=ia32&MACHINE!=athlon_xp&MACHINE!=athlon_mp&MACHINE!=pentium3&CONFIG_SMP=y] CONFIG_HT (y/n) 295 296 % Lazy FPU context switching 297 ! [CONFIG_FPU=y] CONFIG_FPU_LAZY (y/n) 298 299 % Use VHPT 300 ! [PLATFORM=ia64] CONFIG_VHPT (n/y) 301 302 % Use TSB 303 ! [PLATFORM=sparc64] CONFIG_TSB (y/n) 304 263 305 % i8042 controller support 264 ! [PLATFORM=ia32|PLATFORM=amd64|(PLATFORM=ia64&MACHINE=i460GX)] CONFIG_I8042 (y) 306 ! [PLATFORM=ia32|PLATFORM=amd64|(PLATFORM=ia64&MACHINE=i460GX)] CONFIG_I8042 (y/n) 307 308 % Support for NS16550 serial port 309 ! [PLATFORM=sparc64] CONFIG_NS16550 (y/n) 310 311 % Support for NS16550 serial port 312 ! [PLATFORM=ia64&MACHINE!=ski] CONFIG_NS16550 (n/y) 313 314 % Support for Z8530 serial port 315 ! [PLATFORM=sparc64] CONFIG_Z8530 (y/n) 316 317 % Support for Serengeti console 318 ! [PLATFORM=sparc64] CONFIG_SGCN (y/n) 319 320 % PC keyboard support 321 ! [PLATFORM=ia32|PLATFORM=amd64|(PLATFORM=ia64&MACHINE=i460GX)] CONFIG_PC_KBD (y/n) 265 322 266 323 % Sun keyboard support 267 ! [PLATFORM=sparc64] CONFIG_SUN_KBD (y )324 ! [PLATFORM=sparc64] CONFIG_SUN_KBD (y/n) 268 325 269 326 % EGA support 270 327 ! [PLATFORM=ia32|PLATFORM=amd64|(PLATFORM=ia64&MACHINE=i460GX)] CONFIG_EGA (y) 271 272 % Software integer division support273 ! [PLATFORM=ia32|PLATFORM=arm32|PLATFORM=ia64|PLATFORM=mips32|PLATFORM=ppc32] CONFIG_SOFTINT (y)274 275 % ASID support276 ! [PLATFORM=ia64|PLATFORM=mips32|PLATFORM=ppc32|PLATFORM=sparc64] CONFIG_ASID (y)277 278 % ASID FIFO support279 ! [PLATFORM=ia64|PLATFORM=mips32|PLATFORM=ppc32|PLATFORM=sparc64] CONFIG_ASID_FIFO (y)280 281 % OpenFirmware tree support282 ! [PLATFORM=sparc64] CONFIG_OFW_TREE (y)283 284 % Multiboot standard support285 ! [PLATFORM=ia32|PLATFORM=amd64] CONFIG_MULTIBOOT (y)286 287 % FPU support288 ! [PLATFORM=ia32|PLATFORM=amd64|PLATFORM=ia64|PLATFORM=sparc64] CONFIG_FPU (y)289 290 % FPU support291 ! [PLATFORM=mips32&(MACHINE=lgxemul|MACHINE=bgxemul)] CONFIG_FPU (y)292 293 294 ## Kernel features options295 296 % Support for SMP297 ! [(PLATFORM=ia32&MACHINE!=athlon_xp)|PLATFORM=amd64|PLATFORM=sparc64|PLATFORM=ia64|(PLATFORM=mips32&MACHINE=msim)] CONFIG_SMP (y/n)298 299 % Improved support for hyperthreading300 ! [PLATFORM=amd64&CONFIG_SMP=y] CONFIG_HT (y/n)301 302 % Improved support for hyperthreading303 ! [PLATFORM=ia32&MACHINE!=athlon_xp&MACHINE!=athlon_mp&MACHINE!=pentium3&CONFIG_SMP=y] CONFIG_HT (y/n)304 305 % Lazy FPU context switching306 ! [CONFIG_FPU=y] CONFIG_FPU_LAZY (y/n)307 308 % Use VHPT309 ! [PLATFORM=ia64] CONFIG_VHPT (n/y)310 311 % Use TSB312 ! [PLATFORM=sparc64] CONFIG_TSB (y/n)313 314 % Support for Z8530 serial port315 ! [PLATFORM=sparc64] CONFIG_Z8530 (y/n)316 317 % Support for NS16550 serial port318 ! [PLATFORM=sparc64] CONFIG_NS16550 (y/n)319 320 % Support for NS16550 serial port321 ! [PLATFORM=ia64&MACHINE!=ski] CONFIG_NS16550 (n/y)322 323 % Support for Serengeti console324 ! [PLATFORM=sparc64] CONFIG_SGCN (y/n)325 328 326 329 % IOSapic on default address support -
kernel/arch/amd64/src/amd64.c
re06da7e r411b6a6 44 44 #include <genarch/drivers/ega/ega.h> 45 45 #include <arch/drivers/vesa.h> 46 #include <genarch/kbd/i8042.h> 46 #include <genarch/drivers/i8042/i8042.h> 47 #include <genarch/kbrd/kbrd.h> 47 48 #include <arch/drivers/i8254.h> 48 49 #include <arch/drivers/i8259.h> … … 190 191 { 191 192 devno_t devno = device_assign_devno(); 192 /* keyboard controller */ 193 (void) i8042_init((i8042_t *) I8042_BASE, devno, IRQ_KBD); 193 194 /* 195 * Initialize the keyboard module and conect it to stdin. Then 196 * initialize the i8042 controller and connect it to kbrdin. Enable 197 * keyboard interrupts. 198 */ 199 kbrd_init(stdin); 200 (void) i8042_init((i8042_t *) I8042_BASE, devno, IRQ_KBD, &kbrdin); 201 trap_virtual_enable_irqs(1 << IRQ_KBD); 194 202 195 203 /* -
kernel/arch/ia32/src/ia32.c
re06da7e r411b6a6 45 45 #include <genarch/drivers/ega/ega.h> 46 46 #include <arch/drivers/vesa.h> 47 #include <genarch/kbd/i8042.h> 47 #include <genarch/drivers/i8042/i8042.h> 48 #include <genarch/kbrd/kbrd.h> 48 49 #include <arch/drivers/i8254.h> 49 50 #include <arch/drivers/i8259.h> … … 148 149 { 149 150 devno_t devno = device_assign_devno(); 150 /* keyboard controller */ 151 (void) i8042_init((i8042_t *) I8042_BASE, devno, IRQ_KBD); 151 152 /* 153 * Initialize the keyboard module and conect it to stdin. Then 154 * initialize the i8042 controller and connect it to kbrdin. Enable 155 * keyboard interrupts. 156 */ 157 kbrd_init(stdin); 158 (void) i8042_init((i8042_t *) I8042_BASE, devno, IRQ_KBD, &kbrdin); 159 trap_virtual_enable_irqs(1 << IRQ_KBD); 152 160 153 161 /* -
kernel/arch/ia64/src/ia64.c
re06da7e r411b6a6 55 55 #include <genarch/drivers/legacy/ia32/io.h> 56 56 #include <genarch/drivers/ega/ega.h> 57 #include <genarch/kbd/i8042.h> 57 #include <genarch/kbrd/kbrd.h> 58 #include <genarch/drivers/i8042/i8042.h> 58 59 #include <genarch/kbd/ns16550.h> 59 60 #include <smp/smp.h> … … 178 179 #else 179 180 inr = IRQ_KBD; 180 (void) i8042_init((i8042_t *)I8042_BASE, devno, inr); 181 kbrd_init(stdin); 182 (void) i8042_init((i8042_t *)I8042_BASE, devno, inr, &kbrdin); 183 trap_virtual_enable_irqs(1 << inr); 181 184 sysinfo_set_item_val("kbd.type", NULL, KBD_LEGACY); 182 185 sysinfo_set_item_val("kbd.address.physical", NULL, -
kernel/arch/ia64/src/smp/smp.c
re06da7e r411b6a6 53 53 #include <ddi/device.h> 54 54 #include <arch/bootinfo.h> 55 #include <genarch/kbd/i8042.h>56 #include <genarch/kbd/ns16550.h>57 55 #include <smp/smp.h> 58 56 #include <smp/ipi.h> -
kernel/arch/sparc64/src/console.c
re06da7e r411b6a6 41 41 #include <arch/drivers/sgcn.h> 42 42 43 #ifdef CONFIG_Z853044 #include <genarch/kbd/z8530.h>45 #endif46 #ifdef CONFIG_NS1655047 #include <genarch/kbd/ns16550.h>48 #endif49 50 43 #include <console/chardev.h> 51 44 #include <console/console.h> … … 71 64 { 72 65 #ifdef CONFIG_FB 73 stdin = NULL;74 75 66 ofw_tree_property_t *prop; 76 67 ofw_tree_node_t *screen; -
kernel/arch/sparc64/src/drivers/kbd.c
re06da7e r411b6a6 35 35 #include <arch/drivers/kbd.h> 36 36 #include <genarch/ofw/ofw_tree.h> 37 38 #ifdef CONFIG_SUN_KBD 39 #include <genarch/kbrd/kbrd.h> 40 #endif 37 41 #ifdef CONFIG_Z8530 38 #include <genarch/ kbd/z8530.h>42 #include <genarch/drivers/z8530/z8530.h> 39 43 #endif 40 44 #ifdef CONFIG_NS16550 41 #include <genarch/kbd/ns16550.h> 42 #endif 45 #include <genarch/drivers/ns16550/ns16550.h> 46 #endif 47 48 #include <console/console.h> 43 49 #include <ddi/device.h> 44 50 #include <ddi/irq.h> … … 160 166 z8530 = (z8530_t *) hw_map(aligned_addr, offset + size) + 161 167 offset; 162 (void) z8530_init(z8530, devno, inr, cir, cir_arg); 168 kbrd_init(stdin); 169 (void) z8530_init(z8530, devno, inr, cir, cir_arg, &kbrdin); 163 170 164 171 /* … … 180 187 ns16550 = (ns16550_t *) hw_map(aligned_addr, offset + size) + 181 188 offset; 182 (void) ns16550_init(ns16550, devno, inr, cir, cir_arg); 189 kbrd_init(stdin); 190 (void) ns16550_init(ns16550, devno, inr, cir, cir_arg, &kbrdin); 183 191 184 192 /* -
kernel/arch/sparc64/src/sparc64.c
re06da7e r411b6a6 90 90 */ 91 91 irq_init(1 << 11, 128); 92 93 standalone_sparc64_console_init();94 92 } 95 93 } … … 105 103 void arch_post_smp_init(void) 106 104 { 107 static thread_t *t = NULL; 105 if (config.cpu_active == 1) { 106 standalone_sparc64_console_init(); 108 107 109 if (!t) {110 /*111 * Create thread that polls keyboard.112 */113 t = thread_create(kkbdpoll, NULL, TASK, 0, "kkbdpoll",true);108 /* Create thread that polls keyboard. 109 * XXX: this is only used by sgcn now 110 */ 111 thread_t *t = thread_create(kkbdpoll, NULL, TASK, 0, "kkbdpoll", 112 true); 114 113 if (!t) 115 114 panic("Cannot create kkbdpoll."); -
kernel/genarch/Makefile.inc
re06da7e r411b6a6 71 71 ifeq ($(CONFIG_I8042),y) 72 72 GENARCH_SOURCES += \ 73 genarch/src/kbd/i8042.c \ 74 genarch/src/kbd/key.c \ 75 genarch/src/kbd/scanc_pc.c 73 genarch/src/drivers/i8042/i8042.c 74 endif 75 76 ifeq ($(CONFIG_NS16550),y) 77 GENARCH_SOURCES += \ 78 genarch/src/drivers/ns16550/ns16550.c 79 endif 80 81 ifeq ($(CONFIG_Z8530),y) 82 GENARCH_SOURCES += \ 83 genarch/src/drivers/z8530/z8530.c 84 endif 85 86 ifeq ($(CONFIG_PC_KBD),y) 87 GENARCH_SOURCES += \ 88 genarch/src/kbrd/kbrd.c \ 89 genarch/src/kbrd/scanc_pc.c 76 90 endif 77 91 78 92 ifeq ($(CONFIG_SUN_KBD),y) 79 93 GENARCH_SOURCES += \ 80 genarch/src/kb d/key.c \81 genarch/src/kb d/scanc_sun.c94 genarch/src/kbrd/kbrd.c \ 95 genarch/src/kbrd/scanc_sun.c 82 96 endif 83 97 84 ifeq ($(CONFIG_Z8530),y) 85 GENARCH_SOURCES += \ 86 genarch/src/kbd/z8530.c 87 endif 88 89 ifeq ($(CONFIG_NS16550),y) 90 GENARCH_SOURCES += \ 91 genarch/src/kbd/ns16550.c 92 endif 93 94 ifeq ($(CONFIG_OFW_TREE), y) 98 ifeq ($(CONFIG_OFW_TREE),y) 95 99 GENARCH_SOURCES += \ 96 100 genarch/src/ofw/ofw_tree.c \ -
kernel/genarch/include/drivers/i8042/i8042.h
re06da7e r411b6a6 38 38 #include <ddi/irq.h> 39 39 #include <arch/types.h> 40 #include <console/chardev.h> 40 41 #include <typedefs.h> 41 42 … … 51 52 irq_t irq; 52 53 i8042_t *i8042; 54 chardev_t *devout; 53 55 } i8042_instance_t; 54 56 55 extern bool i8042_init(i8042_t *, devno_t, inr_t );57 extern bool i8042_init(i8042_t *, devno_t, inr_t, chardev_t *); 56 58 57 59 #endif -
kernel/genarch/include/drivers/ns16550/ns16550.h
re06da7e r411b6a6 32 32 /** 33 33 * @file 34 * @brief Headers for NS 16550 serial port / keyboard driver.34 * @brief Headers for NS 16550 serial controller. 35 35 */ 36 36 … … 40 40 #include <ddi/irq.h> 41 41 #include <arch/types.h> 42 #include < arch/drivers/kbd.h>42 #include <console/chardev.h> 43 43 44 44 #define IER_ERBFI 0x01 /** Enable Receive Buffer Full Interrupt. */ … … 67 67 ns16550_t *ns16550; 68 68 irq_t irq; 69 chardev_t *devout; 69 70 } ns16550_instance_t; 70 71 71 extern bool ns16550_init(ns16550_t *, devno_t, inr_t, cir_t, void *); 72 extern bool ns16550_init(ns16550_t *, devno_t, inr_t, cir_t, void *, 73 chardev_t *); 72 74 extern irq_ownership_t ns16550_claim(irq_t *); 73 75 extern void ns16550_irq_handler(irq_t *); -
kernel/genarch/include/drivers/z8530/z8530.h
re06da7e r411b6a6 1 1 /* 2 * Copyright (c) 200 1-2004Jakub Jermar2 * Copyright (c) 2009 Jakub Jermar 3 3 * All rights reserved. 4 4 * … … 32 32 /** 33 33 * @file 34 * @brief Headers for Zilog 8530 serial port / keyboard driver.34 * @brief Headers for Zilog 8530 serial controller. 35 35 */ 36 36 … … 40 40 #include <ddi/irq.h> 41 41 #include <arch/types.h> 42 #include <console/chardev.h> 42 43 43 44 #define WR0 0 … … 118 119 irq_t irq; 119 120 z8530_t *z8530; 121 chardev_t *devout; 120 122 } z8530_instance_t; 121 123 122 extern bool z8530_init(z8530_t *, devno_t, inr_t, cir_t, void * );124 extern bool z8530_init(z8530_t *, devno_t, inr_t, cir_t, void *, chardev_t *); 123 125 extern irq_ownership_t z8530_claim(irq_t *); 124 126 extern void z8530_irq_handler(irq_t *); -
kernel/genarch/include/kbrd/kbrd.h
re06da7e r411b6a6 34 34 */ 35 35 36 #ifndef KERN_K EY_H_37 #define KERN_K EY_H_36 #ifndef KERN_KBD_H_ 37 #define KERN_KBD_H_ 38 38 39 #include <arch/types.h>40 39 #include <console/chardev.h> 41 40 42 #define KEY_RELEASE 0x80 41 extern chardev_t kbrdin; 43 42 44 extern chardev_t kbrd; 45 46 extern void key_released(uint8_t sc); 47 extern void key_pressed(uint8_t sc); 48 extern uint8_t active_read_buff_read(void); 49 extern void active_read_buff_write(uint8_t ch); 50 extern void active_read_key_pressed(uint8_t sc); 43 extern void kbrd_init(chardev_t *); 51 44 52 45 #endif -
kernel/genarch/src/drivers/i8042/i8042.c
re06da7e r411b6a6 32 32 /** 33 33 * @file 34 * @brief i8042 processor driver .34 * @brief i8042 processor driver 35 35 * 36 * It takes care of low-level keyboard functions.36 * It takes care of the i8042 serial communication. 37 37 */ 38 38 39 #include <genarch/kbd/i8042.h> 40 #include <arch/drivers/kbd.h> 41 #include <genarch/kbd/key.h> 42 #include <genarch/kbd/scanc.h> 43 #include <genarch/kbd/scanc_pc.h> 39 #include <genarch/drivers/i8042/i8042.h> 44 40 #include <genarch/drivers/legacy/ia32/io.h> 45 #include <cpu.h>46 41 #include <arch/asm.h> 47 #include <arch.h>48 42 #include <console/chardev.h> 49 #include <console/console.h> 50 #include <interrupt.h> 51 52 /* Keyboard commands. */ 53 #define KBD_ENABLE 0xf4 54 #define KBD_DISABLE 0xf5 55 #define KBD_ACK 0xfa 56 57 /* 58 * 60 Write 8042 Command Byte: next data byte written to port 60h is 59 * placed in 8042 command register. Format: 60 * 61 * |7|6|5|4|3|2|1|0|8042 Command Byte 62 * | | | | | | | `---- 1=enable output register full interrupt 63 * | | | | | | `----- should be 0 64 * | | | | | `------ 1=set status register system, 0=clear 65 * | | | | `------- 1=override keyboard inhibit, 0=allow inhibit 66 * | | | `-------- disable keyboard I/O by driving clock line low 67 * | | `--------- disable auxiliary device, drives clock line low 68 * | `---------- IBM scancode translation 0=AT, 1=PC/XT 69 * `----------- reserved, should be 0 70 */ 43 #include <mm/slab.h> 71 44 72 45 #define i8042_SET_COMMAND 0x60 … … 75 48 #define i8042_BUFFER_FULL_MASK 0x01 76 49 #define i8042_WAIT_MASK 0x02 77 #define i8042_MOUSE_DATA 0x2078 79 static void i8042_suspend(chardev_t *);80 static void i8042_resume(chardev_t *);81 82 static chardev_operations_t ops = {83 .suspend = i8042_suspend,84 .resume = i8042_resume,85 };86 50 87 51 static irq_ownership_t i8042_claim(irq_t *irq) … … 106 70 data = pio_read_8(&dev->data); 107 71 108 if ((status & i8042_MOUSE_DATA)) 109 return; 110 111 if (data & KEY_RELEASE) 112 key_released(data ^ KEY_RELEASE); 113 else 114 key_pressed(data); 72 if (instance->devout) 73 chardev_push_character(instance->devout, data); 115 74 } 116 75 } … … 118 77 /** Initialize i8042. */ 119 78 bool 120 i8042_init(i8042_t *dev, devno_t devno, inr_t inr )79 i8042_init(i8042_t *dev, devno_t devno, inr_t inr, chardev_t *devout) 121 80 { 122 81 i8042_instance_t *instance; 123 82 124 chardev_initialize("i8042_kbd", &kbrd, &ops);125 stdin = &kbrd;126 127 83 instance = malloc(sizeof(i8042_instance_t), FRAME_ATOMIC); 128 84 if (!instance) … … 131 87 instance->devno = devno; 132 88 instance->i8042 = dev; 89 instance->devout = devout; 133 90 134 91 irq_initialize(&instance->irq); … … 139 96 instance->irq.instance = instance; 140 97 irq_register(&instance->irq); 141 142 trap_virtual_enable_irqs(1 << inr);143 98 144 99 /* … … 151 106 } 152 107 153 /* Called from getc(). */154 void i8042_resume(chardev_t *d)155 {156 }157 158 /* Called from getc(). */159 void i8042_suspend(chardev_t *d)160 {161 }162 163 108 /** @} 164 109 */ -
kernel/genarch/src/drivers/ns16550/ns16550.c
re06da7e r411b6a6 32 32 /** 33 33 * @file 34 * @brief NS 16550 serial port / keyboarddriver.34 * @brief NS 16550 serial controller driver. 35 35 */ 36 36 37 #include <genarch/kbd/ns16550.h> 38 #include <genarch/kbd/key.h> 39 #include <genarch/kbd/scanc.h> 40 #include <genarch/kbd/scanc_sun.h> 41 #include <arch/drivers/kbd.h> 37 #include <genarch/drivers/ns16550/ns16550.h> 42 38 #include <ddi/irq.h> 43 #include <cpu.h>44 39 #include <arch/asm.h> 45 #include <arch.h>46 40 #include <console/chardev.h> 47 #include <console/console.h>48 #include <interrupt.h>49 #include <arch/interrupt.h>50 #include <synch/spinlock.h>51 41 #include <mm/slab.h> 52 42 53 43 #define LSR_DATA_READY 0x01 54 55 /*56 * These codes read from ns16550 data register are silently ignored.57 */58 #define IGNORE_CODE 0x7f /* all keys up */59 60 static void ns16550_suspend(chardev_t *);61 static void ns16550_resume(chardev_t *);62 63 static chardev_operations_t ops = {64 .suspend = ns16550_suspend,65 .resume = ns16550_resume,66 };67 44 68 45 /** Initialize ns16550. … … 73 50 * @param cir Clear interrupt function. 74 51 * @param cir_arg First argument to cir. 52 * @param devout Output character device. 75 53 * 76 54 * @return True on success, false on failure. 77 55 */ 78 56 bool 79 ns16550_init(ns16550_t *dev, devno_t devno, inr_t inr, cir_t cir, void *cir_arg) 57 ns16550_init(ns16550_t *dev, devno_t devno, inr_t inr, cir_t cir, void *cir_arg, 58 chardev_t *devout) 80 59 { 81 60 ns16550_instance_t *instance; 82 83 chardev_initialize("ns16550_kbd", &kbrd, &ops);84 stdin = &kbrd;85 61 86 62 instance = malloc(sizeof(ns16550_instance_t), FRAME_ATOMIC); … … 90 66 instance->devno = devno; 91 67 instance->ns16550 = dev; 68 instance->devout = devout; 92 69 93 70 irq_initialize(&instance->irq); … … 111 88 } 112 89 113 /* Called from getc(). */114 void ns16550_resume(chardev_t *d)115 {116 }117 118 /* Called from getc(). */119 void ns16550_suspend(chardev_t *d)120 {121 }122 123 90 irq_ownership_t ns16550_claim(irq_t *irq) 124 91 { 125 ns16550_instance_t * ns16550_instance = irq->instance;126 ns16550_t *dev = ns16550_instance->ns16550;92 ns16550_instance_t *instance = irq->instance; 93 ns16550_t *dev = instance->ns16550; 127 94 128 95 if (pio_read_8(&dev->lsr) & LSR_DATA_READY) … … 134 101 void ns16550_irq_handler(irq_t *irq) 135 102 { 136 ns16550_instance_t * ns16550_instance = irq->instance;137 ns16550_t *dev = ns16550_instance->ns16550;103 ns16550_instance_t *instance = irq->instance; 104 ns16550_t *dev = instance->ns16550; 138 105 139 106 if (pio_read_8(&dev->lsr) & LSR_DATA_READY) { … … 141 108 142 109 x = pio_read_8(&dev->rbr); 143 144 if (x != IGNORE_CODE) { 145 if (x & KEY_RELEASE) 146 key_released(x ^ KEY_RELEASE); 147 else 148 key_pressed(x); 149 } 110 if (instance->devout) 111 chardev_push_character(instance->devout, x); 150 112 } 151 152 113 } 153 114 -
kernel/genarch/src/drivers/z8530/z8530.c
re06da7e r411b6a6 32 32 /** 33 33 * @file 34 * @brief Zilog 8530 serial portdriver.34 * @brief Zilog 8530 serial controller driver. 35 35 */ 36 36 37 #include <genarch/kbd/z8530.h> 38 #include <genarch/kbd/key.h> 39 #include <genarch/kbd/scanc.h> 40 #include <genarch/kbd/scanc_sun.h> 41 #include <arch/drivers/kbd.h> 42 #include <console/console.h> 37 #include <genarch/drivers/z8530/z8530.h> 43 38 #include <console/chardev.h> 44 39 #include <ddi/irq.h> … … 66 61 } 67 62 68 /*69 * These codes read from z8530 data register are silently ignored.70 */71 #define IGNORE_CODE 0x7f /* all keys up */72 73 static void z8530_suspend(chardev_t *);74 static void z8530_resume(chardev_t *);75 76 static chardev_operations_t ops = {77 .suspend = z8530_suspend,78 .resume = z8530_resume,79 };80 81 63 /** Initialize z8530. */ 82 64 bool 83 z8530_init(z8530_t *dev, devno_t devno, inr_t inr, cir_t cir, void *cir_arg) 65 z8530_init(z8530_t *dev, devno_t devno, inr_t inr, cir_t cir, void *cir_arg, 66 chardev_t *devout) 84 67 { 85 68 z8530_instance_t *instance; 86 87 chardev_initialize("z8530_kbd", &kbrd, &ops);88 stdin = &kbrd;89 69 90 70 instance = malloc(sizeof(z8530_instance_t), FRAME_ATOMIC); … … 94 74 instance->devno = devno; 95 75 instance->z8530 = dev; 76 instance->devout = devout; 96 77 97 78 irq_initialize(&instance->irq); … … 125 106 } 126 107 127 /* Called from getc(). */128 void z8530_resume(chardev_t *d)129 {130 }131 132 /* Called from getc(). */133 void z8530_suspend(chardev_t *d)134 {135 }136 137 108 irq_ownership_t z8530_claim(irq_t *irq) 138 109 { … … 140 111 z8530_t *dev = instance->z8530; 141 112 142 return (z8530_read(&dev->ctl_a, RR0) & RR0_RCA); 113 if (z8530_read(&dev->ctl_a, RR0) & RR0_RCA) 114 return IRQ_ACCEPT; 115 else 116 return IRQ_DECLINE; 143 117 } 144 118 … … 151 125 if (z8530_read(&dev->ctl_a, RR0) & RR0_RCA) { 152 126 x = z8530_read(&dev->ctl_a, RR8); 153 if (x != IGNORE_CODE) { 154 if (x & KEY_RELEASE) 155 key_released(x ^ KEY_RELEASE); 156 else 157 key_pressed(x); 158 } 127 if (instance->devout) 128 chardev_push_character(instance->devout, x); 159 129 } 160 130 } -
kernel/genarch/src/kbrd/scanc_pc.c
re06da7e r411b6a6 35 35 */ 36 36 37 #include <genarch/kb d/scanc.h>37 #include <genarch/kbrd/scanc.h> 38 38 39 39 /** Primary meaning of scancodes. */ -
kernel/genarch/src/kbrd/scanc_sun.c
re06da7e r411b6a6 35 35 */ 36 36 37 #include <genarch/kb d/scanc.h>37 #include <genarch/kbrd/scanc.h> 38 38 39 39 /** Primary meaning of scancodes. */ -
kernel/generic/include/console/console.h
re06da7e r411b6a6 44 44 extern bool silent; 45 45 46 extern void console_init(void); 47 46 48 extern void klog_init(void); 47 49 extern void klog_update(void); 48 50 49 51 extern uint8_t getc(chardev_t *chardev); 50 uint8_t _getc(chardev_t *chardev);52 extern uint8_t _getc(chardev_t *chardev); 51 53 extern count_t gets(chardev_t *chardev, char *buf, size_t buflen); 52 54 extern void putchar(char c); -
kernel/generic/src/console/console.c
re06da7e r411b6a6 107 107 } 108 108 109 static void stdin_suspend(chardev_t *d) 110 { 111 } 112 113 static void stdin_resume(chardev_t *d) 114 { 115 } 116 117 static chardev_operations_t stdin_ops = { 118 .suspend = stdin_suspend, 119 .resume = stdin_resume, 120 }; 121 109 122 /** Standard input character device */ 123 static chardev_t _stdin; 110 124 chardev_t *stdin = NULL; 111 125 chardev_t *stdout = &null_stdout; 126 127 void console_init(void) 128 { 129 chardev_initialize("stdin", &_stdin, &stdin_ops); 130 stdin = &_stdin; 131 } 112 132 113 133 /** Initialize kernel logging facility -
kernel/generic/src/main/main.c
re06da7e r411b6a6 257 257 LOG_EXEC(ipc_init()); 258 258 LOG_EXEC(klog_init()); 259 LOG_EXEC(console_init()); 259 260 260 261 #ifdef CONFIG_KCONSOLE
Note:
See TracChangeset
for help on using the changeset viewer.