Changeset 69df9373 in mainline
- Timestamp:
- 2011-04-07T12:14:21Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a82889e, c1b1944
- Parents:
- c50941f
- Location:
- uspace/drv/usbhub
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhub/ports.c
rc50941f r69df9373 40 40 #include <usb/debug.h> 41 41 42 /** Retrieve port status. 43 * 44 * @param[in] ctrl_pipe Control pipe to use. 45 * @param[in] port Port number (starting at 1). 46 * @param[out] status Where to store the port status. 47 * @return Error code. 48 */ 42 49 static int get_port_status(usb_pipe_t *ctrl_pipe, size_t port, 43 50 usb_port_status_t *status) … … 66 73 } 67 74 75 /** Information for fibril for device discovery. */ 68 76 struct add_device_phase1 { 69 77 usb_hub_info_t *hub; … … 72 80 }; 73 81 82 /** Callback for enabling a specific port. 83 * 84 * We wait on a CV until port is reseted. 85 * That is announced via change on interrupt pipe. 86 * 87 * @param port_no Port number (starting at 1). 88 * @param arg Custom argument, points to @c usb_hub_info_t. 89 * @return Error code. 90 */ 74 91 static int enable_port_callback(int port_no, void *arg) 75 92 { … … 108 125 } 109 126 127 /** Fibril for adding a new device. 128 * 129 * Separate fibril is needed because the port reset completion is announced 130 * via interrupt pipe and thus we cannot block here. 131 * 132 * @param arg Pointer to struct add_device_phase1. 133 * @return 0 Always. 134 */ 110 135 static int add_device_phase1_worker_fibril(void *arg) 111 136 { … … 142 167 } 143 168 169 /** Start device adding when connection change is detected. 170 * 171 * This fires a new fibril to complete the device addition. 172 * 173 * @param hub Hub where the change occured. 174 * @param port Port index (starting at 1). 175 * @param speed Speed of the device. 176 * @return Error code. 177 */ 144 178 static int add_device_phase1_new_fibril(usb_hub_info_t *hub, size_t port, 145 179 usb_speed_t speed) … … 179 213 } 180 214 215 /** Process change on a single port. 216 * 217 * @param hub Hub to which the port belongs. 218 * @param port Port index (starting at 1). 219 */ 181 220 static void process_port_change(usb_hub_info_t *hub, size_t port) 182 221 { … … 252 291 } 253 292 293 294 /** Callback for polling hub for port changes. 295 * 296 * @param dev Device where the change occured. 297 * @param change_bitmap Bitmap of changed ports. 298 * @param change_bitmap_size Size of the bitmap in bytes. 299 * @param arg Custom argument, points to @c usb_hub_info_t. 300 * @return Whether to continue polling. 301 */ 254 302 bool hub_port_changes_callback(usb_device_t *dev, 255 303 uint8_t *change_bitmap, size_t change_bitmap_size, void *arg) -
uspace/drv/usbhub/ports.h
rc50941f r69df9373 46 46 #include <usb/devdrv.h> 47 47 48 /** Information about single port on a hub. */ 48 49 typedef struct { 50 /** Mutex needed by CV for checking port reset. */ 49 51 fibril_mutex_t reset_mutex; 52 /** CV for waiting to port reset completion. */ 50 53 fibril_condvar_t reset_cv; 54 /** Whether port reset is completed. 55 * Guarded by @c reset_mutex. 56 */ 57 bool reset_completed; 58 59 /** Information about attached device. */ 51 60 usb_hc_attached_device_t attached_device; 52 bool reset_completed;53 61 } usb_hub_port_t; 54 62 63 /** Initialize hub port information. 64 * 65 * @param port Port to be initialized. 66 */ 55 67 static inline void usb_hub_port_init(usb_hub_port_t *port) { 56 68 port->attached_device.address = -1;
Note:
See TracChangeset
for help on using the changeset viewer.