Changeset 79e1abd in mainline for uspace/drv/ohci/hc.c
- Timestamp:
- 2011-03-29T12:09:15Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d012590
- Parents:
- 841e6e5 (diff), 51e5608 (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/ohci/hc.c
r841e6e5 r79e1abd 39 39 #include <usb/debug.h> 40 40 #include <usb/usb.h> 41 #include <usb/hub.h>42 41 #include <usb/ddfiface.h> 43 42 #include <usb/usbdevice.h> … … 45 44 #include "hc.h" 46 45 47 static int dummy_reset(int foo, void *arg);48 46 static int interrupt_emulator(hc_t *instance); 47 /*----------------------------------------------------------------------------*/ 48 int hc_register_hub(hc_t *instance, ddf_fun_t *hub_fun) 49 { 50 assert(instance); 51 assert(hub_fun); 52 53 usb_address_t hub_address = 54 device_keeper_get_free_address(&instance->manager, USB_SPEED_FULL); 55 instance->rh.address = hub_address; 56 usb_device_keeper_bind( 57 &instance->manager, hub_address, hub_fun->handle); 58 59 char *match_str = NULL; 60 int ret = asprintf(&match_str, "usb&mid"); 61 ret = (match_str == NULL) ? ret : EOK; 62 if (ret < 0) { 63 usb_log_error("Failed to create root hub match-id string.\n"); 64 return ret; 65 } 66 67 ret = ddf_fun_add_match_id(hub_fun, match_str, 100); 68 if (ret != EOK) { 69 usb_log_error("Failed add create root hub match-id.\n"); 70 } 71 return ret; 72 } 49 73 /*----------------------------------------------------------------------------*/ 50 74 int hc_init(hc_t *instance, ddf_fun_t *fun, ddf_dev_t *dev, … … 68 92 } 69 93 94 rh_init(&instance->rh, dev, instance->registers); 70 95 71 rh_init(&instance->rh, dev, instance->registers);72 96 /* TODO: implement */ 73 return EOK;74 }75 /*----------------------------------------------------------------------------*/76 int hc_register_hub(hc_t *instance)77 {78 async_usleep(1000000);79 #define CHECK_RET_RETURN(ret, msg...) \80 if (ret != EOK) { \81 usb_log_error(msg); \82 return ret; \83 } else (void)084 assert(instance);85 assert(instance->ddf_instance);86 assert(instance->ddf_instance->handle);87 ddf_dev_t *dev = instance->rh.device;88 int ret = EOK;89 90 usb_hc_connection_t conn;91 ret =92 usb_hc_connection_initialize(&conn, instance->ddf_instance->handle);93 CHECK_RET_RETURN(ret, "Failed to initialize hc connection.\n");94 95 ret = usb_hc_connection_open(&conn);96 CHECK_RET_RETURN(ret, "Failed to open hc connection.\n");97 98 usb_address_t address;99 devman_handle_t handle;100 ret = usb_hc_new_device_wrapper(dev, &conn, USB_SPEED_FULL, dummy_reset,101 0, instance, &address, &handle, NULL, NULL, NULL);102 if (ret != EOK) {103 usb_log_error("Failed to add rh device.\n");104 instance->rh.address = -1;105 return ret;106 }107 108 ret = usb_hc_connection_close(&conn);109 CHECK_RET_RETURN(ret, "Failed to close hc connection.\n");110 97 return EOK; 111 98 } … … 134 121 } 135 122 /*----------------------------------------------------------------------------*/ 136 static int dummy_reset(int foo, void *arg) 137 { 138 hc_t *hc = (hc_t*)arg; 139 assert(hc); 140 hc->rh.address = 0; 141 return EOK; 142 } 143 /*----------------------------------------------------------------------------*/ 144 static int interrupt_emulator(hc_t *instance) 123 int interrupt_emulator(hc_t *instance) 145 124 { 146 125 assert(instance);
Note:
See TracChangeset
for help on using the changeset viewer.