#!/usr/bin/env python2
################################################################################
#	TmsTestSetup.py		Sets up the TMS system to use simulated inputs
################################################################################
#
import sys
import os
import os.path
			
def init(host):
	numChannels = 14 * 3;
	
#	os.system("tmsControl --init " + host);

	# Set the TMS Cycle type for the input signal
	print "Set Cycle type"
	os.system("../tmsControl/tmsControl --cycleType SimBeam3 " + host);

	# Set up the digital test inputs
	for c in range(1, numChannels+1):
		print "Set Internal digital timing inputs for Channel: " + str(c)
		os.system("../tmsControl/tmsControl --setPupeConfig " + str(c) + ",0,0x7F,0 " + host);
#		os.system("../tmsControl/tmsControl --setPupeConfig " + str(c) + ",0,0x7D,0 " + host);
	
	# Set all channels to use internal test signal	
	for c in range(1, numChannels+1):
		print "Set Internal test signal for Channel: " + str(c)
		os.system("../tmsControl/tmsControl --setTestData " + str(c) + ",/usr/tms/data/beam3-437000-8.psd " + host);

			
def main():
	host = "tms1";
	
	init(host);

if __name__ =="__main__":
	main();
