[Armadeus-commitlog] SF.net SVN: armadeus:[1264] trunk/target/test/test_adc.sh
Brought to you by:
sszy
|
From: <ar...@us...> - 2009-05-07 15:12:39
|
Revision: 1264
http://armadeus.svn.sourceforge.net/armadeus/?rev=1264&view=rev
Author: artemys
Date: 2009-05-07 15:12:28 +0000 (Thu, 07 May 2009)
Log Message:
-----------
[TEST] Updates ADC test for APF27 & fast mode
Modified Paths:
--------------
trunk/target/test/test_adc.sh
Modified: trunk/target/test/test_adc.sh
===================================================================
--- trunk/target/test/test_adc.sh 2009-05-07 15:07:21 UTC (rev 1263)
+++ trunk/target/test/test_adc.sh 2009-05-07 15:12:28 UTC (rev 1264)
@@ -15,24 +15,49 @@
source ./test_env.sh
+test_setup_apf9328()
+{
+ echo "I hope you didn't forget to wire EOC and CVNST !"
+ ADC_SPI_SYS="/sys/bus/spi/devices/spi1.0"
+}
+
+test_setup_apf27()
+{
+ ADC_SPI_SYS="/sys/bus/spi/devices/spi0.0"
+}
+
test_ADC()
{
show_test_banner "ADC"
modprobe max1027
if [ "$?" == 0 ]; then
+ execute_for_target test_setup_apf9328 test_setup_apf27
# Slow mode
- let set=0x62; echo $set > /sys/bus/spi/devices/spi1.0/setup
+ let set=0x62; echo $set > $ADC_SPI_SYS/setup
+ let conv=0xf9; echo $conv > $ADC_SPI_SYS/conversion
echo "WAIT" > /dev/null
- let conv=0xf9; echo $conv > /sys/bus/spi/devices/spi1.0/conversion
- echo "WAIT" > /dev/null
- temp=`cat /sys/bus/spi/devices/spi1.0/temp1_input`
- if [ "$temp" != "0" ]; then
+ temp=`cat $ADC_SPI_SYS/temp1_input`
+ AIN0=`cat $ADC_SPI_SYS/in0_input`
+ if [ "$temp" != "0" ] && [ "$AIN0" != "0" ]; then
echo "Temp: $temp m°C"
- echo_test_ok
+ echo "AIN0: $AIN0"
else
exit_failed
fi
+ # Fast mode
+ loadmax.sh
+ let set=0xb1; echo $set > $ADC_SPI_SYS/conversion
+ sleep 1
+ let set=0x48; echo $set > $ADC_SPI_SYS/setup
+ let set=0x20; echo $set > $ADC_SPI_SYS/averaging
+ echo "Reading in fast mode:"
+ dd if=/dev/max1027/AIN0 bs=2 count=10 | hexdump
+ if [ "$?" == 0 ]; then
+ echo_test_ok
+ else
+ exit_failed
+ fi
else
echo "Hardware not found !"
fi
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|