Ignore:
File:
1 edited

Legend:

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

    rae3a941 rb7fd2a0  
    22 * Copyright (c) 2010 Vojtech Horky
    33 * Copyright (c) 2011 Vojtech Horky
    4  * Copyright (c) 2018 Ondrej Hlavaty, Petr Manek
    54 * All rights reserved.
    65 *
     
    4039
    4140#include <ddf/driver.h>
    42 #include <fibril_synch.h>
    4341
    4442#include <usb/classes/hub.h>
     
    4644#include <usb/dev/pipes.h>
    4745#include <usb/dev/driver.h>
    48 #include <usb/dev/poll.h>
     46
     47#include <fibril_synch.h>
    4948
    5049#define NAME "usbhub"
    5150
    5251#include "port.h"
    53 #include "status.h"
    5452
    5553/** Information about attached hub. */
     
    5957        /** Port structures, one for each port */
    6058        usb_hub_port_t *ports;
    61         /** Speed of the hub */
    62         usb_speed_t speed;
    6359        /** Generic usb device data*/
    6460        usb_device_t *usb_device;
    65         /** Data polling handle. */
    66         usb_polling_t polling;
     61
     62        /** Number of pending operations on the mutex to prevent shooting
     63         * ourselves in the foot.
     64         * When the hub is disconnected but we are in the middle of some
     65         * operation, we cannot destroy this structure right away because
     66         * the pending operation might use it.
     67         */
     68        size_t pending_ops_count;
     69        /** Guard for pending_ops_count. */
     70        fibril_mutex_t pending_ops_mutex;
     71        /** Condition variable for pending_ops_count. */
     72        fibril_condvar_t pending_ops_cv;
    6773        /** Pointer to usbhub function. */
    6874        ddf_fun_t *hub_fun;
    69         /** Device communication pipe. */
    70         usb_pipe_t *control_pipe;
     75        /** Status indicator */
     76        bool running;
    7177        /** Hub supports port power switching. */
    7278        bool power_switched;
    7379        /** Each port is switched individually. */
    7480        bool per_port_power;
    75         /** Whether MTT is available */
    76         bool mtt_available;
    7781};
    7882
    79 extern const usb_endpoint_description_t *usb_hub_endpoints [];
     83extern const usb_endpoint_description_t hub_status_change_endpoint_description;
    8084
    81 errno_t usb_hub_device_add(usb_device_t *);
    82 errno_t usb_hub_device_remove(usb_device_t *);
    83 errno_t usb_hub_device_gone(usb_device_t *);
     85extern errno_t usb_hub_device_add(usb_device_t *);
     86extern errno_t usb_hub_device_remove(usb_device_t *);
     87extern errno_t usb_hub_device_gone(usb_device_t *);
    8488
    85 errno_t usb_hub_set_depth(const usb_hub_dev_t *);
    86 errno_t usb_hub_get_port_status(const usb_hub_dev_t *, size_t,
    87     usb_port_status_t *);
    88 errno_t usb_hub_set_port_feature(const usb_hub_dev_t *, size_t,
    89     usb_hub_class_feature_t);
    90 errno_t usb_hub_clear_port_feature(const usb_hub_dev_t *, size_t,
    91     usb_hub_class_feature_t);
    92 
    93 bool hub_port_changes_callback(usb_device_t *, uint8_t *, size_t, void *);
    94 
    95 errno_t usb_hub_reserve_default_address(usb_hub_dev_t *, async_exch_t *,
    96     usb_port_t *);
    97 errno_t usb_hub_release_default_address(usb_hub_dev_t *, async_exch_t *);
     89extern bool hub_port_changes_callback(usb_device_t *, uint8_t *, size_t,
     90    void *);
    9891
    9992#endif
Note: See TracChangeset for help on using the changeset viewer.