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