Changeset 3bacee1 in mainline for uspace/drv/bus/usb/ehci/ehci_batch.c


Ignore:
Timestamp:
2018-04-12T16:27:17Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3cf22f9
Parents:
76d0981d
git-author:
Jiri Svoboda <jiri@…> (2018-04-11 19:25:33)
git-committer:
Jiri Svoboda <jiri@…> (2018-04-12 16:27:17)
Message:

Make ccheck-fix again and commit more good files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ehci/ehci_batch.c

    r76d0981d r3bacee1  
    5353#define EHCI_TD_MAX_TRANSFER   (16 * 1024)
    5454
    55 static void (*const batch_setup[])(ehci_transfer_batch_t*);
     55static void (*const batch_setup[])(ehci_transfer_batch_t *);
    5656
    5757/** Safely destructs ehci_transfer_batch_t structure
     
    7474 *
    7575 */
    76 ehci_transfer_batch_t * ehci_transfer_batch_create(endpoint_t *ep)
     76ehci_transfer_batch_t *ehci_transfer_batch_create(endpoint_t *ep)
    7777{
    7878        assert(ep);
     
    9999        assert(ehci_batch);
    100100
    101         const size_t setup_size = (ehci_batch->base.ep->transfer_type == USB_TRANSFER_CONTROL)
    102                 ? USB_SETUP_PACKET_SIZE
    103                 : 0;
     101        const size_t setup_size = (ehci_batch->base.ep->transfer_type == USB_TRANSFER_CONTROL) ?
     102            USB_SETUP_PACKET_SIZE :
     103            0;
    104104
    105105        const size_t size = ehci_batch->base.size;
     
    109109
    110110        /* Determine number of TDs needed */
    111         ehci_batch->td_count = (size + EHCI_TD_MAX_TRANSFER - 1)
    112                 / EHCI_TD_MAX_TRANSFER;
     111        ehci_batch->td_count = (size + EHCI_TD_MAX_TRANSFER - 1) /
     112            EHCI_TD_MAX_TRANSFER;
    113113
    114114        /* Control transfer need Setup and Status stage */
     
    173173            ehci_batch->qh->next, ehci_batch->qh->alternate);
    174174
    175         if (!qh_halted(ehci_batch->qh) && (qh_transfer_pending(ehci_batch->qh)
    176             || qh_transfer_active(ehci_batch->qh)))
     175        if (!qh_halted(ehci_batch->qh) && (qh_transfer_pending(ehci_batch->qh) ||
     176            qh_transfer_active(ehci_batch->qh)))
    177177                return false;
    178178
     
    204204                         * we leave the very last(unused) TD behind.
    205205                         */
    206                         ehci_batch->base.transferred_size
    207                             -= td_remain_size(&ehci_batch->tds[i]);
     206                        ehci_batch->base.transferred_size -=
     207                            td_remain_size(&ehci_batch->tds[i]);
    208208                } else {
    209209                        usb_log_debug("Batch %p found error TD(%zu):%08x: %s.",
     
    274274            dma_buffer_phys(&ehci_batch->ehci_dma_buffer, ehci_batch->setup_buffer),
    275275            USB_DIRECTION_BOTH, USB_SETUP_PACKET_SIZE, toggle, false);
    276         usb_log_debug2("Batch %p: Created CONTROL SETUP TD(%"PRIxn"): "
     276        usb_log_debug2("Batch %p: Created CONTROL SETUP TD(%" PRIxn "): "
    277277            "%08x:%08x:%08x", ehci_batch,
    278278            dma_buffer_phys(&ehci_batch->ehci_dma_buffer, &ehci_batch->tds[0]),
     
    292292                    dma_buffer_phys(&ehci_batch->ehci_dma_buffer, &ehci_batch->tds[td_current + 1]),
    293293                    buffer, data_dir, transfer_size, toggle, false);
    294                 usb_log_debug2("Batch %p: Created CONTROL DATA TD(%"PRIxn"): "
     294                usb_log_debug2("Batch %p: Created CONTROL DATA TD(%" PRIxn "): "
    295295                    "%08x:%08x:%08x", ehci_batch,
    296296                    dma_buffer_phys(&ehci_batch->ehci_dma_buffer, &ehci_batch->tds[td_current]),
     
    308308        assert(td_current == ehci_batch->td_count - 1);
    309309        td_init(&ehci_batch->tds[td_current], 0, 0, status_dir, 0, 1, true);
    310         usb_log_debug2("Batch %p: Created CONTROL STATUS TD %d(%"PRIxn"): "
     310        usb_log_debug2("Batch %p: Created CONTROL STATUS TD %d(%" PRIxn "): "
    311311            "%08x:%08x:%08x", ehci_batch, td_current,
    312312            dma_buffer_phys(&ehci_batch->ehci_dma_buffer, &ehci_batch->tds[td_current]),
     
    340340            ehci_batch->data_buffer);
    341341        while (remain_size > 0) {
    342                 const size_t transfer_size = remain_size > EHCI_TD_MAX_TRANSFER
    343                     ? EHCI_TD_MAX_TRANSFER : remain_size;
     342                const size_t transfer_size = remain_size > EHCI_TD_MAX_TRANSFER ?
     343                    EHCI_TD_MAX_TRANSFER : remain_size;
    344344
    345345                const bool last = (remain_size == transfer_size);
    346346                td_init(&ehci_batch->tds[td_current],
    347347                    last ? 0 : dma_buffer_phys(&ehci_batch->ehci_dma_buffer,
    348                             &ehci_batch->tds[td_current + 1]),
     348                    &ehci_batch->tds[td_current + 1]),
    349349                    buffer, ehci_batch->base.dir, transfer_size, -1, last);
    350350
    351                 usb_log_debug2("Batch %p: DATA TD(%"PRIxn": %08x:%08x:%08x",
     351                usb_log_debug2("Batch %p: DATA TD(%" PRIxn ": %08x:%08x:%08x",
    352352                    ehci_batch,
    353353                    dma_buffer_phys(&ehci_batch->ehci_dma_buffer,
    354                         &ehci_batch->tds[td_current]),
     354                    &ehci_batch->tds[td_current]),
    355355                    ehci_batch->tds[td_current].status,
    356356                    ehci_batch->tds[td_current].next,
     
    365365
    366366/** Transfer setup table. */
    367 static void (*const batch_setup[])(ehci_transfer_batch_t*) =
    368 {
     367static void (*const batch_setup[])(ehci_transfer_batch_t *) =
     368    {
    369369        [USB_TRANSFER_CONTROL] = batch_control,
    370370        [USB_TRANSFER_BULK] = batch_data,
Note: See TracChangeset for help on using the changeset viewer.