Changeset 24ff4df in mainline for uspace/srv/kbd/port/sgcn.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/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 }
Note:
See TracChangeset
for help on using the changeset viewer.