Changeset 062b25f in mainline
- Timestamp:
- 2011-07-11T11:27:57Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 01bbbb2
- Parents:
- c85804f
- Location:
- uspace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/root_hub.c
rc85804f r062b25f 162 162 static const uint32_t port_status_change_mask = RHPS_CHANGE_WC_MASK; 163 163 164 static intcreate_serialized_hub_descriptor(rh_t *instance);164 static void create_serialized_hub_descriptor(rh_t *instance); 165 165 166 166 static int rh_init_descriptors(rh_t *instance); … … 227 227 { 228 228 assert(instance); 229 assert(regs); 229 230 230 231 instance->registers = regs; … … 321 322 * @return Error code 322 323 */ 323 intcreate_serialized_hub_descriptor(rh_t *instance)324 void create_serialized_hub_descriptor(rh_t *instance) 324 325 { 325 326 assert(instance); … … 329 330 /* 7 bytes + 2 port bit fields (port count + global bit) */ 330 331 const size_t size = 7 + (bit_field_size * 2); 331 332 uint8_t *result = malloc(size); 333 if (!result) 334 return ENOMEM; 332 assert(size <= HUB_DESCRIPTOR_MAX_SIZE); 333 instance->descriptor_size = size; 334 335 const uint32_t hub_desc = instance->registers->rh_desc_a; 336 const uint32_t port_desc = instance->registers->rh_desc_b; 335 337 336 338 /* bDescLength */ 337 result[0] = size;339 instance->hub_descriptor[0] = size; 338 340 /* bDescriptorType */ 339 result[1] = USB_DESCTYPE_HUB;341 instance->hub_descriptor[1] = USB_DESCTYPE_HUB; 340 342 /* bNmbrPorts */ 341 result[2] = instance->port_count; 342 const uint32_t hub_desc = instance->registers->rh_desc_a; 343 instance->hub_descriptor[2] = instance->port_count; 343 344 /* wHubCharacteristics */ 344 result[3] = 0 |345 instance->hub_descriptor[3] = 0 | 345 346 /* The lowest 2 bits indicate power switching mode */ 346 347 (((hub_desc & RHDA_PSM_FLAG) ? 1 : 0) << 0) | … … 353 354 354 355 /* Reserved */ 355 result[4] = 0;356 instance->hub_descriptor[4] = 0; 356 357 /* bPwrOn2PwrGood */ 357 result[5] = (hub_desc >> RHDA_POTPGT_SHIFT) & RHDA_POTPGT_MASK; 358 instance->hub_descriptor[5] = 359 (hub_desc >> RHDA_POTPGT_SHIFT) & RHDA_POTPGT_MASK; 358 360 /* bHubContrCurrent, root hubs don't need no power. */ 359 result[6] = 0; 360 361 const uint32_t port_desc = instance->registers->rh_desc_a; 361 instance->hub_descriptor[6] = 0; 362 362 363 /* Device Removable and some legacy 1.0 stuff*/ 363 result[7] = (port_desc >> RHDB_DR_SHIFT) & RHDB_DR_MASK & 0xff; 364 result[8] = 0xff; 364 instance->hub_descriptor[7] = 365 (port_desc >> RHDB_DR_SHIFT) & RHDB_DR_MASK & 0xff; 366 instance->hub_descriptor[8] = 0xff; 365 367 if (bit_field_size == 2) { 366 result[8] = (port_desc >> RHDB_DR_SHIFT) & RHDB_DR_MASK >> 8; 367 result[9] = 0xff; 368 result[10] = 0xff; 369 } 370 instance->hub_descriptor = result; 371 instance->descriptor_size = size; 372 373 return EOK; 368 instance->hub_descriptor[8] = 369 (port_desc >> RHDB_DR_SHIFT) & RHDB_DR_MASK >> 8; 370 instance->hub_descriptor[9] = 0xff; 371 instance->hub_descriptor[10] = 0xff; 372 } 374 373 } 375 374 /*----------------------------------------------------------------------------*/ … … 392 391 sizeof(ohci_rh_conf_descriptor)); 393 392 394 int opResult = create_serialized_hub_descriptor(instance); 395 if (opResult != EOK) 396 return opResult; 393 create_serialized_hub_descriptor(instance); 397 394 398 395 descriptor.total_length = -
uspace/drv/bus/usb/ohci/root_hub.h
rc85804f r062b25f 41 41 #include "batch.h" 42 42 43 #define HUB_DESCRIPTOR_MAX_SIZE 11 44 #define INTERRUPT_BUFFER_MAX_SIZE 2 45 43 46 /** 44 47 * ohci root hub representation … … 54 57 usb_device_descriptors_t descriptors; 55 58 /** interrupt transfer waiting for an actual interrupt to occur */ 56 usb_transfer_batch_t * 59 usb_transfer_batch_t *unfinished_interrupt_transfer; 57 60 /** Interrupt mask of changes 58 61 * … … 60 63 * gives max 2 bytes. 61 64 */ 62 uint8_t interrupt_buffer[ 2];65 uint8_t interrupt_buffer[INTERRUPT_BUFFER_MAX_SIZE]; 63 66 /** size of interrupt buffer */ 64 67 size_t interrupt_mask_size; 65 68 /** instance`s descriptor*/ 66 uint8_t * hub_descriptor;69 uint8_t hub_descriptor[HUB_DESCRIPTOR_MAX_SIZE]; 67 70 /** size of hub descriptor */ 68 71 size_t descriptor_size; 69 70 72 71 73 } rh_t; -
uspace/lib/usbhost/src/batch.c
rc85804f r062b25f 109 109 assert(instance); 110 110 assert(instance->ep); 111 assert(instance->next_step); 111 112 endpoint_release(instance->ep); 112 113 instance->next_step(instance);
Note:
See TracChangeset
for help on using the changeset viewer.