Changes in uspace/drv/bus/usb/usbmast/main.c [f97f5cc2:58563585] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbmast/main.c
rf97f5cc2 r58563585 35 35 * Main routines of USB mass storage driver. 36 36 */ 37 37 38 #include <as.h> 38 39 #include <async.h> … … 44 45 #include <usb/classes/massstor.h> 45 46 #include <errno.h> 47 #include <io/logctl.h> 46 48 #include <str_error.h> 47 49 #include "cmdw.h" … … 51 53 52 54 #define NAME "usbmast" 53 54 #define GET_BULK_IN(dev) ((dev)->pipes[BULK_IN_EP].pipe)55 #define GET_BULK_OUT(dev) ((dev)->pipes[BULK_OUT_EP].pipe)56 55 57 56 static const usb_endpoint_description_t bulk_in_ep = { … … 112 111 static int usbmast_device_gone(usb_device_t *dev) 113 112 { 114 usbmast_dev_t *mdev = dev->driver_data;113 usbmast_dev_t *mdev = usb_device_data_get(dev); 115 114 assert(mdev); 116 115 … … 152 151 unsigned i; 153 152 153 usb_endpoint_mapping_t *epm_in = 154 usb_device_get_mapped_ep_desc(dev, &bulk_in_ep); 155 usb_endpoint_mapping_t *epm_out = 156 usb_device_get_mapped_ep_desc(dev, &bulk_out_ep); 157 if (!epm_in || !epm_out || !epm_in->present || !epm_out->present) { 158 usb_log_error("Required EPs were not mapped.\n"); 159 return ENOENT; 160 } 161 154 162 /* Allocate softstate */ 155 163 mdev = usb_device_data_alloc(dev, sizeof(usbmast_dev_t)); … … 159 167 } 160 168 161 mdev->ddf_dev = dev->ddf_dev;162 169 mdev->usb_dev = dev; 163 170 164 usb_log_info("Initializing mass storage `%s'.\n", ddf_dev_get_name(dev->ddf_dev)); 171 usb_log_info("Initializing mass storage `%s'.\n", 172 usb_device_get_name(dev)); 165 173 usb_log_debug("Bulk in endpoint: %d [%zuB].\n", 166 dev->pipes[BULK_IN_EP].pipe.endpoint_no, 167 dev->pipes[BULK_IN_EP].pipe.max_packet_size); 174 epm_in->pipe.endpoint_no, epm_in->pipe.max_packet_size); 168 175 usb_log_debug("Bulk out endpoint: %d [%zuB].\n", 169 dev->pipes[BULK_OUT_EP].pipe.endpoint_no, 170 dev->pipes[BULK_OUT_EP].pipe.max_packet_size); 176 epm_out->pipe.endpoint_no, epm_out->pipe.max_packet_size); 171 177 172 178 usb_log_debug("Get LUN count...\n"); … … 179 185 } 180 186 187 mdev->bulk_in_pipe = &epm_in->pipe; 188 mdev->bulk_out_pipe = &epm_out->pipe; 181 189 for (i = 0; i < mdev->lun_count; i++) { 182 190 rc = usbmast_fun_create(mdev, i); … … 223 231 } 224 232 225 fun = ddf_fun_create(mdev->ddf_dev, fun_exposed, fun_name);233 fun = usb_device_ddf_fun_create(mdev->usb_dev, fun_exposed, fun_name); 226 234 if (fun == NULL) { 227 235 usb_log_error("Failed to create DDF function %s.\n", fun_name); … … 254 262 if (rc != EOK) { 255 263 usb_log_warning("Failed to inquire device `%s': %s.\n", 256 ddf_dev_get_name(mdev->ddf_dev), str_error(rc));264 usb_device_get_name(mdev->usb_dev), str_error(rc)); 257 265 rc = EIO; 258 266 goto error; … … 261 269 usb_log_info("Mass storage `%s' LUN %u: " \ 262 270 "%s by %s rev. %s is %s (%s).\n", 263 ddf_dev_get_name(mdev->ddf_dev),271 usb_device_get_name(mdev->usb_dev), 264 272 lun, 265 273 inquiry.product, … … 274 282 if (rc != EOK) { 275 283 usb_log_warning("Failed to read capacity, device `%s': %s.\n", 276 ddf_dev_get_name(mdev->ddf_dev), str_error(rc));284 usb_device_get_name(mdev->usb_dev), str_error(rc)); 277 285 rc = EIO; 278 286 goto error; … … 396 404 { 397 405 log_init(NAME); 398 406 logctl_set_log_level(NAME, LVL_NOTE); 399 407 return usb_driver_main(&usbmast_driver); 400 408 }
Note:
See TracChangeset
for help on using the changeset viewer.