jig: sync with nearly-final version
This is nearly the final version of the factory test jig. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
		@@ -1,13 +1,17 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
 | 
			
		||||
green_led=11
 | 
			
		||||
yellow_led=9
 | 
			
		||||
red_led=10
 | 
			
		||||
led_1=19
 | 
			
		||||
led_2=13
 | 
			
		||||
led_3=6
 | 
			
		||||
led_4=5
 | 
			
		||||
led_5=0
 | 
			
		||||
 | 
			
		||||
all_off() {
 | 
			
		||||
	gpio -g write ${green_led} 0
 | 
			
		||||
	gpio -g write ${yellow_led} 0
 | 
			
		||||
	gpio -g write ${red_led} 0
 | 
			
		||||
	gpio -g write ${led_1} 0
 | 
			
		||||
	gpio -g write ${led_2} 0
 | 
			
		||||
	gpio -g write ${led_3} 0
 | 
			
		||||
	gpio -g write ${led_4} 0
 | 
			
		||||
	gpio -g write ${led_5} 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
green_on() {
 | 
			
		||||
@@ -29,11 +33,49 @@ red_also_on() {
 | 
			
		||||
	gpio -g write ${red_led} 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
led_on() {
 | 
			
		||||
	case $1 in
 | 
			
		||||
	1) gpio -g write ${led_1} on ;;
 | 
			
		||||
	2) gpio -g write ${led_2} on ;;
 | 
			
		||||
	3) gpio -g write ${led_3} on ;;
 | 
			
		||||
	4) gpio -g write ${led_4} on ;;
 | 
			
		||||
	5) gpio -g write ${led_5} on ;;
 | 
			
		||||
	esac
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
led_off() {
 | 
			
		||||
	case $1 in
 | 
			
		||||
	1) gpio -g write ${led_1} off ;;
 | 
			
		||||
	2) gpio -g write ${led_2} off ;;
 | 
			
		||||
	3) gpio -g write ${led_3} off ;;
 | 
			
		||||
	4) gpio -g write ${led_4} off ;;
 | 
			
		||||
	5) gpio -g write ${led_5} off ;;
 | 
			
		||||
	esac
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
gpio_setup() {
 | 
			
		||||
	gpio -g mode ${green_led} out
 | 
			
		||||
	gpio -g mode ${yellow_led} out
 | 
			
		||||
	gpio -g mode ${red_led} out
 | 
			
		||||
	green_on
 | 
			
		||||
	gpio -g mode ${led_1} out
 | 
			
		||||
	gpio -g mode ${led_2} out
 | 
			
		||||
	gpio -g mode ${led_3} out
 | 
			
		||||
	gpio -g mode ${led_4} out
 | 
			
		||||
	gpio -g mode ${led_5} out
 | 
			
		||||
	all_off
 | 
			
		||||
	led_on 5
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fail_test() {
 | 
			
		||||
	case $1 in
 | 
			
		||||
	load-tester-bitstream) ;;
 | 
			
		||||
	run-all-tests)          led_on 2 ;;
 | 
			
		||||
	validate-spi)                      led_on 3 ; led_on 4 ;;
 | 
			
		||||
	test-spi)                          led_on 3 ;;
 | 
			
		||||
	test-rgbg)              led_on 2 ; led_on 3 ;;
 | 
			
		||||
	test-rgbb)              led_on 2 ; led_on 3 ;;
 | 
			
		||||
	test-rgbr)              led_on 2 ; led_on 3 ;;
 | 
			
		||||
	test-touch)                        led_on 3 ; led_on 4 ;;
 | 
			
		||||
	load-final-bitstream)                         led_on 4 ;;
 | 
			
		||||
	verify-final-bitstream)                       led_on 4 ;;
 | 
			
		||||
	esac
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
gpio_setup
 | 
			
		||||
@@ -43,21 +85,29 @@ while read line
 | 
			
		||||
do
 | 
			
		||||
	if echo "${line}" | grep -iq '^start'
 | 
			
		||||
	then
 | 
			
		||||
		yellow_on
 | 
			
		||||
		all_off
 | 
			
		||||
		failures=0
 | 
			
		||||
	elif echo "${line}" | grep -iq '^fail'
 | 
			
		||||
	then
 | 
			
		||||
		red_also_on
 | 
			
		||||
		if [ $failures -ne 1 ]
 | 
			
		||||
		then
 | 
			
		||||
			failures=1
 | 
			
		||||
			fail_test $(echo "${line}" | awk '{print $2}')
 | 
			
		||||
		fi
 | 
			
		||||
		led_on 1
 | 
			
		||||
	elif echo "${line}" | grep -iq '^finish'
 | 
			
		||||
	then
 | 
			
		||||
		led_on 5
 | 
			
		||||
		result=$(echo ${line} | awk '{print $3}')
 | 
			
		||||
		if [ ${result} -ge 200 -a ${result} -lt 300 ]
 | 
			
		||||
		then
 | 
			
		||||
			green_on
 | 
			
		||||
			led_on 5
 | 
			
		||||
		else
 | 
			
		||||
			red_on
 | 
			
		||||
			led_on 1
 | 
			
		||||
		fi
 | 
			
		||||
	elif echo "${line}" | grep -iq '^exit'
 | 
			
		||||
	then
 | 
			
		||||
		all_off
 | 
			
		||||
		exit 0
 | 
			
		||||
	fi
 | 
			
		||||
done
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										41
									
								
								jig/bin/validate-spi.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								jig/bin/validate-spi.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,41 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
 | 
			
		||||
infofile=/tmp/spi-info.txt
 | 
			
		||||
rm -f $infofile
 | 
			
		||||
fomu-flash -i | tee $infofile
 | 
			
		||||
 | 
			
		||||
# Manufacturer ID: Macronix (c2)
 | 
			
		||||
# Memory model: MX25R1635F (28)
 | 
			
		||||
# Memory size: 16 Mbit (15)
 | 
			
		||||
# Device ID: 15
 | 
			
		||||
 | 
			
		||||
error_count=0
 | 
			
		||||
if ! grep -q 'Manufacturer ID: Macronix (c2)' $infofile
 | 
			
		||||
then
 | 
			
		||||
	echo -n "Unrecognized SPI manufacturer: "
 | 
			
		||||
	grep 'Manufacturer ID: ' $infofile
 | 
			
		||||
	error_count=$(($error_count+1))
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if ! grep -q 'Memory model: MX25R1635F (28)' $infofile
 | 
			
		||||
then
 | 
			
		||||
	echo -n "Unrecognized memory model: "
 | 
			
		||||
	grep 'Memory model: ' $infofile
 | 
			
		||||
	error_count=$(($error_count+1))
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if ! grep -q 'Memory size: 16 Mbit (15)' $infofile
 | 
			
		||||
then
 | 
			
		||||
	echo -n "Unrecognized memory size: "
 | 
			
		||||
	grep 'Memory size: ' $infofile
 | 
			
		||||
	error_count=$(($error_count+1))
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if ! grep -q 'Device ID: 15' $infofile
 | 
			
		||||
then
 | 
			
		||||
	echo -n "Unrecognized device id: "
 | 
			
		||||
	grep 'Device ID: ' $infofile
 | 
			
		||||
	error_count=$(($error_count+1))
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
exit $error_count
 | 
			
		||||
		Reference in New Issue
	
	Block a user