[Armadeus-commitlog] SF.net SVN: armadeus:[1331] trunk
Brought to you by:
sszy
|
From: <ar...@us...> - 2009-06-05 20:16:30
|
Revision: 1331
http://armadeus.svn.sourceforge.net/armadeus/?rev=1331&view=rev
Author: artemys
Date: 2009-06-05 20:14:27 +0000 (Fri, 05 Jun 2009)
Log Message:
-----------
[TEST] Cleanup testbutton tool and makes it available for test config
Modified Paths:
--------------
trunk/buildroot/package/armadeus-testsuite/armadeus-tests.mk
trunk/target/linux/modules/fpga/wishbone_example/wb_button/Makefile
trunk/target/linux/modules/fpga/wishbone_example/wb_button/testbutton.c
Modified: trunk/buildroot/package/armadeus-testsuite/armadeus-tests.mk
===================================================================
--- trunk/buildroot/package/armadeus-testsuite/armadeus-tests.mk 2009-06-04 16:12:59 UTC (rev 1330)
+++ trunk/buildroot/package/armadeus-testsuite/armadeus-tests.mk 2009-06-05 20:14:27 UTC (rev 1331)
@@ -11,6 +11,7 @@
ARMADEUS-TESTSUITE_BINARY:=test_env.sh
ARMADEUS-TESTSUITE_TARGET_DIR:=$(TARGET_DIR)/usr/bin/testsuite
ARMADEUS-TESTSUITE_TARGET_BINARY:=$(ARMADEUS-TESTSUITE_TARGET_DIR)/$(ARMADEUS-TESTSUITE_BINARY)
+ARMADEUS-TESTSUITE_WISHBONE_BUTTON_DIR:=$(BUILD_DIR)/../../target/linux/modules/fpga/wishbone_example/wb_button/
$(ARMADEUS-TESTSUITE_DIR)/.unpacked:
mkdir -p $(ARMADEUS-TESTSUITE_DIR)/
@@ -21,6 +22,8 @@
mkdir -p $(ARMADEUS-TESTSUITE_TARGET_DIR)
find $(ARMADEUS-TESTSUITE_DIR) -name "*.sh" -exec install -D {} $(ARMADEUS-TESTSUITE_TARGET_DIR) \;
cp -r $(ARMADEUS-TESTSUITE_DIR)/data $(ARMADEUS-TESTSUITE_TARGET_DIR)/
+ make -C $(ARMADEUS-TESTSUITE_WISHBONE_BUTTON_DIR) test
+ install -D $(ARMADEUS-TESTSUITE_WISHBONE_BUTTON_DIR)/testbutton $(ARMADEUS-TESTSUITE_TARGET_DIR)
touch $@
armadeus-testsuite: $(ARMADEUS-TESTSUITE_TARGET_BINARY)
Modified: trunk/target/linux/modules/fpga/wishbone_example/wb_button/Makefile
===================================================================
--- trunk/target/linux/modules/fpga/wishbone_example/wb_button/Makefile 2009-06-04 16:12:59 UTC (rev 1330)
+++ trunk/target/linux/modules/fpga/wishbone_example/wb_button/Makefile 2009-06-05 20:14:27 UTC (rev 1331)
@@ -19,8 +19,7 @@
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
test:
- ~/armadeus/buildroot/build_arm/staging_dir/bin/arm-linux-gcc testbutton.c -o testbutton
- chmod 755 testbutton
+ $(ARMADEUS_TOOLCHAIN_PATH)/arm-linux-gcc testbutton.c -o testbutton
clean:
rm -f *.*o \
Modified: trunk/target/linux/modules/fpga/wishbone_example/wb_button/testbutton.c
===================================================================
--- trunk/target/linux/modules/fpga/wishbone_example/wb_button/testbutton.c 2009-06-04 16:12:59 UTC (rev 1330)
+++ trunk/target/linux/modules/fpga/wishbone_example/wb_button/testbutton.c 2009-06-05 20:14:27 UTC (rev 1331)
@@ -1,14 +1,9 @@
-/* a program to test button driver
- * Fabien Marteau <fab...@ar...>
- * 7 april 2008
- * fpgaaccess.h
+/*
+ * A simple program to test Wishbone button driver
*
* (c) Copyright 2008 Armadeus project
* Fabien Marteau <fab...@ar...>
*
- * A simple driver for reading and writing on
- * fpga throught a character file /dev/fpgaaccess
- *
* 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, or (at your option)
@@ -40,45 +35,48 @@
int fbutton;
-void quit(int pouet){
+void quit(int pouet) {
close(fbutton);
exit(0);
}
+void usage(char *exe) {
+ if (exe) {
+ printf("\nUsage:\n");
+ printf("%s <button_device>\n", exe);
+ }
+}
+
int main(int argc, char *argv[])
{
- unsigned short i,j;
+ unsigned short i, j=0;
/* quit when Ctrl-C pressed */
signal(SIGINT, quit);
- j=0;
-
printf( "Testing button driver\n" );
- if(argc < 2){
- perror("invalide arguments number\ntestbutton <button_filename>\n");
+ if (argc < 2) {
+ printf("invalid arguments number\n");
+ usage(argv[0]);
exit(EXIT_FAILURE);
}
- fbutton=open(argv[1],O_RDWR);
- if(fbutton<0){
- perror("can't open file\n");
+ fbutton = open(argv[1], O_RDWR);
+ if (fbutton < 0) {
+ perror("can't open file");
exit(EXIT_FAILURE);
}
- while(1){
- i = (i==0)?1:0;
- fflush(stdout);
-
+ while (1) {
/* read value */
- if(read(fbutton,&j,1)<0){
- perror("read error\n");
+ if (read(fbutton, &j, 1) < 0) {
+ perror("read error");
exit(EXIT_FAILURE);
}
printf("Read %d\n",j);
- if(lseek(fbutton,0,SEEK_SET)<0){
+ if (lseek(fbutton, 0, SEEK_SET) < 0) {
perror("lseek error\n");
exit(EXIT_FAILURE);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|