Changeset 7cb0cb4 in mainline
- Timestamp:
- 2011-12-26T10:40:40Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2a52bc6
- Parents:
- ba551ba7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/char/i8042/i8042.c
rba551ba7 r7cb0cb4 3 3 * Copyright (c) 2006 Josef Cejka 4 4 * Copyright (c) 2009 Jiri Svoboda 5 * Copyright (c) 2011 Jan Vesely 5 6 * All rights reserved. 6 7 * … … 275 276 CHECK_RET_UNBIND_DESTROY(ret, "Failed to enable interrupts: %s.\n"); 276 277 277 278 /* Enable port interrupts. */ 278 279 wait_ready(dev); 279 280 pio_write_8(&dev->regs->status, i8042_CMD_WRITE_CMDB); … … 365 366 return size; 366 367 } 367 /*----------------------------------------------------------------------------*/368 369 /** Character device connection handler */370 #if 0371 static void i8042_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)372 {373 ipc_callid_t callid;374 ipc_call_t call;375 sysarg_t method;376 service_id_t dsid;377 int retval;378 int dev_id, i;379 380 printf(NAME ": connection handler\n");381 382 /* Get the device handle. */383 dsid = IPC_GET_ARG1(*icall);384 385 /* Determine which disk device is the client connecting to. */386 dev_id = -1;387 for (i = 0; i < MAX_DEVS; i++) {388 if (device.port[i].service_id == dsid)389 dev_id = i;390 }391 392 if (dev_id < 0) {393 async_answer_0(iid, EINVAL);394 return;395 }396 397 /* Answer the IPC_M_CONNECT_ME_TO call. */398 async_answer_0(iid, EOK);399 400 printf(NAME ": accepted connection\n");401 402 while (1) {403 callid = async_get_call(&call);404 method = IPC_GET_IMETHOD(call);405 406 if (!method) {407 /* The other side has hung up. */408 async_answer_0(callid, EOK);409 return;410 }411 412 async_sess_t *sess =413 async_callback_receive_start(EXCHANGE_SERIALIZE, &call);414 if (sess != NULL) {415 if (device.port[dev_id].client_sess == NULL) {416 device.port[dev_id].client_sess = sess;417 retval = EOK;418 } else419 retval = ELIMIT;420 } else {421 switch (method) {422 case IPC_FIRST_USER_METHOD:423 printf(NAME ": write %" PRIun " to devid %d\n",424 IPC_GET_ARG1(call), dev_id);425 i8042_port_write(&device, dev_id, IPC_GET_ARG1(call));426 retval = 0;427 break;428 default:429 retval = EINVAL;430 break;431 }432 }433 434 async_answer_0(callid, retval);435 }436 }437 void i8042_port_write(i8042_t *dev, int devid, uint8_t data)438 {439 440 assert(dev);441 if (devid == DEVID_AUX) {442 wait_ready(dev);443 pio_write_8(&dev->regs->status, i8042_CMD_WRITE_AUX);444 }445 wait_ready(dev);446 pio_write_8(&dev->regs->data, data);447 }448 #endif449 450 368 /** 451 369 * @}
Note:
See TracChangeset
for help on using the changeset viewer.