Edit online

数据结构设计

31 Jan 2024
Read time: 2 minute(s)

ehci_hc_driver

HCD 核心的数据结构为 hc_driver,EHCI 实现了以下的核心函数:
static const struct hc_driver ehci_hc_driver = {
    .description =          hcd_name,
    .product_desc =         "EHCI Host Controller",
    .hcd_priv_size =        sizeof(struct ehci_hcd),

    /*
    * generic hardware linkage
    */
    .irq =                  ehci_irq,
    .flags =                HCD_MEMORY | HCD_DMA | HCD_USB2 | HCD_BH,

    /*
    * basic lifecycle operations
    */
    .reset =                ehci_setup,
    .start =                ehci_run,
    .stop =                 ehci_stop,
    .shutdown =             ehci_shutdown,

    /*
    * managing i/o requests and associated device resources
    */
    .urb_enqueue =          ehci_urb_enqueue,
    .urb_dequeue =          ehci_urb_dequeue,
    .endpoint_disable =     ehci_endpoint_disable,
    .endpoint_reset =       ehci_endpoint_reset,
    .clear_tt_buffer_complete =     ehci_clear_tt_buffer_complete,

    /*
    * scheduling support
    */
    .get_frame_number =     ehci_get_frame,

    /*
    * root hub support
    */
    .hub_status_data =      ehci_hub_status_data,
    .hub_control =          ehci_hub_control,
    .bus_suspend =          ehci_bus_suspend,
    .bus_resume =           ehci_bus_resume,
    .relinquish_port =      ehci_relinquish_port,
    .port_handed_over =     ehci_port_handed_over,
    .get_resuming_ports =   ehci_get_resuming_ports,

    /*
    * device support
    */
    .free_dev =             ehci_remove_device,
};