Changeset 33d19a7 in mainline for uspace/drv/ohci/batch.c


Ignore:
Timestamp:
2011-05-18T10:40:34Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
68b9f148
Parents:
c7b5826
Message:

Fix OHCI buffer access.

Consider more than one data transaction when computing transfered size.
Reduce max transfer size to 4KB to guarantee that max 2 pages will be used.

File:
1 edited

Legend:

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

    rc7b5826 r33d19a7  
    151151
    152152        /* NOTE: OHCI is capable of handling buffer that crosses page boundaries
    153          * it is, however, not capable of handling buffer that accupies more
    154          * than two pages (the first page is computete using start pointer, the
    155          * other using end pointer)*/
     153         * it is, however, not capable of handling buffer that occupies more
     154         * than two pages (the first page is computed using start pointer, the
     155         * other using the end pointer) */
    156156        if (setup_size + buffer_size > 0) {
    157157                data->device_buffer = malloc32(setup_size + buffer_size);
     
    180180        ohci_transfer_batch_t *data = instance->private_data;
    181181        assert(data);
    182         size_t tds = data->td_count;
    183182        usb_log_debug("Batch(%p) checking %zu td(s) for completion.\n",
    184             instance, tds);
     183            instance, data->td_count);
    185184        usb_log_debug("ED: %x:%x:%x:%x.\n",
    186185            data->ed->status, data->ed->td_head, data->ed->td_tail,
     
    188187        size_t i = 0;
    189188        instance->transfered_size = instance->buffer_size;
    190         for (; i < tds; ++i) {
     189        for (; i < data->td_count; ++i) {
    191190                assert(data->tds[i] != NULL);
    192191                usb_log_debug("TD %zu: %x:%x:%x:%x.\n", i,
     
    213212        assert(hcd_ep);
    214213        hcd_ep->td = data->tds[i];
    215         if (i > 0)
    216                 instance->transfered_size -= td_remain_size(data->tds[i - 1]);
     214        assert(i > 0);
     215        for (--i;i < data->td_count; ++i)
     216                instance->transfered_size -= td_remain_size(data->tds[i]);
    217217
    218218        /* Clear possible ED HALT */
Note: See TracChangeset for help on using the changeset viewer.