You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

112 lines
4.0 KiB

5 years ago
  1. /*-------------------------------------------------------------------------
  2. | rxtx is a native interface to serial ports in java.
  3. | Copyright 1997-2004 by Trent Jarvi taj@www.linux.org.uk.
  4. |
  5. | This library is free software; you can redistribute it and/or
  6. | modify it under the terms of the GNU Library General Public
  7. | License as published by the Free Software Foundation; either
  8. | version 2 of the License, or (at your option) any later version.
  9. |
  10. | This library is distributed in the hope that it will be useful,
  11. | but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. | Library General Public License for more details.
  14. |
  15. | You should have received a copy of the GNU Library General Public
  16. | License along with this library; if not, write to the Free
  17. | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. --------------------------------------------------------------------------*/
  19. This is README
  20. Wed Feb 19 06:33:17 EST 2003
  21. STATUS:
  22. 1) OS's The library has been tested on redhat 8.0 glinux
  23. write writes and read reads. Little else has been
  24. tested but things should work.
  25. 2) TODO:
  26. - test on other Unix Like systems
  27. - bring termios.c over to give win32 support
  28. - autoconf to determine include files
  29. INTRODUCTION
  30. CNI is a new way of mixing Java and native code used by the GNU gcj compiler.
  31. The CNI is a faster way to have native and Java code interact. One can
  32. build fast, stand alone applications using this code.
  33. Possible applications include low latency, embeded and use with other native
  34. projects.
  35. This directory contains an initial hack at getting rxtx (www.rxtx.org) working
  36. with the the GNU gcj using the CNI.
  37. Links:
  38. http://www.rxtx.org
  39. http://gcc.gnu.org/java
  40. http://gcc.gnu.org/java/papers/cni/t1.html
  41. BUILDING
  42. There isn't much here besides the library. To get started, make sure you have gcj
  43. installed.
  44. make # build the library and Simple -- a small application
  45. ./Simple runs the test application.
  46. If there is a loopback on /dev/ttyS1, The Simple application will write to
  47. the port and then read back the data.
  48. If you get "undefined reference to `function_name' you are missing a library
  49. EXAMPLE
  50. Script started on Wed Feb 19 06:16:07 2003
  51. [root@servertrent CNI]# make
  52. rm -f Simple.java
  53. gcj -d . -C *.java
  54. for i in gnu/io/*.class;do gcjh -d . `echo $i|sed s/.class//g`;done
  55. 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
  56. SerialImp.c: In member function `void
  57. gnu::io::RXTXPort::writeArray(JArray<jbyte>*, __java_int, __java_int,
  58. __java_boolean)':
  59. SerialImp.c:1376: warning: label `fail' defined but not used
  60. 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
  61. (cd gnu/io && gcj -g -classpath ../.. -d gnu/io -c *.class )
  62. g++ -g -shared gnu/io/*.o *.o -lpthread -Wl,-soname -Wl,librxtx-0.0-1.so -o librxtx-0.0-1.so
  63. rm -f librxtx.so && ln -s librxtx-0.0-1.so librxtx.so
  64. ar rs librxtx.a gnu/io/*.o *.o
  65. g++ -g -Wall test.c -static -L. -lrxtx -lgcj -lpthread -ldl -lz -o test
  66. #gcj *.o librxtx.a -static -lgcj -lpthread -ldl -lz -o Simple --main=Simple
  67. ln -s Simple.Java Simple.java
  68. gcj --classpath RXTX.jar -d . -C Simple.java
  69. rm Simple.java
  70. gcj -g -classpath RXTX.jar -d . -c Simple.class
  71. gcj -g *.o gnu/io/*.o -static -lgcj -lpthread -ldl -lz -o Simple --main=Simple
  72. [root@servertrent CNI]# ./Simple
  73. Getting PortIdentifiers
  74. Devel Library
  75. =========================================
  76. Native lib Version = RXTX-2.1-7
  77. Java lib Version = RXTX-2.1-7
  78. RXTX Warning: Removing stale lock file. /var/lock/LCK..ttyS1
  79. writing output
  80. Got Data Available
  81. Printing read() results
  82. 123456789
  83. [root@servertrent CNI]# file Simple
  84. Simple: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, not stripped
  85. [root@servertrent CNI]# exit
  86. exit
  87. Script done on Wed Feb 19 06:16:35 2003
  88. --
  89. Trent Jarvi
  90. taj@www.linux.org.uk