summaryrefslogtreecommitdiff
path: root/cleopatre
diff options
context:
space:
mode:
Diffstat (limited to 'cleopatre')
-rw-r--r--cleopatre/application/afe/Makefile10
-rw-r--r--cleopatre/application/afe/afe.c121
-rw-r--r--cleopatre/buildroot/package/Config.in4
-rw-r--r--cleopatre/buildroot/package/afe/Config.in6
-rw-r--r--cleopatre/buildroot/package/afe/afe.mk64
-rw-r--r--cleopatre/buildroot/target/device/Spidcom/arizona/Makefile.in4
-rw-r--r--cleopatre/buildroot/target/device/Spidcom/arizona_defconfig1
7 files changed, 208 insertions, 2 deletions
diff --git a/cleopatre/application/afe/Makefile b/cleopatre/application/afe/Makefile
new file mode 100644
index 0000000000..a8b1b496a5
--- /dev/null
+++ b/cleopatre/application/afe/Makefile
@@ -0,0 +1,10 @@
+EXTRA_CFLAGS= -I$(LINUX_DIR)/include -g -Os
+CC_WITH_CFLAGS=$(CC)
+CC_WITHOUT_CFLAGS=$(CC_FOR_TARGET)
+
+all:
+ $(CC_WITH_CFLAGS) $(EXTRA_CFLAGS) -c -o afe.o afe.c
+ $(CC_WITHOUT_CFLAGS) -o afe afe.o
+
+clean:
+ rm -f afe afe.o
diff --git a/cleopatre/application/afe/afe.c b/cleopatre/application/afe/afe.c
new file mode 100644
index 0000000000..7c99159c16
--- /dev/null
+++ b/cleopatre/application/afe/afe.c
@@ -0,0 +1,121 @@
+/* Cleopatre project {{{
+ *
+ * Copyright (C) 2009 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file afe.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+
+#include "linux/afe.h"
+
+enum modeinfo {
+ READ=0,
+ WRITE
+};
+
+struct init_info {
+ enum modeinfo mode;
+ unsigned int reg;
+ unsigned int val;
+};
+
+static void help(char *file)
+{
+ printf("Usage: %s R/W reg [val]\n",file);
+ printf("R/W read or write in a register.\n");
+ printf("reg register offset.\n");
+ printf("val value to write in a register.\n");
+}
+
+static int parse_args(struct init_info *init, int argc, const char **argv)
+{
+ int i;
+ int result = 0;
+
+ if(argc<3 && argc>4)
+ {
+ help((char*)basename(argv[0]));
+ return -1;
+ }
+
+ if(!strcmp(argv[1],"R"))
+ {
+ init->mode = READ;
+ init->reg = (unsigned int)strtoul(argv[2],NULL,0);
+ }
+ else if (!strcmp(argv[1],"W"))
+ {
+ init->mode = WRITE;
+ init->reg = (unsigned int)strtoul(argv[2],NULL,0);
+ init->val = (unsigned int)strtoul(argv[3],NULL,0);
+ }
+ else
+ {
+ help((char*)basename(argv[0]));
+ return -1;
+ }
+ return result;
+}
+
+int main(int argc, const char **argv)
+{
+ int fd;
+ struct init_info init;
+ struct afe_info cmd;
+
+ if(parse_args(&init, argc, argv))
+ return 0;
+
+ //Open AFE device
+ if((fd=open("/dev/afe",O_RDWR))<0)
+ {
+ fprintf(stderr,"Unable to open AFE device.\n");
+ return -1;
+ }
+
+ //Store init information
+ cmd.reg = init.reg;
+ cmd.val = init.val;
+
+ // Send command trough ioctl channel
+ if(init.mode == WRITE)
+ {
+ if(ioctl(fd, AFEIOC_SETREG, (unsigned long*)&cmd) < 0)
+ {
+ printf("Shell Error: ioctl SET Error\n");
+ return -1;
+ }
+ printf("Write: 0x%x=0x%x\n", cmd.reg, cmd.val);
+ }
+ else
+ {
+ if(ioctl(fd, AFEIOC_GETREG, (unsigned long*)&cmd) < 0)
+ {
+ printf("Shell Error: ioctl GET Error\n");
+ return -1;
+ }
+ printf("Read: 0x%x=0x%x\n", cmd.reg, cmd.val);
+ }
+
+
+ //Close AFE device
+ if(close(fd) < 0)
+ {
+ printf("Shell Error: close error\n");
+ return -1;
+ }
+ return 0;
+}
+
diff --git a/cleopatre/buildroot/package/Config.in b/cleopatre/buildroot/package/Config.in
index 1a218db549..1d9a0d4336 100644
--- a/cleopatre/buildroot/package/Config.in
+++ b/cleopatre/buildroot/package/Config.in
@@ -493,4 +493,8 @@ source "package/magiccube4d/Config.in"
source "package/vice/Config.in"
endif
+if BR2_TARGET_SPIDCOM
+source "package/afe/Config.in"
+endif
+
endmenu
diff --git a/cleopatre/buildroot/package/afe/Config.in b/cleopatre/buildroot/package/afe/Config.in
new file mode 100644
index 0000000000..6a6dc1d220
--- /dev/null
+++ b/cleopatre/buildroot/package/afe/Config.in
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_AFE
+ bool "afe"
+ help
+ Analog Frond End configuration under SPC300 board.
+
+ http://www.spidcom.com
diff --git a/cleopatre/buildroot/package/afe/afe.mk b/cleopatre/buildroot/package/afe/afe.mk
new file mode 100644
index 0000000000..3f87025ee4
--- /dev/null
+++ b/cleopatre/buildroot/package/afe/afe.mk
@@ -0,0 +1,64 @@
+#############################################################
+#
+# afe (provides Analog Front End configuration application)
+# (works only under SPiDCOM SPC300 board)
+#
+#############################################################
+# Copyright (C) 2009 by SPiDCOM technologies
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Library General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
+#
+
+AFE_VERSION:=0.0.1
+AFE_SITE:=$(BASE_DIR)/../application/afe
+AFE_NAME:=afe-$(AFE_VERSION)
+AFE_DIR:=$(BUILD_DIR)/afe-$(AFE_VERSION)
+
+afe-source:
+
+$(AFE_DIR)/.unpacked:
+ @echo "UNPACKED"
+ ln -s $(AFE_SITE) $(AFE_DIR)
+ touch $(AFE_DIR)/.unpacked
+
+$(AFE_DIR)/.configured: $(AFE_DIR)/.unpacked
+ @echo "CONFIGURED"
+ touch $(AFE_DIR)/.configured
+
+$(AFE_DIR)/afe: $(AFE_DIR)/.configured
+ @echo "AFE"
+ (cd $(AFE_DIR); $(TARGET_CONFIGURE_OPTS) $(MAKE) LINUX_DIR="$(BASE_DIR)/../linux-2.6.25.10-spc300")
+
+$(TARGET_DIR)/usr/bin/afe: $(AFE_DIR)/afe
+ @echo "ROOTFS AFE"
+ cp $(AFE_DIR)/afe $(TARGET_DIR)/usr/bin/afe
+
+afe: uclibc $(TARGET_DIR)/usr/bin/afe
+
+afe-clean:
+ rm -f $(TARGET_DIR)/usr/bin/afe
+ -$(MAKE) -C $(AFE_DIR) clean
+
+afe-dirclean:
+ rm -f $(AFE_DIR)
+#############################################################
+#
+# Toplevel Makefile options
+#
+#############################################################
+ifeq ($(strip $(BR2_PACKAGE_AFE)),y)
+TARGETS+=afe
+endif
diff --git a/cleopatre/buildroot/target/device/Spidcom/arizona/Makefile.in b/cleopatre/buildroot/target/device/Spidcom/arizona/Makefile.in
index ca7eb06f1e..198508df59 100644
--- a/cleopatre/buildroot/target/device/Spidcom/arizona/Makefile.in
+++ b/cleopatre/buildroot/target/device/Spidcom/arizona/Makefile.in
@@ -10,8 +10,8 @@ ifeq ($(strip $(BR2_PACKAGE_LINUX)),y)
TARGETS+=linux26
#include target/device/Spidcom/arizona/linux.mk
LINUX26_KCONFIG=$(BOARD_PATH)/linux26.config
-#LINUX26_FORMAT=uImage
-LINUX26_FORMAT=sImage
+LINUX26_FORMAT=uImage
+#LINUX26_FORMAT=sImage
endif
diff --git a/cleopatre/buildroot/target/device/Spidcom/arizona_defconfig b/cleopatre/buildroot/target/device/Spidcom/arizona_defconfig
index 3f0daa235a..98b6d805c7 100644
--- a/cleopatre/buildroot/target/device/Spidcom/arizona_defconfig
+++ b/cleopatre/buildroot/target/device/Spidcom/arizona_defconfig
@@ -619,6 +619,7 @@ BR2_GAMES=y
# BR2_PACKAGE_RUBIX is not set
# BR2_PACKAGE_MAGICCUBE4D is not set
# BR2_PACKAGE_VICE is not set
+BR2_PACKAGE_AFE=y
#
# Target filesystem options