Apr 30, 2003 onlpara, Red Hat Linux 8.0 のシステムでのJavaRMIの実行 --- リモートマシンからの例題ソフトの実行 #4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (http://www-online.kek.jp/~inoue/para-CAMAC/ Work/CAMAC-JavaRMI4.html) 高エネルギー加速器研究機構 素粒子原子核研究所 物理、オンライングループ 井上 栄二 目的 JavaRMIとJNIを使って、リモートマシン onlpara から ターゲットマシン onlsbc1上で例題ソフトを実行する。 (1). 構成 (2). 例題ソフトをサーバプログラムに組み込む (3). 実行 -------------------------------------------------------------------- (1). 構成 テストに使用するマシンは onlpara と onlsbc1 である。 マシン onlpara は DELL社製のPC, Dimension 4500 で、RedHat Linux 7.3 が動作している。 Java のバージョンは1.4.1 である。 一方 onlsbc1 は、アドバンテク社のSBC、 PCM-9370である。 このSBCは、CAMACコントローラ上に装着されている。 SBC上で動作している OSは Red Hat Linux 8.0 で、コンパクトフラッシュ上に 構成してある。 Javaのバージョンは1.4.1_02 である。 (2). 例題ソフトをサーバプログラムに組み込む CAMAC および トリガーロジックをテストするための例題ソフトは、すでに 安さんの手で作られている。 ここでは、この例題ソフトをサーバ側のJNIに 組み込んでリモートから実行できるようにする。 注. 現時点(Apr 28, 2003)ではまだデバッグ中のため、私の使用しているCAMACコン トローラモジュールでは完全なCAMAC機能を利用できない。 したがって、ここ でのテストはCAMACドライバは使用していない。 さらに、組み込んだ例題プロ グラムおよびCAMACライブラリプログラムではドライバをコールしている部分は コメントアウトしてある。 CAMACライブラリの一部の箇所では無条件にダミー のデータを返すようにしてテストした。 (2-1). サーバ側、onlsbc1.kek.jp (2-1-1). Javaのチェック [inoue@onlsbc1 exam]$ java -version java version "1.4.1_02" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06) Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode) [inoue@onlsbc1 exam]$ (2-1-2). 実行環境 [inoue@onlsbc1 exam]$ env MANPATH=:/usr/java/man HOSTNAME=onlsbc1.kek.jp TERM=vt100 SHELL=/bin/bash JLESSCHARSET=japanese HISTSIZE=1000 SSH_CLIENT=130.87.153.116 32798 22 SSH_TTY=/dev/pts/0 USER=inoue LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;0 1:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.b tm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31: *.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:* .bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;3 5:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35: MAIL=/var/spool/mail/inoue PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/java/bin:/home/inoue/bin INPUTRC=/etc/inputrc PWD=/home/inoue/inoue/JavaRMI/camac/exam LANG=ja_JP.eucJP SHLVL=1 HOME=/home/inoue LOGNAME=inoue LESSOPEN=|/usr/bin/lesspipe.sh %s G_BROKEN_FILENAMES=1 _=/bin/env OLDPWD=/home/inoue/inoue/JavaRMI/camac [inoue@onlsbc1 exam]$ (2-1-3). コンパイル [inoue@onlsbc1 exam]$ pwd /home/inoue/inoue/JavaRMI/camac/exam [inoue@onlsbc1 exam]$ ls -l 合計 108 -rw-rw-r-- 1 inoue inoue 233 4月 28 09:33 Client.java -rw-r--r-- 1 inoue inoue 17456 4月 28 10:24 ClientImpl.java -rw-rw-r-- 1 inoue inoue 1106 4月 28 09:52 Makefile -rw-r--r-- 1 inoue inoue 296 4月 28 09:52 Server.java -rw-r--r-- 1 inoue inoue 3058 4月 28 09:53 ServerImpl.java -rw-rw-r-- 1 inoue inoue 46354 4月 28 10:10 cam.c -rw-rw-r-- 1 inoue inoue 791 4月 28 10:15 cam.java -rw-rw-r-- 1 inoue inoue 9096 4月 16 16:10 camac.c -rw-r--r-- 1 inoue inoue 5425 4月 14 11:00 pcc.h [inoue@onlsbc1 exam]$ (2-1-3a). Client.java [inoue@onlsbc1 exam]$ cat Client.java // File Name: Client.java // Date: Apr 28, 2003 // Edited by: Eiji Inoue public interface Client extends java.rmi.Remote { public void camac_reply( int[] ia, int[] ib, int[] ic, int[] id, int ie) throws java.rmi.RemoteException; } [inoue@onlsbc1 exam]$ (2-1-3b). ClientImpl.java [inoue@onlsbc1 exam]$ cat ClientImpl.java // File Name: ClientImpl.java // Date: Apr 28, 2003 // Edited by: Eiji Inoue import java.io.*; import java.rmi.*; import java.rmi.server.*; class ClientImpl implements Client { public static final int CMD_F16_A0_N3 = 0xE0030010; public static final int CMD_F0_A0_N3 = 0xE0030000; public static final char COM = ','; public static final char QUIT = 'q'; public static final char EXAM = 'e'; public static final char STAR = 'g'; public static final char SIN = 's'; public static final char DMA = 'd'; public static int scmd[] = new int[100]; public static int sdat[] = new int[100]; static Server server; public ClientImpl(String host) { try{ UnicastRemoteObject.exportObject(this); Server server = (Server)Naming.lookup("//"+host+"/Server"); server.register(this); ClientImpl.server = server; } catch ( Exception e ) { System.err.println ("Failed to setup for RMI"); } } public void camac_exec( int l_count, int examN ) { int[] s_cmd, s_dat; int[] array_sizes = {4096*16}; int s_length; int j; try{ System.out.println(" RMI: Client side: "); // to send int array System.out.println(" RMI: Sent CAMAC command: array le ngth =" + l_count ); for (int i = 0; i < l_count + 1; i++) System.out.println(" ClientImpl.scmd[" + i + "] = 0x" + Integer.toHexString( ClientImpl.scmd[i]) + ", ClientImpl.sdat[" + i + " ] = 0x" + Integer.toHexString( ClientImpl.sdat[i])); ClientImpl.server.camac_cmd(ClientImpl.scmd, ClientImpl. sdat, l_count, examN ); } catch ( Exception e ) { System.err.println ("Failed to setup for RMI step2"); } } public void camac_reply( int[] c_reply, int[] d_reply, int[] rcmd_buf, i nt[] rrpl_buf, int l_reply) throws RemoteException { System.out.println(); System.out.println(" RMI: Received CAMAC reply: " + "array len gth = " + l_reply); for (int i = 0; i < l_reply + 1; i++) { System.out.println(" c_reply[" + i + "] = 0x" + Integer .toHexString(c_reply[i]) + ", d_reply[" + i + "] = 0x" + Integer.toHexString(d_r eply[i])); } for (int i = 0; i < l_reply + 1; i += 2) { System.out.println(" rcmd_buf[" + i + "] = 0x" + Intege r.toHexString(rcmd_buf[i]) + ", rcmd_buf[" + ( i + 1 ) + "] = 0x" + Integer.toHe xString(rcmd_buf[i+1])); System.out.println(" rrpl_buf[" + i + "] = 0x" + Intege r.toHexString(rrpl_buf[i]) + ", rrpl_buf[" + ( i + 1 ) + "] = 0x" + Integer.toHe xString(rrpl_buf[i+1])); } keyincmd(); } // TX // +---------+-------+-------+-------+-------+---------------------------+ // | cmd | N | A | F | | 24-bit DATA | // +---------+-------+-------+-------+-------+---------------------------+ // // cmd Header pattern // +-------------+---------+---------+---------+---------------+ // | | Packet | Packet | Packet | Single | // | | Start | Period | End | Frame Packet | // +-------------+---------+---------+---------+---------------+ // | CAMAC | | | | | // | Operation | 0xC0 | 0x8C | 0xA0 | 0xE0 | // +-------------+---------+---------+---------+---------------+ // | CAMAC | | | | | // | LAM | -- | -- | -- | 0xE8 | // +-------------+---------+---------+---------+---------------+ // | DAQ Trigger | | | | | // | out | 0xD0 | 0x90 | 0xB0 | 0xF0 | // +-------------+---------+---------+---------+---------------+ // | DAQ | | | | | // | Interrupt | -- | -- | -- | 0xF8 | // +-------------+---------+---------+---------+---------------+ // // CAMAC N. // 55 54 53 52 51 50 49 48 47 32 // +--------------------+----------------+-------------------+---------------+ // | - - - N16 | N8 N4 N2 N1 | | | | | // +--------------------+----------------+-------------------+---------------+ // // CAMAC A. // 47 46 45 44 43 42 41 40 32 // +--------------------+-------------------+----------------+---------------+ // | - - - - | A8 A4 A2 A1 | | | // +--------------------+-------------------+----------------+---------------+ // // CAMAC F. // 39 38 37 36 35 34 33 32 // +--------------------+----------------+------------------+----------------+ // | - - - F16 | F8 F4 F2 F1 | // +--------------------+----------------+------------------+----------------+ // public void cmdbld( int n, int a, int f, int l_count ){ // CAMAC Single action. System.out.println ( " Make up CAMAC Command of Single action." ); System.out.println ( " Accepted data: n = " + n + ", a = " + a + ", f = " + f + ", l_count = " + l_count ); a = a << 8; n = n << 16; ClientImpl.scmd [ l_count -1 ] = 0xE0000000 | ( 0x0000001F & f ) | ( 0x000 00F00 & a ) | ( 0x001F0000 & n ); System.out.println ( " ClientImpl.scmd [ " + ( l_count -1 ) + " ] = " + ClientImpl.scmd [ l_count -1 ] + "(dec), " + "0x" + Integer.toHexString( ClientI mpl.scmd [ l_count -1 ] ) + "(hex)" ); System.out.println ( " ClientImpl.sdat [ " + ( l_count -1 ) + " ] = " + ClientImpl.sdat [ l_count -1 ] + "(dec), " + "0x" + Integer.toHexString( ClientI mpl.sdat [ l_count -1 ] ) + "(hex)" ); // CAMAC LAM handling. // CAMAC DMA action. } public void keyincmd() { char cstr[] = new char[20]; char n[] = new char[4]; char a[] = new char[4]; char f[] = new char[4]; char kc[] = new char[4]; int c[] = new int[3]; int i, i2, count, loop, k_error; int spoin, epoin; int examN; String cn = "0", ca = "0", cf = "0"; String tmp; String nchk[] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", " b", "c", "d", "e", "f" }; InputStream inStream = System.in; InputStreamReader InData = new InputStreamReader ( inStream ); int s_flg = 0; try{ spoin = 0; epoin = 0; loop = 2; k_error = 0; examN = 0; System.out.println ( "" ); System.out.println ( " (1). Enter 'q' to quit." ); System.out.println ( " (2). Enter 'e' to execute an example program." ) ; System.out.println ( " (3). Enter 's' to set up Single action CAMAC com mand"); // System.out.println ( " (4). Enter 'd' to set up DMA action CAMAC command"); System.out.println ( " (4). Enter 'g' to start up command execution." ) ; System.out.println ( "" ); while ( loop > 1 ) { if ( k_error == 1 ) { System.out.println ( "" ); k_error = 0; } // Execution command interpret. System.out.print ( "Execution Command('q' or 'e' or 'g' or 's' or 'd') = "); count = InData.read ( cstr, 0, 19 ); String str1 = new String ( cstr ); if ( QUIT == str1.charAt ( 0 ) ) { s_flg = 2; break; } else if ( EXAM == str1.charAt ( 0 )) { // example program execution; System.out.println( " What's number of program which do you want to execute ? --- default:[1] "); System.out.println( " exam1:[1], exam2:[2], exam3:[3], exam4 :[4], exam5:[5], exam6:[6], exam21:[7], pio_write_read[8], read:[9], read_write: [a], reg_dump:[b], write:[c], write_read:[d]"); System.out.print( " Number = " ); count = InData.read ( cstr, 0, 19 ); String str2 = new String ( cstr ); cn = str2.substring ( 0, 1 ); cn.getChars(0, 1, kc, 0); try { switch ( kc[0] ) { case '1': s_flg = 1; examN = 1; System.out.println( " Ok. Start up an example progr am 1. " ); break; case '2': s_flg = 1; examN = 2; System.out.println( " Ok. Start up an example progr am 2. " ); break; case '3': s_flg = 1; examN = 3; System.out.println( " Ok. Start up an example progr am 3. " ); break; case '4': s_flg = 1; examN = 4; System.out.println( " Ok. Start up an example progr am 4. " ); break; case '5': s_flg = 1; examN = 5; System.out.println( " Ok. Start up an example progr am 5. " ); break; case '6': s_flg = 1; examN = 6; System.out.println( " Ok. Start up an example progr am 6. " ); break; case '7': s_flg = 1; examN = 7; System.out.println( " Ok. Start up an example progr am 21. " ); break; case '8': s_flg = 1; examN = 8; System.out.println( " Ok. Start up an example progr am pio_write_read. " ); break; case '9': s_flg = 1; examN = 9; System.out.println( " Ok. Start up an example progr am read. " ); break; case 'a': s_flg = 1; examN = 0xa; System.out.println( " Ok. Start up an example progr am read_write."); break; case 'b': s_flg = 1; examN = 0xb; System.out.println( " Ok. Start up an example progr am reg_dump."); break; case 'c': s_flg = 1; examN = 0xc; System.out.println( " Ok. Start up an example progr am write."); break; case 'd': s_flg = 1; examN = 0xd; System.out.println( " Ok. Start up an example progr am write_read."); break; default: break; } break; } catch ( NumberFormatException e ) { System.out.println( " NumberFormatExeception occurred !! " ); System.out.println( "" ); } } else if ( STAR == str1.charAt ( 0 )) { if ( epoin == 0 ) { s_flg = 5; System.out.print ( " Command bufer is empty !!"); System.out.println ( "" ); continue; } else { // camacstart(); s_flg = 1; examN = 0xe; System.out.println( " Ok. Start up CAMAC execution. " ); break; } } else if ( SIN == str1.charAt ( 0 )) { // Single action. s_flg = 3; } else if ( DMA == str1.charAt ( 0 )) { // DNA action. s_flg = 4; System.out.println ( " DMA Action." ); } else { s_flg = 5; System.out.println ( " Unmanageable Action." ); continue; } tmp = str1.substring ( 0, count -1 ); System.out.println ( " Execution Command: " + tmp ); if ( s_flg == 4 ) { // DMA mode & word count set up. // Q stop, Q Ignore, Q request, Q scan. System.out.println ( " DMA set up: " ); System.out.println ( " DMA set up: DMA mode: " ); System.out.println ( " DMA set up: DMA wor count: " ); } // N,A,F CAMAC command set up. System.out.print ( "CAMAC Command (N, A, F)(dec) = " ); count = InData.read ( cstr, 0, 19 ); String str = new String ( cstr ); // Single action set up. i2 = 0; for ( i = 0; i < str.length(); i++ ) { if ( COM == str.charAt ( i ) ) { c[ i2++ ] = i; } } cn = str.substring ( 0, c[ 0 ] ); ca = str.substring ( c[ 0 ] +1, c[ 1 ] ); cf = str.substring ( c[ 1 ] +1, count-1 ); try{ int in = Integer.parseInt(cn, 10); if ( ( in < 0 ) || ( in > 25 ) ) { System.out.println ( " Command Error: Illegal value of N: O ut of range !! " ); k_error = 1; continue; } int ia = Integer.parseInt(ca, 10); if ( ( ia < 0 ) || ( ia > 15 ) ) { System.out.println ( " Command Error: Illegal value of A: O ut of range !! " ); k_error = 1; continue; } int inf = Integer.parseInt(cf, 10); if ( ( inf < 0 ) || ( inf > 31 ) ) { System.out.println ( " Command Error: Illegal value of F: O ut of range !! " ); k_error = 1; continue; } if ( ( inf >= 16 ) && ( inf <= 23 ) ) { // データ入力要求 int datf = 0; do { System.out.print ( " Write Data(hex) = " ); count = InData.read ( cstr, 0, 19 ); str = new String ( cstr ); String cdat = str.substring ( 0, count -1 ); for ( i = 0; i < count -1; i++) { String cdat1 = cdat.substring ( i, i + 1 ); // numerical check for ( i2 = 0; i2 < 16; i2++ ) { if ( cdat1.equals( nchk [ i2 ] ) ) { datf = 0; break; } datf = 1; } if ( datf == 1 ) { System.out.println ( " Data error: Illegal character - -- " + cdat1 + " !" ); System.out.println ( "" ); break; } } if ( datf == 1) { continue; } ClientImpl.sdat [ loop -1 ] = Integer.parseInt( cdat, 16); System.out.println ( " 入力されたData: " + ClientImpl.sdat [ loop -1 ] + "(dec), 0x" + Integer.toHexString( ClientImpl.sdat [ loop -1 ] ) + "(hex)"); if ( ( ClientImpl.sdat [ loop -1 ] < 0 ) || ( ClientImpl.sdat [ loop -1 ] > 0xffffff ) ) { System.out.println ( " Data error: Out of range --- " + ClientImpl.sdat [ loop -1 ] + " !" ); System.out.println ( "" ); datf = 1; continue; } } while ( datf == 1 ); } // CAMAC command set up. cmdbld ( in, ia, inf, loop ); epoin++; loop++; System.out.println ( "" ); } catch (NumberFormatException e) { System.out.println(" NumberFormatException occurred !!"); System.out.println ( "" ); } } // end of while loop if ( s_flg == 1 ) { camac_exec( loop -2, examN ); } else if ( s_flg == 2 ) { System.out.println ( " Quited Program. Enter Ctl-C. " ); } } catch ( IOException e ) { System.out.println ( " IOException Error:" + e + " !"); } } public static void main(String argv[]) throws Exception{ String host = (argv.length == 1) ? argv[0] : "localhost"; ClientImpl obj = new ClientImpl(host); obj.keyincmd(); } } [inoue@onlsbc1 exam]$ (2-1-3c). Server.java [inoue@onlsbc1 exam]$ cat Server.java // File Name: Server.java // Date: Apr 28, 2003 // Edited by: Eiji Inoue import java.rmi.*; public interface Server extends java.rmi.Remote { void register(Client aclient) throws java.rmi.RemoteException; void camac_cmd(int[] ia, int[] ib, int ic, int id) throws RemoteExceptio n; } [inoue@onlsbc1 exam]$ (2-1-3d). ServerImpl.java [inoue@onlsbc1 exam]$ cat ServerImpl.java // File Name: ServerImpl.java // Date: Apr 28, 2003 // Edited by: Eiji Inoue import java.rmi.*; import java.rmi.server.*; public class ServerImpl extends UnicastRemoteObject implements Server { Client client; static String serverName; static int[] r_cmd, r_dat, cmd_buf, rpl_buf; static int length; static cam p; static { try { serverName = java.net.InetAddress.getLocalHost().getHost Name(); }catch(Exception e){ serverName = "localhost"; } } public ServerImpl() throws Exception { super(); r_cmd = new int[4096*16]; r_dat = new int[4096*16]; cmd_buf = new int[4096*16]; rpl_buf = new int[4096*16]; p = new cam(); } public void register (Client aclient) { client = aclient; } public void camac_cmd(int[] cmd, int[] dat, int length, int examN) throw s RemoteException{ System.out.println(" RMI: Server side: "); System.out.println(" RMI: Received CAMAC command: " + "array length = " + length); for (int i = 0; i < length + 1; i++) System.out.println(" cmd[" + i + "] = 0x" + Integer.toHexStr ing(cmd[i]) + ", dat[" + i + "] = 0x" + Integer.toHexString(dat[i])); ServerImpl.r_cmd = cmd; ServerImpl.r_dat = dat; ServerImpl.length = length; //JNI try{ System.out.println(); System.out.println(" JNI, Java side: before Native Call"); for (int i = 0; i < ServerImpl.length + 1; i++) System.out.println(" ServerImpl.r_cmd[" + i + "] = 0x" + Integer.t oHexString(ServerImpl.r_cmd[i]) + ", ServerImpl.r_dat[" + i + "] = 0x" + Integer .toHexString(ServerImpl.r_dat[i])); int sum = ServerImpl.p.cmdArray(ServerImpl.r_cmd, ServerImpl.r_dat, ServerIm pl.cmd_buf, ServerImpl.rpl_buf, ServerImpl.length, examN); // if ( examN != 0) { ServerImpl.length = ServerImpl.cmd_buf[1] / 2; // } else { // ServerImpl.length = length; // } System.out.println(); System.out.println(" JNI, Java side: after Native Call" + " array length = " + ServerImpl.length); for (int i = 0; i < ServerImpl.length + 1; i++) { // System.out.println(" ServerImpl.r_cmd[" + i + "] = 0x" + Integer .toHexString(ServerImpl.r_cmd[i]) + ", ServerImpl.r_dat[" + i + "] = 0x" + Integ er.toHexString(ServerImpl.r_dat[i]) + ", ServerImpl.cmd_buf[" + i + "] = 0x" + I nteger.toHexString(ServerImpl.cmd_buf[i]) + ", ServerImpl.rpl_buf[" + i + "] = 0 x" + Integer.toHexString(ServerImpl.rpl_buf[i])); } client.camac_reply (ServerImpl.r_cmd, ServerImpl.r_dat, ServerImpl.cmd_b uf, ServerImpl.rpl_buf, ServerImpl.length); } catch ( Exception e ) { System.err.println ("Failed to exec for camac"); } //JNI end } public static void main(String argv[]) throws Exception { //System.setSecurityManager(new RMISecurityManager()); ServerImpl obj = new ServerImpl(); Naming.bind("//"+serverName+"/Server", obj); System.out.println("bind done"); } } [inoue@onlsbc1 exam]$ (2-1-3e). cam.java [inoue@onlsbc1 exam]$ cat cam.java // File name: cam.java // Date: Apr 28, 2003 // Edited by: Eiji Inoue // // // Parallel camac // packet format of basic camac opeation // TX // +---------+-------+-------+-------+-------+---------------------------+ // | cmd | N | A | F | | 24-bit DATA | // +---------+-------+-------+-------+-------+---------------------------+ // // RX // +---------+-------+-------+-------+-------+---------------------------+ // | rply | N | A | F | ST | 24-bit DATA | // +---------+-------+-------+-------+-------+---------------------------+ public class cam { public native int cmdArray(int j_cmd[], int j_dat[], int jrp_cmd[], int jrp_da t[], int j_length, int j_examN); static { System.loadLibrary("MyImpOfcam"); } } [inoue@onlsbc1 exam]$ (2-1-3f). cam.c [inoue@onlsbc1 exam]$ cat cam.c // file name: cam.c // Date: Apr 28, 2003 // Edited by: E.Inoue // // Parallel camac // packet format of basic camac opeation // TX // +---------+-------+-------+-------+-------+---------------------------+ // | cmd | N | A | F | | 24-bit DATA | // +---------+-------+-------+-------+-------+---------------------------+ // // RX // +---------+-------+-------+-------+-------+---------------------------+ // | rply | N | A | F | ST | 24-bit DATA | // +---------+-------+-------+-------+-------+---------------------------+ #include#include #include #include "cam.h" // exam1.c, from here #include #include #include #include #include // #include #include #include #include "pcc.h" // to #define BASE 0xE800 #define TX_DATA1REG BASE #define TX_DATA2REG (BASE+4) /* #define TX_STATUSREG (BASE+0x10) */ #define TX_STATUSREG (BASE+0x1c) #define TXSTATUS_BUSY 0x10000 #define TXSTATUS_TIMEOUT 0x20000 #define RX_DATA1REG (BASE+0x20) #define RX_DATA2REG (BASE+0x24) /* #define RX_FIFOREG (BASE+0x30) */ #define RX_FIFOREG (BASE+0x3c) #define CMD_F16_A0_N3 0xE0030010 #define CMD_F0_A0_N3 0xE0030000 // exam1.c, read.c, from here //#define SWREG 4 #define SWREG 3 #define CC_READ 0 #define CC_WRITE 16 #define CC_COUNT 10 #define CC_COUNT1 20 #define BUF_LEN 1000*2 // to int gen_command_packet(int *packet1, int *packet2, int n, int a, int f, int d ata, int flag ) { int packet = 0; if( n >= 0 && (n <=23 | n==25) && a >= 0 && a <=15 && f >=0 && f <=31 ) { packet = n; packet <<= 8; packet |= a; packet <<=8; packet += f; switch (flag) { case 0: // normal packet |= 0x80000000; break; case 1: // start bit packet |= 0xC0000000; break; case 2: // end bit packet |= 0xA0000000; break; default: packet |= 0xE0000000; } *packet1 = data & 0xFFFFFF; *packet2 = packet; } else return -1; return 0; } void dump_reg(struct pccreg *pccreg) { // printf("Tx Data1 = %x\n", pccreg->TxData1); // printf("Tx Data2 = %x\n", pccreg->TxData2); printf("Tx Control = %x\n", pccreg->TxControl); printf("Tx Status = %x\n", pccreg->TxStatus); printf("Tx Address = %x\n", pccreg->TxAddress); printf("Tx Preset Count = %x\n", pccreg->TxPresetCount); printf("Tx Actual Count = %x\n", pccreg->TxActualCount); printf("Tx Fifo Count = %x\n", pccreg->TxFifoCount); // printf("Rx Data1 = %x\n", pccreg->RxData1); // printf("Rx Data2 = %x\n", pccreg->RxData2); printf("Rx Control = %x\n", pccreg->RxControl); printf("Rx Status = %x\n", pccreg->RxStatus); printf("Rx Address = %x\n", pccreg->RxAddress); printf("Rx Preset Count = %x\n", pccreg->RxPresetCount); printf("Rx Actual Count = %x\n", pccreg->RxActualCount); printf("Rx Fifo Count = %x\n", pccreg->RxFifoCount); printf("System = %x\n", pccreg->System); } int put_data( int fd, int *buf ) { /* E.Inoue if( ioctl(fd, PCCIOC_PUT_DATA, buf) == -1 ) { printf("ioctl PCCIOC_PUT_DATA : error code = %d\n", errno); return -1; } else */ return 0; } int get_data( int fd, int *buf ) { /* E.Inoue if( ioctl(fd, PCCIOC_GET_DATA, buf) == -1 ) { printf("ioctl PCCIOC_GET_DATA : error code = %d\n", errno); return -1; } else */ return 0; } JNIEXPORT jint JNICALL Java_cam_cmdArray(JNIEnv *env, jobject obj, jintArray r_cmd, jintArray r_dat, ji ntArray cmd_buf, jintArray rpl_buf, jint length1, jint examN) { int sum = 0; jsize len1 = (*env)->GetArrayLength(env, r_cmd); jint *c_cmd = (*env)->GetIntArrayElements(env, r_cmd, 0); jsize len2 = (*env)->GetArrayLength(env, r_dat); jint *c_dat = (*env)->GetIntArrayElements(env, r_dat, 0); jsize len3 = (*env)->GetArrayLength(env, cmd_buf); jint *ccmdbuf = (*env)->GetIntArrayElements(env, cmd_buf, 0); jsize len4 = (*env)->GetArrayLength(env, rpl_buf); jint *crplybuf = (*env)->GetIntArrayElements(env, rpl_buf, 0); int loop1 = length1; int ii, j, data, cmd, value; int example = examN; // exam1.c, exam2.c, exam21.c, exam3.c, exam4.c, exam5.c exam6.c, pio_write_read .c, read.c, read_write.c from here int fd, i, len; int status, loop = 1; int length = BUF_LEN; int* cbuf = ccmdbuf + 2; int* rbuf = crplybuf + 2; int rply; struct pccreg pccreg; unsigned int i1, j1, k1; int retlen; int *w_buffer, *r_buffer; int count, result; int packet1, packet2; struct pollfd pollfds; int timeout = 5000;/* Timeout in msec. */ // to here. printf ("\n JNI, C side: Received CAMAC command: "); printf ("array length = %d\n", length1); printf ("example number = %d\n", example); switch ( example ) { case 1: // exam1.c, from here if( (status = gen_init( length, ccmdbuf )) == -1 ) { printf("gen_cc_init error...\n"); exit(0); } if( (status = gen_init( length, crplybuf )) == -1 ) { printf("gen_cc_init error...\n"); exit(0); } if( (status = gen_cc_begin( ccmdbuf, 25, 0, 17, 0 )) == -1 ) { // Z printf("gen_cc_begin error ...\n"); exit(0); } if( (status = gen_cc(ccmdbuf, 25, 0, 16, 0)) == -1 ) { // C printf("gen_cc error...\n"); exit(0); } if( (status = gen_cc(ccmdbuf, 25, 0, 24, 0)) == -1 ) { // remove Inhibi t printf("gen_cc error...\n"); exit(0); } for ( i = 0; i < 10; i++ ) { status = gen_cc(ccmdbuf, SWREG, 0, CC_WRITE, 0xFFFFFF); status = gen_cc(ccmdbuf, SWREG, 0, CC_WRITE, 0); status = gen_cc(ccmdbuf, SWREG, 0, CC_WRITE, 0x555555); status = gen_cc(ccmdbuf, SWREG, 0, CC_WRITE, 0xAAAAAA); status = gen_cc(ccmdbuf, SWREG, 0, CC_READ, 0); status = gen_cc(ccmdbuf, SWREG, 0, CC_READ, 0); status = gen_cc(ccmdbuf, SWREG, 0, CC_READ, 0); status = gen_cc(ccmdbuf, SWREG, 0, CC_READ, 0); } status = gen_cc(ccmdbuf, SWREG, 0, CC_WRITE, i); status = gen_cc_end(ccmdbuf, SWREG, 0, CC_READ, 0); if((status = cam_open( &fd, 0)) == -1) { printf("cam_open error\n"); exit(0); } len = ccmdbuf[1]; // for(i = 0; i < len; i += 2) for(i = 0; i < len; i += 2) // printf("data = %x cmd = %x\n", cmdbuf[i+2], cmdbuf[i+3]); printf("data = %x cmd = %x\n", ccmdbuf[i+2], ccmdbuf[i+3]); for (i = 0; i < loop; i++) if( (status = cam_exec_pio( fd, ccmdbuf, crplybuf )) < 0 ) { printf("cam_exec_pio error\n"); exit(0); } cam_close( fd ); // length1 = ccmdbuf[1]; // to break; case 2: // exam2.c, from here if( (status = gen_init( length, ccmdbuf )) == -1 ) { printf("gen_cc_init error...\n"); exit(0); } if( (status = gen_init( length, crplybuf )) == -1 ) { printf("gen_cc_init error...\n"); exit(0); } if( (status = gen_cc_begin( ccmdbuf, 25, 0, 17, 0 )) == -1 ) { // Z printf("gen_cc_begin error ...\n"); exit(0); } if( (status = gen_cc(ccmdbuf, 25, 0, 16, 0)) == -1 ) { // C printf("gen_cc error...\n"); exit(0); } if( (status = gen_cc(ccmdbuf, 25, 0, 24, 0)) == -1 ) { // remove Inhibit printf("gen_cc error...\n"); exit(0); } for ( i = 0; i < 10; i++ ) { status = gen_cc(ccmdbuf, SWREG, 0, CC_WRITE, 0xFFFFFF); status = gen_cc(ccmdbuf, SWREG, 0, CC_READ, 0); status = gen_cc(ccmdbuf, SWREG, 0, CC_WRITE, 0); status = gen_cc(ccmdbuf, SWREG, 0, CC_READ, 0); status = gen_cc(ccmdbuf, SWREG, 0, CC_WRITE, 0x555555); status = gen_cc(ccmdbuf, SWREG, 0, CC_READ, 0); status = gen_cc(ccmdbuf, SWREG, 0, CC_WRITE, 0xAAAAAA); status = gen_cc(ccmdbuf, SWREG, 0, CC_READ, 0); } status = gen_cc(ccmdbuf, SWREG, 0, CC_WRITE, i); status = gen_cc_end(ccmdbuf, SWREG, 0, CC_READ, 0); if((status = cam_open( &fd, 0 )) == -1) { printf("cam_open error\n"); exit(0); } len = ccmdbuf[1]; printf("len = %x\n", len); // cbuf = cmdbuf+ 10; rbuf = crplybuf+10; // for(i = 0; i < len; i += 2) // printf("data = %x cmd = %x\n", ccmdbuf[i+2], ccmdbuf[i+3]); for(i = 0; i < len; i += 2) printf("data = %x cmd = %x\n", ccmdbuf[i+2], ccmdbuf[i+3]); for (i = 0; i < loop; i++) { if( (status = gen_init( length, crplybuf )) == -1 ) { printf("gen_cc_init error...\n"); exit(0); } if( (status = cam_exec_dma( fd, ccmdbuf, crplybuf )) < 0 ) { printf("cam_exec_dma error\n"); exit(0); } /* E.Inoue from here */ printf ("array length = %d\n", length1); for( j = 0; j < len - 16; j +=16 ) { printf("rbuf[%x] = %x\n", j, rbuf[j]&0xFFFFFF); } for( j = 0; j < 20; j +=1 ) { printf("rbuf[%x] = %x\n", j, rbuf[j]&0xFFFFFF); } /* to here */ for( j = 0; j < len - 16; j +=16 ) { if( (rbuf[j]&0xFFFFFF) != 0xFFFFFF) { printf("j = %d : written data = %x read data = %x\n", j, 0xFFFFFF, rbuf[j]&0xFFFFFF); exit(0); } if( (rbuf[j+4]&0xFFFFFF) != 0) { printf("j = %d : written data = %x read data = %x\n", j, 0, rbuf[j]&0xFFFFFF); exit(0); } if( (rbuf[j+8]&0xFFFFFF) != 0x555555) { printf("j = %d : written data = %x read data = %x\n", j, 0x555555, rbuf[j]&0xFFFFFF); exit(0); } if( (rbuf[j+12]&0xFFFFFF) != 0xAAAAAA) { printf("j = %d : written data = %x read data = %x\n", j, 0xAAAAAA, rbuf[j]&0xFFFFFF); exit(0); } } } cam_close( fd ); // to here. break; case 3: // exam3.c, from here if( (status = gen_init( length, ccmdbuf )) == -1 ) { printf("gen_cc_init error...\n"); exit(0); } if( (status = gen_init( length, crplybuf )) == -1 ) { printf("gen_cc_init error...\n"); exit(0); } if( (status = gen_cc_begin( ccmdbuf, 25, 0, 17, 0 )) == -1 ) { // Z printf("gen_cc_begin error ...\n"); exit(0); } if( (status = gen_cc(ccmdbuf, 25, 0, 16, 0)) == -1 ) { // C printf("gen_cc error...\n"); exit(0); } if( (status = gen_cc(ccmdbuf, 25, 0, 26, 0)) == -1 ) { // set Inhibit printf("gen_cc error...\n"); exit(0); } if( (status = gen_cc(ccmdbuf, 25, 0, 24, 0)) == -1 ) { // remove Inhibit printf("gen_cc error...\n"); exit(0); } if( (status = gen_cc(ccmdbuf, 25, 1, 24, 0)) == -1 ) { // disable Interrup t printf("gen_cc error...\n"); exit(0); } if( (status = gen_cc(ccmdbuf, 25, 1, 26, 0)) == -1 ) { // enable Interrupt printf("gen_cc error...\n"); exit(0); } if( (status = gen_cc(ccmdbuf, 25, 1, 16, 0xFFFFFF)) == -1 ) { // write int errupt enable bits printf("gen_cc error...\n"); exit(0); } if( (status = gen_cc(ccmdbuf, 25, 1, 26, 0)) == -1 ) { // read interrupt e nable bits printf("gen_cc error...\n"); exit(0); } if( (status = gen_cc(ccmdbuf, 25, 2, 26, 0)) == -1 ) { // set fast cycle printf("gen_cc error...\n"); exit(0); } if( (status = gen_cc_end(ccmdbuf, 25, 2, 24, 0)) == -1 ) { // reset fast c lcle printf("gen_cc error...\n"); exit(0); } if((status = cam_open( &fd, 1 )) == -1) { printf("cam_open error\n"); exit(0); } if( (status = cam_exec_pio( fd, ccmdbuf, crplybuf )) < 0 ) { printf("cam_exec_pio error\n"); exit(0); } printf("number of reply frames : %d\n", crplybuf[1]/2); printf("Z : data = %x rply = %x\n", rbuf[0], rbuf[1]); printf("C : data = %x rply = %x\n", rbuf[2], rbuf[3]); printf("set Inhibit : data = %x rply = %x\n", rbuf[4], rbuf[5]); printf("remove Inhibit : data = %x rply = %x\n", rbuf[6], rbuf[7]); printf("disable Interrupt : data = %x rply = %x\n", rbuf[8], rbuf[9]); printf("enable Interrupt : data = %x rply = %x\n", rbuf[10], rbuf[11]); printf("write Interrupt enable bits : data = %x rply = %x\n", rbuf[12], rb uf[13]); printf("read Interrupt enable bits : data = %x rply = %x\n", rbuf[14], rbu f[15]); printf("set fast cycle : data = %x rply = %x\n", rbuf[16], rbuf[17]); printf("reset fast cyclc : data = %x rply = %x\n", rbuf[18], rbuf[19]); cam_close( fd ); // to here. break; case 4: // exam4.c, from here if( (status = gen_init( length, ccmdbuf )) == -1 ) { printf("gen_daq_init error...\n"); exit(0); } if( (status = gen_init( length, crplybuf )) == -1 ) { printf("gen_daq_init error...\n"); exit(0); } if( (status = gen_daq_begin(ccmdbuf, DAQ_READ_STATUS)) == -1 ) { // read s tatus printf("gen_daq DAQ_READ_STATUS error...\n"); exit(0); } if( (status = gen_daq(ccmdbuf, DAQ_CLR_BUSYOUT)) == -1 ) { // clear busy o ut printf("gen_daq DAQ_CLR_BUSYOUT error...\n"); exit(0); } if( (status = gen_daq(ccmdbuf, DAQ_CLR_EVTCNT)) == -1 ) { // clear evnet c ounter printf("gen_daq DAQ_CLR_EVTCNT error...\n"); exit(0); } if( (status = gen_daq_end(ccmdbuf, DAQ_ENABLE_TRIGIN)) == -1 ) { // enable trigger input printf("gen_daq DAQ_ENABLE_TRIGIN error...\n"); exit(0); } if((status = cam_open( &fd, 1 )) == -1) { printf("cam_open error\n"); exit(0); } if( (status = cam_exec_pio( fd, ccmdbuf, crplybuf )) < 0 ) { printf("cam_exec_pio error\n"); exit(0); } printf("number of reply frames : %d\n", crplybuf[1]/2); printf("read status : data = %x cmd = %x : data = %x rply = %x\n", cbuf[0], cbuf[1], rbuf[0], rbuf[1]); printf("clear busy out : data = %x cmd = %x : data = %x rply = %x\n", cbuf[2], cbuf[3], rbuf[2], rbuf[3]); printf("clear event counter : data = %x cmd = %x : data = %x rply = %x\n", cbuf[4], cbuf[5], rbuf[4], rbuf[5]); printf("enable trigger input : data = %x cmd = %x :data = %x rply = %x\n", cbuf[6], cbuf[7], rbuf[6], rbuf[7]); if( (status = gen_init( length, ccmdbuf )) == -1 ) { printf("gen_daq_init error...\n"); exit(0); } if( (status = gen_init( length, crplybuf )) == -1 ) { printf("gen_daq_init error...\n"); exit(0); } if( (status = gen_daq_packet( ccmdbuf, DAQ_CLR_BUSYOUT) ) == -1 ) { printf("gen_daq_packet error ...\n"); exit(0); } for( i = 0; i < 10; i++) { sleep(1); if( (status = cam_read_pio( fd, &data, &rply )) < 0 ) { printf("cam_read_pio error cod = %d\n", status); exit(0); } printf("LAM frame : data = %x rply = %x\n", data, rply); if( (status = cam_exec_pio( fd, ccmdbuf, crplybuf )) < 0 ) { printf("cam_exec_pio error\n"); exit(0); } printf("Clear BusyOut : data = %x cmd = %x : data = %x rply = %x\n", cbuf[0], cbuf[1], rbuf[0], rbuf[1]); if( (status = gen_init( length, crplybuf )) == -1 ) { printf("gen_daq_init error...\n"); exit(0); } } if( (status = gen_init( length, ccmdbuf )) == -1 ) { printf("gen_daq_init error...\n"); exit(0); } crplybuf[2] = crplybuf[3] = crplybuf[4] = crplybuf[5]= 0; if( (status = gen_init( length, crplybuf )) == -1 ) { printf("gen_daq_init error...\n"); exit(0); } if( (status = gen_daq_begin( ccmdbuf, DAQ_READ_EVTCNT )) == -1 ) { // read event counter printf("gen_daq_begin error ...\n"); exit(0); } if( (status = gen_daq_end(ccmdbuf, DAQ_DISABLE_TRIGIN)) == -1 ) { // disab le trigger input printf("gen_daq_end DAQ_DISABLE_TRIGIN error...\n"); exit(0); } if( (status = cam_exec_pio( fd, ccmdbuf, crplybuf )) < 0 ) { printf("cam_exec_pio error\n"); exit(0); } printf("number of reply frames : %d\n", crplybuf[1]/2); printf("read event counter : data = %x cmd = %x : data = %x rply = %x\n", cbuf[0], cbuf[1], rbuf[0], rbuf[1]); printf("disable trigger input : data = %x cmd = %x : data = %x rply = %x\n ", cbuf[2], cbuf[3], rbuf[2], rbuf[3]); cam_close( fd ); // to here. break; case 5: // exam5.c, from here if( (status = gen_init( length, ccmdbuf )) == -1 ) { printf("gen_cc_init error...\n"); exit(0); } if( (status = gen_init( length, crplybuf )) == -1 ) { printf("gen_cc_init error...\n"); exit(0); } if( (status = gen_cc_begin( ccmdbuf, 25, 0, 17, 0 )) == -1 ) { // Z printf("gen_cc_begin error ...\n"); exit(0); } if( (status = gen_cc(ccmdbuf, 25, 0, 16, 0)) == -1 ) { // C printf("gen_cc error...\n"); exit(0); } if( (status = gen_cc(ccmdbuf, 25, 0, 24, 0)) == -1 ) { // remove Inhibit printf("gen_cc error...\n"); exit(0); } if( (status = gen_cc(ccmdbuf, 25, 1, 26, 0)) == -1 ) { // enable Interrupt printf("gen_cc error...\n"); exit(0); } if( (status = gen_cc(ccmdbuf, 25, 1, 16, 0xFFFFFF)) == -1 ) { // write int errupt enable bits printf("gen_cc error...\n"); exit(0); } if( (status = gen_cc_end(ccmdbuf, 25, 1, 0, 0)) == -1 ) { // read interrup t enable bits printf("gen_cc error...\n"); exit(0); } if((status = cam_open( &fd, 1 )) == -1) { printf("cam_open error\n"); exit(0); } if( (status = cam_exec_pio( fd, ccmdbuf, crplybuf )) < 0 ) { printf("cam_exec_pio error\n"); exit(0); } printf("number of reply frames : %d\n", crplybuf[1]/2); printf("Z : data = %x rply = %x\n", rbuf[0], rbuf[1]); printf("C : data = %x rply = %x\n", rbuf[2], rbuf[3]); printf("remove Inhibit : data = %x rply = %x\n", rbuf[4], rbuf[5]); printf("enable Interrupt : data = %x rply = %x\n", rbuf[6], rbuf[7]); printf("write Interrupt enable bits : data = %x rply = %x\n", rbuf[8], rbu f[9]); printf("read Interrupt enable bits : data = %x rply = %x\n", rbuf[10], rbu f[11]); if( (status = gen_init( length, ccmdbuf )) == -1 ) { printf("gen_cc_init error...\n"); exit(0); } if( (status = gen_init( length, crplybuf )) == -1 ) { printf("gen_cc_init error...\n"); exit(0); } if( (status = gen_cc_packet( ccmdbuf, SWREG, 0, 26, 0 )) == -1 ) { printf("gen_cc_begin error ...\n"); exit(0); } if( (status = cam_exec_pio( fd, ccmdbuf, crplybuf )) < 0 ) { printf("cam_exec_pio error\n"); exit(0); } printf("number of reply frames : %d\n", crplybuf[1]/2); printf("SW enable interrupt : data = %x rply = %x\n", rbuf[0], rbuf[1]); for( i = 0; i < 10; i++ ){ sleep(1); /* E.Inoue if( ioctl(fd, PCCIOC_DUMP_REGISTERS, &pccreg) == -1 ) { printf("ioctl PCCIOC_DUMP_REGISTERS error...\n"); exit(0); } */ dump_pccreg(&pccreg); if( (status = gen_init( length, ccmdbuf )) == -1 ) { printf("gen_cc_init error...\n"); exit(0); } if( (status = gen_init( length, crplybuf )) == -1 ) { printf("gen_cc_init error...\n"); exit(0); } if( (status = gen_cc_packet( ccmdbuf, SWREG, 0, 14, 0 )) == -1 ) { // g en interrupt printf("gen_cc_begin error ...\n"); exit(0); } if( (status = cam_exec_pio( fd, ccmdbuf, crplybuf )) < 0 ) { printf("cam_exec_pio error\n"); exit(0); } if( (status = cam_wait_lam( fd, crplybuf )) < 0 ) { printf("cam_wait_lan error = %d \n", status ); exit(0); } printf("number of reply frames : %d\n", crplybuf[1]/2); printf("LAM reply : data = %x rply = %x\n", rbuf[0], rbuf[1]); if( (status = gen_init( length, ccmdbuf )) == -1 ) { printf("gen_cc_init error...\n"); exit(0); } if( (status = gen_init( length, crplybuf )) == -1 ) { printf("gen_cc_init error...\n"); exit(0); } if( (status = gen_cc_packet( ccmdbuf, SWREG, 0, 10, 0 )) == -1 ) { // c lear interrupt printf("gen_cc_begin error ...\n"); exit(0); } if( (status = cam_exec_pio( fd, ccmdbuf, crplybuf )) < 0 ) { printf("cam_exec_pio error\n"); exit(0); } if( (status = gen_init( length, crplybuf )) == -1 ) { printf("gen_cc_init error...\n"); exit(0); } } cam_close( fd ); // to here. break; case 6: // exam6.c, from here if( (status = gen_init( length, ccmdbuf )) == -1 ) { printf("gen_daq_init error...\n"); exit(0); } if( (status = gen_init( length, crplybuf )) == -1 ) { printf("gen_daq_init error...\n"); exit(0); } if( (status = gen_daq_end(ccmdbuf, DAQ_ENABLE_TRIGIN)) == -1 ) { // enable trigger input printf("gen_daq error...\n"); exit(0); } if((status = cam_open( &fd, 1 )) == -1) { printf("cam_open error\n"); exit(0); } if( (status = cam_exec_pio( fd, ccmdbuf, crplybuf )) < 0 ) { printf("cam_exec_pio error\n"); exit(0); } printf("number of reply frames : %d\n", crplybuf[1]/2); printf("enable trigger input : data = %x rply = %x\n", rbuf[8], rbuf[9]); if( (status = gen_init( length, crplybuf )) == -1 ) { printf("gen_daq_init error...\n"); exit(0); } /* E.Inoue if( ioctl( fd, PCCIOC_WAIT_TRIG, crplybuf ) < 0 ) { printf("PCCIOC_WAIT_TRIG error code = %d\n", errno); exit(0); } */ cam_close( fd ); // to here. break; case 7: // exam21.c, from here if( (status = gen_init( length, ccmdbuf )) == -1 ) { printf("gen_cc_init error...\n"); exit(0); } if( (status = gen_init( length, crplybuf )) == -1 ) { printf("gen_cc_init error...\n"); exit(0); } if( (status = gen_cc_begin( ccmdbuf, 25, 0, 17, 0 )) == -1 ) { // Z printf("gen_cc_begin error ...\n"); exit(0); } if( (status = gen_cc(ccmdbuf, 25, 0, 16, 0)) == -1 ) { // C printf("gen_cc error...\n"); exit(0); } if( (status = gen_cc(ccmdbuf, 25, 0, 24, 0)) == -1 ) { // remove Inhibit printf("gen_cc error...\n"); exit(0); } for ( i = 0; i < 1; i++ ) { status = gen_cc(ccmdbuf, SWREG, 0, CC_WRITE, 0xFFFFFF); status = gen_cc(ccmdbuf, SWREG, 0, CC_READ, 0); status = gen_cc(ccmdbuf, SWREG, 0, CC_WRITE, 0); status = gen_cc(ccmdbuf, SWREG, 0, CC_READ, 0); status = gen_cc(ccmdbuf, SWREG, 0, CC_WRITE, 0x555555); status = gen_cc(ccmdbuf, SWREG, 0, CC_READ, 0); status = gen_cc(ccmdbuf, SWREG, 0, CC_WRITE, 0xAAAAAA); status = gen_cc(ccmdbuf, SWREG, 0, CC_READ, 0); } status = gen_cc(ccmdbuf, SWREG, 0, CC_WRITE, i); status = gen_cc_end(ccmdbuf, SWREG, 0, CC_READ, 0); if((status = cam_open( &fd, 0 )) == -1) { printf("cam_open error\n"); exit(0); } len = ccmdbuf[1]; cbuf = ccmdbuf+ 10; rbuf = crplybuf+10; for (i = 0; i < loop; i++) { // if((i%1000) == 0) printf("loop = %d\n", i); if( (status = gen_init( length, crplybuf )) == -1 ) { printf("gen_cc_init error...\n"); exit(0); } if( (status = cam_exec_dma_seq( fd, ccmdbuf, crplybuf )) < 0 ) { printf("cam_exec_dma error\n"); exit(0); } /* for( j = 0; j < len - 20; j +=16 ) { printf("data = %x %x %x %x\n", rbuf[j], rbuf[j+1], rbuf[j+2], rbuf[j+3]); printf("data = %x %x %x %x\n", rbuf[j+4], rbuf[j+5], rbuf[j+6], rbuf[j+7]); printf("data = %x %x %x %x\n", rbuf[j+8], rbuf[j+9], rbuf[j+10], rbuf[j+11]); printf("data = %x %x %x %x\n", rbuf[j+12], rbuf[j+13], rbuf[j+14], rbuf[j+15]); if( (rbuf[j]&0xFFFFFF) != 0xFFFFFF) { printf("j = %d : written data = %x read data = %x\n", j, 0xFFFFFF, rbuf[j]&0xFFFFFF); exit(0); } if( (rbuf[j+4]&0xFFFFFF) != 0) { printf("j = %d : written data = %x read data = %x\n", j, 0, rbuf[j+4]&0xFFFFFF); exit(0); } if( (rbuf[j+8]&0xFFFFFF) != 0x555555) { printf("j = %d : written data = %x read data = %x\n", j, 0x555555, rbuf[j+8]&0xFFFFFF); exit(0); } if( (rbuf[j+12]&0xFFFFFE) != 0xAAAAAA) { printf("j = %d : written data = %x read data = %x\n", j, 0xAAAAAA, rbuf[j+12]&0xFFFFFF); exit(0); } } */ } cam_close( fd ); // to here. break; case 8: // pio_write_read.c, from here. count = CC_COUNT; r_buffer = (int *)malloc(8); w_buffer = (int *)malloc(8); /* E.Inoue fd = open("/dev/pcc0", O_RDWR); if( fd == -1 ) { printf("pcc: open error\n"); exit(0); } if( ioctl(fd, PCCIOC_DUMP_REGISTERS, &pccreg) == -1 ) { printf("ioctl PCCIOC_DUMP_REGISTERS error...\n"); exit(0); } */ dump_reg(&pccreg); for( i1 = 0; i1 < loop; i1++ ) { j1 = i1&0xFFFFFF; /* CC_WRITE*/ if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_WRITE, j1, -1)) < 0 ) { printf("Command error...\n"); exit(0); } w_buffer[0] = packet1; w_buffer[1] = packet2; //printf("packet1 = %x packet2 = %x\n", packet1, packet2); status = put_data(fd, w_buffer); status = get_data(fd, r_buffer); /* CC_READ */ if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_READ, 0, -1)) < 0 ) { printf("Command error...\n"); exit(0); } w_buffer[0] = packet1; w_buffer[1] = packet2; //printf("packet1 = %x packet2 = %x\n", packet1, packet2); status = put_data(fd, w_buffer); status = get_data(fd, r_buffer); r_buffer[0] &= 0xFFFFFF; /* E.Inoue if( j1 != r_buffer[0] ) { printf("loop = %x : written data = %x : read data = %x\n", i1, j1, r_ buffer[0]); exit(0); } */ } /* E.Inoue if( ioctl(fd, PCCIOC_DUMP_REGISTERS, &pccreg) == -1 ) { printf("ioctl PCCIOC_DUMP_REGISTERS error...\n"); exit(0); } */ dump_reg(&pccreg); /* E.Inoue close(fd); */ // to here. break; case 9: // read.c, from here. count = CC_COUNT1; r_buffer = (int *)malloc(100*8); // r_buffer = (int *)malloc(count*8); w_buffer = (int *)malloc(count*8); if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_WRITE, 0xFFFFFF, 1)) < 0 ) { printf("Command error...\n"); exit(0); } w_buffer[0] = packet1; w_buffer[1] = packet2; printf("packet1 = %x packet2 = %x\n", packet1, packet2); if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_READ, 0, 0)) < 0 ) { printf("Command error...\n"); exit(0); } w_buffer[2] = packet1; w_buffer[3] = packet2; printf("packet1 = %x packet2 = %x\n", packet1, packet2); for ( i1 = 4 ; i1 < (CC_COUNT-2)*2; i1 += 4) { if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_WRITE, i1, 0)) < 0 ) { printf("Command error...\n"); exit(0); } w_buffer[i1] = packet1; w_buffer[i1+1] = packet2; printf("packet1 = %x packet2 = %x\n", packet1, packet2); if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_READ, 0, 0)) < 0 ) { printf("Command error...\n"); exit(0); } w_buffer[i1+2] = packet1; w_buffer[i1+3] = packet2; printf("packet1 = %x packet2 = %x\n", packet1, packet2); } if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_WRITE, 0x555555, 0)) < 0 ) { printf("Command error...\n"); exit(0); } w_buffer[i1] = packet1; w_buffer[i1+1] = packet2; printf("packet1 = %x packet2 = %x\n", packet1, packet2); if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_READ, 0, 2)) < 0 ) { printf("Command error...\n"); exit(0); } w_buffer[i1+2] = packet1; w_buffer[i1+3] = packet2; printf("packet1 = %x packet2 = %x\n", packet1, packet2); /* E.Inoue fd = open("/dev/pcc0", O_RDWR); if( fd == -1 ) { printf("open error...\n"); exit(0); } */ /* if( ioctl(fd, PCCIOC_DUMP_REGISTERS, &pccreg) == -1 ) { printf("ioctl PCCIOC_DUMP_REGISTERS error...\n"); exit(0); } */ // dump_reg(&pccreg); length = count*8; for(i1 = 0; i1 < loop; i1++) { /* E.Inoue retlen = read(fd, r_buffer, length); */ // printf("retlen = %d\n", retlen); /* for(j1 = 0; j1 < count*2; j1++) { if( w_buffer[j1] != r_buffer[j1] ) { printf("data error : loop = %d, i = %d\n", loop, i1); printf("written data read data\n"); for(k1 = i1; k1 < 10; k1++) printf("%x %x\n", w_buffer[k1], r_buffer[k1]); free(r_buffer); free(w_buffer); close(fd); exit(0); } r_buffer[i1] = 0; } */ // for(k = 0; k < 20; k += 2) // printf("written data : %x %x\n", w_buffer[k], w_buffer[k+1]); // for(k = 0; k < 20; k += 2) // printf("read data : %x %x\n", r_buffer[k], r_buffer[k+1]); if(!(i1 % 10000)) printf("loop = %d\n", i1); } /* if( ioctl(fd, PCCIOC_DUMP_REGISTERS, &pccreg) == -1 ) { printf("ioctl PCCIOC_DUMP_REGISTERS error...\n"); exit(0); } */ // dump_reg(&pccreg); /* E.Inoue close(fd); */ // to here. break; case 0xa: // read_write.c. from here r_buffer = (int *)malloc(count*8); w_buffer = (int *)malloc(count*8); if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_WRITE, 0xFFFFFF, 1)) < 0 ) { printf("Command error...\n"); exit(0); } w_buffer[0] = packet1; w_buffer[1] = packet2; printf("packet1 = %x packet2 = %x\n", packet1, packet2); if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_READ, 0, 0)) < 0 ) { printf("Command error...\n"); exit(0); } printf("packet1 = %x packet2 = %x\n", packet1, packet2); w_buffer[2] = packet1; w_buffer[3] = packet2; for ( i1 = 4 ; i1 < (CC_COUNT-2)*2; i1 += 4) { if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_WRITE, i1, 0)) < 0 ) { printf("Command error...\n"); exit(0); } w_buffer[i1] = packet1; w_buffer[i1+1] = packet2; if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_READ, 0, 0)) < 0 ) { printf("Command error...\n"); exit(0); } w_buffer[i1+2] = packet1; w_buffer[i1+3] = packet2; } if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_WRITE, 0x555555, 0)) < 0 ) { printf("Command error...\n"); exit(0); } w_buffer[i1] = packet1; w_buffer[i1+1] = packet2; printf("packet1 = %x packet2 = %x\n", packet1, packet2); if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_READ, 0, 2)) < 0 ) { printf("Command error...\n"); exit(0); } printf("packet1 = %x packet2 = %x\n", packet1, packet2); w_buffer[i1+2] = packet1; w_buffer[i1+3] = packet2; printf("packet1 = %x packet2 = %x\n", packet1, packet2); /* E.Inoue // fd = open("/dev/pcc0", O_RDWR|O_NONBLOCK); fd = open("/dev/pcc0", O_RDWR); if( fd == -1 ) { printf("open error...\n"); exit(0); } if( ioctl(fd, PCCIOC_DUMP_REGISTERS, &pccreg) == -1 ) { printf("ioctl PCCIOC_DUMP_REGISTERS error...\n"); exit(0); } */ dump_reg(&pccreg); pollfds.fd = fd; pollfds.events = POLLIN;/* Wait for CAMAC read */ count = CC_COUNT; length = count*8; for(i1 = 0; i1 < loop; i1++) { // retlen = read(fd, r_buffer, length); /* E.Inoue retlen = write(fd, w_buffer, length); */ printf("retlen of write = %d\n", retlen); /* E.Inoue result = poll (&pollfds, 1, timeout); */ switch (result) { case 0: printf ("timeout\n"); break; case -1: perror ("poll"); exit (1); default: for(j1 = 0; j1 < count*2; j1 += 2) { if( (w_buffer[j1]&0xFFFFFF) != (r_buffer[j1]&0xFFFFFF) ) { printf("data error : loop = %d, i = %d\n", loop, i1); printf("written data read data\n"); for(k1 = j1; k1 < 10; k1++) printf("%x %x\n", w_buffer[k1], r_buffer[k1]); free(r_buffer); free(w_buffer); close(fd); /* E.Inoue exit(0); */ } r_buffer[i1] = 0; } } if(!(i1 % 10000)) printf("loop = %d\n", i1); } /* E.Inoue close(fd); */ // to here. break; case 0xb: // reg_dump.c, from here /* E.Inoue if( (fd = open("/dev/pcc0", O_RDWR)) == -1 ) { printf("pcc0 open error,,,\n"); exit(0); } if( ioctl(fd, PCCIOC_DUMP_REGISTERS, &pccreg) == -1 ) { printf("ioctl PCCIOC_DUMP_REGISTERS error...\n"); exit(0); } */ dump_reg(&pccreg); /* E.Inoue close(fd); */ // to here. break; case 0xc: // write.c, from here count = CC_COUNT1; w_buffer = (int *)malloc(CC_COUNT1*8); if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_WRITE, 0xFFFFFF, 1)) < 0 ) { printf("Command error...\n"); exit(0); } w_buffer[0] = packet1; w_buffer[1] = packet2; printf("packet1 = %x packet2 = %x\n", packet1, packet2); if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_READ, 0, 0)) < 0 ) { printf("Command error...\n"); exit(0); } printf("packet1 = %x packet2 = %x\n", packet1, packet2); w_buffer[2] = packet1; w_buffer[3] = packet2; for ( i1 = 4 ; i1 < (CC_COUNT1-2)*2; i1 += 4) { if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_WRITE, i1, 0)) < 0 ) { printf("Command error...\n"); exit(0); } w_buffer[i1] = packet1; w_buffer[i1+1] = packet2; printf("packet1 = %x packet2 = %x\n", packet1, packet2); if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_READ, 0, 0)) < 0 ) { printf("Command error...\n"); exit(0); } w_buffer[i1+2] = packet1; w_buffer[i1+3] = packet2; printf("packet1 = %x packet2 = %x\n", packet1, packet2); } if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_WRITE, 0x555555, 0)) < 0 ) { printf("Command error...\n"); exit(0); } w_buffer[i1] = packet1; w_buffer[i1+1] = packet2; printf("packet1 = %x packet2 = %x\n", packet1, packet2); if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_READ, 0, 2)) < 0 ) { printf("Command error...\n"); exit(0); } w_buffer[i1+2] = packet1; w_buffer[i1+3] = packet2; printf("packet1 = %x packet2 = %x\n", packet1, packet2); /* E.Inoue if( (fd = open("/dev/pcc0", O_RDWR)) == -1 ) { printf("pcc0 open error,,,\n"); exit(0); } */ /* if( ioctl(fd, PCCIOC_RESET) == -1 ) { printf("ioctl PPCIIOC_RESET error...\n"); exit(0); } */ /* E.Inoue if( ioctl(fd, PCCIOC_DUMP_REGISTERS, &pccreg) == -1 ) { printf("ioctl PCCIOC_DUMP_REGISTERS error...\n"); exit(0); } */ // dump_reg(&pccreg); length = count*8; for(i1 = 0; i1 < loop; i1++) { /* E.Inoue retlen = write(fd, w_buffer, length); */ // printf("retlen = %d\n", retlen); } /* if( ioctl(fd, PCCIOC_DUMP_REGISTERS, &pccreg) == -1 ) { printf("ioctl PCCIOC_DUMP_REGISTERS error...\n"); exit(0); } // dump_reg(&pccreg); close(fd); */ // to here. break; case 0xd: // write_read.c, from here r_buffer = (int *)malloc(count*8); w_buffer = (int *)malloc(count*8); if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_WRITE, 0xFFFFFF, 1)) < 0 ) { printf("Command error...\n"); exit(0); } w_buffer[0] = packet1; w_buffer[1] = packet2; printf("packet1 = %x packet2 = %x\n", packet1, packet2); if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_READ, 0, 0)) < 0 ) { printf("Command error...\n"); exit(0); } printf("packet1 = %x packet2 = %x\n", packet1, packet2); w_buffer[2] = packet1; w_buffer[3] = packet2; for ( i1 = 4 ; i1 < (CC_COUNT-2)*2; i1 += 4) { if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_WRITE, i1, 0)) < 0 ) { printf("Command error...\n"); exit(0); } w_buffer[i1] = packet1; w_buffer[i1+1] = packet2; if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_READ, 0, 0)) < 0 ) { printf("Command error...\n"); exit(0); } w_buffer[i1+2] = packet1; w_buffer[i1+3] = packet2; } if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_WRITE, 0x555555, 0)) < 0 ) { printf("Command error...\n"); exit(0); } w_buffer[i1] = packet1; w_buffer[i1+1] = packet2; printf("packet1 = %x packet2 = %x\n", packet1, packet2); if( (status = gen_command_packet(&packet1, &packet2, SWREG, 0, CC_READ, 0, 2)) < 0 ) { printf("Command error...\n"); exit(0); } printf("packet1 = %x packet2 = %x\n", packet1, packet2); w_buffer[i1+2] = packet1; w_buffer[i1+3] = packet2; printf("packet1 = %x packet2 = %x\n", packet1, packet2); /* E.Inoue fd = open("/dev/pcc0", O_RDWR); if( fd == -1 ) { printf("open error...\n"); exit(0); } if( ioctl(fd, PCCIOC_DUMP_REGISTERS, &pccreg) == -1 ) { printf("ioctl PCCIOC_DUMP_REGISTERS error...\n"); exit(0); } */ printf(" E.Inoue : check before dump_reg()\n"); dump_reg(&pccreg); printf(" E.Inoue : check after dump_reg()\n"); count = CC_COUNT; length = count*8; for(i1 = 0; i1 < loop; i1++) { /* E.Inoue retlen = write(fd, w_buffer, length); if( retlen < 0) { printf("write error return code = %d...\n", errno); return errno; } */ /* E.Inoue retlen = read(fd, r_buffer, length); if( retlen < 0) { printf("read error return code = %d...\n", errno); return errno; } */ /* printf("retlen of write = %d\n", retlen); for(j1 = 0; j1 < count*2; j1 += 2) { if( (w_buffer[j1]&0xFFFFFF) != (r_buffer[j1]&0xFFFFFF) ) { printf("data error : loop = %d, i = %d\n", loop, i1); printf("written data read data\n"); for(k1 = j1; k1 < 10; k1++) printf("%x %x\n", w_buffer[k1], r_buffer[k1]); free(r_buffer); free(w_buffer); close(fd); exit(0); } r_buffer[i1] = 0; } */ if(!(i1 % 10000)) printf("loop = %d\n", i1); } /* E.Inoue close(fd); */ // to here. break; case 0xe: // camac Single action from remote machine, from here. ccmdbuf[1] = length1 * 2; for (i=1; i < length1 +2; i++) { printf(" c_cmd[%d] = 0x%x, c_dat[%d] = 0x%x\n", i, c_cmd[i], i, c_ dat[i]); } if( iopl(3) ){ printf("can not change the privilege level\n"); exit(0); } printf("\n JNI, C side: CAMAC access\n"); for( i = 1; i < loop1 + 1; i++) { switch (c_cmd[i] & 0x00000018) { case 0x00000010 : // CAMAC Write // 送信可能状態になるまで待つ value = inl(TX_STATUSREG); while (value & TXSTATUS_BUSY) { if (value & TXSTATUS_TIMEOUT) break; value = inl(TX_STATUSREG); } // camac writeコマンド&データをセットして、PCIレジスタに書き込む data = c_dat[i] & 0x00ffffff; outl(data, TX_DATA1REG); outl(CMD_F16_A0_N3, TX_DATA2REG); printf(" camac write data: data = 0x%x\n", data); // camac応答が読み出し可能状態になるまで待つ value = 0; do { value = inl(RX_FIFOREG); // for PCI ROM of new version // value = value >> 24; } while( value < 2 ); // camacからの受信用レジスタを読んで camacからの応答を得る data = inl(RX_DATA1REG); cmd = inl(RX_DATA2REG); printf(" camac write command reply: cmd = 0x%x : data = %x\ n", cmd, data); c_cmd[i] = cmd; c_dat[i] = data; break; case 0x00000000 : // CAMAC Read // 送信可能状態になるまで待つ value = inl(TX_STATUSREG); while (value & TXSTATUS_BUSY) { if (value & TXSTATUS_TIMEOUT) break; value = inl(TX_STATUSREG); } // camac readコマンド&データをセットして、PCIレジスタに書き込む outl(CMD_F0_A0_N3, TX_DATA2REG); // camac応答が読み出し可能状態になるまで待つ value = 0; do { value = inl(RX_FIFOREG); // for PCI ROM of new version // value = value >> 24; } while( value < 2); // camacからの受信用レジスタを読んで camacからの応答を得る data = inl(RX_DATA1REG); cmd = inl(RX_DATA2REG); data = 0xffffff & data; ii = 0xffffff & c_dat[i]; printf(" camac read command reply: cmd = 0x%x : data = 0x%x \n", cmd, data); c_cmd[i] = cmd; c_dat[i] = data; break; default : // Default break; } } break; default: break; } (*env)->ReleaseIntArrayElements(env, r_cmd, c_cmd, 0); (*env)->ReleaseIntArrayElements(env, r_dat, c_dat, 0); (*env)->ReleaseIntArrayElements(env, cmd_buf, ccmdbuf, 0); (*env)->ReleaseIntArrayElements(env, rpl_buf, crplybuf, 0); return sum; } [inoue@onlsbc1 exam]$ (2-1-3g). camac.c [inoue@onlsbc1 exam]$ cat camac.c /* * camac.c * * Copyright 2003 (C) 2003 Yoshiji Yasu . * */ #include #include #include #include #include #include #include #include "pcc.h" #define FAST #define MAX_LENGTH 128*1024/4 // limited by maximum length of kernel buffer #define MAX_FIFO 200 void dump_pccreg(struct pccreg *pccreg) { printf("Tx Control = %x\n", pccreg->TxControl); printf("Tx Status = %x\n", pccreg->TxStatus); printf("Tx Address = %x\n", pccreg->TxAddress); printf("Tx Preset Count = %x\n", pccreg->TxPresetCount); printf("Tx Actual Count = %x\n", pccreg->TxActualCount); printf("Tx Fifo Count = %x\n", pccreg->TxFifoCount); printf("Rx Control = %x\n", pccreg->RxControl); printf("Rx Status = %x\n", pccreg->RxStatus); printf("Rx Address = %x\n", pccreg->RxAddress); printf("Rx Preset Count = %x\n", pccreg->RxPresetCount); printf("Rx Actual Count = %x\n", pccreg->RxActualCount); printf("Rx Fifo Count = %x\n", pccreg->RxFifoCount); printf("System = %x\n", pccreg->System); } int gen_cam_command(int *data1, int *data2, int n, int a, int f, int data, int f lag ) { int cmd = 0; if( n >= 0 && (n <=23 | n==25) && a >= 0 && a <=15 && f >=0 && f <=31 ) { cmd = n; cmd <<= 8; cmd |= a; cmd <<=8; cmd += f; switch (flag) { case 0: // normal cmd |= 0x80000000; break; case 1: // start bit cmd |= 0xC0000000; break; case 2: // end bit cmd |= 0xA0000000; break; default: cmd |= 0xE0000000; } *data1 = data & 0xFFFFFF; *data2 = cmd; } else return -1; return 0; } int gen_daq_command(int *data1, int *data2, int func, int flag ) { int cmd = 0; if( func < 0 | func > 4 ) return -1; cmd = func << 16; switch (flag) { case 0: // normal cmd |= 0x90000000; break; case 1: // start bit cmd |= 0xD0000000; break; case 2: // end bit cmd |= 0xB0000000; break; default: cmd |= 0xF0000000; } *data1 = 0; *data2 = cmd; return 0; } int gen_init( int length, int* buf ) { if( length <= 0 | length > MAX_LENGTH ) return -1; buf[0] = length; buf[1] = 0; return 0; } int gen_cc_begin( int *buf, int n, int a, int f, int data ) { int status; if( buf[0] == buf[1] ) return -2; if ((status = gen_cam_command(&buf[buf[1]+2],&buf[buf[1]+3], n, a, f, data, 1) ) == -1) return status; buf[1] += 2; return status; } int gen_daq_begin( int* buf, int cmd ) { int status; if( buf[0] == buf[1] ) return -2; if( (status = gen_daq_command(&buf[buf[1]+2],&buf[buf[1]+3], cmd, 1 ) ) == -1 ) return status; buf[1] += 2; return status; } int gen_cc_end( int *buf, int n, int a, int f, int data ) { int status; if ( buf[0] == buf[1] ) return -2; if ( (status = gen_cam_command(&buf[buf[1]+2],&buf[buf[1]+3], n, a, f, data, 2 )) == -1 ) return status; buf[1] += 2; return status; } int gen_daq_end( int* buf, int cmd ) { int status; if( buf[0] == buf[1] ) return -2; if( (status = gen_daq_command(&buf[buf[1]+2],&buf[buf[1]+3], cmd, 2 ) ) == -1 ) return status; buf[1] += 2; return status; } int gen_cc( int *buf, int n, int a, int f, int data ) { int status; if( buf[0] == buf[1] ) return -2; if ( (status = gen_cam_command(&buf[buf[1]+2],&buf[buf[1]+3], n, a, f, data, 0 )) == -1 ) return status; buf[1] += 2; return status; } int gen_daq( int* buf, int cmd ) { int status; if( buf[0] == buf[1] ) return -2; if( (status = gen_daq_command(&buf[buf[1]+2],&buf[buf[1]+3], cmd, 0 ) ) == -1 ) return status; buf[1] += 2; return status; } int gen_cc_packet( int *buf, int n, int a, int f, int data ) { int status; status = gen_cam_command(&buf[buf[1]+2],&buf[buf[1]+3], n, a, f, data, -1); buf[1] += 2; return status; } int gen_daq_packet( int* buf, int cmd ) { int status; status = gen_daq_command(&buf[buf[1]+2],&buf[buf[1]+3], cmd, -1); buf[1] += 2; return status; } int chk_cc( int *buf ) { int i, length, n, a, f; int data; length = buf[0]; if( length <= 0 | length > MAX_LENGTH ) return -1; if ( length%2 ) return -1; for (i = 1; i < length + 1; i += 2 ) { data = buf[i]; if( i == 1 ) if( !(data & 0xC000 ) ) return -1; if ( i == (length -1) ) if ( !(data & 0xA000) ) return -1; if( !(data & 0x8000) ) return -1; } f = data & 0xF; a = (data>>8) & 0xF; n = (data>>16) & 0xF; if( n <= 0 | (n > 23 && n != 25) | a < 0 | a > 15 | f < 0 | f > 31 ) return -1; return 0; } int cam_open( int* fd, int flag ) { /* E.Inoue if( flag ) *fd = open("/dev/pcc0", O_RDWR|O_NONBLOCK); else *fd = open("/dev/pcc0", O_RDWR); if( fd < 0 ) return -1; else */ return 0; } void cam_close( int fd ) { /* E.Inoue close(fd); */ } int cam_read_pio( int fd, int* data, int* rply ) { int buf[2], status; /* E.Inoue if( ioctl(fd, PCCIOC_GET_DATA, buf) < 0 ) { // printf("ioctl-- get data error\n"); return errno; } */ *data = buf[0]; *rply = buf[1]; return 0; } int cam_write_pio( int fd, int data, int cmd ) { int buf[2], status; buf[0] = data; buf[1] = cmd; /* E.Inoue if( (status = ioctl(fd, PCCIOC_PUT_DATA, buf)) < 0 ) { // printf("ioctl-- put data error fd = %d status = %d\n", fd, status); return errno; } */ } int cam_exec_pio( int fd, int* cmdbuf, int* rplybuf ) { int *cbuf = cmdbuf+2; int *rbuf = rplybuf+2; int length = cmdbuf[1]; int retlen = 0; int i, j, status; // printf("length = %d\n", length); for ( i = 0; i < length; i += 2) { /* E.Inoue if( (status = ioctl(fd, PCCIOC_PUT_DATA, &cbuf[i])) < 0 ) { // printf("ioctl-- put data error fd = %d status = %d\n", fd, status) ; return errno; } // printf("cmdbuf : data = %x cmd = %x\n", cbuf[i], cbuf[i+1]); if( ioctl(fd, PCCIOC_GET_DATA, &rbuf[i]) < 0 ) { // printf("ioctl-- get data error\n"); rplybuf[1] = retlen; return errno; } else { // printf("rplybuf : data = %x cmd = %xe\n", rbuf[i], rbuf[i+1]); retlen += 2; } */ } rplybuf[1] = retlen; return 0; } int cam_exec_dma( int fd, int* cmdbuf, int* rplybuf ) { int *cbuf = cmdbuf+2; int *rbuf = rplybuf+2; int length = cmdbuf[1]; int retlen = 0; int i, j, status; retlen = length*4; /* E.inoue status = ioctl(fd, PCCIOC_KICK_READ, &retlen); if (status < 0) { // printf("ioctl-- PCCIOC_KICK_READ error fd = %d status = %d\n", fd, statu s); return errno; } // printf("cmdbuf : data = %x cmd = %x\n", cbuf[i], cbuf[i+1]); // printf("writen length = %d\n", length*4); retlen = write(fd, cbuf, length*4); if( retlen < 0 ) { printf("write error...\n"); return errno; } retlen = read(fd, rbuf, length*4); if( retlen < 0 ) { printf("read error return code = %d...\n", errno); return errno; } */ /* E.Inoue from here */ for (i = 2; i < length; i += 2) { rbuf[i+2] = cbuf[i]; // printf("c_data = %x c_cmd = %x, r_data = %x r_cmd = %x\n", cbuf[i], cbu f[i+1], rbuf[i], rbuf[i+1]); } /* to here */ /* printf("read return length = %d\n", retlen); for (i = 0; i < length; i += 2) printf("data = %x cmd = %x\n", rbuf[i], rbuf[i+1]); */ rplybuf[1] = retlen/4; return 0; } int cam_exec_dma_seq( int fd, int* cmdbuf, int* rplybuf ) { int *cbuf = cmdbuf+2; int *rbuf = rplybuf+2; int length = cmdbuf[1]; int retlen = 0; int i, j, status; int cmdlen; int amount, loop, remain; retlen = length*4; cmdlen = length/2; loop = cmdlen/MAX_FIFO; remain = cmdlen%MAX_FIFO; amount = 0; // printf("block count = %d remain = %d\n", loop, remain); /* E.Inoue if( loop ) { for( i = 0; i < loop; i++ ) { retlen = write(fd, cbuf, MAX_FIFO*8); if( retlen < 0 ) { printf("write error...\n"); return errno; } usleep(10000); retlen = read(fd, rbuf, MAX_FIFO*8); if( retlen < 0 ) { printf("read error return code = %d...\n", errno); return errno; } amount += retlen/4; usleep(1); } } if( remain ) { retlen = write(fd, cbuf, remain*8); if( retlen < 0 ) { printf("write error...\n"); return errno; } usleep(10000); retlen = read(fd, rbuf, remain*8); amount += retlen/4; if( retlen < 0 ) { printf("read error return code = %d...\n", errno); return errno; } usleep(10000); } // printf("block count = %d retlen/8 = %d\n", loop, amount/2); */ rplybuf[1] = amount; return 0; } int cam_wait_lam( int fd, int* rplybuf ) { /* E.Inoue if( ioctl(fd, PCCIOC_WAIT_LAM, &rplybuf[2]) < 0 ) { printf("PCCIOC_WAIT_LAM:error code = %d\n", errno); return errno; } */ return 0; } int cam_wait_trig( int fd, int* rplybuf ) { /* E.Inoue if( ioctl(fd, PCCIOC_WAIT_TRIG, &rplybuf[2]) < 0 ) { printf("PCCIOC_WAIT_LAM:error code = %d\n", errno); return errno; } */ return 0; } [inoue@onlsbc1 exam]$ (2-1-3h). pcc.h [inoue@onlsbc1 exam]$ cat pcc.h /* * File Name: pcc.h * * Copyright 2003 (C) 2003 Yoshiji Yasu . * * version: 0.1 04-DEC-2002, born * 0.3 14-JAN-2003, add master mode function * 0.35 31-JAN-2003, add symbols related to I/O registers * 0.37 26-FEB-2003, redefined the symbols and put/get * 0.4 28-FEB-2003, add concurrent process, wait lam and * DAQ function */ #define PCI_VENDOR_ID_PCC 0x8642 #define PCI_DEVICE_ID_PCC 0x0630 #define PCC_MAJOR 70 #define CARD_NAME "pcc" #define PCC_TIMEOUT 6000 #define PCCIOC_RESET _IOWR('c', 1, int) #define PCCIOC_DUMP_REGISTERS _IOWR('c', 2, struct pccreg) #define PCCIOC_CLEAR_TX_FIFO _IO('c', 3) #define PCCIOC_CLEAR_RX_FIFO _IO('c', 4) #define PCCIOC_PUT_DATA _IOWR('c', 5, int) #define PCCIOC_GET_DATA _IOWR('c', 6, int) #define PCCIOC_KICK_READ _IOWR('c', 7, int) #define PCCIOC_WAIT_WRITE_COMPLETION _IOWR('c', 8, int) #define PCCIOC_WAIT_LAM _IOWR('c', 9, int) #define PCCIOC_WAIT_TRIG _IOWR('c', 10, int) #define PCCIOC_TMP _IO('c', 11) #define DAQ_READ_STATUS 0 #define DAQ_READ_EVTCNT 0 #define DAQ_CLR_BUSYOUT 1 #define DAQ_CLR_EVTCNT 2 #define DAQ_ENABLE_TRIGIN 3 #define DAQ_DISABLE_TRIGIN 4 #define FIFO_MAX_COUNT 120 struct pccreg { unsigned int TxData1; unsigned int TxData2; unsigned int TxControl; unsigned int TxStatus; unsigned int TxAddress; unsigned int TxPresetCount; unsigned int TxActualCount; unsigned int TxFifoCount; unsigned int RxData1; unsigned int RxData2; unsigned int RxControl; unsigned int RxStatus; unsigned int RxAddress; unsigned int RxPresetCount; unsigned int RxActualCount; unsigned int RxFifoCount; unsigned int System; }; #define TXDATA1 0 #define TXDATA2 4 #define TXCONTROL 8 #define TXSTATUS 0xC #define TXADDRESS 0x10 #define TXPRESETCOUNT 0x14 #define TXACTUALCOUNT 0x18 #define TXFIFOCOUNT 0x1C #define RXDATA1 0x20 #define RXDATA2 0x24 #define RXCONTROL 0x28 #define RXSTATUS 0x2C #define RXADDRESS 0x30 #define RXPRESETCOUNT 0x34 #define RXACTUALCOUNT 0x38 #define RXFIFOCOUNT 0x3C #define SYSTEM 0x40 #define TC_INT_ENABLE 0x07000000 #define TC_INT_ENABLE_FORCE_END 0x04000000 #define TC_INT_ENABLE_FULL_FIFO 0x02000000 #define TC_INT_ENABLE_PKT_END 0x01000000 #define TC_INT_CLR 0x00070000 #define TC_INT_CLR_FORCE_END 0x00040000 #define TC_INT_CLR_FULL_FIFO 0x00020000 #define TC_INT_CLR_PKT_END 0x00010000 #define TC_CLR_FIFO 0x00000002 #define TC_SRT_DMA 0x00000001 #define RC_INT_ENABLE 0x3F000000 #define RC_INT_ENABLE_FORCE_END 0x20000000 #define RC_INT_ENABLE_PRESET_FIFO 0x10000000 #define RC_INT_ENABLE_FULL_FIFO 0x08000000 #define RC_INT_ENABLE_HALFFULL_PKT 0x04000000 #define RC_INT_ENABLE_PKT_END 0x02000000 #define RC_INT_ENABLE_INPUT_FRAME 0x01000000 #define RC_INT_CLR 0x003F0000 #define RC_INT_CLR_FORCE_END 0x00200000 #define RC_INT_CLR_PRESET_FIFO 0x00100000 #define RC_INT_CLR_FULL_FIFO 0x00080000 #define RC_INT_CLR_HALFFULL_PKT 0x00040000 #define RC_INT_CLR_PKT_END 0x00020000 #define RC_INT_CLR_INPUT_FRAME 0x00010000 #define RC_CLR_FIFO 0x00000002 #define RC_SRT_DMA 0x00000001 #define TS_RX_INFO 0xF0000000 #define TS_RX_INFO3 0x80000000 #define TS_RX_INFO2 0x40000000 #define TS_RX_INFO1 0x20000000 #define TS_RX_INFO0 0x10000000 #define TS_TX_INFO 0x0F000000 #define TS_TX_INFO3 0x08000000 #define TS_TX_INFO2 0x04000000 #define TS_TX_INFO1 0x02000000 #define TS_TX_INFO0 0x01000000 #define TS_INT 0x00070000 #define TS_INT_FORCE_END 0x00040000 #define TS_INT_FULL_FIFO 0x00020000 #define TS_INT_PKT_END 0x00010000 #define TS_FULL_FIFO 0x00000400 #define TS_HALFFULL_FIFO 0x00000200 #define TS_EMPTY_FIFO 0x00000100 #define TS_TIMEOUT_PACKET 0x00000002 #define TS_COMPLETION_PACKET 0x00000001 #define RS_RX_INFO 0xF0000000 #define RS_RX_INFO3 0x80000000 #define RS_RX_INFO2 0x40000000 #define RS_RX_INFO1 0x20000000 #define RS_RX_INFO0 0x10000000 #define RS_TX_INFO 0x0F000000 #define RS_TX_INFO3 0x08000000 #define RS_TX_INFO2 0x04000000 #define RS_TX_INFO1 0x02000000 #define RS_TX_INFO0 0x01000000 #define RS_INT 0x003F0000 #define RS_INT_FORCE_END 0x00200000 #define RS_INT_PRESET_FIFO 0x00100000 #define RS_INT_FULL_FIFO 0x00080000 #define RS_INT_HALFFULL_PKT 0x00040000 #define RS_INT_PKT_END 0x00020000 #define RS_INT_INPUT_FRAME 0x00010000 #define RS_FULL_FIFO 0x00000400 #define RS_HALFFULL_FIFO 0x00000200 #define RS_EMPTY_FIFO 0x00000100 #define RS_TIMEOUT_PACKET 0x00000001 #define SYS_LED_ONOFF 0x80000000 #define SYS_RESET 0x40000000 #define SYS_CAMAC_FRAME_SIZE 0x03000000 [inoue@onlsbc1 exam]$ (2-1-3i). Makefile [inoue@onlsbc1 exam]$ cat Makefile # File Name: Makefile # Date: Apr 28, 2003 # Edited by: Eiji Inoue INCDIR = -I/usr/src/linux-2.4/include VERSIONINC = CFLAGS = -O2 -Wall -c -D__KERNEL__ -DMODULE -Wall $(INCDIR) $(VERSIONINC) DRIVER = pcc all : cam.class cam.h libMyImpOfcam.so Client.class ClientImpl.class Server.cla ss ServerImpl.class ClientImpl_Skel.class ClientImpl_Stub.class ServerImpl_Skel. class ServerImpl_Stub.class #$(DRIVER).o: $(DRIVER).c $(DRIVER).h # gcc $(CFLAGS) $(DRIVER).c camac.o: camac.c $(DRIVER).h gcc -c camac.c cam.class: cam.java javac cam.java Client.class: Client.java javac Client.java ClientImpl.class: ClientImpl.java javac ClientImpl.java Server.class: Server.java javac Server.java ServerImpl.class: ServerImpl.java javac ServerImpl.java ClientImpl_Skel.class: ClientImpl.class rmic ClientImpl ServerImpl_Skel.class: ServerImpl.class rmic ServerImpl cam.h: cam.class javah -jni cam libMyImpOfcam.so: cam.c camac.o $(DRIVER).h gcc -O -shared -I/usr/java/include -I/usr/java/include/linux cam.c camac .o -o libMyImpOfcam.so clean: rm -f *.class cam.h libMyImpOfcam.so *.o core *~ [inoue@onlsbc1 exam]$ (2-1-3j). 上記のソースプログラムをコンパイルする [inoue@onlsbc1 exam]$ pwd /home/inoue/inoue/JavaRMI/camac/exam [inoue@onlsbc1 exam]$ ls -l 合計 108 -rw-rw-r-- 1 inoue inoue 233 4月 28 09:33 Client.java -rw-r--r-- 1 inoue inoue 17456 4月 28 10:24 ClientImpl.java -rw-rw-r-- 1 inoue inoue 1106 4月 28 09:52 Makefile -rw-r--r-- 1 inoue inoue 296 4月 28 09:52 Server.java -rw-r--r-- 1 inoue inoue 3058 4月 28 09:53 ServerImpl.java -rw-rw-r-- 1 inoue inoue 46354 4月 28 10:10 cam.c -rw-rw-r-- 1 inoue inoue 791 4月 28 10:15 cam.java -rw-rw-r-- 1 inoue inoue 9096 4月 16 16:10 camac.c -rw-r--r-- 1 inoue inoue 5425 4月 14 11:00 pcc.h [inoue@onlsbc1 exam]$ make clean rm -f *.class cam.h libMyImpOfcam.so *.o core *~ [inoue@onlsbc1 exam]$ make javac cam.java javah -jni cam gcc -c camac.c gcc -O -shared -I/usr/java/include -I/usr/java/include/linux cam.c camac.o -o li bMyImpOfcam.so javac Client.java javac ClientImpl.java javac ServerImpl.java rmic ClientImpl rmic ServerImpl [inoue@onlsbc1 exam]$ [inoue@onlsbc1 exam]$ ls -l 合計 192 -rw-rw-r-- 1 inoue inoue 206 4月 28 15:55 Client.class -rw-rw-r-- 1 inoue inoue 233 4月 28 09:33 Client.java -rw-rw-r-- 1 inoue inoue 8479 4月 28 15:55 ClientImpl.class -rw-r--r-- 1 inoue inoue 17456 4月 28 10:24 ClientImpl.java -rw-rw-r-- 1 inoue inoue 1735 4月 28 15:55 ClientImpl_Skel.class -rw-rw-r-- 1 inoue inoue 3140 4月 28 15:55 ClientImpl_Stub.class -rw-rw-r-- 1 inoue inoue 1106 4月 28 09:52 Makefile -rw-rw-r-- 1 inoue inoue 244 4月 28 15:55 Server.class -rw-r--r-- 1 inoue inoue 296 4月 28 09:52 Server.java -rw-rw-r-- 1 inoue inoue 2523 4月 28 15:55 ServerImpl.class -rw-r--r-- 1 inoue inoue 3058 4月 28 09:53 ServerImpl.java -rw-rw-r-- 1 inoue inoue 1956 4月 28 15:55 ServerImpl_Skel.class -rw-rw-r-- 1 inoue inoue 3510 4月 28 15:55 ServerImpl_Stub.class -rw-rw-r-- 1 inoue inoue 46354 4月 28 10:10 cam.c -rw-rw-r-- 1 inoue inoue 360 4月 28 15:55 cam.class -rw-rw-r-- 1 inoue inoue 414 4月 28 15:55 cam.h -rw-rw-r-- 1 inoue inoue 791 4月 28 10:15 cam.java -rw-rw-r-- 1 inoue inoue 9096 4月 16 16:10 camac.c -rw-rw-r-- 1 inoue inoue 4488 4月 28 15:55 camac.o -rwxrwxr-x 1 inoue inoue 26514 4月 28 15:55 libMyImpOfcam.so -rw-r--r-- 1 inoue inoue 5425 4月 14 11:00 pcc.h [inoue@onlsbc1 exam]$ (2-2). クライアント側、onlpara.kek.jp [inoue@onlpara exam]$ pwd /home/inoue/JavaRMI/camac/exam [inoue@onlpara exam]$ ls -l 合計 108 -rw-rw-r-- 1 inoue inoue 233 4月 28 09:33 Client.java -rw-r--r-- 1 inoue inoue 17456 4月 28 10:24 ClientImpl.java -rw-rw-r-- 1 inoue inoue 1106 4月 28 09:52 Makefile -rw-r--r-- 1 inoue inoue 296 4月 28 09:52 Server.java -rw-r--r-- 1 inoue inoue 3058 4月 28 09:53 ServerImpl.java -rw-rw-r-- 1 inoue inoue 46354 4月 28 10:10 cam.c -rw-rw-r-- 1 inoue inoue 791 4月 28 10:15 cam.java -rw-rw-r-- 1 inoue inoue 9096 4月 16 16:10 camac.c -rw-r--r-- 1 inoue inoue 5425 4月 14 11:00 pcc.h [inoue@onlpara exam]$ (2-2-1). Javaのチェック [inoue@onlpara exam]$ java -version java version "1.4.1-rc" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-rc-b19) Java HotSpot(TM) Client VM (build 1.4.1-rc-b19, mixed mode) [inoue@onlpara exam]$ (2-2-2). 実行環境 [inoue@onlpara exam]$ env PWD=/home/inoue/JavaRMI/camac/exam HOSTNAME=onlpara.kek.jp QTDIR=/usr/lib/qt3-gcc2.96 LESSOPEN=|/usr/bin/lesspipe.sh %s USER=inoue LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;0 1:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.b tm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31: *.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:* .bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;3 5:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35: MAIL=/var/spool/mail/inoue INPUTRC=/etc/inputrc LANG=ja_JP.eucJP SSH_CLIENT=130.87.153.2 3039 22 LOGNAME=inoue SHLVL=1 SHELL=/bin/bash HISTSIZE=1000 HOME=/home/inoue TERM=vt100 SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass PATH=/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/java/bin:/home/inoue/bin JLESSCHARSET=japanese SSH_TTY=/dev/pts/5 _=/usr/bin/env OLDPWD=/home/inoue/JavaRMI/camac [inoue@onlpara exam]$ (2-2-3). コンパイル [inoue@onlpara exam]$ pwd /home/inoue/JavaRMI/camac/exam [inoue@onlpara exam]$ ls -l 合計 108 -rw-rw-r-- 1 inoue inoue 233 4月 28 09:33 Client.java -rw-r--r-- 1 inoue inoue 17456 4月 28 10:24 ClientImpl.java -rw-rw-r-- 1 inoue inoue 1106 4月 28 09:52 Makefile -rw-r--r-- 1 inoue inoue 296 4月 28 09:52 Server.java -rw-r--r-- 1 inoue inoue 3058 4月 28 09:53 ServerImpl.java -rw-rw-r-- 1 inoue inoue 46354 4月 28 10:10 cam.c -rw-rw-r-- 1 inoue inoue 791 4月 28 10:15 cam.java -rw-rw-r-- 1 inoue inoue 9096 4月 16 16:10 camac.c -rw-r--r-- 1 inoue inoue 5425 4月 14 11:00 pcc.h [inoue@onlpara exam]$ (2-2-3a). Client.java 上記の項目(2-1-3a)を参照。 (2-2-3b). ClientImpl.java 上記の項目(2-1-3b)を参照。 (2-2-3c). Server.java 上記の項目(2-1-3c)を参照。 (2-2-3d). ServerImpl.java 上記の項目(2-1-3d)を参照。 (2-2-3e). cam.java 上記の項目(2-1-3e)を参照。 (2-2-3f). cam.c 上記の項目(2-1-3f)を参照。 (2-2-3g). camac.c 上記の項目(2-1-3g)を参照。 (2-2-3h). pcc.h 上記の項目(2-1-3h)を参照。 (2-2-3i). Makefile 上記の項目(2-1-3i)を参照。 (2-2-3j). 上記のソースプログラムをコンパイルする [inoue@onlpara exam]$ pwd /home/inoue/JavaRMI/camac/exam [inoue@onlpara exam]$ ls -l 合計 108 -rw-rw-r-- 1 inoue inoue 233 4月 28 09:33 Client.java -rw-r--r-- 1 inoue inoue 17456 4月 28 10:24 ClientImpl.java -rw-rw-r-- 1 inoue inoue 1106 4月 28 09:52 Makefile -rw-r--r-- 1 inoue inoue 296 4月 28 09:52 Server.java -rw-r--r-- 1 inoue inoue 3058 4月 28 09:53 ServerImpl.java -rw-rw-r-- 1 inoue inoue 46354 4月 28 10:10 cam.c -rw-rw-r-- 1 inoue inoue 791 4月 28 10:15 cam.java -rw-rw-r-- 1 inoue inoue 9096 4月 16 16:10 camac.c -rw-r--r-- 1 inoue inoue 5425 4月 14 11:00 pcc.h [inoue@onlpara exam]$ make clean rm -f *.class cam.h libMyImpOfcam.so *.o core *~ [inoue@onlpara exam]$ make javac cam.java javah -jni cam gcc -c camac.c gcc -O -shared -I/usr/java/include -I/usr/java/include/linux cam.c camac.o -o li bMyImpOfcam.so javac Client.java javac ClientImpl.java javac ServerImpl.java rmic ClientImpl rmic ServerImpl [inoue@onlpara exam]$ (2-3). サーバ側のプログラムの起動 onlsbc1 のSBCからPCIへアクセスする前に、PCIのシステムレジスタに 1を書き 込んで CAMAC 用の FPGA をイニシャライズしないと CAMACにアクセスできない ようになっている。 今回のテストに使用しているネイティブコードには、この ための操作は含んでいない。 したがって、サーバ側のプログラムを起動する前 に手動でこの操作をする必要がある。 これは、以下の一行のコマンドで行う。 # ./w e840 1 [root@onlsbc1 exam]# pwd /home/inoue/inoue/JavaRMI/camac/exam [root@onlsbc1 exam]# export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH [root@onlsbc1 exam]# rmiregistry & [1] 16958 [root@onlsbc1 exam]# java ServerImpl bind done (2-4). クライアント側のプログラムの起動 [inoue@onlpara exam]$ pwd /home/inoue/JavaRMI/camac/exam [inoue@onlpara exam]$ rmiregistry & [1] 8253 [inoue@onlpara exam]$ java ClientImpl onlsbc1 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = (3). 実行 リモートからアクセスできる例題プログラムは以下の機能を持っている。 (3a). 入力したCAMACコマンドを実行し結果を表示する リモートから入力したCAMACコマンドを、CAMACコントローラに送って そのCAMACコマンドを実行する。 実行結果をリモート側へ送り返して 表示する。 (3b). 組み込んであるローカル例題プログラムを実行する 上記(2)で組み込んだローカル例題プログラムをCAMACコントローラ上で 実行する。 FPGAロジックをイニシャライズする。 [root@onlsbc1 camac]# pwd /home/inoue/inoue/JavaRMI/camac [root@onlsbc1 camac]# ls -l 合計 28 drwxrwxr-x 9 inoue inoue 4096 4月 28 09:33 backup drwxrwxr-x 2 inoue inoue 4096 4月 15 16:40 camac drwxrwxr-x 2 inoue inoue 4096 4月 28 17:26 exam -rwxrwxr-x 1 inoue inoue 13935 4月 10 16:28 w [root@onlsbc1 camac]# ./w e840 1 outl(0x1, 0x0000e840) [root@onlsbc1 camac]# (3-1). 上記(3a)の実行 入力したCAMACコマンドを実行し結果を表示する (3-1-1). サーバ側の実行 [root@onlsbc1 exam]# pwd /home/inoue/inoue/JavaRMI/camac/exam [root@onlsbc1 exam]# ls Client.class Server.class cam.class Client.java Server.java cam.h ClientImpl.class ServerImpl.class cam.java ClientImpl.java ServerImpl.java camac.c ClientImpl_Skel.class ServerImpl_Skel.class camac.o ClientImpl_Stub.class ServerImpl_Stub.class libMyImpOfcam.so Makefile cam.c pcc.h [root@onlsbc1 exam]# [root@onlsbc1 exam]# export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH [root@onlsbc1 exam]# rmiregistry & [1] 17168 [root@onlsbc1 exam]# java ServerImpl bind done RMI: Server side: RMI: Received CAMAC command: array length = 2 cmd[0] = 0x0, dat[0] = 0x0 cmd[1] = 0xe0030010, dat[1] = 0x5555 cmd[2] = 0xe0030000, dat[2] = 0x0 JNI, Java side: before Native Call ServerImpl.r_cmd[0] = 0x0, ServerImpl.r_dat[0] = 0x0 ServerImpl.r_cmd[1] = 0xe0030010, ServerImpl.r_dat[1] = 0x5555 ServerImpl.r_cmd[2] = 0xe0030000, ServerImpl.r_dat[2] = 0x0 JNI, C side: Received CAMAC command: array length = 2 example number = 14 c_cmd[1] = 0xe0030010, c_dat[1] = 0x5555 c_cmd[2] = 0xe0030000, c_dat[2] = 0x0 c_cmd[3] = 0x0, c_dat[3] = 0x0 JNI, C side: CAMAC access camac write data: data = 0x5555 camac write command reply: cmd = 0xe0030010 : data = 23000000 camac read command reply: cmd = 0xe0030000 : data = 0x5555 JNI, Java side: after Native Call array length = 2 [root@onlsbc1 exam]# (3-1-2). クライアント側の実行 [inoue@onlpara exam]$ pwd /home/inoue/JavaRMI/camac/exam [inoue@onlpara exam]$ ls Client.class Server.class cam.class Client.java Server.java cam.h ClientImpl.class ServerImpl.class cam.java ClientImpl.java ServerImpl.java camac.c ClientImpl_Skel.class ServerImpl_Skel.class camac.o ClientImpl_Stub.class ServerImpl_Stub.class libMyImpOfcam.so Makefile cam.c pcc.h [inoue@onlpara exam]$ [inoue@onlpara exam]$ rmiregistry & [1] 13839 [inoue@onlpara exam]$ java ClientImpl onlsbc1 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = s Execution Command: s CAMAC Command (N, A, F)(dec) = 3,0,16 Write Data(hex) = 5555 入力されたData: 21845(dec), 0x5555(hex) Make up CAMAC Command of Single action. Accepted data: n = 3, a = 0, f = 16, l_count = 2 ClientImpl.scmd [ 1 ] = -536674288(dec), 0xe0030010(hex) ClientImpl.sdat [ 1 ] = 21845(dec), 0x5555(hex) Execution Command('q' or 'e' or 'g' or 's' or 'd') = s Execution Command: s CAMAC Command (N, A, F)(dec) = 3,0,0 Make up CAMAC Command of Single action. Accepted data: n = 3, a = 0, f = 0, l_count = 3 ClientImpl.scmd [ 2 ] = -536674304(dec), 0xe0030000(hex) ClientImpl.sdat [ 2 ] = 0(dec), 0x0(hex) Execution Command('q' or 'e' or 'g' or 's' or 'd') = g Ok. Start up CAMAC execution. RMI: Client side: RMI: Sent CAMAC command: array length =2 ClientImpl.scmd[0] = 0x0, ClientImpl.sdat[0] = 0x0 ClientImpl.scmd[1] = 0xe0030010, ClientImpl.sdat[1] = 0x5555 ClientImpl.scmd[2] = 0xe0030000, ClientImpl.sdat[2] = 0x0 RMI: Received CAMAC reply: array length = 2 c_reply[0] = 0x0, d_reply[0] = 0x0 c_reply[1] = 0xe0030010, d_reply[1] = 0x23000000 c_reply[2] = 0xe0030000, d_reply[2] = 0x5555 rcmd_buf[0] = 0x0, rcmd_buf[1] = 0x4 rrpl_buf[0] = 0x0, rrpl_buf[1] = 0x0 rcmd_buf[2] = 0x0, rcmd_buf[3] = 0x0 rrpl_buf[2] = 0x0, rrpl_buf[3] = 0x0 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = q Quited Program. Enter Ctl-C. [inoue@onlpara exam]$ (3-2). 上記(3b)の実行 組み込んであるローカル例題プログラムを実行する (3-2-1). ローカル例題プログラム、exam1の実行 これは、CAMACライブラリ関数の内、cam_exec_pio関数をテストするための例題 プログラムである。 cam_exec_pio関数は内部ではioctl()システムコールで PCCIOC_PUT_DATA,PCCIO_GET_DATAを使ってCAMACアクセスを行っている。 (3-2-1a). サーバ側の実行 [root@onlsbc1 exam]# export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH [root@onlsbc1 exam]# rmiregistry & [1] 17211 [root@onlsbc1 exam]# java ServerImpl bind done RMI: Server side: RMI: Received CAMAC command: array length = 0 cmd[0] = 0x0, dat[0] = 0x0 JNI, Java side: before Native Call ServerImpl.r_cmd[0] = 0x0, ServerImpl.r_dat[0] = 0x0 JNI, C side: Received CAMAC command: array length = 0 example number = 1 data = 0 cmd = c0190011 data = 0 cmd = 80190010 data = 0 cmd = 80190018 data = ffffff cmd = 80030010 data = 0 cmd = 80030010 data = 555555 cmd = 80030010 data = aaaaaa cmd = 80030010 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = ffffff cmd = 80030010 data = 0 cmd = 80030010 data = 555555 cmd = 80030010 data = aaaaaa cmd = 80030010 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = ffffff cmd = 80030010 data = 0 cmd = 80030010 data = 555555 cmd = 80030010 data = aaaaaa cmd = 80030010 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = ffffff cmd = 80030010 data = 0 cmd = 80030010 data = 555555 cmd = 80030010 data = aaaaaa cmd = 80030010 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = ffffff cmd = 80030010 data = 0 cmd = 80030010 data = 555555 cmd = 80030010 data = aaaaaa cmd = 80030010 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = ffffff cmd = 80030010 data = 0 cmd = 80030010 data = 555555 cmd = 80030010 data = aaaaaa cmd = 80030010 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = ffffff cmd = 80030010 data = 0 cmd = 80030010 data = 555555 cmd = 80030010 data = aaaaaa cmd = 80030010 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = ffffff cmd = 80030010 data = 0 cmd = 80030010 data = 555555 cmd = 80030010 data = aaaaaa cmd = 80030010 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = ffffff cmd = 80030010 data = 0 cmd = 80030010 data = 555555 cmd = 80030010 data = aaaaaa cmd = 80030010 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = ffffff cmd = 80030010 data = 0 cmd = 80030010 data = 555555 cmd = 80030010 data = aaaaaa cmd = 80030010 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = 0 cmd = 80030000 data = a cmd = 80030010 data = 0 cmd = a0030000 JNI, Java side: after Native Call array length = 85 (3-2-1b). クライアント側の実行 [inoue@onlpara exam]$ rmiregistry & [1] 14154 [inoue@onlpara exam]$ java ClientImpl onlsbc1 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = e What's number of program which do you want to execute ? --- default:[1] exam1:[1], exam2:[2], exam3:[3], exam4:[4], exam5:[5], exam6:[6], exam21:[7], pio_write_read[8], read:[9], read_write:[a], reg_dump:[b], write:[c], write_rea d:[d] Number = 1 : : c_reply[79] = 0x0, d_reply[79] = 0x0 c_reply[80] = 0x0, d_reply[80] = 0x0 c_reply[81] = 0x0, d_reply[81] = 0x0 c_reply[82] = 0x0, d_reply[82] = 0x0 c_reply[83] = 0x0, d_reply[83] = 0x0 c_reply[84] = 0x0, d_reply[84] = 0x0 c_reply[85] = 0x0, d_reply[85] = 0x0 rcmd_buf[0] = 0x7d0, rcmd_buf[1] = 0xaa rrpl_buf[0] = 0x7d0, rrpl_buf[1] = 0x0 rcmd_buf[2] = 0x0, rcmd_buf[3] = 0xc0190011 rrpl_buf[2] = 0x0, rrpl_buf[3] = 0x0 rcmd_buf[4] = 0x0, rcmd_buf[5] = 0x80190010 rrpl_buf[4] = 0x0, rrpl_buf[5] = 0x0 rcmd_buf[6] = 0x0, rcmd_buf[7] = 0x80190018 rrpl_buf[6] = 0x0, rrpl_buf[7] = 0x0 rcmd_buf[8] = 0xffffff, rcmd_buf[9] = 0x80030010 rrpl_buf[8] = 0x0, rrpl_buf[9] = 0x0 rcmd_buf[10] = 0x0, rcmd_buf[11] = 0x80030010 rrpl_buf[10] = 0x0, rrpl_buf[11] = 0x0 rcmd_buf[12] = 0x555555, rcmd_buf[13] = 0x80030010 rrpl_buf[12] = 0x0, rrpl_buf[13] = 0x0 rcmd_buf[14] = 0xaaaaaa, rcmd_buf[15] = 0x80030010 rrpl_buf[14] = 0x0, rrpl_buf[15] = 0x0 rcmd_buf[16] = 0x0, rcmd_buf[17] = 0x80030000 rrpl_buf[16] = 0x0, rrpl_buf[17] = 0x0 rcmd_buf[18] = 0x0, rcmd_buf[19] = 0x80030000 rrpl_buf[18] = 0x0, rrpl_buf[19] = 0x0 rcmd_buf[20] = 0x0, rcmd_buf[21] = 0x80030000 rrpl_buf[20] = 0x0, rrpl_buf[21] = 0x0 rcmd_buf[22] = 0x0, rcmd_buf[23] = 0x80030000 rrpl_buf[22] = 0x0, rrpl_buf[23] = 0x0 rcmd_buf[24] = 0xffffff, rcmd_buf[25] = 0x80030010 rrpl_buf[24] = 0x0, rrpl_buf[25] = 0x0 rcmd_buf[26] = 0x0, rcmd_buf[27] = 0x80030010 rrpl_buf[26] = 0x0, rrpl_buf[27] = 0x0 rcmd_buf[28] = 0x555555, rcmd_buf[29] = 0x80030010 rrpl_buf[28] = 0x0, rrpl_buf[29] = 0x0 rcmd_buf[30] = 0xaaaaaa, rcmd_buf[31] = 0x80030010 rrpl_buf[30] = 0x0, rrpl_buf[31] = 0x0 rcmd_buf[32] = 0x0, rcmd_buf[33] = 0x80030000 rrpl_buf[32] = 0x0, rrpl_buf[33] = 0x0 rcmd_buf[34] = 0x0, rcmd_buf[35] = 0x80030000 rrpl_buf[34] = 0x0, rrpl_buf[35] = 0x0 rcmd_buf[36] = 0x0, rcmd_buf[37] = 0x80030000 rrpl_buf[36] = 0x0, rrpl_buf[37] = 0x0 rcmd_buf[38] = 0x0, rcmd_buf[39] = 0x80030000 rrpl_buf[38] = 0x0, rrpl_buf[39] = 0x0 rcmd_buf[40] = 0xffffff, rcmd_buf[41] = 0x80030010 rrpl_buf[40] = 0x0, rrpl_buf[41] = 0x0 rcmd_buf[42] = 0x0, rcmd_buf[43] = 0x80030010 rrpl_buf[42] = 0x0, rrpl_buf[43] = 0x0 rcmd_buf[44] = 0x555555, rcmd_buf[45] = 0x80030010 rrpl_buf[44] = 0x0, rrpl_buf[45] = 0x0 rcmd_buf[46] = 0xaaaaaa, rcmd_buf[47] = 0x80030010 rrpl_buf[46] = 0x0, rrpl_buf[47] = 0x0 rcmd_buf[48] = 0x0, rcmd_buf[49] = 0x80030000 rrpl_buf[48] = 0x0, rrpl_buf[49] = 0x0 rcmd_buf[50] = 0x0, rcmd_buf[51] = 0x80030000 rrpl_buf[50] = 0x0, rrpl_buf[51] = 0x0 rcmd_buf[52] = 0x0, rcmd_buf[53] = 0x80030000 rrpl_buf[52] = 0x0, rrpl_buf[53] = 0x0 rcmd_buf[54] = 0x0, rcmd_buf[55] = 0x80030000 rrpl_buf[54] = 0x0, rrpl_buf[55] = 0x0 rcmd_buf[56] = 0xffffff, rcmd_buf[57] = 0x80030010 rrpl_buf[56] = 0x0, rrpl_buf[57] = 0x0 rcmd_buf[58] = 0x0, rcmd_buf[59] = 0x80030010 rrpl_buf[58] = 0x0, rrpl_buf[59] = 0x0 rcmd_buf[60] = 0x555555, rcmd_buf[61] = 0x80030010 rrpl_buf[60] = 0x0, rrpl_buf[61] = 0x0 rcmd_buf[62] = 0xaaaaaa, rcmd_buf[63] = 0x80030010 rrpl_buf[62] = 0x0, rrpl_buf[63] = 0x0 rcmd_buf[64] = 0x0, rcmd_buf[65] = 0x80030000 rrpl_buf[64] = 0x0, rrpl_buf[65] = 0x0 rcmd_buf[66] = 0x0, rcmd_buf[67] = 0x80030000 rrpl_buf[66] = 0x0, rrpl_buf[67] = 0x0 rcmd_buf[68] = 0x0, rcmd_buf[69] = 0x80030000 rrpl_buf[68] = 0x0, rrpl_buf[69] = 0x0 rcmd_buf[70] = 0x0, rcmd_buf[71] = 0x80030000 rrpl_buf[70] = 0x0, rrpl_buf[71] = 0x0 rcmd_buf[72] = 0xffffff, rcmd_buf[73] = 0x80030010 rrpl_buf[72] = 0x0, rrpl_buf[73] = 0x0 rcmd_buf[74] = 0x0, rcmd_buf[75] = 0x80030010 rrpl_buf[74] = 0x0, rrpl_buf[75] = 0x0 rcmd_buf[76] = 0x555555, rcmd_buf[77] = 0x80030010 rrpl_buf[76] = 0x0, rrpl_buf[77] = 0x0 rcmd_buf[78] = 0xaaaaaa, rcmd_buf[79] = 0x80030010 rrpl_buf[78] = 0x0, rrpl_buf[79] = 0x0 rcmd_buf[80] = 0x0, rcmd_buf[81] = 0x80030000 rrpl_buf[80] = 0x0, rrpl_buf[81] = 0x0 rcmd_buf[82] = 0x0, rcmd_buf[83] = 0x80030000 rrpl_buf[82] = 0x0, rrpl_buf[83] = 0x0 rcmd_buf[84] = 0x0, rcmd_buf[85] = 0x80030000 rrpl_buf[84] = 0x0, rrpl_buf[85] = 0x0 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = (3-2-2). ローカル例題プログラム、exam2の実行 これは、CAMACライブラリ関数の内、cam_exec_dma関数をテストするための例題 プログラムである。 cam_exec_dma関数は内部ではioctl()システムコールで PCCIOC_KICK_READ,およびwrite()、read()システムコールを使ってCAMACアクセ スを行っている。 (3-2-2a). サーバ側の実行 RMI: Server side: RMI: Received CAMAC command: array length = 0 cmd[0] = 0x0, dat[0] = 0x0 JNI, Java side: before Native Call ServerImpl.r_cmd[0] = 0x0, ServerImpl.r_dat[0] = 0x0 JNI, C side: Received CAMAC command: array length = 0 example number = 2 len = aa data = 0 cmd = c0190011 data = 0 cmd = 80190010 data = 0 cmd = 80190018 data = ffffff cmd = 80030010 data = 0 cmd = 80030000 data = 0 cmd = 80030010 data = 0 cmd = 80030000 data = 555555 cmd = 80030010 data = 0 cmd = 80030000 data = aaaaaa cmd = 80030010 data = 0 cmd = 80030000 data = ffffff cmd = 80030010 data = 0 cmd = 80030000 data = 0 cmd = 80030010 data = 0 cmd = 80030000 data = 555555 cmd = 80030010 data = 0 cmd = 80030000 data = aaaaaa cmd = 80030010 data = 0 cmd = 80030000 data = ffffff cmd = 80030010 data = 0 cmd = 80030000 data = 0 cmd = 80030010 data = 0 cmd = 80030000 data = 555555 cmd = 80030010 data = 0 cmd = 80030000 data = aaaaaa cmd = 80030010 data = 0 cmd = 80030000 data = ffffff cmd = 80030010 data = 0 cmd = 80030000 data = 0 cmd = 80030010 data = 0 cmd = 80030000 data = 555555 cmd = 80030010 data = 0 cmd = 80030000 data = aaaaaa cmd = 80030010 data = 0 cmd = 80030000 data = ffffff cmd = 80030010 data = 0 cmd = 80030000 data = 0 cmd = 80030010 data = 0 cmd = 80030000 data = 555555 cmd = 80030010 data = 0 cmd = 80030000 data = aaaaaa cmd = 80030010 data = 0 cmd = 80030000 data = ffffff cmd = 80030010 data = 0 cmd = 80030000 data = 0 cmd = 80030010 data = 0 cmd = 80030000 data = 555555 cmd = 80030010 data = 0 cmd = 80030000 data = aaaaaa cmd = 80030010 data = 0 cmd = 80030000 data = ffffff cmd = 80030010 data = 0 cmd = 80030000 data = 0 cmd = 80030010 data = 0 cmd = 80030000 data = 555555 cmd = 80030010 data = 0 cmd = 80030000 data = aaaaaa cmd = 80030010 data = 0 cmd = 80030000 data = ffffff cmd = 80030010 data = 0 cmd = 80030000 data = 0 cmd = 80030010 data = 0 cmd = 80030000 data = 555555 cmd = 80030010 data = 0 cmd = 80030000 data = aaaaaa cmd = 80030010 data = 0 cmd = 80030000 data = ffffff cmd = 80030010 data = 0 cmd = 80030000 data = 0 cmd = 80030010 data = 0 cmd = 80030000 data = 555555 cmd = 80030010 data = 0 cmd = 80030000 data = aaaaaa cmd = 80030010 data = 0 cmd = 80030000 data = ffffff cmd = 80030010 data = 0 cmd = 80030000 data = 0 cmd = 80030010 data = 0 cmd = 80030000 data = 555555 cmd = 80030010 data = 0 cmd = 80030000 data = aaaaaa cmd = 80030010 data = 0 cmd = 80030000 data = a cmd = 80030010 data = 0 cmd = a0030000 array length = 0 rbuf[0] = ffffff rbuf[10] = ffffff rbuf[20] = ffffff rbuf[30] = ffffff rbuf[40] = ffffff rbuf[50] = ffffff rbuf[60] = ffffff rbuf[70] = ffffff rbuf[80] = ffffff rbuf[90] = ffffff rbuf[0] = ffffff rbuf[1] = 0 rbuf[2] = 0 rbuf[3] = 0 rbuf[4] = 0 rbuf[5] = 0 rbuf[6] = 0 rbuf[7] = 0 rbuf[8] = 555555 rbuf[9] = 0 rbuf[a] = 0 rbuf[b] = 0 rbuf[c] = aaaaaa rbuf[d] = 0 rbuf[e] = 0 rbuf[f] = 0 rbuf[10] = ffffff rbuf[11] = 0 rbuf[12] = 0 rbuf[13] = 0 JNI, Java side: after Native Call array length = 85 (3-2-2b). クライアント側の実行 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = e What's number of program which do you want to execute ? --- default:[1] exam1:[1], exam2:[2], exam3:[3], exam4:[4], exam5:[5], exam6:[6], exam21:[7], pio_write_read[8], read:[9], read_write:[a], reg_dump:[b], write:[c], write_rea d:[d] Number = 2 Ok. Start up an example program 2. RMI: Client side: RMI: Sent CAMAC command: array length =0 ClientImpl.scmd[0] = 0x0, ClientImpl.sdat[0] = 0x0 RMI: Received CAMAC reply: array length = 85 c_reply[0] = 0x0, d_reply[0] = 0x0 c_reply[1] = 0x0, d_reply[1] = 0x0 c_reply[2] = 0x0, d_reply[2] = 0x0 c_reply[3] = 0x0, d_reply[3] = 0x0 c_reply[4] = 0x0, d_reply[4] = 0x0 c_reply[5] = 0x0, d_reply[5] = 0x0 c_reply[6] = 0x0, d_reply[6] = 0x0 c_reply[7] = 0x0, d_reply[7] = 0x0 c_reply[8] = 0x0, d_reply[8] = 0x0 c_reply[9] = 0x0, d_reply[9] = 0x0 c_reply[10] = 0x0, d_reply[10] = 0x0 c_reply[11] = 0x0, d_reply[11] = 0x0 c_reply[12] = 0x0, d_reply[12] = 0x0 c_reply[13] = 0x0, d_reply[13] = 0x0 c_reply[14] = 0x0, d_reply[14] = 0x0 c_reply[15] = 0x0, d_reply[15] = 0x0 c_reply[16] = 0x0, d_reply[16] = 0x0 c_reply[17] = 0x0, d_reply[17] = 0x0 c_reply[18] = 0x0, d_reply[18] = 0x0 c_reply[19] = 0x0, d_reply[19] = 0x0 c_reply[20] = 0x0, d_reply[20] = 0x0 c_reply[21] = 0x0, d_reply[21] = 0x0 c_reply[22] = 0x0, d_reply[22] = 0x0 c_reply[23] = 0x0, d_reply[23] = 0x0 c_reply[24] = 0x0, d_reply[24] = 0x0 c_reply[25] = 0x0, d_reply[25] = 0x0 c_reply[26] = 0x0, d_reply[26] = 0x0 c_reply[27] = 0x0, d_reply[27] = 0x0 c_reply[28] = 0x0, d_reply[28] = 0x0 c_reply[29] = 0x0, d_reply[29] = 0x0 c_reply[30] = 0x0, d_reply[30] = 0x0 c_reply[31] = 0x0, d_reply[31] = 0x0 c_reply[32] = 0x0, d_reply[32] = 0x0 c_reply[33] = 0x0, d_reply[33] = 0x0 c_reply[34] = 0x0, d_reply[34] = 0x0 c_reply[35] = 0x0, d_reply[35] = 0x0 c_reply[36] = 0x0, d_reply[36] = 0x0 c_reply[37] = 0x0, d_reply[37] = 0x0 c_reply[38] = 0x0, d_reply[38] = 0x0 c_reply[39] = 0x0, d_reply[39] = 0x0 c_reply[40] = 0x0, d_reply[40] = 0x0 c_reply[41] = 0x0, d_reply[41] = 0x0 c_reply[42] = 0x0, d_reply[42] = 0x0 c_reply[43] = 0x0, d_reply[43] = 0x0 c_reply[44] = 0x0, d_reply[44] = 0x0 c_reply[45] = 0x0, d_reply[45] = 0x0 c_reply[46] = 0x0, d_reply[46] = 0x0 c_reply[47] = 0x0, d_reply[47] = 0x0 c_reply[48] = 0x0, d_reply[48] = 0x0 c_reply[49] = 0x0, d_reply[49] = 0x0 c_reply[50] = 0x0, d_reply[50] = 0x0 c_reply[51] = 0x0, d_reply[51] = 0x0 c_reply[52] = 0x0, d_reply[52] = 0x0 c_reply[53] = 0x0, d_reply[53] = 0x0 c_reply[54] = 0x0, d_reply[54] = 0x0 c_reply[55] = 0x0, d_reply[55] = 0x0 c_reply[56] = 0x0, d_reply[56] = 0x0 c_reply[57] = 0x0, d_reply[57] = 0x0 c_reply[58] = 0x0, d_reply[58] = 0x0 c_reply[59] = 0x0, d_reply[59] = 0x0 c_reply[60] = 0x0, d_reply[60] = 0x0 c_reply[61] = 0x0, d_reply[61] = 0x0 c_reply[62] = 0x0, d_reply[62] = 0x0 c_reply[63] = 0x0, d_reply[63] = 0x0 c_reply[64] = 0x0, d_reply[64] = 0x0 c_reply[65] = 0x0, d_reply[65] = 0x0 c_reply[66] = 0x0, d_reply[66] = 0x0 c_reply[67] = 0x0, d_reply[67] = 0x0 c_reply[68] = 0x0, d_reply[68] = 0x0 c_reply[69] = 0x0, d_reply[69] = 0x0 c_reply[70] = 0x0, d_reply[70] = 0x0 c_reply[71] = 0x0, d_reply[71] = 0x0 c_reply[72] = 0x0, d_reply[72] = 0x0 c_reply[73] = 0x0, d_reply[73] = 0x0 c_reply[74] = 0x0, d_reply[74] = 0x0 c_reply[75] = 0x0, d_reply[75] = 0x0 c_reply[76] = 0x0, d_reply[76] = 0x0 c_reply[77] = 0x0, d_reply[77] = 0x0 c_reply[78] = 0x0, d_reply[78] = 0x0 c_reply[79] = 0x0, d_reply[79] = 0x0 c_reply[80] = 0x0, d_reply[80] = 0x0 c_reply[81] = 0x0, d_reply[81] = 0x0 c_reply[82] = 0x0, d_reply[82] = 0x0 c_reply[83] = 0x0, d_reply[83] = 0x0 c_reply[84] = 0x0, d_reply[84] = 0x0 c_reply[85] = 0x0, d_reply[85] = 0x0 rcmd_buf[0] = 0x7d0, rcmd_buf[1] = 0xaa rrpl_buf[0] = 0x7d0, rrpl_buf[1] = 0xaa rcmd_buf[2] = 0x0, rcmd_buf[3] = 0xc0190011 rrpl_buf[2] = 0x0, rrpl_buf[3] = 0x0 rcmd_buf[4] = 0x0, rcmd_buf[5] = 0x80190010 rrpl_buf[4] = 0x0, rrpl_buf[5] = 0x0 rcmd_buf[6] = 0x0, rcmd_buf[7] = 0x80190018 rrpl_buf[6] = 0x0, rrpl_buf[7] = 0x0 rcmd_buf[8] = 0xffffff, rcmd_buf[9] = 0x80030010 rrpl_buf[8] = 0x0, rrpl_buf[9] = 0x0 rcmd_buf[10] = 0x0, rcmd_buf[11] = 0x80030000 rrpl_buf[10] = 0xffffff, rrpl_buf[11] = 0x0 rcmd_buf[12] = 0x0, rcmd_buf[13] = 0x80030010 rrpl_buf[12] = 0x0, rrpl_buf[13] = 0x0 rcmd_buf[14] = 0x0, rcmd_buf[15] = 0x80030000 rrpl_buf[14] = 0x0, rrpl_buf[15] = 0x0 rcmd_buf[16] = 0x555555, rcmd_buf[17] = 0x80030010 rrpl_buf[16] = 0x0, rrpl_buf[17] = 0x0 rcmd_buf[18] = 0x0, rcmd_buf[19] = 0x80030000 rrpl_buf[18] = 0x555555, rrpl_buf[19] = 0x0 rcmd_buf[20] = 0xaaaaaa, rcmd_buf[21] = 0x80030010 rrpl_buf[20] = 0x0, rrpl_buf[21] = 0x0 rcmd_buf[22] = 0x0, rcmd_buf[23] = 0x80030000 rrpl_buf[22] = 0xaaaaaa, rrpl_buf[23] = 0x0 rcmd_buf[24] = 0xffffff, rcmd_buf[25] = 0x80030010 rrpl_buf[24] = 0x0, rrpl_buf[25] = 0x0 rcmd_buf[26] = 0x0, rcmd_buf[27] = 0x80030000 rrpl_buf[26] = 0xffffff, rrpl_buf[27] = 0x0 rcmd_buf[28] = 0x0, rcmd_buf[29] = 0x80030010 rrpl_buf[28] = 0x0, rrpl_buf[29] = 0x0 rcmd_buf[30] = 0x0, rcmd_buf[31] = 0x80030000 rrpl_buf[30] = 0x0, rrpl_buf[31] = 0x0 rcmd_buf[32] = 0x555555, rcmd_buf[33] = 0x80030010 rrpl_buf[32] = 0x0, rrpl_buf[33] = 0x0 rcmd_buf[34] = 0x0, rcmd_buf[35] = 0x80030000 rrpl_buf[34] = 0x555555, rrpl_buf[35] = 0x0 rcmd_buf[36] = 0xaaaaaa, rcmd_buf[37] = 0x80030010 rrpl_buf[36] = 0x0, rrpl_buf[37] = 0x0 rcmd_buf[38] = 0x0, rcmd_buf[39] = 0x80030000 rrpl_buf[38] = 0xaaaaaa, rrpl_buf[39] = 0x0 rcmd_buf[40] = 0xffffff, rcmd_buf[41] = 0x80030010 rrpl_buf[40] = 0x0, rrpl_buf[41] = 0x0 rcmd_buf[42] = 0x0, rcmd_buf[43] = 0x80030000 rrpl_buf[42] = 0xffffff, rrpl_buf[43] = 0x0 rcmd_buf[44] = 0x0, rcmd_buf[45] = 0x80030010 rrpl_buf[44] = 0x0, rrpl_buf[45] = 0x0 rcmd_buf[46] = 0x0, rcmd_buf[47] = 0x80030000 rrpl_buf[46] = 0x0, rrpl_buf[47] = 0x0 rcmd_buf[48] = 0x555555, rcmd_buf[49] = 0x80030010 rrpl_buf[48] = 0x0, rrpl_buf[49] = 0x0 rcmd_buf[50] = 0x0, rcmd_buf[51] = 0x80030000 rrpl_buf[50] = 0x555555, rrpl_buf[51] = 0x0 rcmd_buf[52] = 0xaaaaaa, rcmd_buf[53] = 0x80030010 rrpl_buf[52] = 0x0, rrpl_buf[53] = 0x0 rcmd_buf[54] = 0x0, rcmd_buf[55] = 0x80030000 rrpl_buf[54] = 0xaaaaaa, rrpl_buf[55] = 0x0 rcmd_buf[56] = 0xffffff, rcmd_buf[57] = 0x80030010 rrpl_buf[56] = 0x0, rrpl_buf[57] = 0x0 rcmd_buf[58] = 0x0, rcmd_buf[59] = 0x80030000 rrpl_buf[58] = 0xffffff, rrpl_buf[59] = 0x0 rcmd_buf[60] = 0x0, rcmd_buf[61] = 0x80030010 rrpl_buf[60] = 0x0, rrpl_buf[61] = 0x0 rcmd_buf[62] = 0x0, rcmd_buf[63] = 0x80030000 rrpl_buf[62] = 0x0, rrpl_buf[63] = 0x0 rcmd_buf[64] = 0x555555, rcmd_buf[65] = 0x80030010 rrpl_buf[64] = 0x0, rrpl_buf[65] = 0x0 rcmd_buf[66] = 0x0, rcmd_buf[67] = 0x80030000 rrpl_buf[66] = 0x555555, rrpl_buf[67] = 0x0 rcmd_buf[68] = 0xaaaaaa, rcmd_buf[69] = 0x80030010 rrpl_buf[68] = 0x0, rrpl_buf[69] = 0x0 rcmd_buf[70] = 0x0, rcmd_buf[71] = 0x80030000 rrpl_buf[70] = 0xaaaaaa, rrpl_buf[71] = 0x0 rcmd_buf[72] = 0xffffff, rcmd_buf[73] = 0x80030010 rrpl_buf[72] = 0x0, rrpl_buf[73] = 0x0 rcmd_buf[74] = 0x0, rcmd_buf[75] = 0x80030000 rrpl_buf[74] = 0xffffff, rrpl_buf[75] = 0x0 rcmd_buf[76] = 0x0, rcmd_buf[77] = 0x80030010 rrpl_buf[76] = 0x0, rrpl_buf[77] = 0x0 rcmd_buf[78] = 0x0, rcmd_buf[79] = 0x80030000 rrpl_buf[78] = 0x0, rrpl_buf[79] = 0x0 rcmd_buf[80] = 0x555555, rcmd_buf[81] = 0x80030010 rrpl_buf[80] = 0x0, rrpl_buf[81] = 0x0 rcmd_buf[82] = 0x0, rcmd_buf[83] = 0x80030000 rrpl_buf[82] = 0x555555, rrpl_buf[83] = 0x0 rcmd_buf[84] = 0xaaaaaa, rcmd_buf[85] = 0x80030010 rrpl_buf[84] = 0x0, rrpl_buf[85] = 0x0 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = (3-2-3). ローカル例題プログラム、exam3の実行 これは、CAMACライブラリ関数の内、cam_exec_pio関数を使ってCAMACからの 割り込みのenable、disableをテストするための例題プログラムである。 (3-2-3a). サーバ側の実行 RMI: Server side: RMI: Received CAMAC command: array length = 0 cmd[0] = 0x0, dat[0] = 0x0 JNI, Java side: before Native Call ServerImpl.r_cmd[0] = 0x0, ServerImpl.r_dat[0] = 0x0 JNI, C side: Received CAMAC command: array length = 0 example number = 3 number of reply frames : 0 Z : data = 0 rply = 0 C : data = 0 rply = 0 set Inhibit : data = 0 rply = 0 remove Inhibit : data = 0 rply = 0 disable Interrupt : data = ffffff rply = 0 enable Interrupt : data = 0 rply = 0 write Interrupt enable bits : data = 0 rply = 0 read Interrupt enable bits : data = 0 rply = 0 set fast cycle : data = 555555 rply = 0 reset fast cyclc : data = 0 rply = 0 JNI, Java side: after Native Call array length = 10 (3-2-3b). クライアント側の実行 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = e What's number of program which do you want to execute ? --- default:[1] exam1:[1], exam2:[2], exam3:[3], exam4:[4], exam5:[5], exam6:[6], exam21:[7], pio_write_read[8], read:[9], read_write:[a], reg_dump:[b], write:[c], write_rea d:[d] Number = 3 Ok. Start up an example program 3. RMI: Client side: RMI: Sent CAMAC command: array length =0 ClientImpl.scmd[0] = 0x0, ClientImpl.sdat[0] = 0x0 RMI: Received CAMAC reply: array length = 10 c_reply[0] = 0x0, d_reply[0] = 0x0 c_reply[1] = 0x0, d_reply[1] = 0x0 c_reply[2] = 0x0, d_reply[2] = 0x0 c_reply[3] = 0x0, d_reply[3] = 0x0 c_reply[4] = 0x0, d_reply[4] = 0x0 c_reply[5] = 0x0, d_reply[5] = 0x0 c_reply[6] = 0x0, d_reply[6] = 0x0 c_reply[7] = 0x0, d_reply[7] = 0x0 c_reply[8] = 0x0, d_reply[8] = 0x0 c_reply[9] = 0x0, d_reply[9] = 0x0 c_reply[10] = 0x0, d_reply[10] = 0x0 rcmd_buf[0] = 0x7d0, rcmd_buf[1] = 0x14 rrpl_buf[0] = 0x7d0, rrpl_buf[1] = 0x0 rcmd_buf[2] = 0x0, rcmd_buf[3] = 0xc0190011 rrpl_buf[2] = 0x0, rrpl_buf[3] = 0x0 rcmd_buf[4] = 0x0, rcmd_buf[5] = 0x80190010 rrpl_buf[4] = 0x0, rrpl_buf[5] = 0x0 rcmd_buf[6] = 0x0, rcmd_buf[7] = 0x8019001a rrpl_buf[6] = 0x0, rrpl_buf[7] = 0x0 rcmd_buf[8] = 0x0, rcmd_buf[9] = 0x80190018 rrpl_buf[8] = 0x0, rrpl_buf[9] = 0x0 rcmd_buf[10] = 0x0, rcmd_buf[11] = 0x80190118 rrpl_buf[10] = 0xffffff, rrpl_buf[11] = 0x0 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = (3-2-4). ローカル例題プログラム、exam4の実行 これは、CAMACライブラリ関数の内、cam_exec_pio関数を使ってトリガ入力の enable、disableを行い、イベント・カウンタの読み出しテストするための例題 プログラムである。 (3-2-4a). サーバ側の実行 RMI: Server side: RMI: Received CAMAC command: array length = 0 cmd[0] = 0x0, dat[0] = 0x0 JNI, Java side: before Native Call ServerImpl.r_cmd[0] = 0x0, ServerImpl.r_dat[0] = 0x0 JNI, C side: Received CAMAC command: array length = 0 example number = 3 number of reply frames : 0 Z : data = 0 rply = 0 C : data = 0 rply = 0 set Inhibit : data = 0 rply = 0 remove Inhibit : data = 0 rply = 0 disable Interrupt : data = ffffff rply = 0 enable Interrupt : data = 0 rply = 0 write Interrupt enable bits : data = 0 rply = 0 read Interrupt enable bits : data = 0 rply = 0 set fast cycle : data = 555555 rply = 0 reset fast cyclc : data = 0 rply = 0 JNI, Java side: after Native Call array length = 10 RMI: Server side: RMI: Received CAMAC command: array length = 0 cmd[0] = 0x0, dat[0] = 0x0 JNI, Java side: before Native Call ServerImpl.r_cmd[0] = 0x0, ServerImpl.r_dat[0] = 0x0 JNI, C side: Received CAMAC command: array length = 0 example number = 4 number of reply frames : 0 read status : data = 0 cmd = d0000000 : data = 0 rply = 0 clear busy out : data = 0 cmd = 90010000 : data = 0 rply = 0 clear event counter : data = 0 cmd = 90020000 : data = 0 rply = 0 enable trigger input : data = 0 cmd = b0030000 :data = 0 rply = 0 LAM frame : data = 0 rply = 0 Clear BusyOut : data = 0 cmd = f0010000 : data = 0 rply = 0 LAM frame : data = 1 rply = 0 Clear BusyOut : data = 0 cmd = f0010000 : data = 0 rply = 0 LAM frame : data = 2 rply = 0 Clear BusyOut : data = 0 cmd = f0010000 : data = 0 rply = 0 LAM frame : data = 3 rply = 0 Clear BusyOut : data = 0 cmd = f0010000 : data = 0 rply = 0 LAM frame : data = 4 rply = 0 Clear BusyOut : data = 0 cmd = f0010000 : data = 0 rply = 0 LAM frame : data = 5 rply = 0 Clear BusyOut : data = 0 cmd = f0010000 : data = 0 rply = 0 LAM frame : data = 6 rply = 0 Clear BusyOut : data = 0 cmd = f0010000 : data = 0 rply = 0 LAM frame : data = 7 rply = 0 Clear BusyOut : data = 0 cmd = f0010000 : data = 0 rply = 0 LAM frame : data = 8 rply = 0 Clear BusyOut : data = 0 cmd = f0010000 : data = 0 rply = 0 LAM frame : data = 9 rply = 0 Clear BusyOut : data = 0 cmd = f0010000 : data = 0 rply = 0 number of reply frames : 0 read event counter : data = 0 cmd = d0000000 : data = 0 rply = 0 disable trigger input : data = 0 cmd = b0040000 : data = 0 rply = 0 JNI, Java side: after Native Call array length = 2 (3-2-4b). クライアント側の実行 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = e What's number of program which do you want to execute ? --- default:[1] exam1:[1], exam2:[2], exam3:[3], exam4:[4], exam5:[5], exam6:[6], exam21:[7], pio_write_read[8], read:[9], read_write:[a], reg_dump:[b], write:[c], write_rea d:[d] Number = 4 Ok. Start up an example program 4. RMI: Client side: RMI: Sent CAMAC command: array length =0 ClientImpl.scmd[0] = 0x0, ClientImpl.sdat[0] = 0x0 RMI: Received CAMAC reply: array length = 2 c_reply[0] = 0x0, d_reply[0] = 0x0 c_reply[1] = 0x0, d_reply[1] = 0x0 c_reply[2] = 0x0, d_reply[2] = 0x0 rcmd_buf[0] = 0x7d0, rcmd_buf[1] = 0x4 rrpl_buf[0] = 0x7d0, rrpl_buf[1] = 0x0 rcmd_buf[2] = 0x0, rcmd_buf[3] = 0xd0000000 rrpl_buf[2] = 0x0, rrpl_buf[3] = 0x0 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = (3-2-5). ローカル例題プログラム、exam5の実行 これは、CAMACライブラリ関数の内、cam_exec_pio関数を使ってCAMACからの 割り込みのenable、disableを行い、CAMACスイッチ・レジスタからのLAMをテス トするための例題プログラムである。 (3-2-5a). サーバ側の実行 RMI: Server side: RMI: Received CAMAC command: array length = 0 cmd[0] = 0x0, dat[0] = 0x0 JNI, Java side: before Native Call ServerImpl.r_cmd[0] = 0x0, ServerImpl.r_dat[0] = 0x0 JNI, C side: Received CAMAC command: array length = 0 example number = 5 number of reply frames : 0 Z : data = 0 rply = 0 C : data = 0 rply = 0 remove Inhibit : data = 0 rply = 0 enable Interrupt : data = 0 rply = 0 write Interrupt enable bits : data = ffffff rply = 0 read Interrupt enable bits : data = 0 rply = 0 number of reply frames : 0 SW enable interrupt : data = 0 rply = 0 Tx Control = 0 Tx Status = bd5fed6c Tx Address = 4001f2da Tx Preset Count = b1 Tx Actual Count = 482cfde3 Tx Fifo Count = bd5fedb8 Rx Control = 42171560 Rx Status = 2c Rx Address = 482cb040 Rx Preset Count = 1 Rx Actual Count = 0 Rx Fifo Count = bd5fed94 System = 4001f2da number of reply frames : 0 LAM reply : data = 0 rply = 0 Tx Control = 0 Tx Status = bd5fed6c Tx Address = 4001f2da Tx Preset Count = b1 Tx Actual Count = 482cfde3 Tx Fifo Count = bd5fedb8 Rx Control = 42171560 Rx Status = 2c Rx Address = 482cb040 Rx Preset Count = 1 Rx Actual Count = 0 Rx Fifo Count = bd5fed94 System = 4001f2da number of reply frames : 0 LAM reply : data = 0 rply = 0 Tx Control = 0 Tx Status = bd5fed6c Tx Address = 4001f2da Tx Preset Count = b1 Tx Actual Count = 482cfde3 Tx Fifo Count = bd5fedb8 Rx Control = 42171560 Rx Status = 2c Rx Address = 482cb040 Rx Preset Count = 1 Rx Actual Count = 0 Rx Fifo Count = bd5fed94 System = 4001f2da number of reply frames : 0 LAM reply : data = 0 rply = 0 Tx Control = 0 Tx Status = bd5fed6c Tx Address = 4001f2da Tx Preset Count = b1 Tx Actual Count = 482cfde3 Tx Fifo Count = bd5fedb8 Rx Control = 42171560 Rx Status = 2c Rx Address = 482cb040 Rx Preset Count = 1 Rx Actual Count = 0 Rx Fifo Count = bd5fed94 System = 4001f2da number of reply frames : 0 LAM reply : data = 0 rply = 0 Tx Control = 0 Tx Status = bd5fed6c Tx Address = 4001f2da Tx Preset Count = b1 Tx Actual Count = 482cfde3 Tx Fifo Count = bd5fedb8 Rx Control = 42171560 Rx Status = 2c Rx Address = 482cb040 Rx Preset Count = 1 Rx Actual Count = 0 Rx Fifo Count = bd5fed94 System = 4001f2da number of reply frames : 0 LAM reply : data = 0 rply = 0 Tx Control = 0 Tx Status = bd5fed6c Tx Address = 4001f2da Tx Preset Count = b1 Tx Actual Count = 482cfde3 Tx Fifo Count = bd5fedb8 Rx Control = 42171560 Rx Status = 2c Rx Address = 482cb040 Rx Preset Count = 1 Rx Actual Count = 0 Rx Fifo Count = bd5fed94 System = 4001f2da number of reply frames : 0 LAM reply : data = 0 rply = 0 Tx Control = 0 Tx Status = bd5fed6c Tx Address = 4001f2da Tx Preset Count = b1 Tx Actual Count = 482cfde3 Tx Fifo Count = bd5fedb8 Rx Control = 42171560 Rx Status = 2c Rx Address = 482cb040 Rx Preset Count = 1 Rx Actual Count = 0 Rx Fifo Count = bd5fed94 System = 4001f2da number of reply frames : 0 LAM reply : data = 0 rply = 0 Tx Control = 0 Tx Status = bd5fed6c Tx Address = 4001f2da Tx Preset Count = b1 Tx Actual Count = 482cfde3 Tx Fifo Count = bd5fedb8 Rx Control = 42171560 Rx Status = 2c Rx Address = 482cb040 Rx Preset Count = 1 Rx Actual Count = 0 Rx Fifo Count = bd5fed94 System = 4001f2da number of reply frames : 0 LAM reply : data = 0 rply = 0 Tx Control = 0 Tx Status = bd5fed6c Tx Address = 4001f2da Tx Preset Count = b1 Tx Actual Count = 482cfde3 Tx Fifo Count = bd5fedb8 Rx Control = 42171560 Rx Status = 2c Rx Address = 482cb040 Rx Preset Count = 1 Rx Actual Count = 0 Rx Fifo Count = bd5fed94 System = 4001f2da number of reply frames : 0 LAM reply : data = 0 rply = 0 Tx Control = 0 Tx Status = bd5fed6c Tx Address = 4001f2da Tx Preset Count = b1 Tx Actual Count = 482cfde3 Tx Fifo Count = bd5fedb8 Rx Control = 42171560 Rx Status = 2c Rx Address = 482cb040 Rx Preset Count = 1 Rx Actual Count = 0 Rx Fifo Count = bd5fed94 System = 4001f2da number of reply frames : 0 LAM reply : data = 0 rply = 0 JNI, Java side: after Native Call array length = 1 (3-2-5b). クライアント側の実行 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = e What's number of program which do you want to execute ? --- default:[1] exam1:[1], exam2:[2], exam3:[3], exam4:[4], exam5:[5], exam6:[6], exam21:[7], pio_write_read[8], read:[9], read_write:[a], reg_dump:[b], write:[c], write_rea d:[d] Number = 5 Ok. Start up an example program 5. RMI: Client side: RMI: Sent CAMAC command: array length =0 ClientImpl.scmd[0] = 0x0, ClientImpl.sdat[0] = 0x0 RMI: Received CAMAC reply: array length = 1 c_reply[0] = 0x0, d_reply[0] = 0x0 c_reply[1] = 0x0, d_reply[1] = 0x0 rcmd_buf[0] = 0x7d0, rcmd_buf[1] = 0x2 rrpl_buf[0] = 0x7d0, rrpl_buf[1] = 0x0 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = (3-2-6). ローカル例題プログラム、exam6の実行 これは、CAMACライブラリ関数の内、cam_exec_pio関数を使ってenableトリガ 入力を実行後ioctl()でPCCIOC_WAIT_TRIGを行う例題プログラムである。 (3-2-6a). サーバ側の実行 RMI: Server side: RMI: Received CAMAC command: array length = 0 cmd[0] = 0x0, dat[0] = 0x0 JNI, Java side: before Native Call ServerImpl.r_cmd[0] = 0x0, ServerImpl.r_dat[0] = 0x0 JNI, C side: Received CAMAC command: array length = 0 example number = 6 number of reply frames : 0 enable trigger input : data = ffffff rply = 0 JNI, Java side: after Native Call array length = 1 (3-2-6b). クライアント側の実行 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = e What's number of program which do you want to execute ? --- default:[1] exam1:[1], exam2:[2], exam3:[3], exam4:[4], exam5:[5], exam6:[6], exam21:[7], pio_write_read[8], read:[9], read_write:[a], reg_dump:[b], write:[c], write_rea d:[d] Number = 6 Ok. Start up an example program 6. RMI: Client side: RMI: Sent CAMAC command: array length =0 ClientImpl.scmd[0] = 0x0, ClientImpl.sdat[0] = 0x0 RMI: Received CAMAC reply: array length = 1 c_reply[0] = 0x0, d_reply[0] = 0x0 c_reply[1] = 0x0, d_reply[1] = 0x0 rcmd_buf[0] = 0x7d0, rcmd_buf[1] = 0x2 rrpl_buf[0] = 0x7d0, rrpl_buf[1] = 0x0 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = (3-2-7). ローカル例題プログラム、exam21の実行 これは、CAMACライブラリ関数の内、cam_exec_dma_seq関数をテストするための 例題プログラムである。 (3-2-7a). サーバ側の実行 RMI: Server side: RMI: Received CAMAC command: array length = 0 cmd[0] = 0x0, dat[0] = 0x0 JNI, Java side: before Native Call ServerImpl.r_cmd[0] = 0x0, ServerImpl.r_dat[0] = 0x0 JNI, C side: Received CAMAC command: array length = 0 example number = 7 loop = 0 JNI, Java side: after Native Call array length = 13 (3-2-7b). クライアント側の実行 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = e What's number of program which do you want to execute ? --- default:[1] exam1:[1], exam2:[2], exam3:[3], exam4:[4], exam5:[5], exam6:[6], exam21:[7], pio_write_read[8], read:[9], read_write:[a], reg_dump:[b], write:[c], write_rea d:[d] Number = 7 Ok. Start up an example program 21. RMI: Client side: RMI: Sent CAMAC command: array length =0 ClientImpl.scmd[0] = 0x0, ClientImpl.sdat[0] = 0x0 RMI: Received CAMAC reply: array length = 13 c_reply[0] = 0x0, d_reply[0] = 0x0 c_reply[1] = 0x0, d_reply[1] = 0x0 c_reply[2] = 0x0, d_reply[2] = 0x0 c_reply[3] = 0x0, d_reply[3] = 0x0 c_reply[4] = 0x0, d_reply[4] = 0x0 c_reply[5] = 0x0, d_reply[5] = 0x0 c_reply[6] = 0x0, d_reply[6] = 0x0 c_reply[7] = 0x0, d_reply[7] = 0x0 c_reply[8] = 0x0, d_reply[8] = 0x0 c_reply[9] = 0x0, d_reply[9] = 0x0 c_reply[10] = 0x0, d_reply[10] = 0x0 c_reply[11] = 0x0, d_reply[11] = 0x0 c_reply[12] = 0x0, d_reply[12] = 0x0 c_reply[13] = 0x0, d_reply[13] = 0x0 rcmd_buf[0] = 0x7d0, rcmd_buf[1] = 0x1a rrpl_buf[0] = 0x7d0, rrpl_buf[1] = 0x0 rcmd_buf[2] = 0x0, rcmd_buf[3] = 0xc0190011 rrpl_buf[2] = 0x0, rrpl_buf[3] = 0x0 rcmd_buf[4] = 0x0, rcmd_buf[5] = 0x80190010 rrpl_buf[4] = 0x0, rrpl_buf[5] = 0x0 rcmd_buf[6] = 0x0, rcmd_buf[7] = 0x80190018 rrpl_buf[6] = 0x0, rrpl_buf[7] = 0x0 rcmd_buf[8] = 0xffffff, rcmd_buf[9] = 0x80030010 rrpl_buf[8] = 0x0, rrpl_buf[9] = 0x0 rcmd_buf[10] = 0x0, rcmd_buf[11] = 0x80030000 rrpl_buf[10] = 0xffffff, rrpl_buf[11] = 0x0 rcmd_buf[12] = 0x0, rcmd_buf[13] = 0x80030010 rrpl_buf[12] = 0x0, rrpl_buf[13] = 0x0 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = (3-2-8). ローカル例題プログラム、pio_write_readの実行 これは、ドライバに対してioctl()関数でPCCIOC_PUT_DATA,PCCIO_GET_DATAを 使ってCAMACアクセスをするための例題プログラムである。 (3-2-8a). サーバ側の実行 RMI: Server side: RMI: Received CAMAC command: array length = 0 cmd[0] = 0x0, dat[0] = 0x0 JNI, Java side: before Native Call ServerImpl.r_cmd[0] = 0x0, ServerImpl.r_dat[0] = 0x0 JNI, C side: Received CAMAC command: array length = 0 example number = 8 Tx Control = 0 Tx Status = bcfff0f8 Tx Address = 4001f2da Tx Preset Count = b1 Tx Actual Count = 482cfde3 Tx Fifo Count = bcfff14c Rx Control = 42171560 Rx Status = 2c Rx Address = 482cb040 Rx Preset Count = 1 Rx Actual Count = 0 Rx Fifo Count = bcfff128 System = 4001f2da Tx Control = 0 Tx Status = bcfff0f8 Tx Address = 4001f2da Tx Preset Count = b1 Tx Actual Count = 482cfde3 Tx Fifo Count = bcfff14c Rx Control = 42171560 Rx Status = 2c Rx Address = 482cb040 Rx Preset Count = 1 Rx Actual Count = 0 Rx Fifo Count = bcfff128 System = 4001f2da JNI, Java side: after Native Call array length = 13 (3-2-8b). クライアント側の実行 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = e What's number of program which do you want to execute ? --- default:[1] exam1:[1], exam2:[2], exam3:[3], exam4:[4], exam5:[5], exam6:[6], exam21:[7], pio_write_read[8], read:[9], read_write:[a], reg_dump:[b], write:[c], write_rea d:[d] Number = 8 Ok. Start up an example program pio_write_read. RMI: Client side: RMI: Sent CAMAC command: array length =0 ClientImpl.scmd[0] = 0x0, ClientImpl.sdat[0] = 0x0 RMI: Received CAMAC reply: array length = 13 c_reply[0] = 0x0, d_reply[0] = 0x0 c_reply[1] = 0x0, d_reply[1] = 0x0 c_reply[2] = 0x0, d_reply[2] = 0x0 c_reply[3] = 0x0, d_reply[3] = 0x0 c_reply[4] = 0x0, d_reply[4] = 0x0 c_reply[5] = 0x0, d_reply[5] = 0x0 c_reply[6] = 0x0, d_reply[6] = 0x0 c_reply[7] = 0x0, d_reply[7] = 0x0 c_reply[8] = 0x0, d_reply[8] = 0x0 c_reply[9] = 0x0, d_reply[9] = 0x0 c_reply[10] = 0x0, d_reply[10] = 0x0 c_reply[11] = 0x0, d_reply[11] = 0x0 c_reply[12] = 0x0, d_reply[12] = 0x0 c_reply[13] = 0x0, d_reply[13] = 0x0 rcmd_buf[0] = 0x7d0, rcmd_buf[1] = 0x1a rrpl_buf[0] = 0x7d0, rrpl_buf[1] = 0x0 rcmd_buf[2] = 0x0, rcmd_buf[3] = 0xc0190011 rrpl_buf[2] = 0x0, rrpl_buf[3] = 0x0 rcmd_buf[4] = 0x0, rcmd_buf[5] = 0x80190010 rrpl_buf[4] = 0x0, rrpl_buf[5] = 0x0 rcmd_buf[6] = 0x0, rcmd_buf[7] = 0x80190018 rrpl_buf[6] = 0x0, rrpl_buf[7] = 0x0 rcmd_buf[8] = 0xffffff, rcmd_buf[9] = 0x80030010 rrpl_buf[8] = 0x0, rrpl_buf[9] = 0x0 rcmd_buf[10] = 0x0, rcmd_buf[11] = 0x80030000 rrpl_buf[10] = 0xffffff, rrpl_buf[11] = 0x0 rcmd_buf[12] = 0x0, rcmd_buf[13] = 0x80030010 rrpl_buf[12] = 0x0, rrpl_buf[13] = 0x0 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = (3-2-9). ローカル例題プログラム、readの実行 これは、ドライバのreadシステムコールを使ってCAMAC読み出しを行うための 例題プログラムである。 (3-2-9a). サーバ側の実行 RMI: Server side: RMI: Received CAMAC command: array length = 0 cmd[0] = 0x0, dat[0] = 0x0 JNI, Java side: before Native Call ServerImpl.r_cmd[0] = 0x0, ServerImpl.r_dat[0] = 0x0 JNI, C side: Received CAMAC command: array length = 0 example number = 9 packet1 = ffffff packet2 = c0030010 packet1 = 0 packet2 = 80030000 packet1 = 4 packet2 = 80030010 packet1 = 0 packet2 = 80030000 packet1 = 8 packet2 = 80030010 packet1 = 0 packet2 = 80030000 packet1 = c packet2 = 80030010 packet1 = 0 packet2 = 80030000 packet1 = 555555 packet2 = 80030010 packet1 = 0 packet2 = a0030000 loop = 0 JNI, Java side: after Native Call array length = 13 (3-2-9b). クライアント側の実行 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = e What's number of program which do you want to execute ? --- default:[1] exam1:[1], exam2:[2], exam3:[3], exam4:[4], exam5:[5], exam6:[6], exam21:[7], pio_write_read[8], read:[9], read_write:[a], reg_dump:[b], write:[c], write_rea d:[d] Number = 9 Ok. Start up an example program read. RMI: Client side: RMI: Sent CAMAC command: array length =0 ClientImpl.scmd[0] = 0x0, ClientImpl.sdat[0] = 0x0 RMI: Received CAMAC reply: array length = 13 c_reply[0] = 0x0, d_reply[0] = 0x0 c_reply[1] = 0x0, d_reply[1] = 0x0 c_reply[2] = 0x0, d_reply[2] = 0x0 c_reply[3] = 0x0, d_reply[3] = 0x0 c_reply[4] = 0x0, d_reply[4] = 0x0 c_reply[5] = 0x0, d_reply[5] = 0x0 c_reply[6] = 0x0, d_reply[6] = 0x0 c_reply[7] = 0x0, d_reply[7] = 0x0 c_reply[8] = 0x0, d_reply[8] = 0x0 c_reply[9] = 0x0, d_reply[9] = 0x0 c_reply[10] = 0x0, d_reply[10] = 0x0 c_reply[11] = 0x0, d_reply[11] = 0x0 c_reply[12] = 0x0, d_reply[12] = 0x0 c_reply[13] = 0x0, d_reply[13] = 0x0 rcmd_buf[0] = 0x7d0, rcmd_buf[1] = 0x1a rrpl_buf[0] = 0x7d0, rrpl_buf[1] = 0x0 rcmd_buf[2] = 0x0, rcmd_buf[3] = 0xc0190011 rrpl_buf[2] = 0x0, rrpl_buf[3] = 0x0 rcmd_buf[4] = 0x0, rcmd_buf[5] = 0x80190010 rrpl_buf[4] = 0x0, rrpl_buf[5] = 0x0 rcmd_buf[6] = 0x0, rcmd_buf[7] = 0x80190018 rrpl_buf[6] = 0x0, rrpl_buf[7] = 0x0 rcmd_buf[8] = 0xffffff, rcmd_buf[9] = 0x80030010 rrpl_buf[8] = 0x0, rrpl_buf[9] = 0x0 rcmd_buf[10] = 0x0, rcmd_buf[11] = 0x80030000 rrpl_buf[10] = 0xffffff, rrpl_buf[11] = 0x0 rcmd_buf[12] = 0x0, rcmd_buf[13] = 0x80030010 rrpl_buf[12] = 0x0, rrpl_buf[13] = 0x0 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = (3-2-10). ローカル例題プログラム、read_writeの実行 これは、ドライバのwriteシステムコールおよびpollシステムコールを使って CAMAC読み出しを行うための例題プログラムである。 (3-2-10a). サーバ側の実行 RMI: Server side: RMI: Received CAMAC command: array length = 0 cmd[0] = 0x0, dat[0] = 0x0 JNI, Java side: before Native Call ServerImpl.r_cmd[0] = 0x0, ServerImpl.r_dat[0] = 0x0 JNI, C side: Received CAMAC command: array length = 0 example number = 10 packet1 = ffffff packet2 = c0030010 packet1 = 0 packet2 = 80030000 packet1 = 555555 packet2 = 80030010 packet1 = 0 packet2 = a0030000 packet1 = 0 packet2 = a0030000 Tx Control = 4065a080 Tx Status = 80feab4 Tx Address = 7 Tx Preset Count = 1 Tx Actual Count = 7 Tx Fifo Count = 80fe6c4 Rx Control = 80fe650 Rx Status = 80fe65c Rx Address = 80fea48 Rx Preset Count = 4065a140 Rx Actual Count = 4ab33334 Rx Fifo Count = 1 System = 1d retlen of write = 1079447936 data error : loop = 1, i = 0 written data read data ffffff 40163654 c0030010 40163654 0 442a0f18 80030000 442a0fc0 4 442a0e70 80030010 442a0ff8 0 442a0ea8 80030000 442a0f50 8 442a0ee0 80030010 442a0f88 data error : loop = 1, i = 0 written data read data 0 442a0f18 80030000 442a0fc0 4 442a0e70 80030010 442a0ff8 0 442a0ea8 80030000 442a0f50 8 442a0ee0 80030010 442a0f88 data error : loop = 1, i = 0 written data read data 4 442a0e70 80030010 442a0ff8 0 442a0ea8 80030000 442a0f50 8 442a0ee0 80030010 442a0f88 data error : loop = 1, i = 0 written data read data 0 442a0ea8 80030000 442a0f50 8 442a0ee0 80030010 442a0f88 data error : loop = 1, i = 0 written data read data 8 442a0ee0 80030010 442a0f88 data error : loop = 1, i = 0 written data read data data error : loop = 1, i = 0 written data read data data error : loop = 1, i = 0 written data read data data error : loop = 1, i = 0 written data read data data error : loop = 1, i = 0 written data read data loop = 0 JNI, Java side: after Native Call array length = 0 (3-2-10b). クライアント側の実行 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = e What's number of program which do you want to execute ? --- default:[1] exam1:[1], exam2:[2], exam3:[3], exam4:[4], exam5:[5], exam6:[6], exam21:[7], pio_write_read[8], read:[9], read_write:[a], reg_dump:[b], write:[c], write_rea d:[d] Number = a Ok. Start up an example program read_write. RMI: Client side: RMI: Sent CAMAC command: array length =0 ClientImpl.scmd[0] = 0x0, ClientImpl.sdat[0] = 0x0 RMI: Received CAMAC reply: array length = 0 c_reply[0] = 0x0, d_reply[0] = 0x0 rcmd_buf[0] = 0x0, rcmd_buf[1] = 0x0 rrpl_buf[0] = 0x0, rrpl_buf[1] = 0x0 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = (3-2-11). ローカル例題プログラム、reg_dumpの実行 これは、ドライバに対してioctl()システムコールでPCCIOC_DUMP_REGISTERSを 使ってPCIレジスタをアクセスをするための例題プログラムである。 (3-2-11a). サーバ側の実行 RMI: Server side: RMI: Received CAMAC command: array length = 0 cmd[0] = 0x0, dat[0] = 0x0 JNI, Java side: before Native Call ServerImpl.r_cmd[0] = 0x0, ServerImpl.r_dat[0] = 0x0 JNI, C side: Received CAMAC command: array length = 0 example number = 11 Tx Control = 4065a080 Tx Status = 80feab4 Tx Address = 7 Tx Preset Count = 1 Tx Actual Count = 7 Tx Fifo Count = 80fe6c4 Rx Control = 80fe650 Rx Status = 80fe65c Rx Address = 80fea48 Rx Preset Count = 4065a140 Rx Actual Count = 4ab33334 Rx Fifo Count = 1 System = 1d JNI, Java side: after Native Call array length = 0 (3-2-11b). クライアント側の実行 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = e What's number of program which do you want to execute ? --- default:[1] exam1:[1], exam2:[2], exam3:[3], exam4:[4], exam5:[5], exam6:[6], exam21:[7], pio_write_read[8], read:[9], read_write:[a], reg_dump:[b], write:[c], write_rea d:[d] Number = b Ok. Start up an example program reg_dump. RMI: Client side: RMI: Sent CAMAC command: array length =0 ClientImpl.scmd[0] = 0x0, ClientImpl.sdat[0] = 0x0 RMI: Received CAMAC reply: array length = 0 c_reply[0] = 0x0, d_reply[0] = 0x0 rcmd_buf[0] = 0x0, rcmd_buf[1] = 0x0 rrpl_buf[0] = 0x0, rrpl_buf[1] = 0x0 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = (3-2-12). ローカル例題プログラム、writeの実行 これは、ドライバのwriteシステムコールを使ってCAMAC書き込みを行うための 例題プログラムである。 (3-2-12a). サーバ側の実行 RMI: Server side: RMI: Received CAMAC command: array length = 0 cmd[0] = 0x0, dat[0] = 0x0 JNI, Java side: before Native Call ServerImpl.r_cmd[0] = 0x0, ServerImpl.r_dat[0] = 0x0 JNI, C side: Received CAMAC command: array length = 0 example number = 12 packet1 = ffffff packet2 = c0030010 packet1 = 0 packet2 = 80030000 packet1 = 4 packet2 = 80030010 packet1 = 0 packet2 = 80030000 packet1 = 8 packet2 = 80030010 packet1 = 0 packet2 = 80030000 packet1 = c packet2 = 80030010 packet1 = 0 packet2 = 80030000 packet1 = 10 packet2 = 80030010 packet1 = 0 packet2 = 80030000 packet1 = 14 packet2 = 80030010 packet1 = 0 packet2 = 80030000 packet1 = 18 packet2 = 80030010 packet1 = 0 packet2 = 80030000 packet1 = 1c packet2 = 80030010 packet1 = 0 packet2 = 80030000 packet1 = 20 packet2 = 80030010 packet1 = 0 packet2 = 80030000 packet1 = 555555 packet2 = 80030010 packet1 = 0 packet2 = a0030000 JNI, Java side: after Native Call array length = 0 (3-2-12b). クライアント側の実行 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = e What's number of program which do you want to execute ? --- default:[1] exam1:[1], exam2:[2], exam3:[3], exam4:[4], exam5:[5], exam6:[6], exam21:[7], pio_write_read[8], read:[9], read_write:[a], reg_dump:[b], write:[c], write_rea d:[d] Number = c Ok. Start up an example program write. RMI: Client side: RMI: Sent CAMAC command: array length =0 ClientImpl.scmd[0] = 0x0, ClientImpl.sdat[0] = 0x0 RMI: Received CAMAC reply: array length = 0 c_reply[0] = 0x0, d_reply[0] = 0x0 rcmd_buf[0] = 0x0, rcmd_buf[1] = 0x0 rrpl_buf[0] = 0x0, rrpl_buf[1] = 0x0 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = (3-2-13). ローカル例題プログラム、write_readの実行 これは、ドライバのwriteシステムコールおよびreadシステムコールを使って CAMAC読み書きを行うための例題プログラムである。 (3-2-13a). サーバ側の実行 RMI: Server side: RMI: Received CAMAC command: array length = 0 cmd[0] = 0x0, dat[0] = 0x0 JNI, Java side: before Native Call ServerImpl.r_cmd[0] = 0x0, ServerImpl.r_dat[0] = 0x0 JNI, C side: Received CAMAC command: array length = 0 example number = 13 packet1 = ffffff packet2 = c0030010 packet1 = 0 packet2 = 80030000 packet1 = 555555 packet2 = 80030010 packet1 = 0 packet2 = a0030000 packet1 = 0 packet2 = a0030000 Tx Control = 4065a080 Tx Status = 80feaac Tx Address = 7 Tx Preset Count = 1 Tx Actual Count = 7 Tx Fifo Count = 80fe6bc Rx Control = 80fe648 Rx Status = 80fe654 Rx Address = 80fea40 Rx Preset Count = 4065a140 Rx Actual Count = 4ab33334 Rx Fifo Count = 1 System = 1d loop = 0 JNI, Java side: after Native Call array length = 0 [root@onlsbc1 exam]# (3-2-13b). クライアント側の実行 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = e What's number of program which do you want to execute ? --- default:[1] exam1:[1], exam2:[2], exam3:[3], exam4:[4], exam5:[5], exam6:[6], exam21:[7], pio_write_read[8], read:[9], read_write:[a], reg_dump:[b], write:[c], write_rea d:[d] Number = d Ok. Start up an example program write_read. RMI: Client side: RMI: Sent CAMAC command: array length =0 ClientImpl.scmd[0] = 0x0, ClientImpl.sdat[0] = 0x0 RMI: Received CAMAC reply: array length = 0 c_reply[0] = 0x0, d_reply[0] = 0x0 rcmd_buf[0] = 0x0, rcmd_buf[1] = 0x0 rrpl_buf[0] = 0x0, rrpl_buf[1] = 0x0 (1). Enter 'q' to quit. (2). Enter 'e' to execute an example program. (3). Enter 's' to set up Single action CAMAC command (4). Enter 'g' to start up command execution. Execution Command('q' or 'e' or 'g' or 's' or 'd') = q Quited Program. Enter Ctl-C. [inoue@onlpara exam]$ ok. ダミーのCAMACライブラリーを使っての、リモートマシン onlpara から ターゲットマシンonlsbc1上での例題ソフトの実行は正常に実行できた。 ---xxxx