static int ehci_state_writeback(EHCIQueue *q)

{

    EHCIPacket *p = QTAILQ_FIRST(&q->packets);

    int again = 0;



    /*  Write back the QTD from the QH area */

    assert(p != NULL);

    assert(p->qtdaddr == q->qtdaddr);



    ehci_trace_qtd(q, NLPTR_GET(p->qtdaddr), (EHCIqtd *) &q->qh.next_qtd);

    put_dwords(q->ehci, NLPTR_GET(p->qtdaddr), (uint32_t *) &q->qh.next_qtd,

               sizeof(EHCIqtd) >> 2);

    ehci_free_packet(p);



    /*

     * EHCI specs say go horizontal here.

     *

     * We can also advance the queue here for performance reasons.  We

     * need to take care to only take that shortcut in case we've

     * processed the qtd just written back without errors, i.e. halt

     * bit is clear.

     */

    if (q->qh.token & QTD_TOKEN_HALT) {

        ehci_set_state(q->ehci, q->async, EST_HORIZONTALQH);

        again = 1;

    } else {

        ehci_set_state(q->ehci, q->async, EST_ADVANCEQUEUE);

        again = 1;

    }

    return again;

}

static int ehci_state_writeback(EHCIQueue *q)

{

    EHCIPacket *p = QTAILQ_FIRST(&q->packets);

    int again = 0;



    

    assert(p != NULL);

    assert(p->qtdaddr == q->qtdaddr);



    ehci_trace_qtd(q, NLPTR_GET(p->qtdaddr), (EHCIqtd *) &q->qh.next_qtd);

    put_dwords(q->ehci, NLPTR_GET(p->qtdaddr), (uint32_t *) &q->qh.next_qtd,

               sizeof(EHCIqtd) >> 2);

    ehci_free_packet(p);



    















    if (q->qh.token & QTD_TOKEN_HALT) {

        ehci_set_state(q->ehci, q->async, EST_HORIZONTALQH);

        again = 1;

    } else {

        ehci_set_state(q->ehci, q->async, EST_ADVANCEQUEUE);

        again = 1;

    }

    return again;

}

    put_dwords(q->ehci, NLPTR_GET(p->qtdaddr), (uint32_t *) &q->qh.next_qtd,                sizeof(EHCIqtd) >> 2);
static int FUNC_0(EHCIQueue *VAR_0)

{

    EHCIPacket *p = QTAILQ_FIRST(&VAR_0->packets);

    int VAR_1 = 0;



    

    assert(p != NULL);

    assert(p->qtdaddr == VAR_0->qtdaddr);



    ehci_trace_qtd(VAR_0, NLPTR_GET(p->qtdaddr), (EHCIqtd *) &VAR_0->qh.next_qtd);

    put_dwords(VAR_0->ehci, NLPTR_GET(p->qtdaddr), (uint32_t *) &VAR_0->qh.next_qtd,

               sizeof(EHCIqtd) >> 2);

    ehci_free_packet(p);



    















    if (VAR_0->qh.token & QTD_TOKEN_HALT) {

        ehci_set_state(VAR_0->ehci, VAR_0->async, EST_HORIZONTALQH);

        VAR_1 = 1;

    } else {

        ehci_set_state(VAR_0->ehci, VAR_0->async, EST_ADVANCEQUEUE);

        VAR_1 = 1;

    }

    return VAR_1;

}

static int FUNC_0(EHCIQueue *VAR_0)
{ EHCIPacket *p = QTAILQ_FIRST(&VAR_0->packets); int VAR_1 = 0; assert(p != NULL); assert(p->qtdaddr == VAR_0->qtdaddr); ehci_trace_qtd(VAR_0, NLPTR_GET(p->qtdaddr), (EHCIqtd *) &VAR_0->qh.next_qtd); put_dwords(VAR_0->ehci, NLPTR_GET(p->qtdaddr), (uint32_t *) &VAR_0->qh.next_qtd,
sizeof(EHCIqtd) >> 2); ehci_free_packet(p); if (VAR_0->qh.token & QTD_TOKEN_HALT) { ehci_set_state(VAR_0->ehci, VAR_0->async, EST_HORIZONTALQH); VAR_1 = 1; } else { ehci_set_state(VAR_0->ehci, VAR_0->async, EST_ADVANCEQUEUE); VAR_1 = 1; } return VAR_1; }