Changeset ff582d47 in mainline
- Timestamp:
- 2011-03-21T12:51:02Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- be7950e8
- Parents:
- 8627377
- Location:
- uspace/drv/ohci
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/hc.c
r8627377 rff582d47 40 40 #include <usb/usb.h> 41 41 #include <usb/hub.h> 42 #include <usb/ddfiface.h> 42 43 #include <usb/usbdevice.h> 43 #include <usb/ddfiface.h>44 44 45 45 #include "hc.h" 46 46 47 static int dummy_reset(int foo, void *bar) 48 { 49 return EOK; 50 } 47 51 /*----------------------------------------------------------------------------*/ 48 52 int hc_init(hc_t *instance, ddf_fun_t *fun, ddf_dev_t *dev, … … 50 54 { 51 55 assert(instance); 52 int ret = pio_enable((void*)regs, reg_size, (void**)&instance->registers); 56 int ret = EOK; 57 58 ret = pio_enable((void*)regs, reg_size, (void**)&instance->registers); 53 59 if (ret != EOK) { 54 60 usb_log_error("Failed to gain access to device registers.\n"); 55 61 return ret; 56 62 } 63 instance->ddf_instance = fun; 57 64 device_keeper_init(&instance->manager); 58 65 … … 60 67 rh_init(&instance->rh, dev, instance->registers); 61 68 /* TODO: implement */ 62 /* TODO: register root hub */63 69 return EOK; 64 70 } 65 71 /*----------------------------------------------------------------------------*/ 66 int hc_register_hub(hc_t *instance , ddf_dev_t *dev)72 int hc_register_hub(hc_t *instance) 67 73 { 74 async_usleep(1000000); 75 #define CHECK_RET_RETURN(ret, msg...) \ 76 if (ret != EOK) { \ 77 usb_log_error(msg); \ 78 return ret; \ 79 } else (void)0 68 80 assert(instance); 81 assert(instance->ddf_instance); 82 assert(instance->ddf_instance->handle); 83 ddf_dev_t *dev = instance->rh.device; 84 int ret = EOK; 85 86 usb_hc_connection_t conn; 87 ret = 88 usb_hc_connection_initialize(&conn, instance->ddf_instance->handle); 89 CHECK_RET_RETURN(ret, "Failed to initialize hc connection.\n"); 90 91 ret = usb_hc_connection_open(&conn); 92 CHECK_RET_RETURN(ret, "Failed to open hc connection.\n"); 93 94 usb_address_t address; 95 devman_handle_t handle; 96 ret = usb_hc_new_device_wrapper(dev, &conn, USB_SPEED_FULL, dummy_reset, 97 0, NULL, &address, &handle, NULL, NULL, NULL); 98 CHECK_RET_RETURN(ret, "Failed to add rh device.\n"); 99 100 ret = usb_hc_connection_close(&conn); 101 CHECK_RET_RETURN(ret, "Failed to close hc connection.\n"); 69 102 return EOK; 70 103 } -
uspace/drv/ohci/hc.h
r8627377 rff582d47 59 59 uintptr_t regs, size_t reg_size, bool interrupts); 60 60 61 int hc_register_hub(hc_t *instance , ddf_dev_t *dev);61 int hc_register_hub(hc_t *instance); 62 62 63 63 int hc_schedule(hc_t *instance, batch_t *batch); -
uspace/drv/ohci/main.c
r8627377 rff582d47 179 179 hc_fun->driver_data = hcd; 180 180 181 hc_register_hub(hcd, device); 181 fid_t later = fibril_create((int(*)(void*))hc_register_hub, hcd); 182 fibril_add_ready(later); 182 183 183 184 usb_log_info("Controlling new OHCI device `%s' (handle %llu).\n",
Note:
See TracChangeset
for help on using the changeset viewer.