Changeset ee9ea16 in mainline
- Timestamp:
- 2011-09-19T12:29:04Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d46b13d
- Parents:
- c94f643
- Location:
- uspace/drv/bus/usb/usbhub
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbhub/main.c
rc94f643 ree9ea16 56 56 57 57 /** 58 * usbhub driver operations58 * USB hub driver operations 59 59 * 60 60 * The most important one is add_device, which is set to usb_hub_add_device. … … 64 64 }; 65 65 66 /** 67 * hub endpoints, excluding control endpoint 68 */ 66 /** Hub endpoints, excluding control endpoint. */ 69 67 static usb_endpoint_description_t *usb_hub_endpoints[] = { 70 68 &hub_status_change_endpoint_description, 71 NULL 69 NULL, 72 70 }; 73 74 /** 75 * static usb hub driver information 76 */ 71 /** Static usb hub driver information. */ 77 72 static usb_driver_t usb_hub_driver = { 78 73 .name = NAME, … … 85 80 { 86 81 printf(NAME ": HelenOS USB hub driver.\n"); 87 88 82 usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME); 89 83 … … 94 88 * @} 95 89 */ 96 -
uspace/drv/bus/usb/usbhub/usbhub.c
rc94f643 ree9ea16 57 57 58 58 static usb_hub_info_t * usb_hub_info_create(usb_device_t *usb_dev); 59 60 59 static int usb_hub_process_hub_specific_info(usb_hub_info_t *hub_info); 61 62 60 static int usb_hub_set_configuration(usb_hub_info_t *hub_info); 63 64 61 static int usb_hub_start_hub_fibril(usb_hub_info_t *hub_info); 65 66 62 static int usb_process_hub_over_current(usb_hub_info_t *hub_info, 67 63 usb_hub_status_t status); 68 69 64 static int usb_process_hub_local_power_change(usb_hub_info_t *hub_info, 70 65 usb_hub_status_t status); 71 72 66 static void usb_hub_process_global_interrupt(usb_hub_info_t *hub_info); 73 74 67 static void usb_hub_polling_terminated_callback(usb_device_t *device, 75 68 bool was_error, void *data); … … 93 86 if (!usb_dev) return EINVAL; 94 87 usb_hub_info_t *hub_info = usb_hub_info_create(usb_dev); 88 95 89 //create hc connection 96 90 usb_log_debug("Initializing USB wire abstraction.\n"); 97 91 int opResult = usb_hc_connection_initialize_from_device( 98 &hub_info->connection, 99 hub_info->usb_device->ddf_dev); 100 if (opResult != EOK) { 101 usb_log_error("Could not initialize connection to device, " 102 " %s\n", 92 &hub_info->connection, hub_info->usb_device->ddf_dev); 93 if (opResult != EOK) { 94 usb_log_error("Could not initialize connection to device: %s\n", 103 95 str_error(opResult)); 104 96 free(hub_info); … … 109 101 opResult = usb_hub_set_configuration(hub_info); 110 102 if (opResult != EOK) { 111 usb_log_error("Could not set hub configuration ,%s\n",103 usb_log_error("Could not set hub configuration: %s\n", 112 104 str_error(opResult)); 113 105 free(hub_info); … … 190 182 * @return basic usb_hub_info_t structure 191 183 */ 192 static usb_hub_info_t * usb_hub_info_create(usb_device_t *usb_dev) { 193 usb_hub_info_t * result = malloc(sizeof (usb_hub_info_t)); 194 if (!result) return NULL; 184 static usb_hub_info_t * usb_hub_info_create(usb_device_t *usb_dev) 185 { 186 usb_hub_info_t *result = malloc(sizeof (usb_hub_info_t)); 187 if (!result) 188 return NULL; 189 195 190 result->usb_device = usb_dev; 196 191 result->status_change_pipe = usb_dev->pipes[0].pipe; … … 205 200 fibril_condvar_initialize(&result->pending_ops_cv); 206 201 result->pending_ops_count = 0; 202 207 203 return result; 208 204 } -
uspace/drv/bus/usb/usbhub/usbhub_private.h
rc94f643 ree9ea16 65 65 */ 66 66 static inline void usb_hub_set_descriptor_request( 67 usb_device_request_setup_packet_t * request68 ){67 usb_device_request_setup_packet_t *request ) 68 { 69 69 request->index = 0; 70 70 request->request_type = USB_HUB_REQ_TYPE_GET_DESCRIPTOR; … … 85 85 */ 86 86 static inline int usb_hub_clear_port_feature(usb_pipe_t *pipe, 87 int port_index, 88 usb_hub_class_feature_t feature){87 int port_index, usb_hub_class_feature_t feature) 88 { 89 89 90 90 usb_device_request_setup_packet_t clear_request = { … … 109 109 */ 110 110 static inline int usb_hub_set_port_feature(usb_pipe_t *pipe, 111 int port_index, 112 usb_hub_class_feature_t feature){111 int port_index, usb_hub_class_feature_t feature) 112 { 113 113 114 114 usb_device_request_setup_packet_t clear_request = { … … 152 152 */ 153 153 static inline int usb_hub_set_feature(usb_pipe_t *pipe, 154 usb_hub_class_feature_t feature) { 154 usb_hub_class_feature_t feature) 155 { 155 156 156 157 usb_device_request_setup_packet_t clear_request = { … … 166 167 167 168 168 void * usb_create_serialized_hub_descriptor(usb_hub_descriptor_t * 169 void * usb_create_serialized_hub_descriptor(usb_hub_descriptor_t *descriptor); 169 170 170 void usb_serialize_hub_descriptor(usb_hub_descriptor_t * 171 void * 171 void usb_serialize_hub_descriptor(usb_hub_descriptor_t *descriptor, 172 void *serialized_descriptor); 172 173 173 174 int usb_deserialize_hub_desriptor( -
uspace/drv/bus/usb/usbhub/utils.c
rc94f643 ree9ea16 68 68 size_t var_size = (descriptor->ports_count + 7) / 8; 69 69 size += 2 * var_size; 70 uint8_t * 70 uint8_t *result = malloc(size); 71 71 //size 72 72 if (result) … … 83 83 */ 84 84 void usb_serialize_hub_descriptor(usb_hub_descriptor_t *descriptor, 85 void * serialized_descriptor) { 85 void *serialized_descriptor) 86 { 86 87 //base size 87 uint8_t * 88 uint8_t *sdescriptor = serialized_descriptor; 88 89 size_t size = 7; 89 90 //variable size according to port count … … 109 110 } 110 111 } 111 112 112 /*----------------------------------------------------------------------------*/ 113 113 /** … … 121 121 void *serialized_descriptor, size_t size, usb_hub_descriptor_t *descriptor) 122 122 { 123 uint8_t * 123 uint8_t *sdescriptor = serialized_descriptor; 124 124 125 125 if (sdescriptor[1] != USB_DESCTYPE_HUB) { … … 138 138 descriptor->current_requirement = sdescriptor[6]; 139 139 const size_t var_size = (descriptor->ports_count + 7) / 8; 140 //descriptor->devices_removable = (uint8_t*) malloc(var_size);141 140 142 141 if (size < (7 + var_size)) {
Note:
See TracChangeset
for help on using the changeset viewer.