[Armadeus-commitlog] SF.net SVN: armadeus:[1145] trunk/target/test/test_gpio.sh
Brought to you by:
sszy
|
From: <ar...@us...> - 2009-03-11 14:49:11
|
Revision: 1145
http://armadeus.svn.sourceforge.net/armadeus/?rev=1145&view=rev
Author: artemys
Date: 2009-03-11 14:49:03 +0000 (Wed, 11 Mar 2009)
Log Message:
-----------
[TEST] Add script (very basic) to test gpio driver
Added Paths:
-----------
trunk/target/test/test_gpio.sh
Added: trunk/target/test/test_gpio.sh
===================================================================
--- trunk/target/test/test_gpio.sh (rev 0)
+++ trunk/target/test/test_gpio.sh 2009-03-11 14:49:03 UTC (rev 1145)
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+#
+# Script to test Armadeus Software release
+#
+# Copyright (C) 2008-2009 The Armadeus Project
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+
+source ./test_helpers.sh
+source ./test_env.sh
+
+GPIO_DEV_DIR=/dev/gpio
+GPIO_PROC_DIR=/proc/driver/gpio
+
+blink_led_apf27()
+{
+ cat $GPIO_PROC_DIR/portFdir | sed "s/[0-1]\([0-1]\{14\}\)$/1\1/" > $GPIO_PROC_DIR/portFdir
+ for i in `seq 0 5`; do
+ echo -ne "\x01" > /dev/gpio/PF14
+ usleep 500000
+ echo -ne "\x00" > /dev/gpio/PF14
+ usleep 500000
+ done
+}
+
+blink_led_apf9328()
+{
+ cat $GPIO_PROC_DIR/portDdir | sed "s/[0-1]\([0-1]\{31\}\)$/1\1/" > $GPIO_PROC_DIR/portDdir
+ for i in `seq 0 5`; do
+ echo -ne "\x00" > $GPIO_DEV_DIR/PD31
+ usleep 500000
+ echo -ne "\x01" > $GPIO_DEV_DIR/PD31
+ usleep 500000
+ done
+}
+
+test_led_gpio()
+{
+ show_test_banner "GPIO (LED)"
+
+ loadgpio.sh
+ if [ "$?" != 0 ] || [ ! -c "$GPIO_DEV_DIR/portA" ] ; then
+ echo "Module failed to load"
+ exit_failed
+ fi
+
+ BOARD=`cat /etc/machine`
+ if [ "$BOARD" == "APF9328" ]; then
+ blink_led_apf9328
+ fi
+ if [ "$BOARD" == "APF27" ]; then
+ blink_led_apf27
+ fi
+
+ ask_user "Did you see a LED blinking ? (y/n)"
+ if [ "$response" != "y" ]; then
+ exit_failed
+ fi
+ echo_test_ok
+ exit 0
+}
+
+test_led_gpio
Property changes on: trunk/target/test/test_gpio.sh
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|