Changeset f9b2cb4c in mainline for uspace/lib/drv/generic/driver.c
- Timestamp:
- 2015-08-23T12:50:23Z (9 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9ef495f
- Parents:
- 0dd16778
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/driver.c
r0dd16778 rf9b2cb4c 53 53 #include <devman.h> 54 54 55 #include <ipc/driver.h>56 57 55 #include "dev_iface.h" 58 56 #include "ddf/driver.h" … … 130 128 131 129 char *dev_name = NULL; 132 async_data_write_accept((void **) &dev_name, true, 0, 0, 0, 0); 130 int rc = async_data_write_accept((void **) &dev_name, true, 0, 0, 0, 0); 131 if (rc != EOK) { 132 async_answer_0(iid, rc); 133 return; 134 } 135 133 136 dev->name = dev_name; 134 137 … … 278 281 } 279 282 280 static void driver_connection_devman(ipc_callid_t iid, ipc_call_t *icall) 283 static void driver_connection_devman(ipc_callid_t iid, ipc_call_t *icall, 284 void *arg) 281 285 { 282 286 /* Accept connection */ … … 436 440 } 437 441 438 static void driver_connection_driver(ipc_callid_t iid, ipc_call_t *icall) 442 static void driver_connection_driver(ipc_callid_t iid, ipc_call_t *icall, 443 void *arg) 439 444 { 440 445 driver_connection_gen(iid, icall, true); 441 446 } 442 447 443 static void driver_connection_client(ipc_callid_t iid, ipc_call_t *icall) 448 static void driver_connection_client(ipc_callid_t iid, ipc_call_t *icall, 449 void *arg) 444 450 { 445 451 driver_connection_gen(iid, icall, false); 446 }447 448 /** Function for handling connections to device driver. */449 static void driver_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)450 {451 sysarg_t conn_type;452 453 if (iid == 0) {454 /* Callback connection from devman */455 /* XXX Use separate handler for this type of connection */456 conn_type = DRIVER_DEVMAN;457 } else {458 conn_type = IPC_GET_ARG1(*icall);459 }460 461 /* Select interface */462 switch (conn_type) {463 case DRIVER_DEVMAN:464 /* Handle request from device manager */465 driver_connection_devman(iid, icall);466 break;467 case DRIVER_DRIVER:468 /* Handle request from drivers of child devices */469 driver_connection_driver(iid, icall);470 break;471 case DRIVER_CLIENT:472 /* Handle request from client applications */473 driver_connection_client(iid, icall);474 break;475 default:476 /* No such interface */477 async_answer_0(iid, ENOENT);478 }479 452 } 480 453 … … 620 593 * The session will be automatically closed when @a dev is destroyed. 621 594 * 622 * @param dev Device 623 * @param mgmt Exchange management style 624 * @return New session or NULL if session could not be created 625 */ 626 async_sess_t *ddf_dev_parent_sess_create(ddf_dev_t *dev, exch_mgmt_t mgmt) 595 * @param dev Device 596 * 597 * @return New session or NULL if session could not be created 598 * 599 */ 600 async_sess_t *ddf_dev_parent_sess_create(ddf_dev_t *dev) 627 601 { 628 602 assert(dev->parent_sess == NULL); 629 dev->parent_sess = devman_parent_device_connect( mgmt,dev->handle,603 dev->parent_sess = devman_parent_device_connect(dev->handle, 630 604 IPC_FLAG_BLOCKING); 631 605 … … 955 929 * incoming connections. 956 930 */ 957 async_set_fallback_port_handler(driver_connection, NULL); 958 int rc = devman_driver_register(driver->name); 931 port_id_t port; 932 int rc = async_create_port(INTERFACE_DDF_DRIVER, driver_connection_driver, 933 NULL, &port); 934 if (rc != EOK) 935 return rc; 936 937 rc = async_create_port(INTERFACE_DDF_DEVMAN, driver_connection_devman, 938 NULL, &port); 939 if (rc != EOK) 940 return rc; 941 942 async_set_fallback_port_handler(driver_connection_client, NULL); 943 944 rc = devman_driver_register(driver->name); 959 945 if (rc != EOK) { 960 946 printf("Error: Failed to register driver with device manager "
Note:
See TracChangeset
for help on using the changeset viewer.