/** * 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; }
int urj_tap_chain_clock (urj_chain_t *chain, int tms, int tdi, int n) { int i; if (!chain || !chain->cable) { urj_error_set (URJ_ERROR_NO_CHAIN, "no chain or no part"); return URJ_STATUS_FAIL; } urj_tap_cable_clock (chain->cable, tms, tdi, n); for (i = 0; i < n; i++) urj_tap_state_clock (chain, tms); return URJ_STATUS_OK; }