Changes in uspace/drv/ohci/root_hub.c [f35b294:8148ee3a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/root_hub.c
rf35b294 r8148ee3a 205 205 * @return Error code. 206 206 */ 207 int rh_init(rh_t *instance, ddf_dev_t *dev,ohci_regs_t *regs) {207 int rh_init(rh_t *instance, ohci_regs_t *regs) { 208 208 assert(instance); 209 //instance->address = -1;210 209 instance->registers = regs; 211 instance-> device = dev;212 instance->port_count = instance->registers->rh_desc_a & 0xff;210 instance->port_count = 211 (instance->registers->rh_desc_a >> RHDA_NDS_SHIFT) & RHDA_NDS_MASK; 213 212 rh_init_descriptors(instance); 214 213 // set port power mode to no-power-switching 215 instance->registers->rh_desc_a = 216 instance->registers->rh_desc_a | (1<<9); 214 instance->registers->rh_desc_a |= RHDA_NPS_FLAG; 217 215 218 216 usb_log_info("OHCI root hub with %d ports.\n", instance->port_count); 219 220 //start generic usb hub driver221 222 /* TODO: implement */223 217 return EOK; 224 218 } … … 236 230 assert(request); 237 231 int opResult; 238 if (request-> transfer_type == USB_TRANSFER_CONTROL) {232 if (request->ep->transfer_type == USB_TRANSFER_CONTROL) { 239 233 usb_log_info("Root hub got CONTROL packet\n"); 240 234 opResult = process_ctrl_request(instance, request); 241 } else if (request-> transfer_type == USB_TRANSFER_INTERRUPT) {235 } else if (request->ep->transfer_type == USB_TRANSFER_INTERRUPT) { 242 236 usb_log_info("Root hub got INTERRUPT packet\n"); 243 237 void * buffer; 244 238 create_interrupt_mask(instance, &buffer, 245 239 &(request->transfered_size)); 246 memcpy(request-> transport_buffer, buffer,240 memcpy(request->data_buffer, buffer, 247 241 request->transfered_size); 248 242 opResult = EOK; … … 373 367 if (port < 1 || port > instance->port_count) 374 368 return EINVAL; 375 uint32_t * uint32_buffer = (uint32_t*) request-> transport_buffer;369 uint32_t * uint32_buffer = (uint32_t*) request->data_buffer; 376 370 request->transfered_size = 4; 377 371 uint32_buffer[0] = instance->registers->rh_port_status[port - 1]; … … 399 393 static int process_get_hub_status_request(rh_t *instance, 400 394 usb_transfer_batch_t * request) { 401 uint32_t * uint32_buffer = (uint32_t*) request-> transport_buffer;395 uint32_t * uint32_buffer = (uint32_t*) request->data_buffer; 402 396 request->transfered_size = 4; 403 397 //bits, 0,1,16,17 … … 549 543 } 550 544 request->transfered_size = size; 551 memcpy(request-> transport_buffer, result_descriptor, size);545 memcpy(request->data_buffer, result_descriptor, size); 552 546 if (del) 553 547 free(result_descriptor); … … 570 564 if (request->buffer_size != 1) 571 565 return EINVAL; 572 request-> transport_buffer[0] = 1;566 request->data_buffer[0] = 1; 573 567 request->transfered_size = 1; 574 568 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.