Ignore:
File:
1 edited

Legend:

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

    r0f79283b rb7fd2a0  
    22 * Copyright (c) 2011 Vojtech Horky
    33 * Copyright (c) 2011 Jan Vesely
    4  * Copyright (c) 2017 Ondra Hlavaty
    54 * All rights reserved.
    65 *
     
    3332 */
    3433/** @file
    35  * Hub port handling.
     34 * Hub ports related functions.
    3635 */
    3736
     
    4140#include <usb/dev/driver.h>
    4241#include <usb/classes/hub.h>
    43 #include <usb/port.h>
     42#include <usb_iface.h>
    4443
    4544typedef struct usb_hub_dev usb_hub_dev_t;
     
    4746/** Information about single port on a hub. */
    4847typedef struct {
    49         usb_port_t base;
    50         /* Parenting hub */
    51         usb_hub_dev_t *hub;
    5248        /** Port number as reported in descriptors. */
    5349        unsigned int port_number;
    54         /** Speed at the time of enabling the port */
    55         usb_speed_t speed;
     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;
    5667} usb_hub_port_t;
    5768
    58 void usb_hub_port_init(usb_hub_port_t *, usb_hub_dev_t *, unsigned int);
     69/** Initialize hub port information.
     70 *
     71 * @param port Port to be initialized.
     72 */
     73static 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}
    5984
    60 void usb_hub_port_process_interrupt(usb_hub_port_t *port);
     85errno_t usb_hub_port_fini(usb_hub_port_t *port, usb_hub_dev_t *hub);
     86errno_t usb_hub_port_clear_feature(
     87    usb_hub_port_t *port, usb_hub_class_feature_t feature);
     88errno_t usb_hub_port_set_feature(
     89    usb_hub_port_t *port, usb_hub_class_feature_t feature);
     90void usb_hub_port_reset_fail(usb_hub_port_t *port);
     91void usb_hub_port_process_interrupt(usb_hub_port_t *port, usb_hub_dev_t *hub);
    6192
    6293#endif
Note: See TracChangeset for help on using the changeset viewer.