summaryrefslogtreecommitdiff
path: root/io/bin
diff options
context:
space:
mode:
authorManuel Traut <manut@mecka.net>2012-06-07 13:52:08 +0200
committerManuel Traut <manut@mecka.net>2012-06-07 13:52:08 +0200
commit986a4e78ce5461dc0ada66169bb9111fb0346c46 (patch)
treeff2c7cf1740688313547190fa7626e4543483538 /io/bin
parente84faa1a220ebdcf79a3d95e539dfc8d86a8c460 (diff)
cleanup project structure
move some subprojects fixup makefiles Signed-off-by: Manuel Traut <manut@mecka.net>
Diffstat (limited to 'io/bin')
-rw-r--r--io/bin/Makefile12
-rw-r--r--io/bin/generic_gpio/Makefile39
-rw-r--r--io/bin/generic_gpio/generic_gpio.cpp45
-rwxr-xr-xio/bin/generic_gpio/run.sh9
4 files changed, 105 insertions, 0 deletions
diff --git a/io/bin/Makefile b/io/bin/Makefile
new file mode 100644
index 0000000..0b74f55
--- /dev/null
+++ b/io/bin/Makefile
@@ -0,0 +1,12 @@
+MAKE_DIRECTORIES = generic_gpio
+
+.PHONY: all
+idl: $(MAKE_DIRECTORIES)
+all: $(MAKE_DIRECTORIES)
+
+.PHONY: $(MAKE_DIRECTORIES)
+$(MAKE_DIRECTORIES):
+ @$(MAKE) --keep-going --directory=$@ $(MAKECMDGOALS)
+
+.PHONY: $(MAKECMDGOALS)
+$(MAKECMDGOALS): $(MAKE_DIRECTORIES)
diff --git a/io/bin/generic_gpio/Makefile b/io/bin/generic_gpio/Makefile
new file mode 100644
index 0000000..c8aa810
--- /dev/null
+++ b/io/bin/generic_gpio/Makefile
@@ -0,0 +1,39 @@
+CC := $(CROSS_COMPILE)gcc
+CXX := $(CROSS_COMPILE)g++
+LD := $(CROSS_COMPILE)g++
+
+
+DISTRIO_BASE = ../../../
+
+DISTRIO_COMMON := $(DISTRIO_BASE)common
+DISTRIO_MANAGER := $(DISTRIO_BASE)manager/lib
+DISTRIO_IO := $(DISTRIO_BASE)io/lib
+
+LDFLAGS += -L$(DISTRIO_COMMON) -ldistrio_common \
+ -L$(DISTRIO_IO) -ldistrio_io \
+ -L$(DISTRIO_MANAGER) -ldistrio_manager \
+ -lACE -lTAO -lTAO_AnyTypeCode -lTAO_CosNaming -lTAO_PortableServer
+CFLAGS += -fPIC -I$(DISTRIO_COMMON) -I$(DISTRIO_IO) -I$(DISTRIO_MANAGER)
+CXXFLAGS += $(CFLAGS)
+
+DESTDIR := /usr
+
+COMPONENT = distrio_generic_gpio
+EXEC = $(COMPONENT)
+OBJ = generic_gpio.o
+
+all: $(OBJ)
+ $(LD) $(LDFLAGS) -o $(EXEC) $(OBJ)
+
+clean:
+ rm -f *.o
+ rm -f $(EXEC)
+
+install: all
+ cp -a $(EXEC) $(DESTDIR)/bin
+
+uninstall:
+ rm -f $(DESTDIR)/bin/$(EXEC)
+
+idl:
+ /bin/true
diff --git a/io/bin/generic_gpio/generic_gpio.cpp b/io/bin/generic_gpio/generic_gpio.cpp
new file mode 100644
index 0000000..325cb9c
--- /dev/null
+++ b/io/bin/generic_gpio/generic_gpio.cpp
@@ -0,0 +1,45 @@
+#include <distrio_helper.h>
+#include <distrio_error.h>
+
+#include <distrio_ioI.h>
+
+#include <iostream>
+
+class My_digital : public Distrio_Digital_i {
+ public:
+ ::CORBA::Long id (void)
+ {
+ return my_id;
+ }
+ void id (::CORBA::Long id)
+ {
+ my_id = id;
+ }
+ private:
+ ::CORBA::Long my_id;
+};
+
+int main (int argc, char **argv)
+{
+ int ret = 0;
+ My_digital *digital;
+
+ if (init_corba (argc, argv))
+ return -EINVAL;
+
+ if (run_orb ())
+ return -EINVAL;
+
+ digital = new My_digital ();
+
+ if (register_digital ("pin huhu", digital)) {
+ ret = -EINVAL;
+ goto out;
+ }
+
+ std::cout << "registered id: " << digital->id () << std::endl;
+
+out:
+ free (digital);
+ return ret;
+}
diff --git a/io/bin/generic_gpio/run.sh b/io/bin/generic_gpio/run.sh
new file mode 100755
index 0000000..ab1068f
--- /dev/null
+++ b/io/bin/generic_gpio/run.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+#
+# startup script for distrio generic gpio exporter
+#
+# author: Manuel Traut <manut@mecka.net>
+
+LD_LIBRARY_PATH=../io:../common:../manager/lib ./distrio_generic_gpio \
+ -ORBInitRef NameService=corbaloc:iiop:localhost:12345/NameService \
+ $@