/* Calculate Synchronous Transfer Register value from SDTR code.  */
static uchar calc_sync_xfer(unsigned int period, unsigned int offset, unsigned int fast, const struct sx_period *sx_table)
/* Calculate Synchronous Transfer Register value from SDTR code.  */
static uchar calc_sync_xfer(unsigned int period, unsigned int offset, unsigned int fast, const struct sx_period *sx_table)
{
	uchar result;
	if (offset && fast) {
		fast = STR_FSS;
		period *= 2;
	} else {
		fast = 0;
	}
	period *= 4;
	result = sx_table[round_period(period,sx_table)].reg_value;
	result |= (offset < OPTIMUM_SX_OFF) ? offset : OPTIMUM_SX_OFF;
	result |= fast;
	return result;
}