Changeset df6ded8 in mainline for uspace/drv/block/usbmast/main.c


Ignore:
Timestamp:
2018-02-28T16:37:50Z (6 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1b20da0
Parents:
f5e5f73 (diff), b2dca8de (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.
git-author:
Jakub Jermar <jakub@…> (2018-02-28 16:06:42)
git-committer:
Jakub Jermar <jakub@…> (2018-02-28 16:37:50)
Message:

Merge github.com:helenos-xhci-team/helenos

This commit merges support for USB 3 and generally refactors, fixes,
extends and cleans up the existing USB framework.

Notable additions and features:

  • new host controller driver has been implemented to control various xHC models (among others, NEC Renesas uPD720200)
  • isochronous data transfer mode
  • support for explicit USB device removal
  • USB tablet driver
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/block/usbmast/main.c

    rf5e5f73 rdf6ded8  
    22 * Copyright (c) 2011 Vojtech Horky
    33 * Copyright (c) 2011 Jiri Svoboda
     4 * Copyright (c) 2018 Ondrej Hlavaty
    45 * All rights reserved.
    56 *
     
    156157            usb_device_get_mapped_ep_desc(dev, &bulk_out_ep);
    157158        if (!epm_in || !epm_out || !epm_in->present || !epm_out->present) {
    158                 usb_log_error("Required EPs were not mapped.\n");
     159                usb_log_error("Required EPs were not mapped.");
    159160                return ENOENT;
    160161        }
     
    163164        mdev = usb_device_data_alloc(dev, sizeof(usbmast_dev_t));
    164165        if (mdev == NULL) {
    165                 usb_log_error("Failed allocating softstate.\n");
     166                usb_log_error("Failed allocating softstate.");
    166167                return ENOMEM;
    167168        }
     
    169170        mdev->usb_dev = dev;
    170171
    171         usb_log_info("Initializing mass storage `%s'.\n",
     172        usb_log_info("Initializing mass storage `%s'.",
    172173            usb_device_get_name(dev));
    173         usb_log_debug("Bulk in endpoint: %d [%zuB].\n",
    174             epm_in->pipe.endpoint_no, epm_in->pipe.max_packet_size);
    175         usb_log_debug("Bulk out endpoint: %d [%zuB].\n",
    176             epm_out->pipe.endpoint_no, epm_out->pipe.max_packet_size);
    177 
    178         usb_log_debug("Get LUN count...\n");
     174        usb_log_debug("Bulk in endpoint: %d [%zuB].",
     175            epm_in->pipe.desc.endpoint_no, epm_in->pipe.desc.max_transfer_size);
     176        usb_log_debug("Bulk out endpoint: %d [%zuB].",
     177            epm_out->pipe.desc.endpoint_no, epm_out->pipe.desc.max_transfer_size);
     178
     179        usb_log_debug("Get LUN count...");
    179180        mdev->lun_count = usb_masstor_get_lun_count(mdev);
    180181        mdev->luns = calloc(mdev->lun_count, sizeof(ddf_fun_t*));
    181182        if (mdev->luns == NULL) {
    182                 rc = ENOMEM;
    183                 usb_log_error("Failed allocating luns table.\n");
    184                 goto error;
     183                usb_log_error("Failed allocating luns table.");
     184                return ENOMEM;
    185185        }
    186186
     
    226226
    227227        if (asprintf(&fun_name, "l%u", lun) < 0) {
    228                 usb_log_error("Out of memory.\n");
     228                usb_log_error("Out of memory.");
    229229                rc = ENOMEM;
    230230                goto error;
     
    233233        fun = usb_device_ddf_fun_create(mdev->usb_dev, fun_exposed, fun_name);
    234234        if (fun == NULL) {
    235                 usb_log_error("Failed to create DDF function %s.\n", fun_name);
     235                usb_log_error("Failed to create DDF function %s.", fun_name);
    236236                rc = ENOMEM;
    237237                goto error;
     
    241241        mfun = ddf_fun_data_alloc(fun, sizeof(usbmast_fun_t));
    242242        if (mfun == NULL) {
    243                 usb_log_error("Failed allocating softstate.\n");
     243                usb_log_error("Failed allocating softstate.");
    244244                rc = ENOMEM;
    245245                goto error;
     
    257257        ddf_fun_set_conn_handler(fun, usbmast_bd_connection);
    258258
    259         usb_log_debug("Inquire...\n");
     259        usb_log_debug("Inquire...");
    260260        usbmast_inquiry_data_t inquiry;
    261261        rc = usbmast_inquiry(mfun, &inquiry);
    262262        if (rc != EOK) {
    263                 usb_log_warning("Failed to inquire device `%s': %s.\n",
     263                usb_log_warning("Failed to inquire device `%s': %s.",
    264264                    usb_device_get_name(mdev->usb_dev), str_error(rc));
    265265                rc = EIO;
     
    281281        rc = usbmast_read_capacity(mfun, &nblocks, &block_size);
    282282        if (rc != EOK) {
    283                 usb_log_warning("Failed to read capacity, device `%s': %s.\n",
     283                usb_log_warning("Failed to read capacity, device `%s': %s.",
    284284                    usb_device_get_name(mdev->usb_dev), str_error(rc));
    285285                rc = EIO;
     
    295295        rc = ddf_fun_bind(fun);
    296296        if (rc != EOK) {
    297                 usb_log_error("Failed to bind DDF function %s: %s.\n",
     297                usb_log_error("Failed to bind DDF function %s: %s.",
    298298                    fun_name, str_error(rc));
    299299                goto error;
     
    390390static const usb_driver_ops_t usbmast_driver_ops = {
    391391        .device_add = usbmast_device_add,
    392         .device_rem = usbmast_device_remove,
     392        .device_remove = usbmast_device_remove,
    393393        .device_gone = usbmast_device_gone,
    394394};
Note: See TracChangeset for help on using the changeset viewer.