static int ehci_state_advqueue(EHCIQueue *q, int async)

{

#if 0

    /* TO-DO: 4.10.2 - paragraph 2

     * if I-bit is set to 1 and QH is not active

     * go to horizontal QH

     */

    if (I-bit set) {

        ehci_set_state(ehci, async, EST_HORIZONTALQH);

        goto out;

    }

#endif



    /*

     * want data and alt-next qTD is valid

     */

    if (((q->qh.token & QTD_TOKEN_TBYTES_MASK) != 0) &&

        (q->qh.altnext_qtd > 0x1000) &&

        (NLPTR_TBIT(q->qh.altnext_qtd) == 0)) {

        q->qtdaddr = q->qh.altnext_qtd;

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



    /*

     *  next qTD is valid

     */

    } else if ((q->qh.next_qtd > 0x1000) &&

               (NLPTR_TBIT(q->qh.next_qtd) == 0)) {

        q->qtdaddr = q->qh.next_qtd;

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



    /*

     *  no valid qTD, try next QH

     */

    } else {

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

    }



    return 1;

}

static int ehci_state_advqueue(EHCIQueue *q, int async)

{

#if 0

    







    if (I-bit set) {

        ehci_set_state(ehci, async, EST_HORIZONTALQH);

        goto out;

    }

#endif



    





    if (((q->qh.token & QTD_TOKEN_TBYTES_MASK) != 0) &&

        (q->qh.altnext_qtd > 0x1000) &&

        (NLPTR_TBIT(q->qh.altnext_qtd) == 0)) {

        q->qtdaddr = q->qh.altnext_qtd;

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



    





    } else if ((q->qh.next_qtd > 0x1000) &&

               (NLPTR_TBIT(q->qh.next_qtd) == 0)) {

        q->qtdaddr = q->qh.next_qtd;

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



    





    } else {

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

    }



    return 1;

}

static int FUNC_0(EHCIQueue *VAR_0, int VAR_1)

{

#if 0

    







    if (I-bit set) {

        ehci_set_state(ehci, VAR_1, EST_HORIZONTALQH);

        goto out;

    }

#endif



    





    if (((VAR_0->qh.token & QTD_TOKEN_TBYTES_MASK) != 0) &&

        (VAR_0->qh.altnext_qtd > 0x1000) &&

        (NLPTR_TBIT(VAR_0->qh.altnext_qtd) == 0)) {

        VAR_0->qtdaddr = VAR_0->qh.altnext_qtd;

        ehci_set_state(VAR_0->ehci, VAR_1, EST_FETCHQTD);



    





    } else if ((VAR_0->qh.next_qtd > 0x1000) &&

               (NLPTR_TBIT(VAR_0->qh.next_qtd) == 0)) {

        VAR_0->qtdaddr = VAR_0->qh.next_qtd;

        ehci_set_state(VAR_0->ehci, VAR_1, EST_FETCHQTD);



    





    } else {

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

    }



    return 1;

}

static int FUNC_0(EHCIQueue *VAR_0, int VAR_1)
{ #if 0
if (I-bit set) { ehci_set_state(ehci, VAR_1, EST_HORIZONTALQH); goto out; } #endif
if (((VAR_0->qh.token & QTD_TOKEN_TBYTES_MASK) != 0) &&
(VAR_0->qh.altnext_qtd > 0x1000) &&
(NLPTR_TBIT(VAR_0->qh.altnext_qtd) == 0)) { VAR_0->qtdaddr = VAR_0->qh.altnext_qtd; ehci_set_state(VAR_0->ehci, VAR_1, EST_FETCHQTD); } else if ((VAR_0->qh.next_qtd > 0x1000) && (NLPTR_TBIT(VAR_0->qh.next_qtd) == 0)) { VAR_0->qtdaddr = VAR_0->qh.next_qtd; ehci_set_state(VAR_0->ehci, VAR_1, EST_FETCHQTD); } else { ehci_set_state(VAR_0->ehci, VAR_1, EST_HORIZONTALQH); } return 1; }