[Armadeus-commitlog] armadeus branch, master, updated. latestrelease-65-g83b7997
Brought to you by:
sszy
|
From: Julien B a. A. <ar...@us...> - 2009-09-16 15:56:01
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "armadeus".
The branch, master has been updated
via 83b7997a3a955c02f1d9a46c331b4f38da349fe2 (commit)
from 8f575258eecd6d7bae17f0435cb5fa68b0de4829 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 83b7997a3a955c02f1d9a46c331b4f38da349fe2
Author: Julien Boibessot <jul...@ar...>
Date: Wed Sep 16 15:39:51 2009 +0200
[TEST] Simplify GPIO test
-----------------------------------------------------------------------
Summary of changes:
target/linux/modules/gpio/loadgpio.sh | 7 ++++-
target/test/test_gpio.sh | 51 +++++++++++++++++++++++++++------
2 files changed, 48 insertions(+), 10 deletions(-)
diff --git a/target/linux/modules/gpio/loadgpio.sh b/target/linux/modules/gpio/loadgpio.sh
index 16e98c6..7ef3574 100755
--- a/target/linux/modules/gpio/loadgpio.sh
+++ b/target/linux/modules/gpio/loadgpio.sh
@@ -18,10 +18,15 @@ GPIO_MAJOR=`cat /proc/devices | grep GPIO | cut -d " " -f 1`
PPDEV_MAJOR=`cat /proc/devices | grep ppdev | cut -d " " -f 1`
if [ "$GPIO_MAJOR" == "" ]; then
- echo "GPIO module not loaded, exiting"
+ echo "GPIO module failed to load, exiting..."
exit 1
fi
+if [ -d "$GPIO_DEV_DIR" ]; then
+ echo $GPIO_DEV_DIR"xxx devices already created, skipping..."
+ exit 0
+fi
+
mkdir -p $GPIO_DEV_DIR
# For PPDEV
diff --git a/target/test/test_gpio.sh b/target/test/test_gpio.sh
index e2e54e8..2b55433 100755
--- a/target/test/test_gpio.sh
+++ b/target/test/test_gpio.sh
@@ -17,26 +17,59 @@ source ./test_env.sh
GPIO_DEV_DIR=/dev/gpio
GPIO_PROC_DIR=/proc/driver/gpio
+
+setbit()
+{
+ PORT=$1
+ NB=$2
+ VAL=$3
+ cat $PORT | sed "s/[0-1]\([0-1]\{$NB\}\)$/$VAL\1/" > $PORT
+}
+
+gpio_set_value()
+{
+ GPIO=$1
+ VALUE=$2
+ if [ "$VALUE" == "1" ]; then
+ echo -ne "\x01" > $GPIO_DEV_DIR/$GPIO
+ else
+ echo -ne "\x00" > $GPIO_DEV_DIR/$GPIO
+ fi
+}
+
+# Sets $1 as GPIO; $2 == 1 -> outpout, 0 -> input
+gpio_mode()
+{
+ GPIO=`echo $1 | cut -c 3-4`
+ VALUE=$2
+ PORT=`echo $1 | cut -c 2`
+ PORT_DIR="/proc/driver/gpio/port"$PORT"dir"
+ PORT_MODE="/proc/driver/gpio/port"$PORT"mode"
+
+ setbit $PORT_MODE $GPIO 1
+ setbit $PORT_DIR $GPIO $VALUE
+}
+
blink_led_apf27()
{
- cat $GPIO_PROC_DIR/portFmode | sed "s/[0-1]\([0-1]\{14\}\)$/1\1/" > $GPIO_PROC_DIR/portFmode
- cat $GPIO_PROC_DIR/portFdir | sed "s/[0-1]\([0-1]\{14\}\)$/1\1/" > $GPIO_PROC_DIR/portFdir
+ LED_NAME="D14"
+ gpio_mode PF14 1
for i in `seq 0 5`; do
- echo -ne "\x01" > /dev/gpio/PF14
+ gpio_set_value PF14 0
usleep 500000
- echo -ne "\x00" > /dev/gpio/PF14
+ gpio_set_value PF14 1
usleep 500000
done
}
blink_led_apf9328()
{
- cat $GPIO_PROC_DIR/portDmode | sed "s/[0-1]\([0-1]\{31\}\)$/1\1/" > $GPIO_PROC_DIR/portDmode
- cat $GPIO_PROC_DIR/portDdir | sed "s/[0-1]\([0-1]\{31\}\)$/1\1/" > $GPIO_PROC_DIR/portDdir
+ LED_NAME="a"
+ gpio_mode PD31 1
for i in `seq 0 5`; do
- echo -ne "\x00" > $GPIO_DEV_DIR/PD31
+ gpio_set_value PD31 1
usleep 500000
- echo -ne "\x01" > $GPIO_DEV_DIR/PD31
+ gpio_set_value PD31 0
usleep 500000
done
}
@@ -53,7 +86,7 @@ test_led_gpio()
execute_for_target blink_led_apf9328 blink_led_apf27
- ask_user "Did you see a LED blinking ? (y/n)"
+ ask_user "Did you see "$LED_NAME" LED blinking ? (y/n)"
if [ "$response" != "y" ]; then
exit_failed
fi
hooks/post-receive
--
armadeus
|