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


Ignore:
Timestamp:
2011-04-10T12:18:09Z (13 years ago)
Author:
Lubos Slovak <lubos.slovak@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
60c0573
Parents:
a49e171 (diff), 82e8861 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Development changes

File:
1 edited

Legend:

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

    ra49e171 rdc4c19e  
    8080 * transaction and callback.
    8181 */
    82 usb_transfer_batch_t * batch_get(ddf_fun_t *fun, usb_target_t target,
    83     usb_transfer_type_t transfer_type, size_t max_packet_size,
    84     usb_speed_t speed, char *buffer, size_t buffer_size,
    85     char* setup_buffer, size_t setup_size,
     82usb_transfer_batch_t * batch_get(ddf_fun_t *fun, endpoint_t *ep,
     83    char *buffer, size_t buffer_size, char* setup_buffer, size_t setup_size,
    8684    usbhc_iface_transfer_in_callback_t func_in,
    87     usbhc_iface_transfer_out_callback_t func_out, void *arg, endpoint_t *ep
    88     )
    89 {
     85    usbhc_iface_transfer_out_callback_t func_out, void *arg)
     86{
     87        assert(ep);
    9088        assert(func_in == NULL || func_out == NULL);
    9189        assert(func_in != NULL || func_out != NULL);
     
    103101        CHECK_NULL_DISPOSE_RETURN(instance,
    104102            "Failed to allocate batch instance.\n");
    105         usb_transfer_batch_init(instance, target,
    106             transfer_type, speed, max_packet_size,
    107             buffer, NULL, buffer_size, NULL, setup_size, func_in,
    108             func_out, arg, fun, ep, NULL);
     103        usb_target_t target =
     104            { .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);
    109108
    110109
    111110        uhci_batch_t *data = malloc(sizeof(uhci_batch_t));
    112         CHECK_NULL_DISPOSE_RETURN(instance,
    113             "Failed to allocate batch instance.\n");
     111        CHECK_NULL_DISPOSE_RETURN(data, "Failed to allocate batch data.\n");
    114112        bzero(data, sizeof(uhci_batch_t));
    115113        instance->private_data = data;
    116114
    117         data->transfers = (buffer_size + max_packet_size - 1) / max_packet_size;
    118         if (transfer_type == USB_TRANSFER_CONTROL) {
     115        data->transfers =
     116            (buffer_size + ep->max_packet_size - 1) / ep->max_packet_size;
     117        if (ep->transfer_type == USB_TRANSFER_CONTROL) {
    119118                data->transfers += 2;
    120119        }
     
    178177                            instance, i, data->tds[i].status);
    179178                        td_print_status(&data->tds[i]);
    180                         if (instance->ep != NULL)
    181                                 endpoint_toggle_set(instance->ep,
    182                                     td_toggle(&data->tds[i]));
     179                        assert(instance->ep != NULL);
     180
     181                        endpoint_toggle_set(instance->ep,
     182                            td_toggle(&data->tds[i]));
    183183                        if (i > 0)
    184184                                goto substract_ret;
Note: See TracChangeset for help on using the changeset viewer.