~vojtech-horky/helenos/numa

« back to all changes in this revision

Viewing changes to uspace/drv/bus/usb/usbhub/port.h

  • Committer: Vojtech Horky
  • Date: 2011-09-28 15:13:08 UTC
  • mfrom: (538.1.714 helenos-mainline)
  • Revision ID: vojtechhorky@users.sourceforge.net-20110928151308-2pz4s2w035n48o8a
Merge mainline changes

Conflicts fixed without problems (mostly caused by separating
ABI into /abi/).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * Copyright (c) 2011 Vojtech Horky
 
3
 * Copyright (c) 2011 Jan Vesely
3
4
 * All rights reserved.
4
5
 *
5
6
 * Redistribution and use in source and binary forms, with or without
25
26
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
27
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28
 */
28
 
 
29
29
/** @addtogroup drvusbhub
30
30
 * @{
31
31
 */
32
32
/** @file
33
33
 * Hub ports related functions.
34
34
 */
35
 
#ifndef DRV_USBHUB_PORTS_H
36
 
#define DRV_USBHUB_PORTS_H
 
35
#ifndef DRV_USBHUB_PORT_H
 
36
#define DRV_USBHUB_PORT_H
37
37
 
38
38
#include <usb/dev/driver.h>
39
39
#include <usb/dev/hub.h>
 
40
#include <usb/classes/hub.h>
40
41
 
41
42
typedef struct usb_hub_info_t usb_hub_info_t;
42
43
 
43
44
/** Information about single port on a hub. */
44
45
typedef struct {
45
 
        /** Mutex needed by CV for checking port reset. */
46
 
        fibril_mutex_t reset_mutex;
 
46
        size_t port_number;
 
47
        usb_pipe_t *control_pipe;
 
48
        /** Mutex needed not only by CV for checking port reset. */
 
49
        fibril_mutex_t mutex;
47
50
        /** CV for waiting to port reset completion. */
48
51
        fibril_condvar_t reset_cv;
49
52
        /** Whether port reset is completed.
61
64
 *
62
65
 * @param port Port to be initialized.
63
66
 */
64
 
static inline void usb_hub_port_init(usb_hub_port_t *port) {
 
67
static inline void usb_hub_port_init(usb_hub_port_t *port, size_t port_number,
 
68
    usb_pipe_t *control_pipe)
 
69
{
 
70
        assert(port);
65
71
        port->attached_device.address = -1;
66
72
        port->attached_device.handle = 0;
67
 
        fibril_mutex_initialize(&port->reset_mutex);
 
73
        port->port_number = port_number;
 
74
        port->control_pipe = control_pipe;
 
75
        fibril_mutex_initialize(&port->mutex);
68
76
        fibril_condvar_initialize(&port->reset_cv);
69
77
}
70
78
 
71
 
 
72
 
void usb_hub_process_port_interrupt(usb_hub_info_t *hub,
73
 
        uint16_t port);
74
 
 
75
 
 
 
79
void usb_hub_port_reset_fail(usb_hub_port_t *port);
 
80
void usb_hub_port_process_interrupt(usb_hub_port_t *port, usb_hub_info_t *hub);
 
81
int usb_hub_port_clear_feature(
 
82
    usb_hub_port_t *port, usb_hub_class_feature_t feature);
 
83
int usb_hub_port_set_feature(
 
84
    usb_hub_port_t *port, usb_hub_class_feature_t feature);
76
85
 
77
86
#endif
78
87
/**