#!/bin/sh
################################################################################
# testCapture Development test script
# T.Barnabt, BEAM Ltd, 2007-04-28
################################################################################
#
export PATH=../tmsControl:$PATH
host=tms3
#echo "Set BEAM Type"
#tmsControl --cycleType Beam1 ${host}
#tmsControl --cycleType Beam3 ${host}
tmsControl --cycleType SigGenBeam3 ${host}
echo "Set PupeTest mode"
tmsControl --setPupeConfig 1,1,1,0 ${host}
echo "Load test signal"
#tmsControl --setTestData 1,../datasrc/beam1-437000-8.psd ${host}
tmsControl --setTestData 1,../datasrc/beam3-437000-8.psd ${host}
sleep 1
echo "Capture diagnostics data"
# Channel,Source,Clock,startTime,postTriggerDelay,trigAnd,trigStore,trigData,trigMask
# PLL CycleStart Test
#tmsControl --captureDiagnostics 1,0,3,0,2,0,1,0,2 -outFile diag_start_0.txt ${host}
#tmsControl --captureDiagnostics 1,0,0,0,2,0,1,0,2 -kst -outFile diag_start_0.txt ${host}
tmsControl --captureDiagnostics 1,0,0,0,2,0,0,0,2 -kst -outFile diag_start_0.txt ${host}
tmsControl --captureDiagnostics 1,1,3,0,2,0,0,0,2 -kst -outFile diag_start_1.txt ${host}
# PLL Injection Test
tmsControl --captureDiagnostics 1,0,0,0,2,0,1,0,32 -kst -outFile diag_injection_0t.txt ${host}
tmsControl --captureDiagnostics 1,0,0,0,2,0,0,0,32 -kst -outFile diag_injection_0.txt ${host}
tmsControl --captureDiagnostics 1,1,0,0,2,0,0,0,32 -kst -outFile diag_injection_1.txt ${host}
tmsControl --captureDiagnostics 1,2,0,0,2,0,0,0,32 -kst -outFile diag_injection_2.txt ${host}
tmsControl --captureDiagnostics 1,3,0,0,2,0,0,0,32 -kst -outFile diag_injection_3.txt ${host}
# Timing signals test
#tmsControl --captureDiagnostics 1,0,0,0,2,0,1,0,2 -kst -outFile data.txt ${host}
echo "Capture Data"
tmsControl --readData 1,2,0,0,0,1024,0 -kst -outFile data1.txt ${host}
tmsControl --readData 1,2,0,0,0,1024,1 -kst -outFile data2.txt ${host}
################################################################################
# PlotExamples
################################################################################
#
#kst diag_start_0.kst
#kst diag_start_1.kst
#kst diag_injection_0.kst
#kst diag_injection_1.kst
#kst diag_injection_2.kst
#kst diag_injection_3.kst
#kst data1.kst
#kst -F diag_start_0.txt diagSource0.kst
#kst -F diag_start_1.txt diagSource1.kst
#kst -F diag_injection_0.txt diagSource0.kst
#kst -F diag_injection_1.txt diagSource1.kst
#kst -m 1 -y 1 -y 2 -y 3 -y 4 -y 5 -y 6 -y 7 data.txt
################################################################################
# Examples
################################################################################
#
# PLL Test Source 1
#tmsControl --captureDiagnostics 1,1,0,0,2,0,0,0,2 -kst -outFile data.txt ${host}
#tmsControl --captureDiagnostics 1,1,0,0,10000,0,0,0,2 -kst -outFile data.txt ${host}
#tmsControl --captureDiagnostics 1,1,3,0,2,0,0,0,2 -kst -outFile data.txt ${host}
#tmsControl --captureDiagnostics 1,1,3,0,10000,0,0,0,2 -kst -outFile data.txt ${host}
#tmsControl --captureDiagnostics 1,1,3,0,0,0,0,0,32 -kst -outFile data.txt ${host}
#tmsControl --captureDiagnostics 1,1,0,0,0,0,0,0,32 -kst -outFile data.txt ${host}
#tmsControl --captureDiagnostics 1,1,0,0,10000,0,0,0,32 -kst -outFile data.txt ${host}
#tmsControl --captureDiagnostics 1,1,0,0,20000,0,0,0,32 -kst -outFile data.txt ${host}
#tmsControl --captureDiagnostics 1,1,3,0,2,0,0,0,2 -kst -outFile data1.txt ${host}
#tmsControl --captureDiagnostics 1,1,3,0,10000,0,0,0,2 -kst -outFile data2.txt ${host}
#tmsControl --captureDiagnostics 1,1,3,0,0,0,0,0,32 -kst -outFile data3.txt ${host}
#tmsControl --captureDiagnostics 1,1,3,0,20000,0,0,0,32 -kst -outFile data4.txt ${host}
# Current tests 0
#tmsControl --captureDiagnostics 1,0,0,0,2,0,1,0,32 -kst -outFile data.txt ${host}
#tmsControl --captureDiagnostics 1,2,0,0,2,0,1,0,32 -kst -outFile data.txt ${host}
# Current tests 1
#tmsControl --captureDiagnostics 1,0,0,0,0,0,1,0,2 -kst -outFile data.txt ${host}
#tmsControl --captureDiagnostics 1,0,0,0,0,0,1,0,32 -kst -outFile data.txt ${host}
#tmsControl --captureDiagnostics 1,1,0,0,2,0,0,0,32 -kst -outFile data.txt ${host}
#tmsControl --captureDiagnostics 1,1,0,0,10000,0,0,0,32 -kst -outFile data.txt ${host}
#tmsControl --captureDiagnostics 1,2,0,0,0,0,0,0,32 -kst -outFile data2.txt ${host}
# PLL Test After Injection
#tmsControl --captureDiagnostics 1,0,2,0,2,0,1,0,32 -outFile data.txt ${host}
#tmsControl --captureDiagnostics 1,0,3,0,2,0,1,0,32 -outFile data.txt ${host}
#tmsControl --captureDiagnostics 1,0,4,0,2,0,1,0,2 -outFile data.txt ${host}
#tmsControl --captureDiagnostics 1,0,5,0,2,0,1,0,2 -outFile data.txt ${host}
if false; then
tmsControl --captureDiagnostics 1,0,0,0,2,0,1,0,2 -outFile data1.txt ${host}
tmsControl --captureDiagnostics 1,0,0,0,1024,0,1,0,2 -outFile data2.txt ${host}
tmsControl --captureDiagnostics 1,0,0,0,2048,0,1,0,2 -outFile data3.txt ${host}
tmsControl --captureDiagnostics 1,0,0,0,3072,0,1,0,2 -outFile data4.txt ${host}
cat data1.txt data2.txt data3.txt data4.txt > data.txt
fi