Changeset 6c399765 in mainline for uspace/drv/ohci/root_hub.c
- Timestamp:
- 2011-04-03T20:06:39Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 195890b
- Parents:
- fefc27d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/root_hub.c
rfefc27d r6c399765 244 244 { 245 245 assert(instance); 246 instance->address = -1;246 //instance->address = -1; 247 247 instance->registers = regs; 248 248 instance->device = dev; … … 278 278 request->transfered_size = 4; 279 279 uint32_buffer[0] = instance->registers->rh_port_status[port -1]; 280 #if 0 281 int i; 282 for(i=0;i<instance->port_count;++i){ 283 usb_log_debug("port status %d,x%x\n", 284 instance->registers->rh_port_status[i], 285 instance->registers->rh_port_status[i]); 286 } 287 #endif 280 288 return EOK; 281 289 } … … 298 306 uint32_buffer[0] = mask & instance->registers->rh_status; 299 307 return EOK; 300 301 308 } 302 309 … … 339 346 * Result contains bitmap where bit 0 indicates change on hub and 340 347 * bit i indicates change on i`th port (i>0). For more info see 341 * Hub and Port status bitmap specification in USB specification. 348 * Hub and Port status bitmap specification in USB specification 349 * (chapter 11.13.4) 342 350 * @param instance root hub instance 343 351 * @param@out buffer pointer to created interrupt mas … … 347 355 size_t * buffer_size){ 348 356 int bit_count = instance->port_count + 1; 349 (*buffer_size) = (bit_count / 8) + (bit_count%8==0)?0:1; 357 (*buffer_size) = (bit_count / 8) + ((bit_count%8==0)?0:1); 358 350 359 (*buffer) = malloc(*buffer_size); 351 360 uint8_t * bitmap = (uint8_t*)(*buffer); 352 uint32_t mask = (1<<16) + (1<<17); 361 uint32_t mask = (1<<(USB_HUB_FEATURE_C_HUB_LOCAL_POWER+16)) 362 | (1<<(USB_HUB_FEATURE_C_HUB_OVER_CURRENT+16)); 353 363 bzero(bitmap,(*buffer_size)); 354 364 if(instance->registers->rh_status & mask){ … … 358 368 mask = 0; 359 369 int i; 360 for(i=16;i<=20;++i) 370 for(i=16;i<=20;++i){ 361 371 mask += 1<<i; 372 } 362 373 for(port = 1; port<=instance->port_count;++port){ 363 374 if(mask & instance->registers->rh_port_status[port-1]){ 364 bitmap[(port +1)/8] += 1<<(port%8);375 bitmap[(port)/8] += 1<<(port%8); 365 376 } 366 377 } … … 436 447 request->transfered_size = size; 437 448 memcpy(request->transport_buffer,result_descriptor,size); 438 usb_log_debug("sent desctiptor: %s\n",439 usb_debug_str_buffer((uint8_t*)request->transport_buffer,size,size));440 449 if (del) 441 450 free(result_descriptor);
Note:
See TracChangeset
for help on using the changeset viewer.