Changeset 1998bcd in mainline for uspace/drv


Ignore:
Timestamp:
2011-04-08T22:25:00Z (15 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
98064795
Parents:
297341b
Message:

Endpoint registration sends address as well

This is the first step towards using endpoint registration instead
of reservation of default address.

Location:
uspace/drv
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ehci-hcd/hc_iface.c

    r297341b r1998bcd  
    123123 * @param[in] fun Device function the action was invoked on.
    124124 * @param[in] address USB address of the device.
     125 * @param[in] speed Endpoint speed (invalid means to use device one).
    125126 * @param[in] endpoint Endpoint number.
    126127 * @param[in] transfer_type USB transfer type.
     
    131132 */
    132133static int register_endpoint(ddf_fun_t *fun,
    133     usb_address_t address, usb_endpoint_t endpoint,
     134    usb_address_t address, usb_speed_t speed, usb_endpoint_t endpoint,
    134135    usb_transfer_type_t transfer_type, usb_direction_t direction,
    135136    size_t max_packet_size, unsigned int interval)
  • uspace/drv/ohci/iface.c

    r297341b r1998bcd  
    139139 * @param[in] fun Device function the action was invoked on.
    140140 * @param[in] address USB address of the device.
     141 * @param[in] ep_speed Endpoint speed (invalid means to use device one).
    141142 * @param[in] endpoint Endpoint number.
    142143 * @param[in] transfer_type USB transfer type.
     
    146147 * @return Error code.
    147148 */
    148 static int register_endpoint(
    149     ddf_fun_t *fun, usb_address_t address, usb_endpoint_t endpoint,
     149static int register_endpoint(ddf_fun_t *fun,
     150    usb_address_t address, usb_speed_t ep_speed, usb_endpoint_t endpoint,
    150151    usb_transfer_type_t transfer_type, usb_direction_t direction,
    151152    size_t max_packet_size, unsigned int interval)
     
    156157        if (address == hc->rh.address)
    157158                return EOK;
    158         const usb_speed_t speed =
    159                 usb_device_keeper_get_speed(&hc->manager, address);
     159        usb_speed_t speed = usb_device_keeper_get_speed(&hc->manager, address);
     160        if (speed >= USB_SPEED_MAX) {
     161                speed = ep_speed;
     162        }
    160163        const size_t size = max_packet_size;
    161164        usb_log_debug("Register endpoint %d:%d %s %s(%d) %zu(%zu) %u.\n",
     
    183186        usb_log_debug("Unregister endpoint %d:%d %d.\n",
    184187            address, endpoint, direction);
     188        endpoint_t *ep = usb_endpoint_manager_get_ep(&hc->ep_manager,
     189            address, endpoint, direction, NULL);
     190        if (ep != NULL) {
     191                usb_device_keeper_del_ep(&hc->manager, address, ep);
     192        }
    185193        return usb_endpoint_manager_unregister_ep(&hc->ep_manager, address,
    186194            endpoint, direction);
  • uspace/drv/uhci-hcd/iface.c

    r297341b r1998bcd  
    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));
     76//      assert(ep->speed ==
     77//          usb_device_keeper_get_speed(&(*hc)->manager, target.address));
    7878//      assert(ep->max_packet_size == max_packet_size);
    7979//      assert(ep->transfer_type == USB_TRANSFER_CONTROL);
     
    198198/*----------------------------------------------------------------------------*/
    199199static int register_endpoint(
    200     ddf_fun_t *fun, usb_address_t address, usb_endpoint_t endpoint,
     200    ddf_fun_t *fun, usb_address_t address, usb_speed_t ep_speed,
     201    usb_endpoint_t endpoint,
    201202    usb_transfer_type_t transfer_type, usb_direction_t direction,
    202203    size_t max_packet_size, unsigned int interval)
     
    204205        hc_t *hc = fun_to_hc(fun);
    205206        assert(hc);
    206         const usb_speed_t speed =
    207             usb_device_keeper_get_speed(&hc->manager, address);
     207        usb_speed_t speed = usb_device_keeper_get_speed(&hc->manager, address);
     208        if (speed >= USB_SPEED_MAX) {
     209                speed = ep_speed;
     210        }
    208211        const size_t size =
    209212            (transfer_type == USB_TRANSFER_INTERRUPT
     
    243246        usb_log_debug("Unregister endpoint %d:%d %d.\n",
    244247            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        }
    245253        return usb_endpoint_manager_unregister_ep(&hc->ep_manager, address,
    246254            endpoint, direction);
Note: See TracChangeset for help on using the changeset viewer.