Changeset 867b375 in mainline for uspace/lib/usbhost/include


Ignore:
Timestamp:
2017-10-15T02:04:10Z (8 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
20eaa82
Parents:
d7869d7e
Message:

hcd_ddf_new_device refactoring

This long function is now split into parts. Instead of passing dozens of arguments, it now creates the usb_dev_t right away, and uses that to pass it along. The address_device part is now modifiable by drivers.

There is still a work to be done. The biggest problem I see is in the addressing - currently, there is usb_address_t, and for high speed transaction translating there is another address. For (near) future extensibility, we should pass address as a structure. Or even better, make a way how to reference a device, maybe in a similar way how we work with endpoints.

Location:
uspace/lib/usbhost/include/usb/host
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/include/usb/host/ddf_helpers.h

    rd7869d7e r867b375  
    4949typedef int (*claim_t)(hcd_t *, ddf_dev_t *);
    5050typedef int (*driver_start_t)(hcd_t *, bool irq);
    51 typedef int (*setup_root_hub_t)(ddf_dev_t *);
     51typedef int (*setup_root_hub_t)(hcd_t *, ddf_dev_t *);
    5252
    5353typedef void (*driver_stop_t)(hcd_t *);
     
    8181void hcd_ddf_clean_hc(ddf_dev_t *device);
    8282
    83 int hcd_setup_virtual_root_hub(ddf_dev_t *);
     83int hcd_setup_virtual_root_hub(hcd_t *, ddf_dev_t *);
    8484
    8585hcd_t *dev_to_hcd(ddf_dev_t *dev);
     
    9393void ddf_hcd_gen_irq_handler(ipc_callid_t iid, ipc_call_t *call, ddf_dev_t *dev);
    9494
     95/* For xHCI, we need to drive the roothub without roothub having assigned an
     96 * address. Thus we cannot create function for it, and we have to carry the
     97 * usb_dev_t somewhere.
     98 *
     99 * This is sort of hacky, but at least does not expose the internals of ddf_helpers.
     100 */
     101typedef struct hcd_roothub hcd_roothub_t;
     102
     103hcd_roothub_t *hcd_roothub_create(hcd_t *, ddf_dev_t *, usb_speed_t);
     104int hcd_roothub_new_device(hcd_roothub_t *, unsigned port);
     105
    95106#endif
    96107
  • uspace/lib/usbhost/include/usb/host/endpoint.h

    rd7869d7e r867b375  
    7979        fibril_condvar_t avail;
    8080        /** High speed TT data */
    81         struct {
    82                 usb_address_t address;
    83                 unsigned port;
    84         } tt;
     81        usb_tt_address_t tt;
    8582
    8683        /* This structure is meant to be extended by overriding. */
  • uspace/lib/usbhost/include/usb/host/hcd.h

    rd7869d7e r867b375  
    5050
    5151typedef int (*schedule_hook_t)(hcd_t *, usb_transfer_batch_t *);
    52 typedef int (*ep_add_hook_t)(hcd_t *, endpoint_t *);
    53 typedef void (*ep_remove_hook_t)(hcd_t *, endpoint_t *);
    5452typedef void (*interrupt_hook_t)(hcd_t *, uint32_t);
    5553typedef int (*status_hook_t)(hcd_t *, uint32_t *);
     54typedef int (*address_device_hook_t)(hcd_t *, usb_speed_t, usb_tt_address_t, usb_address_t *);
    5655
    5756typedef struct {
     
    6261        /** Periodic polling hook */
    6362        status_hook_t status_hook;
     63        /** Hook to setup device address */
     64        address_device_hook_t address_device;
    6465} hcd_ops_t;
    6566
     
    112113
    113114extern int hcd_add_ep(hcd_t *, usb_target_t, usb_direction_t,
    114     usb_transfer_type_t, size_t, unsigned int, size_t, usb_address_t,
    115     unsigned int);
     115    usb_transfer_type_t, size_t, unsigned int, size_t, usb_tt_address_t);
    116116
    117117extern int hcd_remove_ep(hcd_t *, usb_target_t, usb_direction_t);
Note: See TracChangeset for help on using the changeset viewer.