Changeset d8b275d in mainline for uspace/drv/ohci/iface.c


Ignore:
Timestamp:
2011-04-14T08:24:29Z (13 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5e07e2b5
Parents:
3f2af64 (diff), 34e8bab (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.
Message:

Merge development/ changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ohci/iface.c

    r3f2af64 rd8b275d  
    5555
    5656        size_t res_bw;
    57         endpoint_t *ep = usb_endpoint_manager_get_ep(&(*hc)->ep_manager,
     57        endpoint_t *ep = hc_get_endpoint(*hc,
    5858            target.address, target.endpoint, direction, &res_bw);
    5959        if (ep == NULL) {
     
    6363        }
    6464
     65        usb_log_debug("%s %d:%d %zu(%zu).\n",
     66            name, target.address, target.endpoint, size, ep->max_packet_size);
     67
    6568        const size_t bw = bandwidth_count_usb11(
    6669            ep->speed, ep->transfer_type, size, ep->max_packet_size);
     
    6871                usb_log_error("Endpoint(%d:%d) %s needs %zu bw "
    6972                    "but only %zu is reserved.\n",
    70                     name, target.address, target.endpoint, bw, res_bw);
     73                    target.address, target.endpoint, name, bw, res_bw);
    7174                return ENOSPC;
    7275        }
    73         usb_log_debug("%s %d:%d %zu(%zu).\n",
    74             name, target.address, target.endpoint, size, ep->max_packet_size);
    7576
    7677        *batch = batch_get(
     
    157158        hc_t *hc = fun_to_hc(fun);
    158159        assert(hc);
    159         if (address == hc->rh.address)
    160                 return EOK;
     160
    161161        usb_speed_t speed = usb_device_keeper_get_speed(&hc->manager, address);
    162162        if (speed >= USB_SPEED_MAX) {
    163163                speed = ep_speed;
    164164        }
    165         const size_t size =
    166             (transfer_type == USB_TRANSFER_INTERRUPT
    167             || transfer_type == USB_TRANSFER_ISOCHRONOUS) ?
    168             max_packet_size : 0;
    169         int ret;
    170 
    171         endpoint_t *ep = malloc(sizeof(endpoint_t));
    172         if (ep == NULL)
    173                 return ENOMEM;
    174         ret = endpoint_init(ep, address, endpoint, direction,
    175             transfer_type, speed, max_packet_size);
    176         if (ret != EOK) {
    177                 free(ep);
    178                 return ret;
    179         }
     165        const size_t size = max_packet_size;
    180166
    181167        usb_log_debug("Register endpoint %d:%d %s %s(%d) %zu(%zu) %u.\n",
     
    183169            usb_str_speed(speed), direction, size, max_packet_size, interval);
    184170
    185         ret = usb_endpoint_manager_register_ep(&hc->ep_manager, ep, size);
    186         if (ret != EOK) {
    187                 endpoint_destroy(ep);
    188         }
    189         return ret;
     171        return hc_add_endpoint(hc, address, endpoint, speed, transfer_type,
     172            direction, max_packet_size, size, interval);
    190173}
    191174/*----------------------------------------------------------------------------*/
     
    198181        usb_log_debug("Unregister endpoint %d:%d %d.\n",
    199182            address, endpoint, direction);
    200         return usb_endpoint_manager_unregister_ep(&hc->ep_manager, address,
    201             endpoint, direction);
     183        return hc_remove_endpoint(hc, address, endpoint, direction);
    202184}
    203185/*----------------------------------------------------------------------------*/
     
    231213        ret = hc_schedule(hc, batch);
    232214        if (ret != EOK) {
    233                 batch_dispose(batch);
     215                usb_transfer_batch_dispose(batch);
    234216        }
    235217        return ret;
     
    265247        ret = hc_schedule(hc, batch);
    266248        if (ret != EOK) {
    267                 batch_dispose(batch);
     249                usb_transfer_batch_dispose(batch);
    268250        }
    269251        return ret;
     
    299281        ret = hc_schedule(hc, batch);
    300282        if (ret != EOK) {
    301                 batch_dispose(batch);
     283                usb_transfer_batch_dispose(batch);
    302284        }
    303285        return ret;
     
    333315        ret = hc_schedule(hc, batch);
    334316        if (ret != EOK) {
    335                 batch_dispose(batch);
     317                usb_transfer_batch_dispose(batch);
    336318        }
    337319        return ret;
     
    349331 * @param[in] setup_packet Setup packet buffer (in USB endianess, allocated
    350332 *      and deallocated by the caller).
    351  * @param[in] setup_packet_size Size of @p setup_packet buffer in bytes.
     333 * @param[in] setup_size Size of @p setup_packet buffer in bytes.
    352334 * @param[in] data_buffer Data buffer (in USB endianess, allocated and
    353335 *      deallocated by the caller).
    354  * @param[in] data_buffer_size Size of @p data_buffer buffer in bytes.
     336 * @param[in] size Size of @p data_buffer buffer in bytes.
    355337 * @param[in] callback Callback to be issued once the transfer is complete.
    356338 * @param[in] arg Pass-through argument to the callback.
     
    373355        ret = hc_schedule(hc, batch);
    374356        if (ret != EOK) {
    375                 batch_dispose(batch);
     357                usb_transfer_batch_dispose(batch);
    376358        }
    377359        return ret;
     
    389371 * @param[in] setup_packet Setup packet buffer (in USB endianess, allocated
    390372 *      and deallocated by the caller).
    391  * @param[in] setup_packet_size Size of @p setup_packet buffer in bytes.
     373 * @param[in] setup_size Size of @p setup_packet buffer in bytes.
    392374 * @param[in] data_buffer Buffer where to store the data (in USB endianess,
    393375 *      allocated and deallocated by the caller).
    394  * @param[in] data_buffer_size Size of @p data_buffer buffer in bytes.
     376 * @param[in] size Size of @p data_buffer buffer in bytes.
    395377 * @param[in] callback Callback to be issued once the transfer is complete.
    396378 * @param[in] arg Pass-through argument to the callback.
     
    412394        ret = hc_schedule(hc, batch);
    413395        if (ret != EOK) {
    414                 batch_dispose(batch);
     396                usb_transfer_batch_dispose(batch);
    415397        }
    416398        return ret;
Note: See TracChangeset for help on using the changeset viewer.