Changeset 51b46f2 in mainline for uspace/drv/uhci-hcd/root_hub.c
- Timestamp:
- 2011-03-01T15:39:52Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e135751
- Parents:
- 0e3505a (diff), cc44f7e (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/drv/uhci-hcd/root_hub.c
r0e3505a r51b46f2 34 34 #include <assert.h> 35 35 #include <errno.h> 36 #include <str_error.h> 36 37 #include <stdio.h> 38 #include <ops/hw_res.h> 39 37 40 #include <usb_iface.h> 38 41 #include <usb/debug.h> … … 41 44 #include "uhci.h" 42 45 46 /*----------------------------------------------------------------------------*/ 43 47 static int usb_iface_get_hc_handle_rh_impl(ddf_fun_t *root_hub_fun, 44 48 devman_handle_t *handle) … … 51 55 return EOK; 52 56 } 53 57 /*----------------------------------------------------------------------------*/ 54 58 static int usb_iface_get_address_rh_impl(ddf_fun_t *fun, devman_handle_t handle, 55 59 usb_address_t *address) … … 61 65 assert(hc); 62 66 63 usb_address_t addr = usb_address_keeping_find(&hc->address_manager,67 usb_address_t addr = device_keeper_find(&hc->device_manager, 64 68 handle); 65 69 if (addr < 0) { … … 73 77 return EOK; 74 78 } 75 79 /*----------------------------------------------------------------------------*/ 76 80 usb_iface_t usb_iface_root_hub_fun_impl = { 77 81 .get_hc_handle = usb_iface_get_hc_handle_rh_impl, 78 82 .get_address = usb_iface_get_address_rh_impl 79 83 }; 84 /*----------------------------------------------------------------------------*/ 85 static hw_resource_list_t *get_resource_list(ddf_fun_t *dev) 86 { 87 assert(dev); 88 ddf_fun_t *hc_ddf_instance = dev->driver_data; 89 assert(hc_ddf_instance); 90 uhci_t *hc = hc_ddf_instance->driver_data; 91 assert(hc); 80 92 93 //TODO: fix memory leak 94 hw_resource_list_t *resource_list = malloc(sizeof(hw_resource_list_t)); 95 assert(resource_list); 96 resource_list->count = 1; 97 resource_list->resources = malloc(sizeof(hw_resource_t)); 98 assert(resource_list->resources); 99 resource_list->resources[0].type = IO_RANGE; 100 resource_list->resources[0].res.io_range.address = 101 ((uintptr_t)hc->registers) + 0x10; // see UHCI design guide 102 resource_list->resources[0].res.io_range.size = 4; 103 resource_list->resources[0].res.io_range.endianness = LITTLE_ENDIAN; 104 105 return resource_list; 106 } 107 /*----------------------------------------------------------------------------*/ 108 static hw_res_ops_t hw_res_iface = { 109 .get_resource_list = get_resource_list, 110 .enable_interrupt = NULL 111 }; 112 /*----------------------------------------------------------------------------*/ 81 113 static ddf_dev_ops_t root_hub_ops = { 82 .interfaces[USB_DEV_IFACE] = &usb_iface_root_hub_fun_impl 114 .interfaces[USB_DEV_IFACE] = &usb_iface_root_hub_fun_impl, 115 .interfaces[HW_RES_DEV_IFACE] = &hw_res_iface 83 116 }; 84 85 117 /*----------------------------------------------------------------------------*/ 86 118 int setup_root_hub(ddf_fun_t **fun, ddf_dev_t *hc) 87 119 { 88 120 assert(fun); 121 assert(hc); 89 122 int ret; 90 123 … … 105 138 ret = ddf_fun_add_match_id(hub, match_str, 100); 106 139 if (ret != EOK) { 107 usb_log_error("Failed to add root hub match id.\n"); 140 usb_log_error("Failed(%d) to add root hub match id: %s\n", 141 ret, str_error(ret)); 108 142 ddf_fun_destroy(hub); 109 return ENOMEM;143 return ret; 110 144 } 111 145
Note:
See TracChangeset
for help on using the changeset viewer.