Ignore:
File:
1 edited

Legend:

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

    r8148ee3a rf35b294  
    205205 * @return Error code.
    206206 */
    207 int rh_init(rh_t *instance, ohci_regs_t *regs) {
     207int rh_init(rh_t *instance, ddf_dev_t *dev, ohci_regs_t *regs) {
    208208        assert(instance);
     209        //instance->address = -1;
    209210        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;
    212213        rh_init_descriptors(instance);
    213214        // 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);
    215217
    216218        usb_log_info("OHCI root hub with %d ports.\n", instance->port_count);
     219
     220        //start generic usb hub driver
     221
     222        /* TODO: implement */
    217223        return EOK;
    218224}
     
    230236        assert(request);
    231237        int opResult;
    232         if (request->ep->transfer_type == USB_TRANSFER_CONTROL) {
     238        if (request->transfer_type == USB_TRANSFER_CONTROL) {
    233239                usb_log_info("Root hub got CONTROL packet\n");
    234240                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) {
    236242                usb_log_info("Root hub got INTERRUPT packet\n");
    237243                void * buffer;
    238244                create_interrupt_mask(instance, &buffer,
    239245                        &(request->transfered_size));
    240                 memcpy(request->data_buffer, buffer,
     246                memcpy(request->transport_buffer, buffer,
    241247                        request->transfered_size);
    242248                opResult = EOK;
     
    367373        if (port < 1 || port > instance->port_count)
    368374                return EINVAL;
    369         uint32_t * uint32_buffer = (uint32_t*) request->data_buffer;
     375        uint32_t * uint32_buffer = (uint32_t*) request->transport_buffer;
    370376        request->transfered_size = 4;
    371377        uint32_buffer[0] = instance->registers->rh_port_status[port - 1];
     
    393399static int process_get_hub_status_request(rh_t *instance,
    394400        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;
    396402        request->transfered_size = 4;
    397403        //bits, 0,1,16,17
     
    543549        }
    544550        request->transfered_size = size;
    545         memcpy(request->data_buffer, result_descriptor, size);
     551        memcpy(request->transport_buffer, result_descriptor, size);
    546552        if (del)
    547553                free(result_descriptor);
     
    564570        if (request->buffer_size != 1)
    565571                return EINVAL;
    566         request->data_buffer[0] = 1;
     572        request->transport_buffer[0] = 1;
    567573        request->transfered_size = 1;
    568574        return EOK;
Note: See TracChangeset for help on using the changeset viewer.