Changes in uspace/srv/hw/char/i8042/i8042.c [5da7199:9934f7d] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hw/char/i8042/i8042.c
r5da7199 r9934f7d 32 32 * @ingroup kbd 33 33 * @{ 34 */ 34 */ 35 35 /** @file 36 36 * @brief i8042 PS/2 port driver. … … 39 39 #include <ddi.h> 40 40 #include <libarch/ddi.h> 41 #include < loc.h>41 #include <devmap.h> 42 42 #include <async.h> 43 #include <async_obsolete.h> 43 44 #include <unistd.h> 44 45 #include <sysinfo.h> … … 48 49 #include "i8042.h" 49 50 50 #define NAME "i8042" 51 #define NAMESPACE "char" 51 // FIXME: remove this header 52 #include <kernel/ipc/ipc_methods.h> 53 54 #define NAME "i8042" 55 #define NAMESPACE "char" 52 56 53 57 /* Interesting bits for status register */ … … 131 135 printf(NAME ": i8042 PS/2 port driver\n"); 132 136 133 rc = loc_server_register(NAME, i8042_connection);137 rc = devmap_driver_register(NAME, i8042_connection); 134 138 if (rc < 0) { 135 printf(NAME ": Unable to register server.\n");139 printf(NAME ": Unable to register driver.\n"); 136 140 return rc; 137 141 } … … 141 145 142 146 for (i = 0; i < MAX_DEVS; i++) { 143 i8042_port[i].client_ sess = NULL;147 i8042_port[i].client_phone = -1; 144 148 145 149 snprintf(name, 16, "%s/ps2%c", NAMESPACE, dchar[i]); 146 rc = loc_service_register(name, &i8042_port[i].service_id);150 rc = devmap_device_register(name, &i8042_port[i].devmap_handle); 147 151 if (rc != EOK) { 148 152 printf(NAME ": Unable to register device %s.\n", name); … … 217 221 ipc_call_t call; 218 222 sysarg_t method; 219 service_id_t dsid;223 devmap_handle_t dh; 220 224 int retval; 221 225 int dev_id, i; … … 224 228 225 229 /* Get the device handle. */ 226 d sid= IPC_GET_ARG1(*icall);230 dh = IPC_GET_ARG1(*icall); 227 231 228 232 /* Determine which disk device is the client connecting to. */ 229 233 dev_id = -1; 230 234 for (i = 0; i < MAX_DEVS; i++) { 231 if (i8042_port[i]. service_id == dsid)235 if (i8042_port[i].devmap_handle == dh) 232 236 dev_id = i; 233 237 } … … 253 257 } 254 258 255 async_sess_t *sess = 256 async_callback_receive_start(EXCHANGE_SERIALIZE, &call); 257 if (sess != NULL) { 258 if (i8042_port[dev_id].client_sess == NULL) { 259 i8042_port[dev_id].client_sess = sess; 260 retval = EOK; 261 } else 259 switch (method) { 260 case IPC_M_CONNECT_TO_ME: 261 printf(NAME ": creating callback connection\n"); 262 if (i8042_port[dev_id].client_phone != -1) { 262 263 retval = ELIMIT; 263 } else {264 switch (method) {265 case IPC_FIRST_USER_METHOD:266 printf(NAME ": write %" PRIun " to devid %d\n",267 IPC_GET_ARG1(call), dev_id);268 i8042_port_write(dev_id, IPC_GET_ARG1(call));269 retval = 0;270 break;271 default:272 retval = EINVAL;273 264 break; 274 265 } 266 i8042_port[dev_id].client_phone = IPC_GET_ARG5(call); 267 retval = 0; 268 break; 269 case IPC_FIRST_USER_METHOD: 270 printf(NAME ": write %" PRIun " to devid %d\n", 271 IPC_GET_ARG1(call), dev_id); 272 i8042_port_write(dev_id, IPC_GET_ARG1(call)); 273 retval = 0; 274 break; 275 default: 276 retval = EINVAL; 277 break; 275 278 } 276 277 279 async_answer_0(callid, retval); 278 280 } … … 303 305 } 304 306 305 if (i8042_port[devid].client_sess != NULL) { 306 async_exch_t *exch = 307 async_exchange_begin(i8042_port[devid].client_sess); 308 async_msg_1(exch, IPC_FIRST_USER_METHOD, data); 309 async_exchange_end(exch); 307 if (i8042_port[devid].client_phone != -1) { 308 async_obsolete_msg_1(i8042_port[devid].client_phone, 309 IPC_FIRST_USER_METHOD, data); 310 310 } 311 311 }
Note:
See TracChangeset
for help on using the changeset viewer.