Changeset 24ff4df in mainline for uspace/srv/kbd/port/z8530.c
- 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
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
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.