Changes in uspace/drv/bus/usb/usbhub/port.h [b7fd2a0:0f79283b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhub/port.h
rb7fd2a0 r0f79283b 2 2 * Copyright (c) 2011 Vojtech Horky 3 3 * Copyright (c) 2011 Jan Vesely 4 * Copyright (c) 2017 Ondra Hlavaty 4 5 * All rights reserved. 5 6 * … … 32 33 */ 33 34 /** @file 34 * Hub port s related functions.35 * Hub port handling. 35 36 */ 36 37 … … 40 41 #include <usb/dev/driver.h> 41 42 #include <usb/classes/hub.h> 42 #include <usb _iface.h>43 #include <usb/port.h> 43 44 44 45 typedef struct usb_hub_dev usb_hub_dev_t; … … 46 47 /** Information about single port on a hub. */ 47 48 typedef struct { 49 usb_port_t base; 50 /* Parenting hub */ 51 usb_hub_dev_t *hub; 48 52 /** Port number as reported in descriptors. */ 49 53 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; 67 56 } usb_hub_port_t; 68 57 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 } 58 void usb_hub_port_init(usb_hub_port_t *, usb_hub_dev_t *, unsigned int); 84 59 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); 60 void usb_hub_port_process_interrupt(usb_hub_port_t *port); 92 61 93 62 #endif
Note:
See TracChangeset
for help on using the changeset viewer.