Changeset b5e68c8 in mainline for uspace/lib/c/generic/device/hw_res.c
- Timestamp:
- 2011-05-12T16:49:44Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f36787d7
- Parents:
- e80329d6 (diff), 750636a (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
re80329d6 rb5e68c8 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 28 29 29 /** @addtogroup libc 30 30 * @{ … … 32 32 /** @file 33 33 */ 34 34 35 35 #include <device/hw_res.h> 36 36 #include <errno.h> … … 38 38 #include <malloc.h> 39 39 40 bool get_hw_resources(int dev_phone, hw_resource_list_t *hw_resources)40 int hw_res_get_resource_list(int dev_phone, hw_resource_list_t *hw_resources) 41 41 { 42 ipcarg_t count = 0; 43 int rc = async_req_1_1(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE), GET_RESOURCE_LIST, &count); 42 sysarg_t count = 0; 43 44 int rc = async_req_1_1(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE), 45 HW_RES_GET_RESOURCE_LIST, &count); 46 44 47 hw_resources->count = count; 45 if (EOK != rc) { 46 return false; 47 } 48 if (rc != EOK) 49 return rc; 48 50 49 51 size_t size = count * sizeof(hw_resource_t); 50 52 hw_resources->resources = (hw_resource_t *)malloc(size); 51 if (NULL == hw_resources->resources) { 52 return false; 53 if (!hw_resources->resources) 54 return ENOMEM; 55 56 rc = async_data_read_start(dev_phone, hw_resources->resources, size); 57 if (rc != EOK) { 58 free(hw_resources->resources); 59 hw_resources->resources = NULL; 60 return rc; 53 61 } 54 62 55 rc = async_data_read_start(dev_phone, hw_resources->resources, size); 56 if (EOK != rc) { 57 free(hw_resources->resources); 58 hw_resources->resources = NULL; 59 return false; 60 } 61 62 return true; 63 return EOK; 63 64 } 64 65 65 bool enable_interrupt(int dev_phone)66 bool hw_res_enable_interrupt(int dev_phone) 66 67 { 67 int rc = async_req_1_0(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE), ENABLE_INTERRUPT); 68 int rc = async_req_1_0(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE), 69 HW_RES_ENABLE_INTERRUPT); 70 68 71 return rc == EOK; 69 72 } 70 71 72 73 /** @} 73 74 /** @} 74 75 */
Note:
See TracChangeset
for help on using the changeset viewer.