Changeset ff685c9 in mainline
- Timestamp:
- 2009-03-03T23:00:33Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 150385b9
- Parents:
- 9cd98796
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/src/amd64.c
r9cd98796 rff685c9 200 200 sysinfo_set_item_val("kbd.devno", NULL, devno); 201 201 sysinfo_set_item_val("kbd.inr", NULL, IRQ_KBD); 202 sysinfo_set_item_val("kbd.address.physical", NULL, 203 (uintptr_t) I8042_BASE); 204 sysinfo_set_item_val("kbd.address.kernel", NULL, 205 (uintptr_t) I8042_BASE); 202 206 } 203 207 -
kernel/arch/ia32/src/ia32.c
r9cd98796 rff685c9 158 158 sysinfo_set_item_val("kbd.devno", NULL, devno); 159 159 sysinfo_set_item_val("kbd.inr", NULL, IRQ_KBD); 160 sysinfo_set_item_val("kbd.address.physical", NULL, 161 (uintptr_t) I8042_BASE); 162 sysinfo_set_item_val("kbd.address.kernel", NULL, 163 (uintptr_t) I8042_BASE); 160 164 } 161 165 -
kernel/arch/ia64/src/ia64.c
r9cd98796 rff685c9 169 169 (void) ns16550_init((ns16550_t *)NS16550_BASE, devno, inr, NULL, NULL); 170 170 sysinfo_set_item_val("kbd.type", NULL, KBD_NS16550); 171 sysinfo_set_item_val("kbd.port", NULL, (uintptr_t)NS16550_BASE); 171 sysinfo_set_item_val("kbd.address.physical", NULL, 172 (uintptr_t) NS16550_BASE); 173 sysinfo_set_item_val("kbd.address.kernel", NULL, 174 (uintptr_t) NS16550_BASE); 172 175 #else 173 176 inr = IRQ_KBD; 174 177 (void) i8042_init((i8042_t *)I8042_BASE, devno, inr); 175 178 sysinfo_set_item_val("kbd.type", NULL, KBD_LEGACY); 179 sysinfo_set_item_val("kbd.address.physical", NULL, 180 (uintptr_t) I8042_BASE); 181 sysinfo_set_item_val("kbd.address.kernel", NULL, 182 (uintptr_t) I8042_BASE); 176 183 #endif 177 184 sysinfo_set_item_val("kbd", NULL, true); -
kernel/arch/sparc64/src/drivers/kbd.c
r9cd98796 rff685c9 170 170 sysinfo_set_item_val("kbd.devno", NULL, devno); 171 171 sysinfo_set_item_val("kbd.inr", NULL, inr); 172 sysinfo_set_item_val("kbd.address. virtual", NULL,172 sysinfo_set_item_val("kbd.address.kernel", NULL, 173 173 (uintptr_t) z8530); 174 174 sysinfo_set_item_val("kbd.address.physical", NULL, pa); … … 190 190 sysinfo_set_item_val("kbd.devno", NULL, devno); 191 191 sysinfo_set_item_val("kbd.inr", NULL, inr); 192 sysinfo_set_item_val("kbd.address. virtual", NULL,192 sysinfo_set_item_val("kbd.address.kernel", NULL, 193 193 (uintptr_t) ns16550); 194 194 sysinfo_set_item_val("kbd.address.physical", NULL, pa); -
uspace/srv/kbd/port/i8042.c
r9cd98796 rff685c9 36 36 */ 37 37 38 #include <ddi.h> 39 #include <libarch/ddi.h> 38 40 #include <ipc/ipc.h> 39 41 #include <async.h> … … 67 69 { 68 70 .cmd = CMD_PIO_READ_8, 69 .addr = (void *) 0x64,71 .addr = NULL, /* will be patched in run-time */ 70 72 .dstarg = 1 71 73 }, … … 83 85 { 84 86 .cmd = CMD_PIO_READ_8, 85 .addr = (void *) 0x60,87 .addr = NULL, /* will be patched in run-time */ 86 88 .dstarg = 2 87 89 }, … … 96 98 }; 97 99 100 static uintptr_t i8042_physical; 101 static uintptr_t i8042_kernel; 102 static i8042_t * i8042; 103 98 104 static void wait_ready(void) { 99 while ( i8042_status_read() & i8042_INPUT_FULL)100 105 while (pio_read_8(&i8042->status) & i8042_INPUT_FULL) 106 ; 101 107 } 102 108 … … 105 111 int kbd_port_init(void) 106 112 { 107 // int i;108 113 int mouseenabled = 0; 114 void *vaddr; 115 116 i8042_physical = sysinfo_value("kbd.address.physical"); 117 i8042_kernel = sysinfo_value("kbd.address.kernel"); 118 if (pio_enable((void *) i8042_physical, sizeof(i8042_t), &vaddr) != 0) 119 return -1; 120 i8042 = vaddr; 109 121 110 122 async_set_interrupt_received(i8042_irq_handler); 111 iospace_enable(task_get_id(), (void *) i8042_DATA, 5);112 123 113 124 /* Disable kbd, enable mouse */ 114 i8042_command_write(i8042_CMD_KBD);125 pio_write_8(&i8042->status, i8042_CMD_KBD); 115 126 wait_ready(); 116 i8042_command_write(i8042_CMD_KBD);127 pio_write_8(&i8042->status, i8042_CMD_KBD); 117 128 wait_ready(); 118 i8042_data_write(i8042_KBD_DISABLE);129 pio_write_8(&i8042->data, i8042_KBD_DISABLE); 119 130 wait_ready(); 120 131 121 132 /* Flush all current IO */ 122 while ( i8042_status_read() & i8042_OUTPUT_FULL)123 i8042_data_read();133 while (pio_read_8(&i8042->status) & i8042_OUTPUT_FULL) 134 (void) pio_read_8(&i8042->data); 124 135 125 /* Initialize mouse */126 /* i8042_command_write(i8042_CMD_MOUSE);127 wait_ready();128 i8042_data_write(MOUSE_OUT_INIT);129 wait_ready();130 131 int mouseanswer = 0;132 for (i=0;i < 1000; i++) {133 int status = i8042_status_read();134 if (status & i8042_OUTPUT_FULL) {135 int data = i8042_data_read();136 if (status & i8042_MOUSE_DATA) {137 mouseanswer = data;138 break;139 }140 }141 usleep(1000);142 }*/143 // if (mouseanswer == MOUSE_ACK) {144 // /* enable mouse */145 // mouseenabled = 1;146 //147 // ipc_register_irq(sysinfo_value("mouse.inr"), sysinfo_value("mouse.devno"), 0, &i8042_kbd);148 // }149 150 136 /* Enable kbd */ 137 i8042_kbd.cmds[0].addr = &((i8042_t *) i8042_kernel)->status; 138 i8042_kbd.cmds[3].addr = &((i8042_t *) i8042_kernel)->data; 151 139 ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), 0, &i8042_kbd); 152 140 … … 155 143 newcontrol |= i8042_MOUSE_IE; 156 144 157 i8042_command_write(i8042_CMD_KBD);145 pio_write_8(&i8042->status, i8042_CMD_KBD); 158 146 wait_ready(); 159 i8042_data_write(newcontrol);147 pio_write_8(&i8042->data, newcontrol); 160 148 wait_ready(); 161 149 … … 168 156 169 157 if ((status & i8042_MOUSE_DATA)) 170 return 0;158 return; 171 159 172 160 int scan_code = IPC_GET_ARG2(*call); 173 161 174 162 kbd_push_scancode(scan_code); 175 return 1;163 return; 176 164 } 177 165 -
uspace/srv/kbd/port/i8042.h
r9cd98796 rff685c9 39 39 #define KBD_PORT_i8042_H_ 40 40 41 #include <ddi.h>42 41 #include <libarch/ddi.h> 42 #include <libarch/types.h> 43 43 44 #define i8042_DATA 0x60 45 #define i8042_STATUS 0X64 46 47 48 typedef unsigned char u8; 49 typedef short u16; 50 51 static inline void i8042_data_write(u8 data) 52 { 53 outb(i8042_DATA, data); 54 } 55 56 static inline u8 i8042_data_read(void) 57 { 58 return inb(i8042_DATA); 59 } 60 61 static inline u8 i8042_status_read(void) 62 { 63 return inb(i8042_STATUS); 64 } 65 66 static inline void i8042_command_write(u8 command) 67 { 68 outb(i8042_STATUS, command); 69 } 44 struct i8042 { 45 ioport8_t data; 46 uint8_t pad[3]; 47 ioport8_t status; 48 } __attribute__ ((packed)); 49 typedef struct i8042 i8042_t; 70 50 71 51 #endif -
uspace/srv/kbd/port/ns16550.c
r9cd98796 rff685c9 87 87 static void ns16550_irq_handler(ipc_callid_t iid, ipc_call_t *call); 88 88 89 uint16_t ns16550_port; 89 static uintptr_t ns16550_physical; 90 static uintptr_t ns16550_kernel; 90 91 91 92 int kbd_port_init(void) 92 93 { 94 void *vaddr; 95 93 96 async_set_interrupt_received(ns16550_irq_handler); 94 97 95 ns16550_port = sysinfo_value("kbd.port"); 96 ns16550_kbd.cmds[0].addr = (void *) (ns16550_port + LSR_REG); 97 ns16550_kbd.cmds[3].addr = (void *) (ns16550_port + RBR_REG); 98 ns16550_physical = sysinfo_value("kbd.address.physical"); 99 ns16550_kernel = sysinfo_value("kbd.address.kernel"); 100 ns16550_kbd.cmds[0].addr = (void *) (ns16550_kernel + LSR_REG); 101 ns16550_kbd.cmds[3].addr = (void *) (ns16550_kernel + RBR_REG); 98 102 ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), 99 103 0, &ns16550_kbd); 100 iospace_enable(task_get_id(), ns16550_port, 8); 101 102 return 0; 104 return pio_enable((void *) ns16550_physical, 8, &vaddr); 103 105 } 104 106 -
uspace/srv/kbd/port/z8530.c
r9cd98796 rff685c9 42 42 #include <kbd_port.h> 43 43 #include <sys/types.h> 44 #include <ddi.h> 44 45 45 46 #define CHAN_A_STATUS 4 … … 85 86 { 86 87 async_set_interrupt_received(z8530_irq_handler); 87 z8530_cmds[0].addr = (void *) sysinfo_value("kbd.address. virtual") +88 z8530_cmds[0].addr = (void *) sysinfo_value("kbd.address.kernel") + 88 89 CHAN_A_STATUS; 89 z8530_cmds[3].addr = (void *) sysinfo_value("kbd.address. virtual") +90 z8530_cmds[3].addr = (void *) sysinfo_value("kbd.address.kernel") + 90 91 CHAN_A_DATA; 91 92 ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"),
Note:
See TracChangeset
for help on using the changeset viewer.