Exemplo n.º 1
0
/*SoftPLL must be locked prior calling this function*/
static int calib_t24p_slave(uint32_t *value)
{
	int rv;
	uint32_t prev;

	rxts_calibration_start();
	while (!(rv = rxts_calibration_update(value)))
		/* FIXME: timeout */;
	if (rv < 0) {
		/* Fall back on master == eeprom-or-error */
		return calib_t24p_master(value);
	}

	/*
	 * Let's see if we have a matching value in EEPROM:
	 * accept a 200ps difference, otherwise rewrite eeprom
	 */
	rv = storage_phtrans(&prev, 0 /* rd */);
	if (rv < 0 || (prev < *value - 200) || (prev > *value + 200)) {
		rv = storage_phtrans(value, 1);
		pp_printf("Wrote new t24p value: %d ps (%s)\n", *value,
			  rv < 0 ? "Failed" : "Success");
	}
	return rv;
}
Exemplo n.º 2
0
int calib_t24p(int mode, uint32_t *value)
{
	if (mode == WRC_MODE_SLAVE)
		return calib_t24p_slave(value);
	else
		return calib_t24p_master(value);
}
Exemplo n.º 3
0
int calib_t24p(int mode, uint32_t *value)
{
	int ret;

	if (mode == WRC_MODE_SLAVE)
		ret = calib_t24p_slave(value);
	else
		ret = calib_t24p_master(value);

	//update phtrans value in socket struct
	ptpd_netif_set_phase_transition(*value);
	return ret;
}