static void conditional_branch(DBDMA_channel *ch)

{

    dbdma_cmd *current = &ch->current;

    uint16_t br;

    uint16_t sel_mask, sel_value;

    uint32_t status;

    int cond;



    DBDMA_DPRINTF("conditional_branch\n");



    /* check if we must branch */



    br = le16_to_cpu(current->command) & BR_MASK;



    switch(br) {

    case BR_NEVER:  /* don't branch */

        next(ch);

        return;

    case BR_ALWAYS: /* always branch */

        branch(ch);

        return;

    }



    status = be32_to_cpu(ch->regs[DBDMA_STATUS]) & DEVSTAT;



    sel_mask = (be32_to_cpu(ch->regs[DBDMA_BRANCH_SEL]) >> 16) & 0x0f;

    sel_value = be32_to_cpu(ch->regs[DBDMA_BRANCH_SEL]) & 0x0f;



    cond = (status & sel_mask) == (sel_value & sel_mask);



    switch(br) {

    case BR_IFSET:  /* branch if condition bit is 1 */

        if (cond)

            branch(ch);

        else

            next(ch);

        return;

    case BR_IFCLR:  /* branch if condition bit is 0 */

        if (!cond)

            branch(ch);

        else

            next(ch);

        return;

    }

}

static void conditional_branch(DBDMA_channel *ch)

{

    dbdma_cmd *current = &ch->current;

    uint16_t br;

    uint16_t sel_mask, sel_value;

    uint32_t status;

    int cond;



    DBDMA_DPRINTF("conditional_branch\n");



    



    br = le16_to_cpu(current->command) & BR_MASK;



    switch(br) {

    case BR_NEVER:  

        next(ch);

        return;

    case BR_ALWAYS: 

        branch(ch);

        return;

    }



    status = be32_to_cpu(ch->regs[DBDMA_STATUS]) & DEVSTAT;



    sel_mask = (be32_to_cpu(ch->regs[DBDMA_BRANCH_SEL]) >> 16) & 0x0f;

    sel_value = be32_to_cpu(ch->regs[DBDMA_BRANCH_SEL]) & 0x0f;



    cond = (status & sel_mask) == (sel_value & sel_mask);



    switch(br) {

    case BR_IFSET:  

        if (cond)

            branch(ch);

        else

            next(ch);

        return;

    case BR_IFCLR:  

        if (!cond)

            branch(ch);

        else

            next(ch);

        return;

    }

}

static void FUNC_0(DBDMA_channel *VAR_0)

{

    dbdma_cmd *current = &VAR_0->current;

    uint16_t br;

    uint16_t sel_mask, sel_value;

    uint32_t status;

    int VAR_1;



    DBDMA_DPRINTF("FUNC_0\n");



    



    br = le16_to_cpu(current->command) & BR_MASK;



    switch(br) {

    case BR_NEVER:  

        next(VAR_0);

        return;

    case BR_ALWAYS: 

        branch(VAR_0);

        return;

    }



    status = be32_to_cpu(VAR_0->regs[DBDMA_STATUS]) & DEVSTAT;



    sel_mask = (be32_to_cpu(VAR_0->regs[DBDMA_BRANCH_SEL]) >> 16) & 0x0f;

    sel_value = be32_to_cpu(VAR_0->regs[DBDMA_BRANCH_SEL]) & 0x0f;



    VAR_1 = (status & sel_mask) == (sel_value & sel_mask);



    switch(br) {

    case BR_IFSET:  

        if (VAR_1)

            branch(VAR_0);

        else

            next(VAR_0);

        return;

    case BR_IFCLR:  

        if (!VAR_1)

            branch(VAR_0);

        else

            next(VAR_0);

        return;

    }

}

static void FUNC_0(DBDMA_channel *VAR_0)
{ dbdma_cmd *current = &VAR_0->current; uint16_t br; uint16_t sel_mask, sel_value; uint32_t status; int VAR_1; DBDMA_DPRINTF("FUNC_0\n"); br = le16_to_cpu(current->command) & BR_MASK; switch(br) { case BR_NEVER:
next(VAR_0); return; case BR_ALWAYS:
branch(VAR_0); return; } status = be32_to_cpu(VAR_0->regs[DBDMA_STATUS]) & DEVSTAT; sel_mask = (be32_to_cpu(VAR_0->regs[DBDMA_BRANCH_SEL]) >> 16) & 0x0f; sel_value = be32_to_cpu(VAR_0->regs[DBDMA_BRANCH_SEL]) & 0x0f; VAR_1 = (status & sel_mask) == (sel_value & sel_mask); switch(br) { case BR_IFSET:
if (VAR_1)
branch(VAR_0); else
next(VAR_0); return; case BR_IFCLR:
if (!VAR_1)
branch(VAR_0); else
next(VAR_0); return; } }