Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ohci/root_hub.c

    rf35b294 r8148ee3a  
    205205 * @return Error code.
    206206 */
    207 int rh_init(rh_t *instance, ddf_dev_t *dev, ohci_regs_t *regs) {
     207int rh_init(rh_t *instance, ohci_regs_t *regs) {
    208208        assert(instance);
    209         //instance->address = -1;
    210209        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;
    213212        rh_init_descriptors(instance);
    214213        // 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;
    217215
    218216        usb_log_info("OHCI root hub with %d ports.\n", instance->port_count);
    219 
    220         //start generic usb hub driver
    221 
    222         /* TODO: implement */
    223217        return EOK;
    224218}
     
    236230        assert(request);
    237231        int opResult;
    238         if (request->transfer_type == USB_TRANSFER_CONTROL) {
     232        if (request->ep->transfer_type == USB_TRANSFER_CONTROL) {
    239233                usb_log_info("Root hub got CONTROL packet\n");
    240234                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) {
    242236                usb_log_info("Root hub got INTERRUPT packet\n");
    243237                void * buffer;
    244238                create_interrupt_mask(instance, &buffer,
    245239                        &(request->transfered_size));
    246                 memcpy(request->transport_buffer, buffer,
     240                memcpy(request->data_buffer, buffer,
    247241                        request->transfered_size);
    248242                opResult = EOK;
     
    373367        if (port < 1 || port > instance->port_count)
    374368                return EINVAL;
    375         uint32_t * uint32_buffer = (uint32_t*) request->transport_buffer;
     369        uint32_t * uint32_buffer = (uint32_t*) request->data_buffer;
    376370        request->transfered_size = 4;
    377371        uint32_buffer[0] = instance->registers->rh_port_status[port - 1];
     
    399393static int process_get_hub_status_request(rh_t *instance,
    400394        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;
    402396        request->transfered_size = 4;
    403397        //bits, 0,1,16,17
     
    549543        }
    550544        request->transfered_size = size;
    551         memcpy(request->transport_buffer, result_descriptor, size);
     545        memcpy(request->data_buffer, result_descriptor, size);
    552546        if (del)
    553547                free(result_descriptor);
     
    570564        if (request->buffer_size != 1)
    571565                return EINVAL;
    572         request->transport_buffer[0] = 1;
     566        request->data_buffer[0] = 1;
    573567        request->transfered_size = 1;
    574568        return EOK;
Note: See TracChangeset for help on using the changeset viewer.