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


Ignore:
Timestamp:
2011-04-12T10:09:56Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
508a0ca
Parents:
f13381b
Message:

Remove EP information stored in usb_transfer_batch_t

rename usb_transfer_batch_t.transport_buffer ⇒ data_buffer

File:
1 edited

Legend:

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

    rf13381b rd017cea  
    103103        usb_target_t target =
    104104            { .address = ep->address, .endpoint = ep->endpoint };
    105         usb_transfer_batch_init(instance, target, ep->transfer_type, ep->speed,
    106             ep->max_packet_size, buffer, NULL, buffer_size, NULL, setup_size,
    107             func_in, func_out, arg, fun, ep, NULL);
     105        usb_transfer_batch_init(instance, ep,
     106            buffer, NULL, buffer_size, NULL, setup_size,
     107            func_in, func_out, arg, fun, NULL);
    108108
    109109
     
    131131
    132132        if (buffer_size > 0) {
    133                 instance->transport_buffer = malloc32(buffer_size);
    134                 CHECK_NULL_DISPOSE_RETURN(instance->transport_buffer,
     133                instance->data_buffer = malloc32(buffer_size);
     134                CHECK_NULL_DISPOSE_RETURN(instance->data_buffer,
    135135                    "Failed to allocate device accessible buffer.\n");
    136136        }
     
    205205        assert(instance);
    206206        /* We are data out, we are supposed to provide data */
    207         memcpy(instance->transport_buffer, instance->buffer,
    208             instance->buffer_size);
     207        memcpy(instance->data_buffer, instance->buffer, instance->buffer_size);
    209208        batch_control(instance, USB_PID_OUT, USB_PID_IN);
    210209        instance->next_step = batch_call_out_and_dispose;
     
    235234{
    236235        assert(instance);
    237         instance->direction = USB_DIRECTION_IN;
     236//      instance->direction = USB_DIRECTION_IN;
    238237        batch_data(instance, USB_PID_IN);
    239238        instance->next_step = batch_call_in_and_dispose;
     
    250249{
    251250        assert(instance);
    252         instance->direction = USB_DIRECTION_OUT;
    253251        /* We are data out, we are supposed to provide data */
    254         memcpy(instance->transport_buffer, instance->buffer,
    255             instance->buffer_size);
     252        memcpy(instance->data_buffer, instance->buffer, instance->buffer_size);
    256253        batch_data(instance, USB_PID_OUT);
    257254        instance->next_step = batch_call_out_and_dispose;
     
    269266        assert(instance);
    270267        batch_data(instance, USB_PID_IN);
    271         instance->direction = USB_DIRECTION_IN;
    272268        instance->next_step = batch_call_in_and_dispose;
    273269        usb_log_debug("Batch(%p) BULK IN initialized.\n", instance);
     
    283279{
    284280        assert(instance);
    285         instance->direction = USB_DIRECTION_OUT;
    286281        /* We are data out, we are supposed to provide data */
    287         memcpy(instance->transport_buffer, instance->buffer,
     282        memcpy(instance->data_buffer, instance->buffer,
    288283            instance->buffer_size);
    289284        batch_data(instance, USB_PID_OUT);
     
    306301        assert(data);
    307302
    308         const bool low_speed = instance->speed == USB_SPEED_LOW;
     303        const bool low_speed = instance->ep->speed == USB_SPEED_LOW;
    309304        int toggle = endpoint_toggle_get(instance->ep);
    310305        assert(toggle == 0 || toggle == 1);
     
    314309        while (remain_size > 0) {
    315310                char *trans_data =
    316                     instance->transport_buffer + instance->buffer_size
     311                    instance->data_buffer + instance->buffer_size
    317312                    - remain_size;
    318313
    319314                const size_t packet_size =
    320                     (instance->max_packet_size > remain_size) ?
    321                     remain_size : instance->max_packet_size;
     315                    (instance->ep->max_packet_size > remain_size) ?
     316                    remain_size : instance->ep->max_packet_size;
    322317
    323318                td_t *next_transfer = (transfer + 1 < data->transfers)
     
    326321                assert(transfer < data->transfers);
    327322                assert(packet_size <= remain_size);
     323                usb_target_t target =
     324                    { instance->ep->address, instance->ep->endpoint };
    328325
    329326                td_init(
    330327                    &data->tds[transfer], DEFAULT_ERROR_COUNT, packet_size,
    331                     toggle, false, low_speed, instance->target, pid, trans_data,
     328                    toggle, false, low_speed, target, pid, trans_data,
    332329                    next_transfer);
    333330
     
    360357        assert(data->transfers >= 2);
    361358
    362         const bool low_speed = instance->speed == USB_SPEED_LOW;
     359        const bool low_speed = instance->ep->speed == USB_SPEED_LOW;
    363360        int toggle = 0;
     361        const usb_target_t target =
     362            { instance->ep->address, instance->ep->endpoint };
     363
    364364        /* setup stage */
    365365        td_init(
    366366            data->tds, DEFAULT_ERROR_COUNT, instance->setup_size, toggle, false,
    367             low_speed, instance->target, USB_PID_SETUP, instance->setup_buffer,
     367            low_speed, target, USB_PID_SETUP, instance->setup_buffer,
    368368            &data->tds[1]);
    369369
     
    373373        while (remain_size > 0) {
    374374                char *control_data =
    375                     instance->transport_buffer + instance->buffer_size
     375                    instance->data_buffer + instance->buffer_size
    376376                    - remain_size;
    377377
     
    379379
    380380                const size_t packet_size =
    381                     (instance->max_packet_size > remain_size) ?
    382                     remain_size : instance->max_packet_size;
     381                    (instance->ep->max_packet_size > remain_size) ?
     382                    remain_size : instance->ep->max_packet_size;
    383383
    384384                td_init(
    385385                    &data->tds[transfer], DEFAULT_ERROR_COUNT, packet_size,
    386                     toggle, false, low_speed, instance->target, data_stage,
     386                    toggle, false, low_speed, target, data_stage,
    387387                    control_data, &data->tds[transfer + 1]);
    388388
     
    398398        td_init(
    399399            &data->tds[transfer], DEFAULT_ERROR_COUNT, 0, 1, false, low_speed,
    400             instance->target, status_stage, NULL, NULL);
     400            target, status_stage, NULL, NULL);
    401401        td_set_ioc(&data->tds[transfer]);
    402402
     
    449449        free32(data->qh);
    450450        free32(instance->setup_buffer);
    451         free32(instance->transport_buffer);
     451        free32(instance->data_buffer);
    452452        free(data);
    453453        free(instance);
Note: See TracChangeset for help on using the changeset viewer.