Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhub/port.h

    rb7fd2a0 r0f79283b  
    22 * Copyright (c) 2011 Vojtech Horky
    33 * Copyright (c) 2011 Jan Vesely
     4 * Copyright (c) 2017 Ondra Hlavaty
    45 * All rights reserved.
    56 *
     
    3233 */
    3334/** @file
    34  * Hub ports related functions.
     35 * Hub port handling.
    3536 */
    3637
     
    4041#include <usb/dev/driver.h>
    4142#include <usb/classes/hub.h>
    42 #include <usb_iface.h>
     43#include <usb/port.h>
    4344
    4445typedef struct usb_hub_dev usb_hub_dev_t;
     
    4647/** Information about single port on a hub. */
    4748typedef struct {
     49        usb_port_t base;
     50        /* Parenting hub */
     51        usb_hub_dev_t *hub;
    4852        /** Port number as reported in descriptors. */
    4953        unsigned int port_number;
    50         /** Device communication pipe. */
    51         usb_pipe_t *control_pipe;
    52         /** Mutex needed not only by CV for checking port reset. */
    53         fibril_mutex_t mutex;
    54         /** CV for waiting to port reset completion. */
    55         fibril_condvar_t reset_cv;
    56         /** Port reset status.
    57          * Guarded by @c reset_mutex.
    58          */
    59         enum {
    60                 NO_RESET,
    61                 IN_RESET,
    62                 RESET_OK,
    63                 RESET_FAIL,
    64         } reset_status;
    65         /** Device reported to USB bus driver */
    66         bool device_attached;
     54        /** Speed at the time of enabling the port */
     55        usb_speed_t speed;
    6756} usb_hub_port_t;
    6857
    69 /** Initialize hub port information.
    70  *
    71  * @param port Port to be initialized.
    72  */
    73 static inline void usb_hub_port_init(usb_hub_port_t *port,
    74     unsigned int port_number, usb_pipe_t *control_pipe)
    75 {
    76         assert(port);
    77         port->port_number = port_number;
    78         port->control_pipe = control_pipe;
    79         port->reset_status = NO_RESET;
    80         port->device_attached = false;
    81         fibril_mutex_initialize(&port->mutex);
    82         fibril_condvar_initialize(&port->reset_cv);
    83 }
     58void usb_hub_port_init(usb_hub_port_t *, usb_hub_dev_t *, unsigned int);
    8459
    85 errno_t usb_hub_port_fini(usb_hub_port_t *port, usb_hub_dev_t *hub);
    86 errno_t usb_hub_port_clear_feature(
    87     usb_hub_port_t *port, usb_hub_class_feature_t feature);
    88 errno_t usb_hub_port_set_feature(
    89     usb_hub_port_t *port, usb_hub_class_feature_t feature);
    90 void usb_hub_port_reset_fail(usb_hub_port_t *port);
    91 void usb_hub_port_process_interrupt(usb_hub_port_t *port, usb_hub_dev_t *hub);
     60void usb_hub_port_process_interrupt(usb_hub_port_t *port);
    9261
    9362#endif
Note: See TracChangeset for help on using the changeset viewer.