Changeset 32fb6bce in mainline for uspace/drv/bus/usb/uhci/hc.h


Ignore:
Timestamp:
2017-12-18T22:50:21Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7f70d1c
Parents:
1ea0bbf
git-author:
Ondřej Hlavatý <aearsis@…> (2017-12-18 22:04:50)
git-committer:
Ondřej Hlavatý <aearsis@…> (2017-12-18 22:50:21)
Message:

usbhost: refactoring

This commit moves interrupt, status and schedule to bus
operations. Then the purpose of hcd_t is better defined, and split into
hc_driver_t and hc_device_t. hc_driver_t is used to wrap driver
implementation by the library (similar to how usb_driver_t is used to
wrap usb device drivers). hc_device_t is used as a parent for hc_t
inside drivers, and is allocated inside the DDF device node.

To support these changes, some local identifiers were renamed, some
functions were moved and/or renamed and their arguments changed. The
most notable one being hcd_send_batch → bus_device_send_batch.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/uhci/hc.h

    r1ea0bbf r32fb6bce  
    100100/** Main UHCI driver structure */
    101101typedef struct hc {
     102        /* Common hc_device header */
     103        hc_device_t base;
     104
    102105        uhci_rh_t rh;
    103106        usb2_bus_t bus;
     
    119122        /** Pointer table to the above lists, helps during scheduling */
    120123        transfer_list_t *transfers[2][4];
    121         /** Indicator of hw interrupts availability */
    122         bool hw_interrupts;
    123124
    124125        /** Number of hw failures detected. */
     
    126127} hc_t;
    127128
    128 extern int hc_init(hc_t *, hcd_t *, const hw_res_list_parsed_t *);
    129 extern void hc_start(hc_t *);
    130 extern void hc_fini(hc_t *);
     129static inline hc_t *hcd_to_hc(hc_device_t *hcd)
     130{
     131        assert(hcd);
     132        return (hc_t *) hcd;
     133}
    131134
    132 extern int uhci_hc_gen_irq_code(irq_code_t *, hcd_t *,const hw_res_list_parsed_t *);
     135static inline hc_t *bus_to_hc(bus_t *bus)
     136{
     137        assert(bus);
     138        return member_to_inst(bus, hc_t, bus);
     139}
    133140
    134 extern void uhci_hc_interrupt(hcd_t *, uint32_t);
    135 extern int uhci_hc_status(hcd_t *, uint32_t *);
    136 extern int uhci_hc_schedule(hcd_t *, usb_transfer_batch_t *);
     141extern int hc_add(hc_device_t *, const hw_res_list_parsed_t *);
     142extern int hc_gen_irq_code(irq_code_t *, hc_device_t *, const hw_res_list_parsed_t *);
     143extern int hc_start(hc_device_t *);
     144extern int hc_gone(hc_device_t *);
    137145
    138146#endif
Note: See TracChangeset for help on using the changeset viewer.