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