FreeCalypso > hg > freecalypso-tools
annotate rvinterf/tmsh/l1resp.c @ 132:5380872923a6
fc-tmsh: beginning of l1tm response handling
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 19 Feb 2017 20:53:41 +0000 |
parents | |
children | 4aa1c18c7a2f |
rev | line source |
---|---|
132
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * Handling of TM3 responses from L1TM |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <sys/types.h> |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdio.h> |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 extern u_char rvi_msg[]; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 extern int rvi_msg_len; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 void |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 l1tm_response_nodata(op) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 char *op; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 { |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 char buf[80]; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 if (rvi_msg_len > 5) { |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 sprintf(buf, "%s response wrong length", op); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 print_etm_pkt_raw(buf); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 } |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 if (rvi_msg[3]) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 sprintf(buf, "%s error %u (0x%x)", op, rvi_msg[3], rvi_msg[3]); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 else |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 sprintf(buf, "%s OK", op); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 async_msg_output(buf); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 } |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 void |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 l1tm_response_index(op) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 char *op; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 { |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 char buf[80]; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 if (rvi_msg[3]) { |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 if (rvi_msg_len == 5) { |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 sprintf(buf, "%s error %u (0x%02X)", op, |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 rvi_msg[3], rvi_msg[3]); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 async_msg_output(buf); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 } else { |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 sprintf(buf, "%s long error response", op); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 print_etm_pkt_raw(buf); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 } |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 } |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 if (rvi_msg_len != 6) { |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 sprintf(buf, "%s response wrong length", op); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 print_etm_pkt_raw(buf); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 } |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 sprintf(buf, "%s index %u (0x%02X) OK", op, rvi_msg[4], rvi_msg[4]); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 async_msg_output(buf); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 } |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 void |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 l1tm_response_index_val(op) |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 char *op; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 { |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 char buf[80]; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 unsigned val; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 if (rvi_msg[3]) { |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 if (rvi_msg_len == 5) { |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 sprintf(buf, "%s error %u (0x%02X)", op, |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 rvi_msg[3], rvi_msg[3]); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 async_msg_output(buf); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 } else { |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 sprintf(buf, "%s long error response", op); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 print_etm_pkt_raw(buf); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 } |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 } |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 if (rvi_msg_len != 8) { |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 sprintf(buf, "%s response wrong length", op); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
75 print_etm_pkt_raw(buf); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 return; |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
77 } |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
78 val = rvi_msg[5] | (rvi_msg[6] << 8); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
79 sprintf(buf, "%s index %u (0x%02X): %u (0x%04X)", op, |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
80 rvi_msg[4], rvi_msg[4], val, val); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
81 async_msg_output(buf); |
5380872923a6
fc-tmsh: beginning of l1tm response handling
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
82 } |