Fw: [rtl] RTLinux and Java
-----Ursprüngliche Nachricht-----
Von: Robert Reid <robreid-at-INAME.COM>
An: rtl-at-rtlinux.org <rtl-at-rtlinux.org>
Datum: Sonntag, 27. August 2000 12:15
Betreff: [rtl] RTLinux and Java
>Dear forum,
>
>We are working on a set of Java Native Interface hooks to allow java
>programs to have access to shared memory and realtime FIFO's to allow
>communication between RTLinux space and a Java VM.
>
>We have currently implemented code that allows java to read and write to
>a integer held in shared memory. The code to do this and some sample
>java code is attached.
>
>This could allow people to create networked / graphical front ends to
>RTLinux programs very easily. For many high level, non realtime tasks
>the java environment provides the easiest and quickest development
>environment.
>
>We are interested to find out if there is any interest / demand for this
>code as it could easily be written to allow access to all type of
>RTLinux / Linux communications paths. We would also appreciate any
>comments regarding to the structure of the code and improvements that
>could be made.
>
>The files are as follows:
>RTL_SharedMemInt.java - Java library for accessing shared memory
>integers
>RTL_SharedMemInt.h - Header file for implementing Java Native Calls
>RTL_SharedMemInt.c - Header file for implementing Java Native Calls, to
>be compiled to libRTL_SharedMemInt.so
>realtime_module.c - A test realtime module
>SharedMemTest.java - A terminal based java test program
>SharedMemApplet.java - A applet based java test program
>Makefile - makefile for compiling RTL_SharedMemInt.c (check library
>locations to suit your machine for realtime and java paths)
>
>The sample program creates a thread that increments an int variable
>every second (realtime) and the value of this variable is accessed from
>java space.
>
>
>Kelvin Proctor & Robert Reid
>University of NSW
>Sydney, Australia
>
begin 666 Makefile.txt
M;&EB4E1,7U-H87)E9$UE;4EN="YS;R Z( T*"6=C8R M5V%L;" M<VAA<F5D
M("U)+W5S<B]S<F,O;&EN=7-at-O<G1L:6YU>" M22]U<W(O:6YC;'5D92 M22]U
M<W(O;&]C86PO4$%#2T%'15,O:F1K,3$X7W8Q7V)D+VEN8VQU9&4-at-+4DO=7-R
M+VQO8V%L+U!!0TM!1T53+VID:S$Q.%]V,5]B9"]I;F-L=61E+VQI;G5X("UO
L(&QI8E)43%]3:&%R961-96U);G0N<V\-at-4E1,7U-H87)E9$UE;4EN="YC#0H`
`
end
begin 666 RTL_SharedMemInt.c
M(VEN8VQU9&4-at-/'-T9&EO+F-at-^#0HC:6YC;'5D92 \<G1L:6YU>"]M8G5F9BYH
M/-at-T*(VEN8VQU9&4-at-(E)43%]3:&%R961-96U);G0N:"(-"-at-T*+RH-"B J($-L
M87-S.B -at-(" -at-4E1,7U-H87)E9$UE;4EN= T*("H-at-365T:&]D.B -at-("!R96%D
M26YT#0H-at-*B!3:6=N871U<F4Z("A,:F%V82]L86YG+U-T<FEN9SLI20T*("HO
M#0I*3DE%6%!/4E0-at-:FEN="!*3DE#04Q,($IA=F%?4E1,7S%3:&%R961-96U)
M;G1?<F5A9$EN=" H2DY)16YV("IE;G8-at-+"!J;V)J96-T(&]B:BP-at-:G-T<FEN
M9R!?=&%G;F%M92D-at->PT*#0H-at-(&-O;G-T(&IB>71E("IT86=N86UE.R O*B!J
M8GET92!I<R!S:6=N960-at-."!B:70-at-*B\-"B -at-=F]L871I;&4-at-:6YT*B!V86QU
M93L-"B -at-:FEN="!R971U<FY?=F%L=64[("\J(&II;G0-at-:7,-at-,S(-at-8FET('-I
M9VYE9"!I;G1E9V5R("HO#0H-"B -at-+RH-at-1V5T('1H92!N86UE(&]F('1A9R!F
M<F]M(&$-at-:F%V82YL86YG+E-T<FEN9R!T;PT*(" -at-("!A('-T86YD87)D(&,-at-
M<W1R:6YG("HO#0H-at-('1A9VYA;64-at-/2 H*F5N=BDM/D=E=%-T<FEN9U541D-H
M87)S*&5N=BQ?=&%G;F%M92Q.54Q,*3L-"B -at-:68-at-*'1A9VYA;64-at-/3T-at-3E5,
M3"D-at->PT*(" -at-(')E='5R;B!.54Q,.R O*B!%>&-E<'1I;VX-at-=VEL;"!H879E
M(&)E96X-at-=&AR;W=N("HO#0H-at-('T-"-at-T*(" O*B!#<F5A=&4-at-<F5F97)E;F-E
M('1O('-H87)E9"!M96UO<GD-at-;V)J96-T(&%S(&%N(&EN=" J+PT*("!V86QU
M92 ]("AV;VQA=&EL92!I;G0J*2!M8G5F9E]A;&QO8RAT86=N86UE+" Q,#(T
M*3L-"-at-T*(" O*B!C87-T(&EN="!V86QU92!T;R!A(&IA=F$-at-:6YT("HO#0H-at-
M(')E='5R;E]V86QU92 ]("AJ:6YT*2 J=F%L=64[#0H-"B -at-+RH-at-4F5L96%S
M92!R969E<F5N8V4-at-=&\-at-=&AE('1A9VYA;64-at-9G)O;2!J879A(&5N=FER;VUE
M;G0-at-*B\-"B -at-*"IE;G8I+3Y296QE87-E4W1R:6YG551&0VAA<G,H96YV+%]T
M86=N86UE+'1A9VYA;64I.PT*#0H-at-("\J(&1E<W1R;WD-at-=&AE(')E9F5R96YC
M92!T;R!T:&4-at-<VAA<F5D(&UE;6]R>2!O8FIE8W0-at-*B\-"B -at-;6)U9F9?9G)E
M92AT86=N86UE+"AV;VED("HI=F%L=64I.PT*#0H-at-(')E='5R;B!R971U<FY?
M=F%L=64[#0H-"GT-"-at-T*+RH-"B J($-L87-S.B -at-(" -at-4E1,7U-H87)E9$UE
M;4EN= T*("H-at-365T:&]D.B -at-("!W<FET94EN= T*("H-at-4VEG;F%T=7)E.B H
M3&IA=F$O;&%N9R]3=')I;F<[22E6#0H-at-*B\-"DI.24584$]25"!V;VED($I.
M24-!3$P-at-2F%V85]25$Q?,5-H87)E9$UE;4EN=%]W<FET94EN=" H2DY)16YV
M("IE;G8L(&IO8FIE8W0-at-;V)J+"!J<W1R:6YG(%]T86=N86UE+"!J:6YT(%]V
M86QU92D-at->PT*#0H-at-(&-O;G-T(&IB>71E("IT86=N86UE.R O*B!J:6YT(&ES
M(#,R(&)I="!S:6=N960-at-:6YT96=E<B J+PT*("!V;VQA=&EL92!I;G0J('9A
M<FEA8FQE.PT*#0H-at-("\J($=E="!T:&4-at-;F%M92!O9B!T86<-at-9G)O;2!A(&IA
M=F$N;&%N9RY3=')I;F<-at-=&\-"B -at-(" -at-82!S=&%N9&%R9"!C('-T<FEN9R J
M+PT*("!T86=N86UE(#T-at-*"IE;G8I+3Y'9713=')I;F=55$9#:&%R<RAE;G8L
M7W1A9VYA;64L3E5,3"D[#0H-at-(&EF("AT86=N86UE(#T]($Y53$PI('L-"B -at-
M("!R971U<FX[("\J($5X8V5P=&EO;B!W:6QL(&AA=F4-at-8F5E;B!T:')O=VX-at-
M*B\-"B -at-?0T*#0H-at-("\J($-R96%T92!R969E<F5N8V4-at-=&\-at-<VAA<F5D(&UE
M;6]R>2!O8FIE8W0-at-87,-at-86X-at-:6YT("HO#0H-at-('9A<FEA8FQE(#T-at-*'9O;&%T
M:6QE(&EN="HI(&UB=69F7V%L;&]C*'1A9VYA;64L(#$P,C0I.PT*#0H-at-("\J
M(&-A<W0-at-:FEN="!V86QU92!T;R!A;B!I;G0-at-86YD('=R:71E('1O('-H87)E
M9"!M96UO<GD-at-*B\-"B -at-*G9A<FEA8FQE(#T-at-*&EN="D-at-7W9A;'5E.PT*#0H-at-
M("\J(%)E;&5A<V4-at-<F5F97)E;F-E('1O('1H92!T86=N86UE(&9R;VT-at-:F%V
M82!E;G9I<F]M96YT("HO#0H-at-("-at-J96YV*2T^4F5L96%S95-T<FEN9U541D-H
M87)S*&5N=BQ?=&%G;F%M92QT86=N86UE*3L-"-at-T*(" O*B!D97-T<F]Y('1H
M92!R969E<F5N8V4-at-=&\-at-=&AE('-H87)E9"!M96UO<GD-at-;V)J96-T("HO#0H-at-
M(&UB=69F7V9R964H=&%G;F%M92PH=F]I9" J*79A<FEA8FQE*3L-"-at-T*?0T*
`
end
begin 666 RTL_SharedMemInt.h
M+RH-at-1$\-at-3D]4($5$250-at-5$A)4R!&24Q%("T-at-:70-at-:7,-at-;6%C:&EN92!G96YE
M<F%T960-at-*B\-"B-I;F-L=61E(")J;FDN:"(-"B\J($AE861E<B!F;W(-at-8VQA
M<W,-at-4E1,7U-H87)E9$UE;4EN=" J+PT*#0HC:69N9&5F(%]);F-L=61E9%]2
M5$Q?4VAA<F5D365M26YT#0HC9&5F:6YE(%]);F-L=61E9%]25$Q?4VAA<F5D
M365M26YT#0HC:69D968-at-7U]C<&QU<W!L=7,-"F5X=&5R;B B0R(-at->PT*(V5N
M9&EF#0HO*-at-T*("H-at-0VQA<W,Z(" -at-("!25$Q?4VAA<F5D365M26YT#0H-at-*B!-
M971H;V0Z(" -at-(')E861);G0-"B J(%-I9VYA='5R93H-at-*$QJ879A+VQA;F<O
M4W1R:6YG.RE)#0H-at-*B\-"DI.24584$]25"!J:6YT($I.24-!3$P-at-2F%V85]2
M5$Q?,5-H87)E9$UE;4EN=%]R96%D26YT#0H-at-("A*3DE%;G8-at-*BP-at-:F]B:F5C
M="P-at-:G-T<FEN9RD[#0H-"B\J#0H-at-*B!#;&%S<SH-at-(" -at-(%)43%]3:&%R961-
M96U);G0-"B J($UE=&AO9#H-at-(" -at-=W)I=&5);G0-"B J(%-I9VYA='5R93H-at-
M*$QJ879A+VQA;F<O4W1R:6YG.TDI5-at-T*("HO#0I*3DE%6%!/4E0-at-=F]I9"!*
M3DE#04Q,($IA=F%?4E1,7S%3:&%R961-96U);G1?=W)I=&5);G0-"B -at-*$I.
M245N=B J+"!J;V)J96-T+"!J<W1R:6YG+"!J:6YT*3L-"-at-T*(VEF9&5F(%]?
>8W!L=7-P;'5S#0I]#0HC96YD:68-"B-E;F1I9-at-T*
`
end
begin 666 RTL_SharedMemInt.java
M+RH-at-2F%V82!C;&%S<R!T;R!A;&QO=R!I;G1E<F%C=&EO;B!B971W965N(%)4
M3&EN=7-at--at-86YD($IA=F$-"B J( T*("H-at-5&AI<R!C;&%S<R!W:6QL(&%L;&]W
M(&%C8V5S<R!T;R!A;B!I;G1E9V5R('9A<FEA8FQE(&ME<'0-at-:6X-"B J('-H
M87)E9"!M96UO<GD-at-8GD-at-4E1,:6YU>"X-at-(%1H92!V:6%B;&4-at-;75S="!A;')E
M861Y(&5X:7-T(&EN#0H-at-*B!25$QI;G5X('-P86-E(&]N(&%N(&5X8V5P=&EO
M;B!W:6QL(&]C8W5R+-at-T*("H-"B J($1U92!T;R!T:&4-at-;&EM:71A=&EO;G,-at-
M=&AA="!T:&5R92!I<R!N;R!D97-T<G5C=&]R(&9U;F-T:6]N#0H-at-*B!I;B!*
M879A(&$-at-;F5W(')E9F5R96YC92!T;R!T:&4-at-4VAA<F5D($UE;6]R>2!O8FIE
M8W0-at-;75S="!B90T*("H-at-8W)E871E9"!E86-H('1I;64-at-=&AE('9A<FEA8FQE
M+-at-T*("H-"B J(%-I;F-E('1H92 S,B!B:70-at-<VEG;F5D(&EN=&5G97(-at-9F]R
M;6%T(&9R;VT-at-:F%V82!M87D-at-;F]T(&UA< T*("H-at-=&\-at-82!C+V,K*R!I;G0-at-
M<')I;6ET:79E(&%N(&5X<&QI8V%T92!C87-T(&ES(&UA9&4-at-86YD('1H97)E
M#0H-at-*B!I<R!T:&4-at-<&]S<VEB:6QI='D-at-;V8-at-9&%T82!L;W-S+W1R=6YC871I
M;VX-at-#0H-at-*-at-T*("H-at-075T:&]R<SH-at-2V5L=FEN(%!R;V-T;W(-"B J(" -at-(" -at-
M(" -at-(%)O8F5R="!296ED#0H-at-*B!#<F5A=&5D.B R-"\X+S(P,# -"B J($UO
M9&EF:65D.B R-R\X+S(P,# -"B J+PT*#0IP=6)L:6,-at-8VQA<W,-at-4E1,7U-H
M87)E9$UE;4EN="![#0H)<W1A=&EC('L-"-at-D)4WES=&5M+FQO861,:6)R87)Y
M*")25$Q?4VAA<F5D365M26YT(BD[#0H)?0T*"0T*"7!R:79A=&4-at-4W1R:6YG
M('1A9VYA;64[#0H)#0H)<'5B;&EC(%)43%]3:&%R961-96U);G0H4W1R:6YG
M(%]T86=N86UE*2![#0H)"71A9VYA;64-at-/2!?=&%G;F%M93L-"-at-E]#0H)#0H)
M<')I=F%T92!N871I=F4-at-:6YT(')E861);G0H4W1R:6YG(&YA;64I.PT*"7!R
M:79A=&4-at-;F%T:79E('9O:60-at-=W)I=&5);G0H4W1R:6YG(&YA;64L(&EN="!V
M86QU92D[#0H-"-at-EP=6)L:6,-at-:6YT(%)43%]R96%D26YT*"D-at->PT*"0ER971U
M<FX-at-<F5A9$EN="AT86=N86UE*3L-"-at-E]#0H-"-at-EP=6)L:6,-at-=F]I9"!25$Q?
M=W)I=&5);G0H:6YT('9A;'5E*2![#0H)"7=R:71E26YT*'1A9VYA;64L('9A
0;'5E*3L-"-at-E]#0I]#0H-"-at-``
`
end
begin 666 ShareMemTest.java
M<'5B;&EC(&-L87-S(%-H87)E365M5&5S="![#0H-"B -at-("!P=6)L:6,-at-<W1A
M=&EC('9O:60-at-;6%I;BA3=')I;F<-at-87)G<UM=*2![#0H-"-at-E25$Q?4VAA<F5D
M365M26YT('-M(#T-at-;F5W(%)43%]3:&%R961-96U);G0H(F-O=6YT97(B*3L-
M"-at-T*(" -at-(" -at-("!W:&EL92 H=')U92D-at->PT*"2 -at-("!3>7-T96TN;W5T+G!R
M:6YT;&XH<VTN4E1,7W)E861);G0H*2D[#0H)(" -at-('1R>2![#0H)"51H<F5A
M9"YS;&5E<"-at-Q,# P*3L-"-at-D-at-(" -at-?2!C871C:" H17AC97!T:6]N(&4I('M]
0#0H)?0T*(" -at-('T-"GT-"-at-``
`
end
begin 666 realtime_module.c
M(VEN8VQU9&4-at-/')T;&EN=7-at-O<G1L7W-C:&5D+F-at-^#0HC:6YC;'5D92 \;&EN
M=7-at-O;6]D=6QE+F-at-^#0HC:6YC;'5D92 \<'1H<F5A9"YH/-at-T*(VEN8VQU9&4-at-
M/')T;&EN=7-at-O<G1L7W!R:6YT9BYH/-at-T*(VEN8VQU9&4-at-/')T;&EN=7-at-O<G1L
M7W1I;64N:#X-"B-I;F-L=61E(#QR=&QI;G5X+VUB=69F+F-at-^#0H-"G9O;&%T
M:6QE(&EN="H-at-8V]U;G0[#0H-"G9O:60-at-*G1A<VLQ7V9U;F-T:6]N*'9O:60-at-
M*F%R9RD[#0H-"G!T:')E861?="!T:')E860Q.PT*#0II;G0-at-:6YI=%]M;V1U
M;&4H=F]I9"D-at->PT*(" -"B -at-8V]U;G0-at-/2 H=F]L871I;&4-at-:6YT*BD-at-;6)U
M9F9?86QL;V,H(F-O=6YT97(B+" Q,#(T*3L-"B -at-*F-O=6YT(#T-at-,#L-"B -
M"B -at-+RH-at-8W)E871E('1A<VL-at-,2 J+PT*("!P=&AR96%D7V-R96%T92 H)G1H
M<F5A9#$L($Y53$PL('1A<VLQ7V9U;F-T:6]N+"!.54Q,*3L-"-at-T*("!R971U
M<FX-at-,#L-"-at-T*?0T*#0II;G0-at-8VQE86YU<%]M;V1U;&4H=F]I9"D-at->PT*#0H-at-
M("\J(&MI;&P-at-=&%S:R Q("HO#0H-at-('!T:')E861?9&5L971E7VYP*'1H<F5A
M9#$I.PT*#0H-at-(&UB=69F7V9R964H(F-O=6YT97(B+"AV;VED("HI8V]U;G0I
M.PT*#0H-at-(')E='5R;B P.PT*(" -"GT-"-at-T*=F]I9" J=&%S:S%?9G5N8W1I
M;VXH=F]I9" J87)G*2![#0H-"B -at-:')T:6UE7W0-at-;F]W(#T-at-9V5T:')T:6UE
M*"D[#0H-at-(&AR=&EM95]T('!E<FEO9" ](#$P,# P,# P,# [("\J(#$-at-<V5C
M;VYD("HO#0H-"B -at-<W1R=6-T('-C:&5D7W!A<F%M(' [#0H-"B -at-<"YS8VAE
M9%]P<FEO<FET>2 ](#$[#0H-"B -at-<'1H<F5A9%]S971S8VAE9'!A<F%M*'!T
M:')E861?<V5L9B-at-I+"!30TA%1%]&249/+" F<"D[#0H-"B -at-<'1H<F5A9%]M
M86ME7W!E<FEO9&EC7VYP*'!T:')E861?<V5L9B-at-I+&YO=RLQ,# P,"QP97)I
M;V0I.PT*(" -"B -at-=VAI;&4-at-*#$I('L-"B -at-("!R=&Q?<')I;G1F*")#;W5N
M=&5R('9A;'5E(&ES("5D7&XB+" J8V]U;G0I.PT*(" -at-("-at-J8V]U;G0I*RL[
M#0H-at-(" -at-<'1H<F5A9%]W86ET7VYP*"D[#0H-at-('T-"-at-T*("!R971U<FX-at-3E5,
'3#L-"GT-"-at-``
`
end
begin 666 ShareMemApplet.java
M:6UP;W)T(&IA=F$N87!P;&5T+BH[#0II;7!O<G0-at-:F%V82YA=W0N*CL-"-at-T*
M+RH-at-/$%04$Q%5"!#3T1%/5-H87)E365M07!P;&5T+F-L87-S(%=)1%1(/3,R
M,"!(14E'2%0],C P/CPO05!03$54/B J+PT*#0IP=6)L:6,-at-8VQA<W,-at-4VAA
M<F5-96U!<'!L970-at-97AT96YD<R!!<'!L970-at-:6UP;&5M96YT<R!2=6YN86)L
M92![#0H-at-(" -at-5&AR96%D(&%P<&QE=%1H<F5A9#L-"B -at-("!25$Q?4VAA<F5D
M365M26YT('-M(#T-at-;F5W(%)43%]3:&%R961-96U);G0H(F-O=6YT97(B*3L-
M"-at-T*(" -at-("\O(%5P9&%T92!T:&4-at-<VAA<F5D(&UE;6]R>2!C;W5N=&5R#0H-at-
M(" -at-<'5B;&EC('9O:60-at-<&%I;G0H1W)A<&AI8W,-at-9RD-at->PT*"6<N8VQE87)2
M96-T*# L,"PQ,# L,3 P*3L-"-at-E3=')I;F<-at-8V]U;G1E<B ]($EN=&5G97(N
M=&]3=')I;F<H<VTN4E1,7W)E861);G0H*2D[#0H)9RYD<F%W4W1R:6YG*&-O
M=6YT97(L(#4P+#4P*3L-"B -at-("!]#0H-"B -at-(" O+R!3=&%R="!A<'!L9714
M:')E860-"B -at-("!P=6)L:6,-at-=F]I9"!I;FET*"D-at->PT*"6EF("AA<'!L9714
M:')E860]/6YU;&PI('L-"-at-D-at-(" -at-87!P;&5T5&AR96%D(#T-at-;F5W(%1H<F5A
M9"AT:&ES*3L-"-at-D-at-(" -at-87!P;&5T5&AR96%D+G-T87)T*"D[#0H)?0T*(" -at-
M('T-"-at-T*(" -at-("\O(%)U;B!W:6QL(&)E(&-A;&QE9"!O;F-E(&%P<&QE=%1H
M<F5A9"!H87,-at-8F5E;B!S=&%R=&5D#0H-at-(" -at-<'5B;&EC('9O:60-at-<G5N*"D-at-
M>PT*"7=H:6QE("AT<G5E*2![#0H)(" -at-('1R>2![(%1H<F5A9"YS;&5E<"-at-Q
M,# P*3L-"-at-D-at-(" -at-?2!C871C:" H17AC97!T:6]N(&4I('L-at-?0T*"2 -at-("!R
M97!A:6YT*"D[#0H)?0T*(" -at-('T-"-at-T*(" -at-("\J#0H)=')Y('L-at-5&AR96%D
M+G-L965P*#$P,# I.PT*"7T-at-8V%T8V-at--at-*$5X8V5P=&EO;B!E*2![('T-"-at-ER
797!A:6YT*"D[#0H-at-(" -at-("HO#0I]#0H`
`
end
Date Index |
Thread Index |
Back to archive index |
Back to Mailing List Page
Problems or questions? Contact