Exemple #1
0
int
urj_tap_chain_set_trst (urj_chain_t *chain, int trst)
{
    int old_val = urj_tap_cable_set_signal (chain->cable, URJ_POD_CS_TRST,
                                            trst ? URJ_POD_CS_TRST : 0);
    int old_trst = (old_val & URJ_POD_CS_TRST) ? 1 : 0;

    urj_tap_state_set_trst (chain, old_trst, trst);

    return trst;
}
Exemple #2
0
/**
 * This function sets interface buffers to MOSI direction.
 * MOSI (Master Output Slave Input) is a SWD Write operation.
 * \param *libswdctx is the swd context to work on.
 * \param bits specify how many clock cycles must be used for TRN.
 * \return number of bits transmitted or negative LIBSWD_ERROR code on failure. 
 */
int libswd_drv_mosi_trn(libswd_ctx_t *libswdctx, int bits){
 if (bits<LIBSWD_TURNROUND_MIN_VAL && bits>LIBSWD_TURNROUND_MAX_VAL)
  return LIBSWD_ERROR_TURNAROUND; 

 int res;
 res=urj_tap_cable_set_signal((urj_cable_t *)libswdctx->driver->device, URJ_POD_CS_RnW, 0); 
 if (res<0) return LIBSWD_ERROR_DRIVER;
 /* void urj_tap_cable_clock (urj_cable_t *cable, int tms, int tdi, int n); */
 urj_tap_cable_clock((urj_cable_t *)libswdctx->driver->device, 1, 1, bits); 

 return bits;
}
Exemple #3
0
int
urj_tap_chain_set_pod_signal (urj_chain_t *chain, int mask, int val)
{
    int old_val = urj_tap_cable_set_signal (chain->cable, mask, val);
    int old_trst = (old_val & URJ_POD_CS_TRST) ? 1 : 0;
    int new_trst =
        (((old_val & ~mask) | (val & mask)) & URJ_POD_CS_TRST) ? 1 : 0;

    urj_tap_state_set_trst (chain, old_trst, new_trst);

    return old_val;
}