Changeset f11c288 in mainline for uspace/drv/uhci-hcd/iface.c


Ignore:
Timestamp:
2011-04-09T22:20:02Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0748854, d32ed36
Parents:
709e868 (diff), a19a2d7 (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:

Fix crash on endpoint_t instance removal

Remove unused default address handling (support in device_keeper_t will be removed later)
Add tons of OHCI debug output (still not working), and some fixes found by using that debug output.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-hcd/iface.c

    r709e868 rf11c288  
    7474            name, target.address, target.endpoint, size, ep->max_packet_size);
    7575
    76 //      assert(ep->speed ==
    77 //          usb_device_keeper_get_speed(&(*hc)->manager, target.address));
    78 //      assert(ep->max_packet_size == max_packet_size);
    79 //      assert(ep->transfer_type == USB_TRANSFER_CONTROL);
    80 
    81         *batch =
    82             batch_get(fun, ep, data, size, setup_data, setup_size,
    83                 in, out, arg);
    84         if (!batch)
     76        *batch = batch_get(
     77                fun, ep, data, size, setup_data, setup_size, in, out, arg);
     78        if (!*batch)
    8579                return ENOMEM;
    86         return EOK;
    87 }
    88 
    89 
    90 /** Reserve default address interface function
    91  *
    92  * @param[in] fun DDF function that was called.
    93  * @param[in] speed Speed to associate with the new default address.
    94  * @return Error code.
    95  */
    96 static int reserve_default_address(ddf_fun_t *fun, usb_speed_t speed)
    97 {
    98         assert(fun);
    99         hc_t *hc = fun_to_hc(fun);
    100         assert(hc);
    101         usb_log_debug("Default address request with speed %d.\n", speed);
    102         usb_device_keeper_reserve_default_address(&hc->manager, speed);
    103         return EOK;
    104 #if 0
    105         endpoint_t *ep = malloc(sizeof(endpoint_t));
    106         if (ep == NULL)
    107                 return ENOMEM;
    108         const size_t max_packet_size = speed == USB_SPEED_LOW ? 8 : 64;
    109         endpoint_init(ep, USB_TRANSFER_CONTROL, speed, max_packet_size);
    110         int ret;
    111 try_retgister:
    112         ret = usb_endpoint_manager_register_ep(&hc->ep_manager,
    113             USB_ADDRESS_DEFAULT, 0, USB_DIRECTION_BOTH, ep, endpoint_destroy, 0);
    114         if (ret == EEXISTS) {
    115                 async_usleep(1000);
    116                 goto try_retgister;
    117         }
    118         if (ret != EOK) {
    119                 endpoint_destroy(ep);
    120         }
    121         return ret;
    122 #endif
    123 }
    124 /*----------------------------------------------------------------------------*/
    125 /** Release default address interface function
    126  *
    127  * @param[in] fun DDF function that was called.
    128  * @return Error code.
    129  */
    130 static int release_default_address(ddf_fun_t *fun)
    131 {
    132         assert(fun);
    133         hc_t *hc = fun_to_hc(fun);
    134         assert(hc);
    135         usb_log_debug("Default address release.\n");
    136 //      return usb_endpoint_manager_unregister_ep(&hc->ep_manager,
    137 //          USB_ADDRESS_DEFAULT, 0, USB_DIRECTION_BOTH);
    138         usb_device_keeper_release_default_address(&hc->manager);
    13980        return EOK;
    14081}
     
    232173        if (ret != EOK) {
    233174                endpoint_destroy(ep);
    234         } else {
    235                 usb_device_keeper_add_ep(&hc->manager, address, ep);
    236175        }
    237176        return ret;
     
    246185        usb_log_debug("Unregister endpoint %d:%d %d.\n",
    247186            address, endpoint, direction);
    248         endpoint_t *ep = usb_endpoint_manager_get_ep(&hc->ep_manager,
    249             address, endpoint, direction, NULL);
    250         if (ep != NULL) {
    251                 usb_device_keeper_del_ep(&hc->manager, address, ep);
    252         }
    253187        return usb_endpoint_manager_unregister_ep(&hc->ep_manager, address,
    254188            endpoint, direction);
     
    391325        if (ret != EOK)
    392326                return ret;
    393         usb_device_keeper_reset_if_need(&hc->manager, target, setup_data);
     327        usb_endpoint_manager_reset_if_need(&hc->ep_manager, target, setup_data);
    394328        batch_control_write(batch);
    395329        ret = hc_schedule(hc, batch);
     
    433367/*----------------------------------------------------------------------------*/
    434368usbhc_iface_t hc_iface = {
    435         .reserve_default_address = reserve_default_address,
    436         .release_default_address = release_default_address,
    437369        .request_address = request_address,
    438370        .bind_address = bind_address,
Note: See TracChangeset for help on using the changeset viewer.