Changeset 56257ba in mainline for uspace/drv/bus/usb/ehci/ehci_bus.c


Ignore:
Timestamp:
2018-01-07T01:01:42Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
63431db
Parents:
9efad54
git-author:
Ondřej Hlavatý <aearsis@…> (2018-01-07 01:01:41)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-01-07 01:01:42)
Message:

usbhost: manage endpoints by library + get/set_toggle → reset_toggle

That simplifies things A LOT. Now you can find endpoints for device in
an array inside device. This array is managed automatically in
register/unregister endpoint. HC drivers still needs to write to it when
setting up/tearing down the device.

Sorry for these two changes being in one commit, but splitting them
would be simply more work for no benefit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ehci/ehci_bus.c

    r9efad54 r56257ba  
    4848 * @param[in] toggle new value of toggle bit
    4949 */
    50 static void ehci_ep_toggle_set(endpoint_t *ep, bool toggle)
     50static void ehci_ep_toggle_reset(endpoint_t *ep)
    5151{
    5252        ehci_endpoint_t *instance = ehci_endpoint_get(ep);
    53         assert(instance);
    54         assert(instance->qh);
    55         ep->toggle = toggle;
    5653        if (qh_toggle_from_td(instance->qh))
    57                 usb_log_warning("EP(%p): Setting toggle bit for transfer "
    58                     "directed EP", instance);
    59         qh_toggle_set(instance->qh, toggle);
     54                usb_log_warning("EP(%p): Resetting toggle bit for transfer directed EP", instance);
     55        qh_toggle_set(instance->qh, 0);
     56        ep->toggle = 0;
    6057}
    6158
    62 /** Callback to get value of toggle bit.
    63  *
    64  * @param[in] hcd_ep hcd endpoint structure
    65  * @return Current value of toggle bit.
    66  */
    67 static bool ehci_ep_toggle_get(endpoint_t *ep)
    68 {
    69         ehci_endpoint_t *instance = ehci_endpoint_get(ep);
    70         assert(instance);
    71         assert(instance->qh);
    72 
    73         if (qh_toggle_from_td(instance->qh))
    74                 usb_log_warning("EP(%p): Reading useless toggle bit", instance);
    75         return qh_toggle_get(instance->qh);
    76 }
    7759
    7860/** Creates new hcd endpoint representation.
     
    166148        .endpoint_register = ehci_register_ep,
    167149        .endpoint_unregister = ehci_unregister_ep,
    168         .endpoint_set_toggle = ehci_ep_toggle_set,
    169         .endpoint_get_toggle = ehci_ep_toggle_get,
     150        .endpoint_toggle_reset = ehci_ep_toggle_reset,
    170151        .endpoint_count_bw = bandwidth_count_usb11,
    171152        .batch_create = ehci_create_batch,
Note: See TracChangeset for help on using the changeset viewer.