Changeset c3ae877 in mainline for uspace/drv/uhci-hcd/batch.c


Ignore:
Timestamp:
2011-02-25T23:46:32Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
86c2ccd
Parents:
1a93bb0
Message:

Add support for low speed transfers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci-hcd/batch.c

    r1a93bb0 rc3ae877  
    168168        memcpy(instance->transport_buffer, instance->buffer, instance->buffer_size);
    169169
     170        const bool low_speed = instance->speed == USB_SPEED_LOW;
    170171        int toggle = 0;
    171172        /* setup stage */
    172173        transfer_descriptor_init(instance->tds, DEFAULT_ERROR_COUNT,
    173             instance->setup_size, toggle, false, instance->target,
    174             USB_PID_SETUP, instance->setup_buffer, &instance->tds[1]);
     174            instance->setup_size, toggle, false, low_speed,
     175            instance->target, USB_PID_SETUP, instance->setup_buffer,
     176            &instance->tds[1]);
    175177
    176178        /* data stage */
     
    182184
    183185                transfer_descriptor_init(&instance->tds[i], DEFAULT_ERROR_COUNT,
    184                     instance->max_packet_size, toggle++, false, instance->target,
    185                     USB_PID_OUT, data, &instance->tds[i + 1]);
     186                    instance->max_packet_size, toggle++, false, low_speed,
     187                    instance->target, USB_PID_OUT, data, &instance->tds[i + 1]);
    186188        }
    187189
     
    189191        i = instance->packets - 1;
    190192        transfer_descriptor_init(&instance->tds[i], DEFAULT_ERROR_COUNT,
    191             0, 1, false, instance->target, USB_PID_IN, NULL, NULL);
     193            0, 1, false, low_speed, instance->target, USB_PID_IN, NULL, NULL);
    192194
    193195        instance->tds[i].status |= TD_STATUS_COMPLETE_INTERRUPT_FLAG;
     
    201203        assert(instance);
    202204
     205        const bool low_speed = instance->speed == USB_SPEED_LOW;
    203206        int toggle = 0;
    204207        /* setup stage */
    205208        transfer_descriptor_init(instance->tds, DEFAULT_ERROR_COUNT,
    206             instance->setup_size, toggle, false, instance->target,
     209            instance->setup_size, toggle, false, low_speed, instance->target,
    207210            USB_PID_SETUP, instance->setup_buffer, &instance->tds[1]);
    208211
     
    215218
    216219                transfer_descriptor_init(&instance->tds[i], DEFAULT_ERROR_COUNT,
    217                     instance->max_packet_size, toggle, false, instance->target,
    218                     USB_PID_IN, data, &instance->tds[i + 1]);
     220                    instance->max_packet_size, toggle, false, low_speed,
     221                                instance->target, USB_PID_IN, data, &instance->tds[i + 1]);
    219222        }
    220223
     
    222225        i = instance->packets - 1;
    223226        transfer_descriptor_init(&instance->tds[i], DEFAULT_ERROR_COUNT,
    224             0, 1, false, instance->target, USB_PID_OUT, NULL, NULL);
     227            0, 1, false, low_speed, instance->target, USB_PID_OUT, NULL, NULL);
    225228
    226229        instance->tds[i].status |= TD_STATUS_COMPLETE_INTERRUPT_FLAG;
     
    234237        assert(instance);
    235238
     239        const bool low_speed = instance->speed == USB_SPEED_LOW;
    236240        int toggle = 1;
    237241        size_t i = 0;
     
    244248
    245249                transfer_descriptor_init(&instance->tds[i], DEFAULT_ERROR_COUNT,
    246                     instance->max_packet_size, toggle, false, instance->target,
    247                     USB_PID_IN, data, next);
     250                    instance->max_packet_size, toggle, false, low_speed,
     251                    instance->target, USB_PID_IN, data, next);
    248252        }
    249253
     
    260264        memcpy(instance->transport_buffer, instance->buffer, instance->buffer_size);
    261265
     266        const bool low_speed = instance->speed == USB_SPEED_LOW;
    262267        int toggle = 1;
    263268        size_t i = 0;
     
    270275
    271276                transfer_descriptor_init(&instance->tds[i], DEFAULT_ERROR_COUNT,
    272                     instance->max_packet_size, toggle++, false, instance->target,
    273                     USB_PID_OUT, data, next);
     277                    instance->max_packet_size, toggle++, false, low_speed,
     278                    instance->target, USB_PID_OUT, data, next);
    274279        }
    275280
     
    338343        return uhci_schedule(hc, instance);
    339344}
    340 /*----------------------------------------------------------------------------*/
    341 /* DEPRECATED FUNCTIONS NEEDED BY THE OLD API */
    342 void batch_control_setup_old(batch_t *instance)
    343 {
    344         assert(instance);
    345         instance->packets = 1;
    346 
    347         /* setup stage */
    348         transfer_descriptor_init(instance->tds, DEFAULT_ERROR_COUNT,
    349             instance->setup_size, 0, false, instance->target,
    350             USB_PID_SETUP, instance->setup_buffer, NULL);
    351 
    352         instance->next_step = batch_call_out_and_dispose;
    353         batch_schedule(instance);
    354 }
    355 /*----------------------------------------------------------------------------*/
    356 void batch_control_write_data_old(batch_t *instance)
    357 {
    358         assert(instance);
    359         instance->packets -= 2;
    360         batch_interrupt_out(instance);
    361 }
    362 /*----------------------------------------------------------------------------*/
    363 void batch_control_read_data_old(batch_t *instance)
    364 {
    365         assert(instance);
    366         instance->packets -= 2;
    367         batch_interrupt_in(instance);
    368 }
    369 /*----------------------------------------------------------------------------*/
    370 void batch_control_write_status_old(batch_t *instance)
    371 {
    372         assert(instance);
    373         instance->packets = 1;
    374         transfer_descriptor_init(instance->tds, DEFAULT_ERROR_COUNT,
    375             0, 1, false, instance->target, USB_PID_IN, NULL, NULL);
    376         instance->next_step = batch_call_in_and_dispose;
    377         batch_schedule(instance);
    378 }
    379 /*----------------------------------------------------------------------------*/
    380 void batch_control_read_status_old(batch_t *instance)
    381 {
    382         assert(instance);
    383         instance->packets = 1;
    384         transfer_descriptor_init(instance->tds, DEFAULT_ERROR_COUNT,
    385             0, 1, false, instance->target, USB_PID_OUT, NULL, NULL);
    386         instance->next_step = batch_call_out_and_dispose;
    387         batch_schedule(instance);
    388 }
    389345/**
    390346 * @}
Note: See TracChangeset for help on using the changeset viewer.