Changeset 8033f89 in mainline for uspace/drv/bus/usb/xhci/isoch.c


Ignore:
Timestamp:
2018-01-23T12:41:22Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e7e1fd3
Parents:
e546142
Message:

xhci: cstyle

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/isoch.c

    re546142 r8033f89  
    8181        fibril_timer_clear_locked(isoch->feeding_timer);
    8282        isoch->last_mf = -1U;
    83         usb_log_info("[isoch] Endpoint" XHCI_EP_FMT ": Data flow reset.", XHCI_EP_ARGS(*ep));
     83        usb_log_info("[isoch] Endpoint" XHCI_EP_FMT ": Data flow reset.",
     84            XHCI_EP_ARGS(*ep));
    8485}
    8586
     
    110111static void timer_schedule_reset(xhci_endpoint_t *ep) {
    111112        xhci_isoch_t * const isoch = ep->isoch;
    112         const suseconds_t delay = isoch->buffer_count * ep->interval * 125 + RESET_TIMER_DELAY;
     113        const suseconds_t delay = isoch->buffer_count * ep->interval * 125
     114            + RESET_TIMER_DELAY;
    113115
    114116        fibril_timer_clear_locked(isoch->reset_timer);
     
    213215        const uint32_t reg_mfindex = XHCI_REG_RD(hc->rt_regs, XHCI_RT_MFINDEX);
    214216        /*
    215          * If the mfindex is low and the time passed since last mfindex wrap
    216          * is too high, we have entered the new epoch already (and haven't received event yet).
     217         * If the mfindex is low and the time passed since last mfindex wrap is too
     218         * high, we have entered the new epoch already (and haven't received event
     219         * yet).
    217220         */
    218221        uint64_t epoch = hc->wrap_count;
    219         if (reg_mfindex < EPOCH_LOW_MFINDEX && get_system_time() - hc->wrap_time > EPOCH_DELAY) {
     222        if (reg_mfindex < EPOCH_LOW_MFINDEX
     223            && get_system_time() - hc->wrap_time > EPOCH_DELAY) {
    220224                ++epoch;
    221225        }
     
    230234                const xhci_hc_t *hc = bus->hc;
    231235
    232                 /* Delay the first frame by some time to fill the buffer, but at most 10 miliseconds. */
     236                /*
     237                 * Delay the first frame by some time to fill the buffer, but at most 10
     238                 * miliseconds.
     239                 */
    233240                const uint64_t delay = min(isoch->buffer_count * ep->interval, 10 * 8);
    234241                it->mfindex = get_current_microframe(hc) + 1 + delay + hc->ist;
     
    262269 * uframes it's off.
    263270 */
    264 static inline void window_decide(window_decision_t *res, xhci_hc_t *hc, uint64_t mfindex)
     271static inline void window_decide(window_decision_t *res, xhci_hc_t *hc,
     272    uint64_t mfindex)
    265273{
    266274        const uint64_t current_mf = get_current_microframe(hc);
     
    333341
    334342                case WINDOW_TOO_LATE:
    335                         /* Missed the opportunity to schedule. Just mark this transfer as skipped. */
    336                         usb_log_debug("[isoch] missed feeding buffer %lu at 0x%llx by %llu uframes",
    337                             it - isoch->transfers, it->mfindex, wd.offset);
     343                        /*
     344                         * Missed the opportunity to schedule. Just mark this transfer as
     345                         * skipped.
     346                         */
     347                        usb_log_debug("[isoch] missed feeding buffer %lu at 0x%llx by "
     348                                "%llu uframes", it - isoch->transfers, it->mfindex, wd.offset);
    338349                        it->state = ISOCH_COMPLETE;
    339350                        it->error = EOK;
     
    348359        if (fed) {
    349360                hc_ring_ep_doorbell(ep, 0);
    350                 /* The ring may be dead. If no event happens until the delay, reset the endpoint. */
     361                /*
     362                 * The ring may be dead. If no event happens until the delay, reset the
     363                 * endpoint.
     364                 */
    351365                timer_schedule_reset(ep);
    352366        }
     
    405419
    406420                case WINDOW_TOO_LATE:
    407                         usb_log_debug("[isoch] missed feeding buffer %lu at 0x%llx by %llu uframes",
    408                             it - isoch->transfers, it->mfindex, wd.offset);
     421                        usb_log_debug("[isoch] missed feeding buffer %lu at 0x%llx by"
     422                                "%llu uframes", it - isoch->transfers, it->mfindex, wd.offset);
    409423                        /* Missed the opportunity to schedule. Schedule ASAP. */
    410424                        it->mfindex += wd.offset;
     
    435449        if (fed) {
    436450                hc_ring_ep_doorbell(ep, 0);
    437                 /* The ring may be dead. If no event happens until the delay, reset the endpoint. */
     451                /*
     452                 * The ring may be dead. If no event happens until the delay, reset the
     453                 * endpoint.
     454                 */
    438455                timer_schedule_reset(ep);
    439456        }
     
    502519        calc_next_mfindex(ep, it);
    503520        isoch->last_mf = it->mfindex;
    504         usb_log_debug("[isoch] buffer %zu will be on schedule at 0x%llx", it - isoch->transfers, it->mfindex);
     521        usb_log_debug("[isoch] buffer %zu will be on schedule at 0x%llx",
     522            it - isoch->transfers, it->mfindex);
    505523
    506524        /* Prepare the transfer. */
     
    543561                isoch_feed_in(ep);
    544562
    545                 usb_log_debug("[isoch] waiting for buffer %zu to be completed", it - isoch->transfers);
     563                usb_log_debug("[isoch] waiting for buffer %zu to be completed",
     564                    it - isoch->transfers);
    546565                fibril_condvar_wait(&isoch->avail, &isoch->guard);
    547566
     
    568587}
    569588
    570 void isoch_handle_transfer_event(xhci_hc_t *hc, xhci_endpoint_t *ep, xhci_trb_t *trb)
     589void isoch_handle_transfer_event(xhci_hc_t *hc, xhci_endpoint_t *ep,
     590    xhci_trb_t *trb)
    571591{
    572592        assert(ep->base.transfer_type == USB_TRANSFER_ISOCHRONOUS);
     
    581601                case XHCI_TRBC_RING_OVERRUN:
    582602                case XHCI_TRBC_RING_UNDERRUN:
    583                         /* For OUT, there was nothing to process */
    584                         /* For IN, the buffer has overfilled, we empty the buffers and readd TRBs */
     603                        /*
     604                         * For OUT, there was nothing to process.
     605                         * For IN, the buffer has overfilled.
     606                         * In either case, reset the ring.
     607                         */
    585608                        usb_log_warning("Ring over/underrun.");
    586609                        isoch_reset_no_timer(ep);
Note: See TracChangeset for help on using the changeset viewer.