#!/bin/sh
## Testing QDRII, PLL, and GPIOs
##
##	This test stress the QDRII at maximum, and start monitoring the 
##	different temperature sensor.
##	
##
##	Future Improvements:
##	- There are no communications between the FPGA and CPU
##	- The test should be divided in first a QDRII check, then a temperature stress
#
##
##
## Authors: 
##	- Benoit Rat (Seven Solutions, www.sevensols.com)
##
## GNU Lesser General Public License Usage
## This file may be used under the terms of the GNU Lesser
## General Public License version 2.1 as published by the Free Software
## Foundation and appearing in the file LICENSE.LGPL included in the
## packaging of this file.  Please review the following information to
## ensure the GNU Lesser General Public License version 2.1 requirements
## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
#######################################################################################################

printf "======: $0\n"
. 000-functions.sh


#First loading the correct firmwares:
load-virtex ${APTS_SWITCH_DIR}/bin/fpga_qdr2temp.bit

#Setting the fan at 70%
${APTS_SWITCH_DIR}/bin/shw_tool --fan 60

timeout=10 #Timeout before reading


printf "FPGA QDRII stress and temperature monitoring (${timeout}s): "
i=0
while [ $i -lt $timeout ]; do
	printf "."
	sleep 1
	i=`expr $i + 1`
done
echo ""


user_echoasking "y/n" "Do you see the 3 + 1 last LEDs on the miniBP?" "LED QDRII"
ret0=-$?
if [ $ans == "n" ]; then
	user_echoasking "bin" "LED pattern?" "LED patterm QDRII"
fi;	

exit_multierr $ret0 
