Changeset eb1a2f4 in mainline for uspace/drv/uhci-hcd/main.c
- Timestamp:
- 2011-02-22T23:30:56Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3b5d1535, a9c674e0
- Parents:
- dbe25f1 (diff), 664af708 (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/main.c
rdbe25f1 reb1a2f4 32 32 * @brief UHCI driver 33 33 */ 34 #include <driver.h> 34 #include <ddf/driver.h> 35 #include <ddf/interrupt.h> 35 36 #include <usb_iface.h> 36 37 #include <usb/ddfiface.h> … … 48 49 #define NAME "uhci-hcd" 49 50 50 static int uhci_add_device(d evice_t *device);51 static int uhci_add_device(ddf_dev_t *device); 51 52 52 static int usb_iface_get_address(device_t *dev, devman_handle_t handle,53 usb_address_t *address)54 {55 assert(dev);56 uhci_t *hc = dev_to_uhci(dev);57 assert(hc);58 59 usb_address_t addr = usb_address_keeping_find(&hc->address_manager,60 handle);61 if (addr < 0) {62 return addr;63 }64 65 if (address != NULL) {66 *address = addr;67 }68 69 return EOK;70 }71 72 73 static usb_iface_t hc_usb_iface = {74 .get_hc_handle = usb_iface_get_hc_handle_hc_impl,75 .get_address = usb_iface_get_address76 };77 /*----------------------------------------------------------------------------*/78 static device_ops_t uhci_ops = {79 .interfaces[USB_DEV_IFACE] = &hc_usb_iface,80 .interfaces[USBHC_DEV_IFACE] = &uhci_iface81 };82 53 /*----------------------------------------------------------------------------*/ 83 54 static driver_ops_t uhci_driver_ops = { … … 90 61 }; 91 62 /*----------------------------------------------------------------------------*/ 92 static void irq_handler(d evice_t *device, ipc_callid_t iid, ipc_call_t *call)63 static void irq_handler(ddf_dev_t *dev, ipc_callid_t iid, ipc_call_t *call) 93 64 { 94 assert(dev ice);95 uhci_t *hc = dev_to_uhci(dev ice);65 assert(dev); 66 uhci_t *hc = dev_to_uhci(dev); 96 67 uint16_t status = IPC_GET_ARG1(*call); 97 68 assert(hc); … … 105 76 } 106 77 107 static int uhci_add_device(d evice_t *device)78 static int uhci_add_device(ddf_dev_t *device) 108 79 { 109 80 assert(device); 110 81 111 82 usb_log_info("uhci_add_device() called\n"); 112 device->ops = &uhci_ops; 83 113 84 114 85 uintptr_t io_reg_base; … … 131 102 CHECK_RET_RETURN(ret, "Failed to allocate memory for uhci hcd driver.\n"); 132 103 133 ret = uhci_init(uhci_hc, (void*)io_reg_base, io_reg_size);104 ret = uhci_init(uhci_hc, device, (void*)io_reg_base, io_reg_size); 134 105 if (ret != EOK) { 135 106 usb_log_error("Failed to init uhci-hcd.\n"); … … 137 108 return ret; 138 109 } 110 111 /* 112 * We might free uhci_hc, but that does not matter since no one 113 * else would access driver_data anyway. 114 */ 115 device->driver_data = uhci_hc; 139 116 140 117 ret = register_interrupt_handler(device, irq, irq_handler, … … 147 124 } 148 125 149 d evice_t *rh;126 ddf_fun_t *rh; 150 127 ret = setup_root_hub(&rh, device); 151 128 if (ret != EOK) { … … 155 132 return ret; 156 133 } 134 rh->driver_data = uhci_hc->ddf_instance; 157 135 158 ret = child_device_register(rh, device);136 ret = ddf_fun_bind(rh); 159 137 if (ret != EOK) { 160 138 usb_log_error("Failed to register root hub.\n"); … … 165 143 } 166 144 167 device->driver_data = uhci_hc;168 145 return EOK; 169 146 } … … 172 149 { 173 150 sleep(3); 174 usb_log_enable(USB_LOG_LEVEL_ DEBUG, NAME);151 usb_log_enable(USB_LOG_LEVEL_INFO, NAME); 175 152 176 return d river_main(&uhci_driver);153 return ddf_driver_main(&uhci_driver); 177 154 } 178 155 /**
Note:
See TracChangeset
for help on using the changeset viewer.