コード例 #1
0
ファイル: chain.c プロジェクト: cktben/urjtag
int
urj_tap_chain_shift_instructions_mode (urj_chain_t *chain,
                                       int capture_output, int capture,
                                       int chain_exit)
{
    int i;
    urj_parts_t *ps;

    if (!chain || !chain->parts)
    {
        urj_error_set (URJ_ERROR_NO_CHAIN, "no chain or no part");
        return URJ_STATUS_FAIL;
    }

    ps = chain->parts;

    for (i = 0; i < ps->len; i++)
    {
        if (ps->parts[i]->active_instruction == NULL)
        {
            urj_error_set (URJ_ERROR_NO_ACTIVE_INSTRUCTION,
                           _("Part %d without active instruction"), i);
            return URJ_STATUS_FAIL;
        }
    }

    if (capture)
        urj_tap_capture_ir (chain);

    /* new implementation: split into defer + retrieve part
       shift the data register of each part in the chain one by one */

    for (i = 0; i < ps->len; i++)
    {
        urj_tap_defer_shift_register (chain,
                                      ps->parts[i]->active_instruction->value,
                                      capture_output ? ps->parts[i]->active_instruction->out
                                      : NULL,
                                      (i + 1) == ps->len ? chain_exit : URJ_CHAIN_EXITMODE_SHIFT);
    }

    if (capture_output)
    {
        for (i = 0; i < ps->len; i++)
        {
            urj_tap_shift_register_output (chain,
                                           ps->parts[i]->active_instruction->value,
                                           ps->parts[i]->active_instruction->out,
                                           (i + 1) == ps->len ? chain_exit
                                           : URJ_CHAIN_EXITMODE_SHIFT);
        }
    }
    else
    {
        /* give the cable driver a chance to flush if it's considered useful */
        urj_tap_cable_flush (chain->cable, URJ_TAP_CABLE_TO_OUTPUT);
    }

    return URJ_STATUS_OK;
}
コード例 #2
0
ファイル: bfin.c プロジェクト: bgelb/urjtag
void
part_emudat_defer_get (urj_chain_t *chain, int n, int exit)
{
    int i;
    urj_parts_t *ps;

    assert (exit == URJ_CHAIN_EXITMODE_UPDATE || exit == URJ_CHAIN_EXITMODE_IDLE);

    if (exit == URJ_CHAIN_EXITMODE_IDLE)
    {
        assert (urj_tap_state (chain) & URJ_TAP_STATE_IDLE);
        urj_tap_chain_defer_clock (chain, 0, 0, 1);
        urj_tap_chain_wait_ready (chain);
    }

    if (part_scan_select (chain, n, EMUDAT_SCAN) < 0)
        abort ();

    if (!chain || !chain->parts)
        return;

    ps = chain->parts;

    for (i = 0; i < ps->len; i++)
    {
        if (ps->parts[i]->active_instruction == NULL)
        {
            urj_log (URJ_LOG_LEVEL_ERROR,
                     _("Part %d without active instruction\n"), i);
            return;
        }
        if (ps->parts[i]->active_instruction->data_register == NULL)
        {
            urj_log (URJ_LOG_LEVEL_ERROR,
                     _("Part %d without data register\n"), i);
            return;
        }
    }

    urj_tap_capture_dr (chain);

    /* new implementation: split into defer + retrieve part
       shift the data register of each part in the chain one by one */

    for (i = 0; i < ps->len; i++)
    {
        urj_tap_defer_shift_register (chain, ps->parts[i]->active_instruction->data_register->in,
                                      ps->parts[i]->active_instruction->data_register->out,
                                      (i + 1) == ps->len ? URJ_CHAIN_EXITMODE_UPDATE : URJ_CHAIN_EXITMODE_SHIFT);
    }
}