annotate src/fdl/PSXReply.java @ 15:aced4bfc15af

add Meta Linda Interface for debugger.
author kono
date Sun, 17 Aug 2008 20:24:24 +0900
parents 083a0b5e12cc
children 609b288f47f9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
1
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
2 /**
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
3 * PSXReply
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
4 *
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
5 * @author Shinji Kono
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
6 *
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
7
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
8 psx.in(),psxrd.() return this.
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
9
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
10 method for check answer is ready or not.
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
11
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
12 (call back interface can be used instead of this)
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
13
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
14 unique sequence number */
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
15
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
16 package fdl;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
17 import java.nio.ByteBuffer;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
18
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
19 public class PSXReply implements PSXQueueInterface {
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
20 public ByteBuffer command;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
21 public ByteBuffer data;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
22 public int seq;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
23 public PSXReply next;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
24 public int mode;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
25 public PSXCallback callback;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
26 static final boolean debug = false;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
27
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
28 public PSXReply(int _mode,PSXCallback _callback) {
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
29 mode = _mode;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
30 callback = _callback;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
31 }
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
32
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
33 public PSXReply() {
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
34 }
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
35
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
36 public void setAnswer(int _mode, ByteBuffer _command,ByteBuffer _data) {
15
aced4bfc15af add Meta Linda Interface for debugger.
kono
parents: 0
diff changeset
37 mode = _mode;
aced4bfc15af add Meta Linda Interface for debugger.
kono
parents: 0
diff changeset
38 data = _data;
aced4bfc15af add Meta Linda Interface for debugger.
kono
parents: 0
diff changeset
39 command = _command;
aced4bfc15af add Meta Linda Interface for debugger.
kono
parents: 0
diff changeset
40 if (debug) {
aced4bfc15af add Meta Linda Interface for debugger.
kono
parents: 0
diff changeset
41 System.out.print("setAnswer mode:");
aced4bfc15af add Meta Linda Interface for debugger.
kono
parents: 0
diff changeset
42 System.out.println(mode);
aced4bfc15af add Meta Linda Interface for debugger.
kono
parents: 0
diff changeset
43 System.out.print("setAnswer bool:");
aced4bfc15af add Meta Linda Interface for debugger.
kono
parents: 0
diff changeset
44 System.out.println(mode==PSX_ANSWER);
aced4bfc15af add Meta Linda Interface for debugger.
kono
parents: 0
diff changeset
45 }
0
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
46 }
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
47
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
48 public int getMode() {
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
49 return command.get(LINDA_MODE_OFFSET);
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
50 }
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
51
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
52 public int getId() {
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
53 return command.getShort(LINDA_ID_OFFSET);
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
54 }
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
55
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
56 public int getSeq() {
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
57 return command.getInt(LINDA_SEQ_OFFSET);
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
58 }
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
59
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
60 public int getLength() {
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
61 return command.getInt(LINDA_DATA_LENGTH_OFFSET);
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
62 }
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
63
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
64 public ByteBuffer getData() {
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
65 data.rewind();
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
66 return data;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
67 }
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
68
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
69 public boolean ready() {
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
70 return mode==PSX_ANSWER;
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
71 }
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
72 }
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
73
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
74
083a0b5e12cc Apply Debug Interface version start
fuchita
parents:
diff changeset
75 /* end */