Changeset 24ff4df in mainline
- Timestamp:
- 2009-02-18T21:47:05Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 96f392c
- Parents:
- f89979b
- Location:
- uspace/srv
- Files:
-
- 1 added
- 30 deleted
- 10 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/console/console.c
rf89979b r24ff4df 36 36 #include <fb.h> 37 37 #include <ipc/ipc.h> 38 #include <k eys.h>38 #include <kbd.h> 39 39 #include <kbd/keycode.h> 40 40 #include <ipc/fb.h> -
uspace/srv/kbd/Makefile
rf89979b r24ff4df 111 111 ifeq ($(UARCH), sparc64) 112 112 GENARCH_SOURCES += \ 113 port/ dummy.c \114 ctl/s tty.c113 port/z8350.c \ 114 ctl/sun.c 115 115 endif 116 116 -
uspace/srv/kbd/ctl/gxe_fb.c
rf89979b r24ff4df 27 27 */ 28 28 29 /** @addtogroup kbd 29 /** @addtogroup kbd_ctl 30 * @ingroup kbd 31 * @{ 32 */ 33 /** 34 * @file 30 35 * @brief GXEmul framebuffer-mode keyboard controller driver. 31 * @{ 32 */ 36 */ 33 37 34 38 #include <kbd.h> -
uspace/srv/kbd/ctl/pc.c
rf89979b r24ff4df 27 27 */ 28 28 29 /** @addtogroup kbd 29 /** @addtogroup kbd_ctl 30 * @ingroup kbd 31 * @{ 32 */ 33 /** 34 * @file 30 35 * @brief PC keyboard controller driver. 31 * @{ 32 */ 36 */ 33 37 34 38 #include <kbd.h> … … 37 41 #include <kbd_ctl.h> 38 42 39 int scanmap_simple[];43 static int scanmap_simple[]; 40 44 41 45 void kbd_ctl_parse_scancode(int scancode) … … 44 48 unsigned int key; 45 49 46 if (scancode < 0 || scancode >= 0x100) return; 50 if (scancode < 0 || scancode >= 0x100) 51 return; 47 52 48 53 if (scancode & 0x80) { … … 58 63 } 59 64 60 int scanmap_simple[128] = {65 static int scanmap_simple[128] = { 61 66 62 67 [0x29] = KC_BACKTICK, -
uspace/srv/kbd/ctl/stty.c
rf89979b r24ff4df 27 27 */ 28 28 29 /** @addtogroup kbd 29 /** @addtogroup kbd_ctl 30 * @ingroup kbd 31 * @{ 32 */ 33 /** 34 * @file 30 35 * @brief Serial TTY-like keyboard controller driver. 31 * @{ 32 */ 36 */ 33 37 34 38 #include <kbd.h> -
uspace/srv/kbd/port/dummy.c
rf89979b r24ff4df 27 27 */ 28 28 29 /** @addtogroup kbd 29 /** @addtogroup kbd_port 30 30 * @brief Dummy keyboard port driver. 31 * @ingroup kbd 31 32 * @{ 32 33 */ -
uspace/srv/kbd/port/gxemul.c
rf89979b r24ff4df 27 27 */ 28 28 29 /** @addtogroup kbd 29 /** @addtogroup kbd_port 30 30 * @{ 31 * @ingroup kbd 31 32 */ 32 33 /** @file -
uspace/srv/kbd/port/i8042.c
rf89979b r24ff4df 28 28 */ 29 29 30 /** @addtogroup kbd 30 /** @addtogroup kbd_port 31 * @ingroup kbd 31 32 * @{ 32 33 */ 33 34 /** @file 35 * @brief i8042 port driver. 34 36 */ 35 37 -
uspace/srv/kbd/port/i8042.h
rf89979b r24ff4df 27 27 */ 28 28 29 /** @addtogroup kbdamd64 amd64 30 * @brief HelenOS ia32 / amd64 arch dependent parts of uspace keyboard and mouse handler. 29 /** @addtogroup kbd_port 31 30 * @ingroup kbd 32 31 * @{ … … 34 33 35 34 /** @file 36 * @ ingroup kbdia3235 * @brief i8042 port driver. 37 36 */ 38 37 -
uspace/srv/kbd/port/msim.c
rf89979b r24ff4df 27 27 */ 28 28 29 /** @addtogroup kbd 30 * @ brief Msim keyboard port driver.29 /** @addtogroup kbd_port 30 * @ingroup kbd 31 31 * @{ 32 32 */ 33 33 /** @file 34 * @brief Msim keyboard port driver. 34 35 */ 35 36 -
uspace/srv/kbd/port/ns16550.c
rf89979b r24ff4df 27 27 */ 28 28 29 /** @addtogroup kbdamd64 amd64 30 * @brief HelenOS ia32 / amd64 arch dependent parts of uspace keyboard and mouse handler. 29 /** @addtogroup kbd_port 31 30 * @ingroup kbd 32 31 * @{ 32 */ 33 /** @file 34 * @brief NS16550 port driver. 33 35 */ 34 36 35 /** @file 36 * @ingroup kbdia32 37 */ 37 #include <ipc/ipc.h> 38 #include <async.h> 39 #include <sysinfo.h> 40 #include <kbd.h> 41 #include <kbd_port.h> 42 #include <ddi.h> 38 43 39 #ifndef KBD_ia32_KBD_H_ 40 #define KBD_ia32_KBD_H_ 44 /* NS16550 registers */ 45 #define RBR_REG 0 /** Receiver Buffer Register. */ 46 #define IER_REG 1 /** Interrupt Enable Register. */ 47 #define IIR_REG 2 /** Interrupt Ident Register (read). */ 48 #define FCR_REG 2 /** FIFO control register (write). */ 49 #define LCR_REG 3 /** Line Control register. */ 50 #define MCR_REG 4 /** Modem Control Register. */ 51 #define LSR_REG 5 /** Line Status Register. */ 41 52 42 #include <ddi.h> 43 #include <libarch/ddi.h> 53 irq_cmd_t ns16550_cmds[1] = { 54 { CMD_PORT_READ_1, 0, 0, 2 }, 55 }; 44 56 45 #define i8042_DATA 0x60 46 #define i8042_STATUS 0X64 57 irq_code_t ns16550_kbd = { 58 1, 59 ns16550_cmds 60 }; 47 61 62 static void ns16550_irq_handler(ipc_callid_t iid, ipc_call_t *call); 48 63 49 typedef unsigned char u8; 50 typedef short u16; 64 uint16_t ns16550_port; 51 65 52 static inline void i8042_data_write(u8 data)66 int kbd_port_init(void) 53 67 { 54 outb(i8042_DATA, data); 68 async_set_interrupt_received(ns16550_irq_handler); 69 70 ns16550_port = sysinfo_value("kbd.port"); 71 ns16550_kbd.cmds[0].addr = (void *) (ns16550_port + RBR_REG); 72 ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), 73 0, &ns16550_kbd); 74 iospace_enable(task_get_id(), ns16550_port, 8); 75 76 return 0; 55 77 } 56 78 57 static inline u8 i8042_data_read(void) 79 #define LSR_DATA_READY 0x01 80 81 static void ns16550_irq_handler(ipc_callid_t iid, ipc_call_t *call) 58 82 { 59 return inb(i8042_DATA); 83 int scan_code = IPC_GET_ARG2(*call); 84 kbd_push_scancode(scan_code); 60 85 } 61 62 static inline u8 i8042_status_read(void)63 {64 return inb(i8042_STATUS);65 }66 67 static inline void i8042_command_write(u8 command)68 {69 outb(i8042_STATUS, command);70 }71 72 #endif73 86 74 87 /** 75 88 * @} 76 */ 89 */ -
uspace/srv/kbd/port/sgcn.c
rf89979b r24ff4df 27 27 */ 28 28 29 /** @addtogroup kbdsparc64 sparc64 30 * @brief Serengeti-specific parts of uspace keyboard handler. 29 /** @addtogroup kbd_port 31 30 * @ingroup kbd 32 31 * @{ 33 32 */ 34 33 /** @file 34 * @brief Z8350 keyboard port driver. 35 * @brief SGCN (Serengeti Console) keyboard port driver. 35 36 */ 36 37 37 #include <arch/sgcn.h>38 38 #include <as.h> 39 39 #include <ddi.h> 40 40 #include <ipc/ipc.h> 41 #include <async.h> 41 42 #include <kbd.h> 42 #include <genarch/nofb.h> 43 #include <genarch/kbd.h> 43 #include <kbd_port.h> 44 44 #include <sysinfo.h> 45 45 #include <stdio.h> 46 #include <futex.h>47 46 48 47 /** … … 80 79 #define SGCN_BUFFER_HEADER (SGCN_BUFFER(sgcn_buffer_header_t, 0)) 81 80 82 extern keybuffer_t keybuffer;83 84 81 /** 85 82 * Virtual address mapped to SRAM. … … 92 89 static uintptr_t sram_buffer_offset; 93 90 91 static void sgcn_irq_handler(ipc_callid_t iid, ipc_call_t *call); 92 93 94 94 /** 95 95 * Initializes the SGCN driver. 96 96 * Maps the physical memory (SRAM) and registers the interrupt. 97 97 */ 98 void sgcn_init(void)98 int kbd_port_init(void) 99 99 { 100 async_set_interrupt_received(sgcn_irq_handler); 100 101 sram_virt_addr = (uintptr_t) as_get_mappable_page(sysinfo_value("sram.area.size")); 101 102 if (physmem_map((void *) sysinfo_value("sram.address.physical"), 102 103 (void *) sram_virt_addr, sysinfo_value("sram.area.size") / PAGE_SIZE, 103 AS_AREA_READ | AS_AREA_WRITE) != 0) 104 AS_AREA_READ | AS_AREA_WRITE) != 0) { 104 105 printf("SGCN: uspace driver could not map physical memory."); 106 return -1; 107 } 105 108 106 109 sram_buffer_offset = sysinfo_value("sram.buffer.offset"); 107 110 ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), 108 111 0, (void *) 0); 112 return 0; 109 113 } 110 114 … … 113 117 * the buffer. 114 118 */ 115 void sgcn_key_pressed(void)119 static void sgcn_irq_handler(ipc_callid_t iid, ipc_call_t *call) 116 120 { 117 121 char c; … … 131 135 buf_ptr = (volatile char *) 132 136 SGCN_BUFFER(char, SGCN_BUFFER_HEADER->in_rdptr); 133 if (c == '\r') { 134 c = '\n'; 135 } 136 kbd_process_no_fb(&keybuffer, c); 137 kbd_push_scancode(c); 137 138 } 138 139 } -
uspace/srv/kbd/port/z8530.c
rf89979b r24ff4df 1 1 /* 2 * Copyright (c) 2006 Josef Cejka2 * Copyright (c) 2006 Martin Decky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup kbdamd64 amd64 30 * @brief HelenOS ia32 / amd64 arch dependent parts of uspace keyboard and mouse handler. 29 /** @addtogroup kbd_port 31 30 * @ingroup kbd 32 31 * @{ 32 */ 33 /** @file 34 * @brief Z8350 keyboard port driver. 33 35 */ 34 36 35 /** @file 36 * @ingroup kbdia32 37 */ 37 #include <ipc/ipc.h> 38 #include <async.h> 39 #include <sysinfo.h> 40 #include <kbd.h> 41 #include <kbd_port.h> 42 #include <sys/types.h> 38 43 39 #ifndef KBD_ia32_KBD_H_ 40 #define KBD_ia32_KBD_H_ 44 /** Top-half pseudocode for z8530. */ 45 irq_cmd_t z8530_cmds[] = { 46 { 47 CMD_MEM_READ_1, 48 0, /**< Address. Will be patched in run-time. */ 49 0, /**< Value. Not used. */ 50 1 /**< Arg 1 will contain the result. */ 51 } 52 }; 41 53 42 #include <ddi.h> 43 #include <libarch/ddi.h> 54 55 irq_code_t z8530_kbd = { 56 1, 57 z8530_cmds 58 }; 44 59 45 #define i8042_DATA 0x60 46 #define i8042_STATUS 0X64 60 static void z8530_irq_handler(ipc_callid_t iid, ipc_call_t *call); 47 61 48 49 typedef unsigned char u8; 50 typedef short u16; 51 52 static inline void i8042_data_write(u8 data) 62 int kbd_port_init(void) 53 63 { 54 outb(i8042_DATA, data); 64 async_set_interrupt_received(z8350_irq_handler); 65 z8530_cmds[0].addr = (void *) sysinfo_value("kbd.address.virtual") + 6; 66 ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), 67 0, &z8530_kbd); 68 return 0; 55 69 } 56 70 57 static inline u8 i8042_data_read(void)71 static void z8530_irq_handler(ipc_callid_t iid, ipc_call_t *call) 58 72 { 59 return inb(i8042_DATA); 73 int scan_code = IPC_GET_ARG1(*call); 74 kbd_push_scancode(scan_code); 60 75 } 61 76 62 static inline u8 i8042_status_read(void) 63 { 64 return inb(i8042_STATUS); 65 } 66 67 static inline void i8042_command_write(u8 command) 68 { 69 outb(i8042_STATUS, command); 70 } 71 72 #endif 73 74 /** 75 * @} 76 */ 77 /** @} 78 */
Note:
See TracChangeset
for help on using the changeset viewer.