if(JTAG_channels[chn].mode==JTAG_MODE_BOUNDARY)JTAG_channels[chn].mode=JTAG_MODE_SAMPLE;//should write the last byte before reading - or buffer data will be just lost
/* TCK = 0 - just a delay; is it really needed? */
data.tck=0;
data.tck_set=1;
seq_num=prep_sensio_status(sens_num);
x393_sensio_jtag(data,sens_num);
wait_sensio_status(sens_num,seq_num);
data.tms=tms&1;
data.tms_set=1;
data.tdi=((d<<=1)>>8)&1;
data.tdi_set=1;
data.tck=0;
data.tck_set=1;
seq_num=prep_sensio_status(sens_num);
x393_sensio_jtag(data,sens_num);
wait_sensio_status(sens_num,seq_num);
/* TCK = 0 - just a delay; is it really needed? */
data.tck=0;
data.tck_set=1;
seq_num=prep_sensio_status(sens_num);
x393_sensio_jtag(data,sens_num);
wait_sensio_status(sens_num,seq_num);
data.tck=1;
data.tck_set=1;
seq_num=prep_sensio_status(sens_num);
x393_sensio_jtag(data,sens_num);
wait_sensio_status(sens_num,seq_num);
/* read TDO before TCK pulse */
stat=x393_sensio_status(sens_num);
r=(r<<1)+(stat.xfpgatdo&1);
/* TCK = 0 - just a delay; is it really needed? */
data.tck=0;
data.tck_set=1;
seq_num=prep_sensio_status(sens_num);
x393_sensio_jtag(data,sens_num);
wait_sensio_status(sens_num,seq_num);
}
data.tck=0;
data.tck_set=1;
seq_num=prep_sensio_status(sens_num);
x393_sensio_jtag(data,sens_num);
wait_sensio_status(sens_num,seq_num);
break;
caseJTAG_AUX_FPGA:
break;
}
returnr;
}
//====================================
// port_csp0_addr[X313_WA_SENSFPGA] = 0; // nop
// write data data bytes from buffer, read data, optionally compare/abort
// return: 0- OK, !=0 - readback mismatch error
// modified so it reads data in-place of the written one
// send/receive bits, raising TMS during the last one (if last==1). If number of bits are not multiple of 8, lower bits of the last byte will not be used.
intjtag_write_bits(intchn,
unsignedchar*buf,// data to write
intlen,// number of bytes to write
intcheck,// compare readback data with previously written, abort on mismatch