Changeset 56fd7cf in mainline for uspace/drv/bus/usb/uhci
- Timestamp:
- 2012-08-17T11:37:03Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1d5a540
- Parents:
- be2a38ad
- Location:
- uspace/drv/bus/usb/uhci
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/main.c
rbe2a38ad r56fd7cf 70 70 } else { 71 71 usb_log_info("Controlling new UHCI device '%s'.\n", 72 d evice->name);72 ddf_dev_get_name(device)); 73 73 } 74 74 -
uspace/drv/bus/usb/uhci/res.c
rbe2a38ad r56fd7cf 51 51 * @return Error code. 52 52 */ 53 int get_my_registers( constddf_dev_t *dev,53 int get_my_registers(ddf_dev_t *dev, 54 54 uintptr_t *io_reg_address, size_t *io_reg_size, int *irq_no) 55 55 { … … 57 57 58 58 async_sess_t *parent_sess = 59 devman_parent_device_connect(EXCHANGE_SERIALIZE, dev->handle,60 IPC_FLAG_BLOCKING);59 devman_parent_device_connect(EXCHANGE_SERIALIZE, 60 ddf_dev_get_handle(dev), IPC_FLAG_BLOCKING); 61 61 if (!parent_sess) 62 62 return ENOMEM; … … 92 92 * @return Error code. 93 93 */ 94 int enable_interrupts( constddf_dev_t *device)94 int enable_interrupts(ddf_dev_t *device) 95 95 { 96 96 async_sess_t *parent_sess = 97 devman_parent_device_connect(EXCHANGE_SERIALIZE, device->handle,98 IPC_FLAG_BLOCKING);97 devman_parent_device_connect(EXCHANGE_SERIALIZE, 98 ddf_dev_get_handle(device), IPC_FLAG_BLOCKING); 99 99 if (!parent_sess) 100 100 return ENOMEM; … … 111 111 * @return Error code. 112 112 */ 113 int disable_legacy( constddf_dev_t *device)113 int disable_legacy(ddf_dev_t *device) 114 114 { 115 115 assert(device); 116 116 117 117 async_sess_t *parent_sess = devman_parent_device_connect( 118 EXCHANGE_SERIALIZE, d evice->handle, IPC_FLAG_BLOCKING);118 EXCHANGE_SERIALIZE, ddf_dev_get_handle(device), IPC_FLAG_BLOCKING); 119 119 if (!parent_sess) 120 120 return ENOMEM; -
uspace/drv/bus/usb/uhci/res.h
rbe2a38ad r56fd7cf 38 38 #include <ddf/driver.h> 39 39 40 int get_my_registers( constddf_dev_t *, uintptr_t *, size_t *, int *);41 int enable_interrupts( constddf_dev_t *);42 int disable_legacy( constddf_dev_t *);40 int get_my_registers(ddf_dev_t *, uintptr_t *, size_t *, int *); 41 int enable_interrupts(ddf_dev_t *); 42 int disable_legacy(ddf_dev_t *); 43 43 44 44 #endif -
uspace/drv/bus/usb/uhci/uhci.c
rbe2a38ad r56fd7cf 33 33 * @brief UHCI driver 34 34 */ 35 36 /* XXX Fix this */ 37 #define _DDF_DATA_IMPLANT 38 35 39 #include <errno.h> 36 40 #include <str_error.h> … … 60 64 } uhci_t; 61 65 62 static inline uhci_t * dev_to_uhci(const ddf_dev_t *dev) 63 { 64 assert(dev); 65 return dev->driver_data; 66 static inline uhci_t *dev_to_uhci(ddf_dev_t *dev) 67 { 68 return ddf_dev_data_get(dev); 66 69 } 67 70 … … 97 100 static int usb_iface_get_hc_handle(ddf_fun_t *fun, devman_handle_t *handle) 98 101 { 99 assert(fun); 100 ddf_fun_t *hc_fun = dev_to_uhci(fun->dev)->hc_fun; 102 ddf_fun_t *hc_fun = dev_to_uhci(ddf_fun_get_dev(fun))->hc_fun; 101 103 assert(hc_fun); 102 104 103 105 if (handle != NULL) 104 *handle = hc_fun->handle;106 *handle = ddf_fun_get_handle(hc_fun); 105 107 return EOK; 106 108 } … … 118 120 static hw_resource_list_t *get_resource_list(ddf_fun_t *fun) 119 121 { 120 assert(fun); 121 rh_t *rh = fun->driver_data; 122 rh_t *rh = ddf_fun_data_get(fun); 122 123 assert(rh); 123 124 return &rh->resource_list; … … 160 161 if (ret != EOK) { \ 161 162 if (instance->hc_fun) \ 162 instance->hc_fun->driver_data = NULL; \163 163 ddf_fun_destroy(instance->hc_fun); \ 164 164 if (instance->rh_fun) {\ 165 instance->rh_fun->driver_data = NULL; \166 165 ddf_fun_destroy(instance->rh_fun); \ 167 166 } \ … … 174 173 int ret = (instance->hc_fun == NULL) ? ENOMEM : EOK; 175 174 CHECK_RET_DEST_FREE_RETURN(ret, "Failed to create UHCI HC function.\n"); 176 instance->hc_fun->ops = &hc_ops;177 instance->hc_fun->driver_data = &instance->hc.generic;175 ddf_fun_set_ops(instance->hc_fun, &hc_ops); 176 ddf_fun_data_implant(instance->hc_fun, &instance->hc.generic); 178 177 179 178 instance->rh_fun = ddf_fun_create(device, fun_inner, "uhci_rh"); 180 179 ret = (instance->rh_fun == NULL) ? ENOMEM : EOK; 181 180 CHECK_RET_DEST_FREE_RETURN(ret, "Failed to create UHCI RH function.\n"); 182 instance->rh_fun->ops = &rh_ops;183 instance->rh_fun->driver_data = &instance->rh;181 ddf_fun_set_ops(instance->rh_fun, &rh_ops); 182 ddf_fun_data_implant(instance->rh_fun, &instance->rh); 184 183 185 184 uintptr_t reg_base = 0; … … 190 189 CHECK_RET_DEST_FREE_RETURN(ret, 191 190 "Failed to get I/O addresses for %" PRIun ": %s.\n", 192 d evice->handle, str_error(ret));191 ddf_dev_get_handle(device), str_error(ret)); 193 192 usb_log_debug("I/O regs at 0x%p (size %zu), IRQ %d.\n", 194 193 (void *) reg_base, reg_size, irq);
Note:
See TracChangeset
for help on using the changeset viewer.
