Changeset 41811af in mainline for uspace/lib/c/generic/device/hw_res.c
- Timestamp:
- 2011-06-10T10:14:26Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ab547063
- Parents:
- 9536e6e (diff), 390d80d (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 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/device/hw_res.c
r9536e6e r41811af 38 38 #include <malloc.h> 39 39 40 int hw_res_get_resource_list(int dev_phone, hw_resource_list_t *hw_resources) 40 int hw_res_get_resource_list(async_sess_t *sess, 41 hw_resource_list_t *hw_resources) 41 42 { 42 43 sysarg_t count = 0; 43 44 int rc = async_req_1_1(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE), 44 45 async_exch_t *exch = async_exchange_begin(sess); 46 int rc = async_req_1_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE), 45 47 HW_RES_GET_RESOURCE_LIST, &count); 46 47 hw_resources->count = count;48 if (rc != EOK)48 49 if (rc != EOK) { 50 async_exchange_end(exch); 49 51 return rc; 52 } 50 53 51 54 size_t size = count * sizeof(hw_resource_t); 52 hw_resources->resources = (hw_resource_t *)malloc(size); 53 if (!hw_resources->resources) 55 hw_resource_t *resources = (hw_resource_t *) malloc(size); 56 if (resources == NULL) { 57 // FIXME: This is protocol violation 58 async_exchange_end(exch); 54 59 return ENOMEM; 60 } 55 61 56 rc = async_data_read_start(dev_phone, hw_resources->resources, size); 62 rc = async_data_read_start(exch, resources, size); 63 async_exchange_end(exch); 64 57 65 if (rc != EOK) { 58 free(hw_resources->resources); 59 hw_resources->resources = NULL; 66 free(resources); 60 67 return rc; 61 68 } 69 70 hw_resources->resources = resources; 71 hw_resources->count = count; 62 72 63 73 return EOK; 64 74 } 65 75 66 bool hw_res_enable_interrupt( int dev_phone)76 bool hw_res_enable_interrupt(async_sess_t *sess) 67 77 { 68 int rc = async_req_1_0(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE), 78 async_exch_t *exch = async_exchange_begin(sess); 79 int rc = async_req_1_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE), 69 80 HW_RES_ENABLE_INTERRUPT); 70 71 return rc == EOK; 81 async_exchange_end(exch); 82 83 return (rc == EOK); 72 84 } 73 85
Note:
See TracChangeset
for help on using the changeset viewer.