global = {
	hal_modules_path = "/wr/lib/modules";
	hal_firmware_path = "/wr/firmware";
	
	main_firmware="rtu_with_endpoints";
	clkb_firmware="dmtd_pll_test";

	modules = {"wr_vic.ko", "wr_minic.ko"};
};

timing =  {
	pps_width = 100000; -- PPS pulse width
	use_external_clock = 0;
};

ports = {

	wru0 = {
		phy_rx_bias = 5600;      	-- phase measurement at which the phy delay is minimal
		phy_rx_min = 20 * 800 - 3900;   	-- minimal RX latency introduced by the PHY (in picoseconds)
														 	-- for TLK1221 it's 20 UI of 0.8 ns each
														 	
		phy_rx_range = 7 * 800;		-- maximal range of RX latency nondeterminism (e.g. the difference
															-- between the max and min. RX latency). Say, it's 3 UI.
		

		-- the same parameters for TX path
		
		phy_tx_bias = 3800;
		phy_tx_min = 20 * 800;
		phy_tx_range = 3 * 800;
		
		mac_addr = "auto";
		mode = "wr_master";	
},

	wru1 = {
		phy_rx_bias = 5600;      	-- phase measurement at which the phy delay is minimal
		phy_rx_min = 20 * 800 - 3900;   	-- minimal RX latency introduced by the PHY (in picoseconds)
														 	-- for TLK1221 it's 20 UI of 0.8 ns each
														 	
		phy_rx_range = 7 * 800;		-- maximal range of RX latency nondeterminism (e.g. the difference
															-- between the max and min. RX latency). Say, it's 3 UI.
		

		-- the same parameters for TX path
		
		phy_tx_bias = 3800;
		phy_tx_min = 20 * 800;
		phy_tx_range = 3 * 800;

		
		mac_addr = "auto";
		mode = "wr_slave";
	},

	wrd0 = {
		phy_rx_bias = 0;
		phy_rx_min = 0;
		phy_rx_max = 0;
		
		phy_tx_bias = 0;
		phy_tx_min = 0;
		phy_tx_max = 0;
		
		mac_addr = "auto";
		mode = "non_wr";
	},

	wrd1 = {
		phy_rx_bias = 0;
		phy_rx_min = 0;
		phy_rx_max = 0;
		
		phy_tx_bias = 0;
		phy_tx_min = 0;
		phy_tx_max = 0;
		
		mac_addr = "auto";
		mode = "non_wr";
	},
	
	
	wrd2 = {
		phy_rx_bias = 0;
		phy_rx_min = 0;
		phy_rx_max = 0;
		
		phy_tx_bias = 0;
		phy_tx_min = 0;
		phy_tx_max = 0;
		
		mac_addr = "auto";
		mode = "non_wr";
	},
	
	wrd3 = {
		phy_rx_bias = 0;
		phy_rx_min = 0;
		phy_rx_max = 0;
		
		phy_tx_bias = 0;
		phy_tx_min = 0;
		phy_tx_max = 0;
		
		mac_addr = "auto";
		mode = "non_wr";
	},
	
	
	wrd4 = {
		phy_rx_bias = 0;
		phy_rx_min = 0;
		phy_rx_max = 0;
		
		phy_tx_bias = 0;
		phy_tx_min = 0;
		phy_tx_max = 0;
		
		mac_addr = "auto";
		mode = "non_wr";
	},
	
	wrd5 = {
		phy_rx_bias = 0;
		phy_rx_min = 0;
		phy_rx_max = 0;
		
		phy_tx_bias = 0;
		phy_tx_min = 0;
		phy_tx_max = 0;
		
		mac_addr = "auto";
		mode = "non_wr";
	},
	

	wrd6 = {
		phy_rx_bias = 0;
		phy_rx_min = 0;
		phy_rx_max = 0;
		
		phy_tx_bias = 0;
		phy_tx_min = 0;
		phy_tx_max = 0;
		
		mac_addr = "auto";
		mode = "non_wr";
	},
	
	wrd7 = {
		phy_rx_bias = 0;
		phy_rx_min = 0;
		phy_rx_max = 0;
		
		phy_tx_bias = 0;
		phy_tx_min = 0;
		phy_tx_max = 0;
		
		mac_addr = "auto";
		mode = "non_wr";
	}	



}

-- fixme: nicer detection of grandmaster mode
--f=io.popen("ip -o address | grep 192.168.1.6");
--if(f:read("*l") ~= nil) then
--	timing.use_external_clock = 1;
--end
--f:close()
