Changeset eb522e8 in mainline for uspace/lib/drv/generic/remote_hw_res.c
- Timestamp:
- 2011-06-01T08:43:42Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8d6c1f1
- Parents:
- 9e2e715 (diff), e51a514 (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. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_hw_res.c
r9e2e715 reb522e8 33 33 */ 34 34 35 #include <ipc/ipc.h>36 35 #include <async.h> 37 36 #include <errno.h> 38 37 39 #include " driver.h"40 #include " resource.h"38 #include "ops/hw_res.h" 39 #include "ddf/driver.h" 41 40 42 static void remote_ res_get_resources(device_t *, void *, ipc_callid_t,41 static void remote_hw_res_get_resource_list(ddf_fun_t *, void *, ipc_callid_t, 43 42 ipc_call_t *); 44 static void remote_ res_enable_interrupt(device_t *, void *, ipc_callid_t,43 static void remote_hw_res_enable_interrupt(ddf_fun_t *, void *, ipc_callid_t, 45 44 ipc_call_t *); 46 45 47 static remote_iface_func_ptr_t remote_ res_iface_ops [] = {48 &remote_ res_get_resources,49 &remote_ res_enable_interrupt46 static remote_iface_func_ptr_t remote_hw_res_iface_ops [] = { 47 &remote_hw_res_get_resource_list, 48 &remote_hw_res_enable_interrupt 50 49 }; 51 50 52 remote_iface_t remote_ res_iface = {53 .method_count = sizeof(remote_ res_iface_ops) /51 remote_iface_t remote_hw_res_iface = { 52 .method_count = sizeof(remote_hw_res_iface_ops) / 54 53 sizeof(remote_iface_func_ptr_t), 55 .methods = remote_ res_iface_ops54 .methods = remote_hw_res_iface_ops 56 55 }; 57 56 58 static void remote_ res_enable_interrupt(device_t *dev, void *iface,57 static void remote_hw_res_enable_interrupt(ddf_fun_t *fun, void *ops, 59 58 ipc_callid_t callid, ipc_call_t *call) 60 59 { 61 resource_iface_t *ires = (resource_iface_t *) iface;60 hw_res_ops_t *hw_res_ops = (hw_res_ops_t *) ops; 62 61 63 if ( NULL == ires->enable_interrupt)64 ipc_answer_0(callid, ENOTSUP);65 else if ( ires->enable_interrupt(dev))66 ipc_answer_0(callid, EOK);62 if (hw_res_ops->enable_interrupt == NULL) 63 async_answer_0(callid, ENOTSUP); 64 else if (hw_res_ops->enable_interrupt(fun)) 65 async_answer_0(callid, EOK); 67 66 else 68 ipc_answer_0(callid, EREFUSED);67 async_answer_0(callid, EREFUSED); 69 68 } 70 69 71 static void remote_ res_get_resources(device_t *dev, void *iface,70 static void remote_hw_res_get_resource_list(ddf_fun_t *fun, void *ops, 72 71 ipc_callid_t callid, ipc_call_t *call) 73 72 { 74 resource_iface_t *ires = (resource_iface_t *) iface; 75 if (NULL == ires->get_resources) { 76 ipc_answer_0(callid, ENOTSUP); 73 hw_res_ops_t *hw_res_ops = (hw_res_ops_t *) ops; 74 75 if (hw_res_ops->get_resource_list == NULL) { 76 async_answer_0(callid, ENOTSUP); 77 77 return; 78 78 } 79 79 80 hw_resource_list_t *hw_resources = ires->get_resources(dev);81 if ( NULL == hw_resources){82 ipc_answer_0(callid, ENOENT);80 hw_resource_list_t *hw_resources = hw_res_ops->get_resource_list(fun); 81 if (hw_resources == NULL){ 82 async_answer_0(callid, ENOENT); 83 83 return; 84 } 84 } 85 85 86 ipc_answer_1(callid, EOK, hw_resources->count);86 async_answer_1(callid, EOK, hw_resources->count); 87 87 88 88 size_t len; 89 89 if (!async_data_read_receive(&callid, &len)) { 90 /* protocol error - the recipient is not accepting data */90 /* Protocol error - the recipient is not accepting data */ 91 91 return; 92 92 }
Note:
See TracChangeset
for help on using the changeset viewer.