Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 11cb0565 in mainline


Ignore:
Timestamp:
2011-12-06T14:03:34Z (10 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master
Children:
890a3454
Parents:
5ca08d4
Message:

ohci: Drop leave_td field. Make is_compete() and commit() parameters const.

Location:
uspace/drv/bus/usb/ohci
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/ohci_batch.c

    r5ca08d4 r11cb0565  
    5454                return;
    5555        if (ohci_batch->tds) {
     56                const ohci_endpoint_t *ohci_ep =
     57                    ohci_endpoint_get(ohci_batch->usb_batch->ep);
     58                assert(ohci_ep);
    5659                for (unsigned i = 0; i < ohci_batch->td_count; ++i) {
    57                         if (i != ohci_batch->leave_td)
     60                        if (ohci_batch->tds[i] != ohci_ep->td)
    5861                                free32(ohci_batch->tds[i]);
    5962                }
     
    119122        ohci_batch->ed = ohci_endpoint_get(usb_batch->ep)->ed;
    120123        ohci_batch->tds[0] = ohci_endpoint_get(usb_batch->ep)->td;
    121         ohci_batch->leave_td = 0;
    122124
    123125        for (unsigned i = 1; i <= ohci_batch->td_count; ++i) {
     
    166168 * completes with the last TD.
    167169 */
    168 bool ohci_transfer_batch_is_complete(ohci_transfer_batch_t *ohci_batch)
     170bool ohci_transfer_batch_is_complete(const ohci_transfer_batch_t *ohci_batch)
    169171{
    170172        assert(ohci_batch);
     
    188190
    189191        /* Assume we will leave the last(unused) TD behind */
    190         ohci_batch->leave_td = ohci_batch->td_count;
     192        unsigned leave_td = ohci_batch->td_count;
    191193
    192194        /* Check all TDs */
     
    226228                         * It will be the one TD we leave behind.
    227229                         */
    228                         ohci_batch->leave_td = i + 1;
     230                        leave_td = i + 1;
    229231
    230232                        /* Check TD assumption */
    231                         const uint32_t pa = addr_to_phys(
    232                             ohci_batch->tds[ohci_batch->leave_td]);
    233                         assert((ohci_batch->ed->td_head & ED_TDTAIL_PTR_MASK)
     233                        const uint32_t pa =
     234                            addr_to_phys(ohci_batch->tds[leave_td]);
     235                        assert((ohci_batch->ed->td_head & ED_TDHEAD_PTR_MASK)
    234236                            == pa);
    235237
    236238                        ed_set_tail_td(ohci_batch->ed,
    237                             ohci_batch->tds[ohci_batch->leave_td]);
     239                            ohci_batch->tds[leave_td]);
    238240
    239241                        /* Clear possible ED HALT */
     
    248250        ohci_endpoint_t *ohci_ep = ohci_endpoint_get(ohci_batch->usb_batch->ep);
    249251        assert(ohci_ep);
    250         ohci_ep->td = ohci_batch->tds[ohci_batch->leave_td];
     252        ohci_ep->td = ohci_batch->tds[leave_td];
    251253
    252254        /* Make sure that we are leaving the right TD behind */
     
    262264 * @param[in] ohci_batch Batch structure to use
    263265 */
    264 void ohci_transfer_batch_commit(ohci_transfer_batch_t *ohci_batch)
     266void ohci_transfer_batch_commit(const ohci_transfer_batch_t *ohci_batch)
    265267{
    266268        assert(ohci_batch);
  • uspace/drv/bus/usb/ohci/ohci_batch.h

    r5ca08d4 r11cb0565  
    5353        /** Number of TDs used by the transfer */
    5454        size_t td_count;
    55         /** Dummy TD to be left at the ED and used by the next transfer */
    56         size_t leave_td;
    5755        /** Data buffer, must be accessible by the OHCI hw. */
    5856        char *device_buffer;
     
    6260
    6361ohci_transfer_batch_t * ohci_transfer_batch_get(usb_transfer_batch_t *batch);
    64 bool ohci_transfer_batch_is_complete(ohci_transfer_batch_t *batch);
    65 void ohci_transfer_batch_commit(ohci_transfer_batch_t *batch);
     62bool ohci_transfer_batch_is_complete(const ohci_transfer_batch_t *batch);
     63void ohci_transfer_batch_commit(const ohci_transfer_batch_t *batch);
    6664void ohci_transfer_batch_finish_dispose(ohci_transfer_batch_t *batch);
    6765/*----------------------------------------------------------------------------*/
Note: See TracChangeset for help on using the changeset viewer.