Changeset 32fb6bce in mainline for uspace/drv/bus/usb/ohci/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/ohci/hc.h

    r1ea0bbf r32fb6bce  
    5858/** Main OHCI driver structure */
    5959typedef struct hc {
     60        /** Common hcd header */
     61        hc_device_t base;
     62
    6063        /** Memory mapped I/O registers area */
    6164        ohci_regs_t *registers;
     
    7073        list_t pending_batches;
    7174
    72         /** Fibril for periodic checks if interrupts can't be used */
    73         fid_t interrupt_emulator;
    74 
    7575        /** Guards schedule and endpoint manipulation */
    7676        fibril_mutex_t guard;
    77 
    78         /** interrupts available */
    79         bool hw_interrupts;
    8077
    8178        /** USB hub emulation structure */
     
    8683} hc_t;
    8784
    88 extern int hc_init(hc_t *, const hw_res_list_parsed_t *);
    89 extern void hc_gain_control(hc_t *instance);
    90 extern void hc_start(hc_t *instance);
    91 extern void hc_fini(hc_t *);
     85static inline hc_t * hcd_to_hc(hc_device_t *hcd)
     86{
     87        assert(hcd);
     88        return (hc_t *) hcd;
     89}
     90
     91extern int hc_add(hc_device_t *, const hw_res_list_parsed_t *);
     92extern int hc_gen_irq_code(irq_code_t *, hc_device_t *, const hw_res_list_parsed_t *);
     93extern int hc_gain_control(hc_device_t *);
     94extern int hc_start(hc_device_t *);
     95extern int hc_gone(hc_device_t *);
    9296
    9397extern void hc_enqueue_endpoint(hc_t *, const endpoint_t *);
    9498extern void hc_dequeue_endpoint(hc_t *, const endpoint_t *);
    9599
    96 int ohci_hc_gen_irq_code(irq_code_t *code, hcd_t *hcd, const hw_res_list_parsed_t *hw_res);
    97 
    98 extern void ohci_hc_interrupt(hcd_t *, uint32_t);
    99 extern int ohci_hc_status(hcd_t *, uint32_t *);
    100 extern int ohci_hc_schedule(hcd_t *, usb_transfer_batch_t *);
     100extern int ohci_hc_schedule(usb_transfer_batch_t *);
     101extern int ohci_hc_status(bus_t *, uint32_t *);
     102extern void ohci_hc_interrupt(bus_t *, uint32_t);
    101103
    102104#endif
Note: See TracChangeset for help on using the changeset viewer.