FreeCalypso > hg > freecalypso-tools
comparison rvinterf/lowlevel/format.c @ 928:65953c172f24
rvinterf/lowlevel: new hex dump format
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 23 May 2023 05:23:19 +0000 |
parents | 4e243402f453 |
children | ab771ce34fac |
comparison
equal
deleted
inserted
replaced
927:4e243402f453 | 928:65953c172f24 |
---|---|
11 #include "../include/pktmux.h" | 11 #include "../include/pktmux.h" |
12 #include "../include/limits.h" | 12 #include "../include/limits.h" |
13 | 13 |
14 extern u_char rxpkt[]; | 14 extern u_char rxpkt[]; |
15 extern size_t rxpkt_len; | 15 extern size_t rxpkt_len; |
16 | |
17 extern void output_cont(); | |
16 | 18 |
17 static char fmtbuf[MAX_PKT_FROM_TARGET*8]; /* size it generously */ | 19 static char fmtbuf[MAX_PKT_FROM_TARGET*8]; /* size it generously */ |
18 | 20 |
19 void | 21 void |
20 print_rv_trace() | 22 print_rv_trace() |
31 dp += 2; | 33 dp += 2; |
32 } | 34 } |
33 /* severity level */ | 35 /* severity level */ |
34 sprintf(dp, " %d ", rxpkt[5]); | 36 sprintf(dp, " %d ", rxpkt[5]); |
35 dp = index(dp, '\0'); | 37 dp = index(dp, '\0'); |
36 safe_print_trace(rxpkt + 6, rxpkt_len - 6, dp); | 38 safe_print_trace(rxpkt + 6, (int)rxpkt_len - 6, dp); |
37 output_line(fmtbuf); | 39 output_line(fmtbuf); |
38 } | 40 } |
39 | 41 |
40 void | 42 void |
41 print_l1_trace() | 43 print_l1_trace() |
99 } | 101 } |
100 | 102 |
101 void | 103 void |
102 print_tm_output_raw() | 104 print_tm_output_raw() |
103 { | 105 { |
104 int i; | 106 output_line("Rx Test Mode packet"); |
105 char *dp; | 107 packet_hex_dump(rxpkt, (unsigned) rxpkt_len, output_cont); |
106 | |
107 dp = fmtbuf; | |
108 strcpy(dp, "TM:"); | |
109 dp += 3; | |
110 for (i = 1; i < rxpkt_len; i++) { | |
111 sprintf(dp, " %02X", rxpkt[i]); | |
112 dp += 3; | |
113 } | |
114 *dp = '\0'; | |
115 output_line(fmtbuf); | |
116 } | 108 } |
117 | 109 |
118 void | 110 void |
119 print_unknown_packet() | 111 print_unknown_packet() |
120 { | 112 { |
121 int i; | 113 output_line("Rx unknown packet format"); |
122 char *dp; | 114 packet_hex_dump(rxpkt, (unsigned) rxpkt_len, output_cont); |
123 | |
124 dp = fmtbuf; | |
125 strcpy(dp, "UNK:"); | |
126 dp += 4; | |
127 for (i = 0; i < rxpkt_len; i++) { | |
128 sprintf(dp, " %02X", rxpkt[i]); | |
129 dp += 3; | |
130 } | |
131 *dp = '\0'; | |
132 output_line(fmtbuf); | |
133 } | 115 } |