Пример #1
0
void
chain_shift_data_registers( chain_t *chain, int capture_output )
{
    int i;
    parts_t *ps;

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

    ps = chain->parts;

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

    tap_capture_dr( chain );
    for (i = 0; i < ps->len; i++)
        tap_shift_register( chain, ps->parts[i]->active_instruction->data_register->in,
                            capture_output ? ps->parts[i]->active_instruction->data_register->out : NULL,
                            (i + 1) == ps->len );
}
Пример #2
0
void
discovery( chain_t *chain )
{
    int irlen;
    tap_register *ir;
    tap_register *irz;

    /* detecting IR size */
    jtag_reset( chain );

    printf( _("Detecting IR length ... ") );
    fflush( stdout );

    tap_capture_ir( chain );
    irlen = detect_register_size( chain );

    printf( _("%d\n"), irlen );

    if (irlen < 1) {
        printf( _("Error: Invalid IR length!\n") );
        return;
    }

    /* all 1 is BYPASS in all parts, so DR length gives number of parts */
    ir = register_fill( register_alloc( irlen ), 1 );
    irz = register_duplicate( ir );

    if (!ir || !irz) {
        register_free( ir );
        register_free( irz );
        printf( _("Error: Out of memory!\n") );
        return;
    }

    for (;;) {
        int rs;

        jtag_reset( chain );

        tap_capture_ir( chain );
        tap_shift_register( chain, ir, NULL, 1 );

        printf( _("Detecting DR length for IR %s ... "), register_get_string( ir ) );
        fflush( stdout );

        tap_capture_dr( chain );
        rs = detect_register_size( chain );

        printf( _("%d\n"), rs );

        register_inc( ir );
        if (register_compare( ir, irz ) == 0)
            break;
    }
    register_free( ir );
    register_free( irz );
}