|
|
- /*-------------------------------------------------------------------------
- | rxtx is a native interface to serial ports in java.
- | Copyright 1997-2004 by Trent Jarvi taj@www.linux.org.uk.
- |
- | This library 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 library 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 library; if not, write to the Free
- | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- --------------------------------------------------------------------------*/
- This is README
- Wed Feb 19 06:33:17 EST 2003
-
-
- STATUS:
-
- 1) OS's The library has been tested on redhat 8.0 glinux
- write writes and read reads. Little else has been
- tested but things should work.
-
- 2) TODO:
-
- - test on other Unix Like systems
- - bring termios.c over to give win32 support
- - autoconf to determine include files
-
- INTRODUCTION
-
- CNI is a new way of mixing Java and native code used by the GNU gcj compiler.
- The CNI is a faster way to have native and Java code interact. One can
- build fast, stand alone applications using this code.
-
- Possible applications include low latency, embeded and use with other native
- projects.
-
- This directory contains an initial hack at getting rxtx (www.rxtx.org) working
- with the the GNU gcj using the CNI.
-
-
- Links:
-
- http://www.rxtx.org
- http://gcc.gnu.org/java
- http://gcc.gnu.org/java/papers/cni/t1.html
-
- BUILDING
-
- There isn't much here besides the library. To get started, make sure you have gcj
- installed.
-
- make # build the library and Simple -- a small application
- ./Simple runs the test application.
-
- If there is a loopback on /dev/ttyS1, The Simple application will write to
- the port and then read back the data.
-
- If you get "undefined reference to `function_name' you are missing a library
-
-
- EXAMPLE
-
- Script started on Wed Feb 19 06:16:07 2003
- [root@servertrent CNI]# make
- rm -f Simple.java
- gcj -d . -C *.java
- for i in gnu/io/*.class;do gcjh -d . `echo $i|sed s/.class//g`;done
- g++ -Wall -g -O2 -D_POSIX_SOURCE -D_BSD_SOURCE -D__need_timespec -O2 -D_POSIX_SOURCE -D_BSD_SOURCE -D__need_timespec -I . -c SerialImp.c
- SerialImp.c: In member function `void
- gnu::io::RXTXPort::writeArray(JArray<jbyte>*, __java_int, __java_int,
- __java_boolean)':
- SerialImp.c:1376: warning: label `fail' defined but not used
- g++ -Wall -g -O2 -D_POSIX_SOURCE -D_BSD_SOURCE -D__need_timespec -O2 -D_POSIX_SOURCE -D_BSD_SOURCE -D__need_timespec -I . -c fuserImp.c
- (cd gnu/io && gcj -g -classpath ../.. -d gnu/io -c *.class )
- g++ -g -shared gnu/io/*.o *.o -lpthread -Wl,-soname -Wl,librxtx-0.0-1.so -o librxtx-0.0-1.so
- rm -f librxtx.so && ln -s librxtx-0.0-1.so librxtx.so
- ar rs librxtx.a gnu/io/*.o *.o
- g++ -g -Wall test.c -static -L. -lrxtx -lgcj -lpthread -ldl -lz -o test
- #gcj *.o librxtx.a -static -lgcj -lpthread -ldl -lz -o Simple --main=Simple
- ln -s Simple.Java Simple.java
- gcj --classpath RXTX.jar -d . -C Simple.java
- rm Simple.java
- gcj -g -classpath RXTX.jar -d . -c Simple.class
- gcj -g *.o gnu/io/*.o -static -lgcj -lpthread -ldl -lz -o Simple --main=Simple
- [root@servertrent CNI]# ./Simple
- Getting PortIdentifiers
- Devel Library
- =========================================
- Native lib Version = RXTX-2.1-7
- Java lib Version = RXTX-2.1-7
- RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS1
- writing output
- Got Data Available
- Printing read() results
- 123456789
- [root@servertrent CNI]# file Simple
- Simple: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, not stripped
- [root@servertrent CNI]# exit
- exit
-
- Script done on Wed Feb 19 06:16:35 2003
- --
- Trent Jarvi
- taj@www.linux.org.uk
-
|