Changeset 95c675b in mainline for uspace/lib/drv/generic
- Timestamp:
- 2017-10-17T13:11:35Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 60af4cdb
- Parents:
- dbf32b1 (diff), a416d070 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace/lib/drv/generic
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/driver.c
rdbf32b1 r95c675b 599 599 } 600 600 601 /** Create session with the parent function.602 *603 * The session will be automatically closed when @a dev is destroyed.604 *605 * @param dev Device606 *607 * @return New session or NULL if session could not be created608 *609 */610 async_sess_t *ddf_dev_parent_sess_create(ddf_dev_t *dev)611 {612 assert(dev->parent_sess == NULL);613 dev->parent_sess = devman_parent_device_connect(dev->handle,614 IPC_FLAG_BLOCKING);615 616 return dev->parent_sess;617 }618 619 601 /** Return existing session with the parent function. 620 602 * 621 603 * @param dev Device 622 * @return Existing session or NULL if there is no session604 * @return Session with parent function or NULL upon failure 623 605 */ 624 606 async_sess_t *ddf_dev_parent_sess_get(ddf_dev_t *dev) 625 607 { 608 if (dev->parent_sess == NULL) { 609 dev->parent_sess = devman_parent_device_connect(dev->handle, 610 IPC_FLAG_BLOCKING); 611 } 612 626 613 return dev->parent_sess; 627 614 } … … 943 930 int rc = async_create_port(INTERFACE_DDF_DRIVER, driver_connection_driver, 944 931 NULL, &port); 945 if (rc != EOK) 932 if (rc != EOK) { 933 printf("Error: Failed to create driver port.\n"); 946 934 return rc; 935 } 947 936 948 937 rc = async_create_port(INTERFACE_DDF_DEVMAN, driver_connection_devman, 949 938 NULL, &port); 950 if (rc != EOK) 939 if (rc != EOK) { 940 printf("Error: Failed to create devman port.\n"); 951 941 return rc; 942 } 952 943 953 944 async_set_fallback_port_handler(driver_connection_client, NULL); … … 964 955 /* Return success from the task since server has started. */ 965 956 rc = task_retval(0); 966 if (rc != EOK) 957 if (rc != EOK) { 958 printf("Error: Failed returning task value.\n"); 967 959 return rc; 960 } 968 961 969 962 async_manager(); -
uspace/lib/drv/generic/interrupt.c
rdbf32b1 r95c675b 44 44 45 45 int register_interrupt_handler(ddf_dev_t *dev, int irq, 46 interrupt_handler_t *handler, const irq_code_t * pseudocode)46 interrupt_handler_t *handler, const irq_code_t *irq_code) 47 47 { 48 return async_irq_subscribe(irq, dev->handle,49 (async_notification_handler_t) handler, dev, pseudocode);48 return async_irq_subscribe(irq, (async_notification_handler_t) handler, 49 dev, irq_code); 50 50 } 51 51 52 int unregister_interrupt_handler(ddf_dev_t *dev, int irq)52 int unregister_interrupt_handler(ddf_dev_t *dev, int cap) 53 53 { 54 return async_irq_unsubscribe( irq, dev->handle);54 return async_irq_unsubscribe(cap); 55 55 } 56 56 -
uspace/lib/drv/generic/remote_hw_res.c
rdbf32b1 r95c675b 45 45 static void remote_hw_res_enable_interrupt(ddf_fun_t *, void *, ipc_callid_t, 46 46 ipc_call_t *); 47 static void remote_hw_res_disable_interrupt(ddf_fun_t *, void *, ipc_callid_t, 48 ipc_call_t *); 49 static void remote_hw_res_clear_interrupt(ddf_fun_t *, void *, ipc_callid_t, 50 ipc_call_t *); 47 51 static void remote_hw_res_dma_channel_setup(ddf_fun_t *, void *, ipc_callid_t, 48 52 ipc_call_t *); … … 53 57 [HW_RES_GET_RESOURCE_LIST] = &remote_hw_res_get_resource_list, 54 58 [HW_RES_ENABLE_INTERRUPT] = &remote_hw_res_enable_interrupt, 59 [HW_RES_DISABLE_INTERRUPT] = &remote_hw_res_disable_interrupt, 60 [HW_RES_CLEAR_INTERRUPT] = &remote_hw_res_clear_interrupt, 55 61 [HW_RES_DMA_CHANNEL_SETUP] = &remote_hw_res_dma_channel_setup, 56 62 [HW_RES_DMA_CHANNEL_REMAIN] = &remote_hw_res_dma_channel_remain, … … 67 73 hw_res_ops_t *hw_res_ops = (hw_res_ops_t *) ops; 68 74 69 if (hw_res_ops->enable_interrupt == NULL) 75 if (hw_res_ops->enable_interrupt == NULL) { 70 76 async_answer_0(callid, ENOTSUP); 71 else if (hw_res_ops->enable_interrupt(fun)) 72 async_answer_0(callid, EOK); 73 else 74 async_answer_0(callid, EREFUSED); 77 return; 78 } 79 80 const int irq = DEV_IPC_GET_ARG1(*call); 81 const int ret = hw_res_ops->enable_interrupt(fun, irq); 82 async_answer_0(callid, ret); 83 } 84 85 static void remote_hw_res_disable_interrupt(ddf_fun_t *fun, void *ops, 86 ipc_callid_t callid, ipc_call_t *call) 87 { 88 hw_res_ops_t *hw_res_ops = (hw_res_ops_t *) ops; 89 90 if (hw_res_ops->disable_interrupt == NULL) { 91 async_answer_0(callid, ENOTSUP); 92 return; 93 } 94 95 const int irq = DEV_IPC_GET_ARG1(*call); 96 const int ret = hw_res_ops->disable_interrupt(fun, irq); 97 async_answer_0(callid, ret); 98 } 99 100 static void remote_hw_res_clear_interrupt(ddf_fun_t *fun, void *ops, 101 ipc_callid_t callid, ipc_call_t *call) 102 { 103 hw_res_ops_t *hw_res_ops = (hw_res_ops_t *) ops; 104 105 if (hw_res_ops->clear_interrupt == NULL) { 106 async_answer_0(callid, ENOTSUP); 107 return; 108 } 109 110 const int irq = DEV_IPC_GET_ARG1(*call); 111 const int ret = hw_res_ops->enable_interrupt(fun, irq); 112 async_answer_0(callid, ret); 75 113 } 76 114
Note:
See TracChangeset
for help on using the changeset viewer.