+ if (tap)
+ {
+ /* Tap is specified, set header/trailer paddings */
+ int header_ir_len = 0, header_dr_len = 0, trailer_ir_len = 0, trailer_dr_len = 0;
+ struct jtag_tap *check_tap;
+
+ svf_tap_is_specified = 1;
+
+ for (check_tap = jtag_all_taps(); check_tap; check_tap = check_tap->next_tap) {
+ if (check_tap->abs_chain_position < tap->abs_chain_position)
+ {
+ //Header
+ header_ir_len += check_tap->ir_length;
+ header_dr_len ++;
+ }
+ else if (check_tap->abs_chain_position > tap->abs_chain_position)
+ {
+ //Trailer
+ trailer_ir_len += check_tap->ir_length;
+ trailer_dr_len ++;
+ }
+ }
+
+ // HDR %d TDI (0)
+ if (ERROR_OK != svf_set_padding(&svf_para.hdr_para, header_dr_len, 0))
+ {
+ LOG_ERROR("failed to set data header");
+ return ERROR_FAIL;
+ }
+
+ // HIR %d TDI (0xFF)
+ if (ERROR_OK != svf_set_padding(&svf_para.hir_para, header_ir_len, 0xFF))
+ {
+ LOG_ERROR("failed to set instruction header");
+ return ERROR_FAIL;
+ }
+
+ // TDR %d TDI (0)
+ if (ERROR_OK != svf_set_padding(&svf_para.tdr_para, trailer_dr_len, 0))
+ {
+ LOG_ERROR("failed to set data trailer");
+ return ERROR_FAIL;
+ }
+
+ // TIR %d TDI (0xFF)
+ if (ERROR_OK != svf_set_padding(&svf_para.tir_para, trailer_ir_len, 0xFF))
+ {
+ LOG_ERROR("failed to set instruction trailer");
+ return ERROR_FAIL;
+ }
+
+ }
+
+ if (svf_progress_enabled)