diff options
Diffstat (limited to 'io')
| -rw-r--r-- | io/bin/Makefile | 12 | ||||
| -rw-r--r-- | io/bin/generic_gpio/Makefile | 39 | ||||
| -rw-r--r-- | io/bin/generic_gpio/generic_gpio.cpp | 45 | ||||
| -rwxr-xr-x | io/bin/generic_gpio/run.sh | 9 | ||||
| -rw-r--r-- | io/lib/Makefile (renamed from io/Makefile) | 7 | ||||
| -rw-r--r-- | io/lib/distrio_io.cpp (renamed from io/distrio_io.cpp) | 0 |
6 files changed, 110 insertions, 2 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 \ + $@ diff --git a/io/Makefile b/io/lib/Makefile index e609b7f..4b79e01 100644 --- a/io/Makefile +++ b/io/lib/Makefile @@ -2,7 +2,9 @@ CC := $(CROSS_COMPILE)gcc CXX := $(CROSS_COMPILE)g++ LD := $(CROSS_COMPILE)g++ -DISTRIO_COMMON := ../common +DISTRIO_BASE = ../../ + +DISTRIO_COMMON := $(DISTRIO_BASE)common CFLAGS += -fPIC -I$(DISTRIO_COMMON) CXXFLAGS += $(CFLAGS) @@ -23,7 +25,8 @@ all: $(OBJ) .PHONY: idl idl: - $(TAO_IDL) -GI -I../interfaces ../interfaces/$(COMPONENT).idl + $(TAO_IDL) -GI -I$(DISTRIO_BASE)interfaces \ + $(DISTRIO_BASE)interfaces/$(COMPONENT).idl rm -f $(COMPONENT)I.cpp .PHONY: idl_clean diff --git a/io/distrio_io.cpp b/io/lib/distrio_io.cpp index deae171..deae171 100644 --- a/io/distrio_io.cpp +++ b/io/lib/distrio_io.cpp |
