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/lib/usbhost/include/usb/host/ddf_helpers.h

    r1ea0bbf r32fb6bce  
    3939#include <ddf/driver.h>
    4040#include <ddf/interrupt.h>
    41 #include <device/hw_res_parsed.h>
    4241#include <usb/usb.h>
    4342
    4443#include <usb/host/hcd.h>
    4544
    46 typedef int (*driver_init_t)(hcd_t *, const hw_res_list_parsed_t *, ddf_dev_t *);
    47 typedef int (*irq_code_gen_t)(irq_code_t *, hcd_t *, const hw_res_list_parsed_t *);
    48 typedef int (*claim_t)(hcd_t *, ddf_dev_t *);
    49 typedef int (*driver_start_t)(hcd_t *, bool irq);
    50 typedef int (*setup_root_hub_t)(hcd_t *, ddf_dev_t *);
     45int hcd_ddf_setup_hc(ddf_dev_t *, size_t);
     46void hcd_ddf_clean_hc(hc_device_t *);
    5147
    52 typedef void (*driver_stop_t)(hcd_t *);
    53 typedef void (*driver_fini_t)(hcd_t *);
     48int hcd_setup_virtual_root_hub(hc_device_t *);
    5449
    55 /**
    56  * All callbacks are optional.
    57  */
    58 typedef struct {
    59         hcd_ops_t ops;
    60         const char *name;
     50device_t *hcd_ddf_fun_create(hc_device_t *);
     51void hcd_ddf_fun_destroy(device_t *);
    6152
    62         interrupt_handler_t *irq_handler;  /**< Handler of IRQ. Do have generic implementation. */
     53int hcd_device_explore(device_t *);
    6354
    64         /* Initialization sequence: */
    65         driver_init_t init;                /**< Initialize internal structures, memory */
    66         claim_t claim;                     /**< Claim device from BIOS */
    67         irq_code_gen_t irq_code_gen;       /**< Generate IRQ handling code */
    68         driver_start_t start;              /**< Start the HC */
    69         setup_root_hub_t setup_root_hub;   /**< Setup the root hub */
     55int hcd_ddf_enable_interrupt(hc_device_t *hcd, int);
     56int hcd_ddf_get_registers(hc_device_t *hcd, hw_res_list_parsed_t *hw_res);
    7057
    71         /* Destruction sequence: */
    72         driver_stop_t stop;                /**< Stop the HC (counterpart of start) */
    73         driver_fini_t fini;                /**< Destroy internal structures (counterpart of init) */
    74 } ddf_hc_driver_t;
    75 
    76 int hcd_ddf_add_hc(ddf_dev_t *device, const ddf_hc_driver_t *driver);
    77 
    78 int hcd_ddf_setup_hc(ddf_dev_t *device);
    79 void hcd_ddf_clean_hc(ddf_dev_t *device);
    80 
    81 int hcd_setup_virtual_root_hub(hcd_t *, ddf_dev_t *);
    82 
    83 device_t *hcd_ddf_device_create(ddf_dev_t *, bus_t *);
    84 void hcd_ddf_device_destroy(device_t *);
    85 int hcd_ddf_device_explore(device_t *);
    86 int hcd_ddf_device_online(ddf_fun_t *);
    87 int hcd_ddf_device_offline(ddf_fun_t *);
    88 
    89 hcd_t *dev_to_hcd(ddf_dev_t *dev);
    90 
    91 int hcd_ddf_enable_interrupt(ddf_dev_t *device, int);
    92 int hcd_ddf_get_registers(ddf_dev_t *device, hw_res_list_parsed_t *hw_res);
    93 int hcd_ddf_setup_interrupts(ddf_dev_t *device,
    94     const hw_res_list_parsed_t *hw_res,
    95     interrupt_handler_t handler,
    96     irq_code_gen_t gen_irq_code);
    97 void ddf_hcd_gen_irq_handler(ipc_callid_t iid, ipc_call_t *call, ddf_dev_t *dev);
     58void hcd_ddf_gen_irq_handler(ipc_callid_t iid, ipc_call_t *call, ddf_dev_t *dev);
    9859
    9960#endif
Note: See TracChangeset for help on using the changeset viewer.