Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbmast/main.c

    r58563585 rf97f5cc2  
    3535 * Main routines of USB mass storage driver.
    3636 */
    37 
    3837#include <as.h>
    3938#include <async.h>
     
    4544#include <usb/classes/massstor.h>
    4645#include <errno.h>
    47 #include <io/logctl.h>
    4846#include <str_error.h>
    4947#include "cmdw.h"
     
    5351
    5452#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)
    5556
    5657static const usb_endpoint_description_t bulk_in_ep = {
     
    111112static int usbmast_device_gone(usb_device_t *dev)
    112113{
    113         usbmast_dev_t *mdev = usb_device_data_get(dev);
     114        usbmast_dev_t *mdev = dev->driver_data;
    114115        assert(mdev);
    115116
     
    151152        unsigned i;
    152153
    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 
    162154        /* Allocate softstate */
    163155        mdev = usb_device_data_alloc(dev, sizeof(usbmast_dev_t));
     
    167159        }
    168160
     161        mdev->ddf_dev = dev->ddf_dev;
    169162        mdev->usb_dev = dev;
    170163
    171         usb_log_info("Initializing mass storage `%s'.\n",
    172             usb_device_get_name(dev));
     164        usb_log_info("Initializing mass storage `%s'.\n", ddf_dev_get_name(dev->ddf_dev));
    173165        usb_log_debug("Bulk in endpoint: %d [%zuB].\n",
    174             epm_in->pipe.endpoint_no, epm_in->pipe.max_packet_size);
     166            dev->pipes[BULK_IN_EP].pipe.endpoint_no,
     167            dev->pipes[BULK_IN_EP].pipe.max_packet_size);
    175168        usb_log_debug("Bulk out endpoint: %d [%zuB].\n",
    176             epm_out->pipe.endpoint_no, epm_out->pipe.max_packet_size);
     169            dev->pipes[BULK_OUT_EP].pipe.endpoint_no,
     170            dev->pipes[BULK_OUT_EP].pipe.max_packet_size);
    177171
    178172        usb_log_debug("Get LUN count...\n");
     
    185179        }
    186180
    187         mdev->bulk_in_pipe = &epm_in->pipe;
    188         mdev->bulk_out_pipe = &epm_out->pipe;
    189181        for (i = 0; i < mdev->lun_count; i++) {
    190182                rc = usbmast_fun_create(mdev, i);
     
    231223        }
    232224
    233         fun = usb_device_ddf_fun_create(mdev->usb_dev, fun_exposed, fun_name);
     225        fun = ddf_fun_create(mdev->ddf_dev, fun_exposed, fun_name);
    234226        if (fun == NULL) {
    235227                usb_log_error("Failed to create DDF function %s.\n", fun_name);
     
    262254        if (rc != EOK) {
    263255                usb_log_warning("Failed to inquire device `%s': %s.\n",
    264                     usb_device_get_name(mdev->usb_dev), str_error(rc));
     256                    ddf_dev_get_name(mdev->ddf_dev), str_error(rc));
    265257                rc = EIO;
    266258                goto error;
     
    269261        usb_log_info("Mass storage `%s' LUN %u: " \
    270262            "%s by %s rev. %s is %s (%s).\n",
    271             usb_device_get_name(mdev->usb_dev),
     263            ddf_dev_get_name(mdev->ddf_dev),
    272264            lun,
    273265            inquiry.product,
     
    282274        if (rc != EOK) {
    283275                usb_log_warning("Failed to read capacity, device `%s': %s.\n",
    284                     usb_device_get_name(mdev->usb_dev), str_error(rc));
     276                    ddf_dev_get_name(mdev->ddf_dev), str_error(rc));
    285277                rc = EIO;
    286278                goto error;
     
    404396{
    405397        log_init(NAME);
    406         logctl_set_log_level(NAME, LVL_NOTE);
     398
    407399        return usb_driver_main(&usbmast_driver);
    408400}
Note: See TracChangeset for help on using the changeset viewer.