Changeset 63b1537 in mainline for uspace/srv/kbd/port/sgcn.c
- Timestamp:
- 2009-03-11T17:26:48Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- de88998
- Parents:
- 04d672c3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/kbd/port/sgcn.c
r04d672c3 r63b1537 37 37 #include <as.h> 38 38 #include <ddi.h> 39 #include <ipc/ipc.h>40 39 #include <async.h> 41 40 #include <kbd.h> … … 43 42 #include <sysinfo.h> 44 43 #include <stdio.h> 44 #include <thread.h> 45 46 #define POLL_INTERVAL 10000 45 47 46 48 /** … … 88 90 static uintptr_t sram_buffer_offset; 89 91 90 static void sgcn_irq_handler(ipc_callid_t iid, ipc_call_t *call); 92 /* polling thread */ 93 static void *sgcn_thread_impl(void *arg); 91 94 92 95 93 96 /** 94 97 * Initializes the SGCN driver. 95 * Maps the physical memory (SRAM) and registers the interrupt.98 * Maps the physical memory (SRAM) and creates the polling thread. 96 99 */ 97 100 int kbd_port_init(void) 98 101 { 99 async_set_interrupt_received(sgcn_irq_handler);100 102 sram_virt_addr = (uintptr_t) as_get_mappable_page(sysinfo_value("sram.area.size")); 101 103 if (physmem_map((void *) sysinfo_value("sram.address.physical"), … … 107 109 108 110 sram_buffer_offset = sysinfo_value("sram.buffer.offset"); 109 ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), 110 0, (void *) 0); 111 112 thread_id_t tid; 113 int rc; 114 115 rc = thread_create(sgcn_thread_impl, NULL, "kbd_poll", &tid); 116 if (rc != 0) { 117 return rc; 118 } 119 111 120 return 0; 112 121 } … … 116 125 * the buffer. 117 126 */ 118 static void sgcn_ irq_handler(ipc_callid_t iid, ipc_call_t *call)127 static void sgcn_key_pressed(void) 119 128 { 120 129 char c; … … 138 147 } 139 148 149 /** 150 * Thread to poll SGCN for keypresses. 151 */ 152 static void *sgcn_thread_impl(void *arg) 153 { 154 (void) arg; 155 156 while (1) { 157 sgcn_key_pressed(); 158 usleep(POLL_INTERVAL); 159 } 160 } 161 162 140 163 /** @} 141 164 */
Note:
See TracChangeset
for help on using the changeset viewer.